text:
Q: Does entrywise bounded positive definite matrix also have bounded inverse? Suppose $A(x)\colon \mathbb{R}\to\mathbb{R}^{n\times n}$ is a matrix-valued function.
Assume that for all $x\in\mathbb{R}$, $A(x)$ is positive definite, and $A(x)$ is uniformly entrywise bounded (i.e., absolute value of entry) by a constant $C$ independent of $x$.
Is it true that the matrix inversion $(A(x))^{-1}$ is also uniformly entrywise bounded? If not, do we have any counter-example?

A: It is not true even in the case that $n=1$. Consider $A(x) = e^{-|x|}$.

The absolute values of the entries of $A^{-1}$ are bounded above by $1/\sigma_\min(A)$. If $A$ is positive definite and symmetric, then its singular values are equal to its eigenvalues.
To see that this is the case, note that $\sigma_\max(A^{-1}) = 1/\sigma_\min(A)$, and for all matrix $M$ and vectors $v$ we have $\|Mv\| \leq \sigma_\max(M) \cdot \|v\|$. If we use $e_j$ to denote the $j$th standard unit vector, then we have
$$
|A^{-1}_{ij}| = |e_i^T A^{-1}e_j| \leq \|e_i\| \cdot \|A^{-1}e_j\| \\
\leq \|e_i\| \cdot \sigma_\max(A^{-1}) \cdot \|e_j\|\\
= 1/\sigma_\min(A).
$$


text:
Q: DELETE from multiple tables based on the same SELECT query My table structure is as described in this post:
 name | version | processed | processing | updated  | ref_time
------+---------+-----------+------------+----------+----------
 abc  |       1 | t         | f          | 27794395 | 27794160
 def  |       1 | t         | f          | 27794395 | 27793440
 ghi  |       1 | t         | f          | 27794395 | 27793440
 jkl  |       1 | f         | f          | 27794395 | 27794160
 mno  |       1 | t         | f          | 27794395 | 27793440
 pqr  |       1 | f         | t          | 27794395 | 27794160

Based on this answer, I am deriving a list of ref_time values which I want to use as a basis for deleting 'old' entries from status_table.
This is the query to generate the list of relevant ref_time values:
WITH main AS
(
    SELECT ref_time,
        ROUND(AVG(processed::int) * 100, 1) percent
    FROM status_table
    GROUP BY ref_time ORDER BY ref_time DESC, percent DESC
)
SELECT ref_time FROM main WHERE percent=100 OFFSET 2;

For example this might return:
 ref_time
----------
 27794880
 27794160

I can then use this to DELETE all relevant entries in the status_table:
DELETE FROM status_table
WHERE ref_time IN
(
    WITH main AS
    (
        SELECT ref_time,
            ROUND(AVG(processed::int) * 100, 1) percent
        FROM status_table
        GROUP BY ref_time ORDER BY ref_time DESC, percent DESC
    )
    SELECT ref_time FROM main WHERE percent=100 OFFSET 2
);

But I have another table named data_table, which also has a ref_time column, and I want to DELETE entries from that table on the same basis, i.e. any rows having ref_time in the above list.
How do I achieve this without duplicating the query used to generate the ref_time list?

A: You can use common table expressions:
with
    ref as (
        select ref_time
        from status_table
        group by ref_time
        having bool_and(processed)
        order by ref_time desc limit 2
    ),
    del_ref as (
        delete from status_table s
        using ref r
        where s.ref_time = r.ref_time
    )
delete from data_table d
using ref r
where d.ref_time = r.ref_time

The first CTE,ref, returns the list of timestamps that you want to delete from the two other tables. I attempted to simplify the logic: you seem to want the top 2 timestamps that are fully processed (note that offset skips that many rows from the resultset, which is different than limit).
The second CTE deletes from status_table, and the last part of the query addresses data_table.

redpajama_set_name: RedPajamaStackExchange


text:
Q: RubyKoans: broken koan? Probably a sign of an amateur that I'm wondering if the problem's the koan (rather than me), however, consider this koan
def test_calling_global_methods_without_parentheses
    result = my_global_method 2, 3
    assert_equal __, result
  end

Note, my_global method is
def my_global_method(a,b)
  a + b
end

This is the hint it gives me in the terminal
The answers you seek...
  <"FILL ME IN"> expected but was  <5>.

So I did
  def test_calling_global_methods_without_parentheses
    result = my_global_method 2, 3
    assert_equal 5, result
  end

and I got this error
Users/mm/Sites/koans/about_methods.rb:21:in `eval': (eval):1: syntax error, unexpected tINTEGER, expecting keyword_do or '{' or '(' (SyntaxError)
assert_equal 5, my_global_method 2, 3
                                  ^
    from /Users/mm/Sites/koans/about_methods.rb:21:in `test_sometimes_missing_parentheses_are_ambiguous'
    from /Users/mm/Sites/koans/edgecase.rb:377:in `meditate'
    from /Users/mm/Sites/koans/edgecase.rb:449:in `block in walk'
    from /Users/mm/Sites/koans/edgecase.rb:460:in `block (3 levels) in each_step'
    from /Users/mm/Sites/koans/edgecase.rb:458:in `each'
    from /Users/mm/Sites/koans/edgecase.rb:458:in `block (2 levels) in each_step'
    from /Users/mm/Sites/koans/edgecase.rb:457:in `each'
    from /Users/mm/Sites/koans/edgecase.rb:457:in `each_with_index'
    from /Users/mm/Sites/koans/edgecase.rb:457:in `block in each_step'
    from /Users/mm/Sites/koans/edgecase.rb:455:in `catch'
    from /Users/mm/Sites/koans/edgecase.rb:455:in `each_step'
    from /Users/mm/Sites/koans/edgecase.rb:448:in `walk'
    from /Users/mm/Sites/koans/edgecase.rb:470:in `block in <top (required)>'

Does anyone know the problem or can you tell me how to skip a koan?

A: Oh, I tested this koan. The error is on line 21 if you noticed that, not the "test_calling_global_methods_without_parentheses" method. It's the "test_sometimes_missing_parentheses_are_ambiguous" method goes wrong as it should be. You are expected to correct that method.
def test_calling_global_methods_without_parentheses
  result = my_global_method 2, 3
  assert_equal 5, result           # You're fine with this koan.
end

# (NOTE: We are Using eval below because the example code is
# considered to be syntactically invalid).
def test_sometimes_missing_parentheses_are_ambiguous
  eval "assert_equal 5, my_global_method 2, 3" # ENABLE CHECK
  # **LOOK HERE~~~ HERE IS THE ERROR YOU SEE** Just correct it.

And if there is any koan you don't know how to deal with, just comment it.


text:
Q: How to fix JavaScript promise using AWS SDK for S3? Using JavaScript promise to upload a batch of files to an s3 bucket, the .then() function calls immediately after the putObject() function. How do I configure it to call when all files are successfully uploaded?
Below you can see the code that I have tried, most of which was from the AWS tutorial site.
var putBatch = function putBatch(bucket,folder, files) {
  // Make all the putObject calls immediately
  // Will return rejected promise if any requests fail
  return Promise.all(files.map(function(file) {
    var params = {
      Bucket: bucket,
      Key: folder +"/" + file.name,
      Body: file,
      Metadata: {
               latlng: "saf",
               timestamp: "fds",
               alt: "df",
               mission: "kjfahsdk"
             }
    };
    return s3.putObject(params).promise();
  }));
};

function addPhoto(albumName) {
  var fileBatch = [];
  var files = document.getElementById("inputGroupFile01").files;
  if (!files.length) {
    return alert("Please choose a file to upload first.");
  }

  for (var i = 0; i < files.length; i++) {
    // console.log((files[i]));
    var file = files[i];
    var fileName = file.name;
    // var albumPhotosKey = encodeURIComponent(albumName) + '//';
    var photoKey = albumName + "/" + fileName;
    fileBatch.push(file);
  }
  //putBatch(albumName, fileBatch);

  putBatch(albumBucketName,albumName, fileBatch)
  .then(console.log("done"))
  .catch(console.error.bind(console));
}

As soon as I call the putBatch() function, I receive "done" in the console.

A: you can use async for wait till file upload to s3 like:
var putBatch = function async putBatch(bucket,folder, files) {
  // Make all the putObject calls immediately
  // Will return rejected promise if any requests fail
  let result = await Promise.all(files.map(async (file) => {
    var params = {
      Bucket: bucket,
      Key: folder +"/" + file.name,
      Body: file,
      Metadata: {
               latlng: "saf",
               timestamp: "fds",
               alt: "df",
               mission: "kjfahsdk"
             }
    };
    let s3Result = await s3.putObject(params).promise();
    return s3Result;
  }));
  return result;
};

A: You can try  jQuery.when(). You can read more from here
$.when(putBatch(albumBucketName,albumName, fileBatch))
  .then(console.log("done"))


text:
Q: Merge three list to Dictionary but everything is out of place/not printed I asked this question yesterday
Merging three lists into into one dictionary
The number one answer was the most correct in what I needed
but re-looking at MY automobile.txt file I realized two things.

*

*It has multiple car makers in the list and only one of each is listed.

*Every data seems to be out place but a few.
I'm so close but so far.
Here is what I Have
Please Note if it makes a difference This is being read from a .txt file I appended and split the data into three list. I know the data is there. I checked.
from pprint import pprint
import string
import re

data_file = open("Automobil.txt", 'r')
try:
    from itertools import izip_longest
    zip_longest = izip_longest
except ImportError:
    from itertools import zip_longest

def formatting_list(data_file):
    year = []
    maker = []
    model = []
    for line in data_file:
        maker = (' '.join(line.split()[1:2]))
        year =  (' '.join(line.split()[0:1]))
        model = ((' '.join(line.split()[2:])))
    return maker,year,model

def car_data_merge(maker,year,model):
#This was the one suggested to me that I liked

     car_dict_longest = {mk: (yr, md) for mk, yr, md in zip_longest(maker,year,model)}
     pprint(car_dict_longest)

This is something similar to what I tried that another person showed me on the other page
  car_dict = {maker: (year, model) for maker, model, year in zip(car_maker,car_model,car_year)}
  print(car_dict)

After reading up on the uses of izip and how it is different from zip
I thought izip kept everything on place instead of it being temporary tuple.
This a small part of the .txt list where I think the problem is:
year  = [1958,1909,1958,1958, 1961, 1961]
maker = [Ford,Ford,Lotus,MGA, Amphicar, Corvair]
model = [Edsel,Model T,Elite,Twin Cam]
When ran this is what should happen
Ford: {1958 , Edsel}, Ford: {1909, Model T}, Lotus: {1958, Elite}, MGA :{1958, Twin Cam}, Amphicar:{1961}, Corvair:{1961}

Instead I get something like:
Ford: {1958 , Edsel},  Lotus: {1958, MGA}, Amphicar:{1961, Corvair}
Any help or guidance would be appreciated.

A: Recommendation
You could do a dictionary of lists of tuples. Defaultdict is your friend.
Code
from collections import defaultdict

year = [1958, 1909, 1958, 1958, 1961, 1961]
maker = ['Ford', 'Ford', 'Lotus', 'MGA', 'Amphicar', 'Corvair']
model = ['Edsel', 'Model T', 'Elite', 'Twin Cam', '', '']

d = defaultdict(list)
for maker, model, year in zip(maker, model, year):
    d[maker].append((model, year))

Result
>>> from collections import defaultdict
>>>
>>> year = [1958, 1909, 1958, 1958, 1961, 1961]
>>> maker = ['Ford','Ford','Lotus','MGA', 'Amphicar', 'Corvair']
>>> model = ['Edsel', 'Model T', 'Elite', 'Twin Cam', "", ""]
>>>
>>> d = defaultdict(list)
>>> for maker, model, year in zip(maker, model, year):
...     d[maker].append((model, year))
...
>>> from pprint import pprint
>>> pprint(dict(d))
{'Amphicar': [('', 1961)],
 'Corvair': [('', 1961)],
 'Ford': [('Edsel', 1958), ('Model T', 1909)],
 'Lotus': [('Elite', 1958)],
 'MGA': [('Twin Cam', 1958)]}

You can also use your izip_longest:
from itertools import izip_longest

...

d = defaultdict(list)
for maker, model, year in izip_longest(maker, model, year):
    d[maker].append((model, year))

Then you get None for the other values.


text:
Q: Excel 2010 "sending the command to the program" error Multiple domain users receive the following Excel 2010 (32-bit edition) error occasionally when opening random XLS files.

There was a problem sending the command to the program

http://imgur.com/AU4ZlFC
Files are located on a Server 2008 R2 SMB share. Domain users have Full Control permissions access.
Excel 2010 (32-bit edition) is on a Server 2008 R2 terminal server.
Sometimes a file that gets the error will open ok the next time.
I have tried setting Excel to run in "XP SP3" compatibility mode for all users, and have ensured that "Ignore other applications that use DDE" in Excel options.
Any ideas on how to resolve this one?

A: Typically this is caused by Excel's OLE timeout, which cannot be extended.
To avoid this, I always leave one window of Excel open.  Then if you launch any Excel file from another source (e.g. Windows Explorer, File Share, Website), it will open into that existing Excel window.


text:
Q: Dynamic 404 Page.. kinda Alright, so this is what I am trying to achieve.
I want to be able to send URL data to a php file if the server returns 404.
for example:
example.com/stackoverflow

would bring up a dynamic 404 page
(404.php?id=stackoverflow)

but I am not using it for 404 in my case, I want to send the data after the domain.com/
So that I can pull from my database and display content accordingly.
I know this can be done with a small rewrite in the .htaccess, regex is just confusing for me.
I do NOT want a redirect.
http://example.com/datahere

should show the data of
404.php?id=datahere

A: You can use ErrorDocument directive to redirect 404 uris to  /404.php something like the following :
ErrorDocument 404 /404.php?id=%{REQUEST_URI}

This will rewrite /datahere to /404.php?id=datahere ( /datahere will show you the contents of /404.php?id ) .
Note that the above directive doesn't work on apache versions bellow  2.4 as the mod-rewrite variable %{REQUEST_URI} is treated as plain text not as a variable on lower versions.
On apache 2.2  you could use mod-rewrite to rewrite non-existent requests to 404 . Use the following :
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /404.php?id=$1 [L]


text:
Q: Where to find dotTrace after installation on Windows 8.1 Pro I have installed JetBrains dotTrace ( https://www.jetbrains.com/profiler/ ) on Windows 8.1 Pro. Installation has been completed successfully.
Now how to open dotTrace interface? I did search in Start Menu but couldn't find. I searched by "dottrace" and "jetbrains" keyword but no success.

A: There should be "JetBrains dotTrace 20xx.x" entry in Start Menu. If it doesn't exist, I'd recommend you to reinstall dotTrace or contact dotTrace support team.
But if you still want to open dotTrace manually, you need to run dotTrace64.exe file from %localappdata%\JetBrains\Installations\dotTrace11 folder (for 2017.3 version of dotTrace).


text:
Q: Where does glassfish save your class/project after deployment on Windows? I am using Glassfish3.1 on Windows XP. After deploy a web service project using Netbeans, it works fine. But when i go to
install-path\glassfish-3.1\glassfish\domains\domain1\applications

I don't see my application.
under install\glassfish-3.1\glassfish\domains\domain1\applications\__internal, there's a folder with the same name as my project. But that folder is empty.
But if i deploy a project on linux, i can find my application and classes under application folder.
So where are they on windows?

A: you can see path of application where it was deployed through glashfish admin console
eg.
http://localhost:4848/

or
http://yourhost_name:4848/

Common Tasks -> Applications -> you_application -> general -> Location:

A: When you use netbeans, the default deployment dir is the build/web subdir of your netbeans project folder. E.g. when your project is called myProject, the deployment dir is myProject/build/web.
It's of course a bit irritating since it is usually outside the glassfish install dir. But you can configure your webapp to be based in any dir of your harddrive.
In general you can find the location of any of your glassfish webapps in the domain.xml file of your domain, e.g. glassfish/domains/domain1/config/domain.xml
Each webapp has an <application> element with an attribute location, e.g. for one of my projects:
<application context-root="/MyFirstWebService"
     location="file:/C:/.../NetBeansProjects/MyFirstWebService/build/web/"
     directory-deployed="true" name="MyFirstWebService" object-type="user">

A: Try going to install-path\glassfish-3.1\glassfish\domains\domain1\autodeploy

A: The location of your deployed project is dependent on the IDE you use.
To detect the location. Do the following:

*

*Launch your Glassfish or Payara server from this location: http://localhost:4848 or any other location of your configuration for glassfish or payara server.

*Location the sidebar "Common Tasks"

*Click on Applications. List of deployed application will drop down

*Select you application from the list. Information about your app will display on the right hand side. Check for the Label "Location". e.g :  Location:
file:/C:/Users/Abode/Documents/NetBeansProjects/ImageJavapoint/build/web/
Then you will find where your app is being deployed.


text:
Q: How to set an extjs grid record phantom to true In Ext 4.1, I am dropping items to a grid, but the records come in with an id and the phantom flag is set to false, causing the store to remain empty and not add those records to it. even though they appear fine on the grid.
I read several solutions online, and many suggested setting the phantom flag to false and/or setting the id to null, but I am not able to implement this? Where do I set it?
Here are related links:

*

*http://www.sencha.com/forum/showthread.php?261174-Store-is-not-syncing-after-adding-new-row-to-grid-(CRUD)

*http://yiyujia.blogspot.com/2011/06/managing-grid-crud-in-extjs-4.html

*http://www.sencha.com/forum/showthread.php?143710-Grid-Drag-amp-Drop-and-Getting-dropped-records
I tried adding a beforedrop listener on the viewConfig and changing the phantom flag and id there, but that didnot work. Any help?

A: I have it working. Try this:
// BUGFIX - when records are copied between grids, the copied record don't get its phantom set
// to true, thus, no Create call will be made to the server.
Ext.override( Ext.data.Model, {

    copy : function(newId) {
        var iNewRecord = this.callParent( arguments );
        iNewRecord.phantom = true;
        return iNewRecord;
    }
});

I also have my source table with the view config copy set to true, although at the time of writing I have no idea why or whether this even does anything:
Ext.define('BS.view.items.Items' ,
{
    extend: 'BS.tree.Panel',

    ...

    viewConfig: {
        plugins: {
            ptype: 'treeviewdragdrop',
            dragGroup: 'classrooms',
        },

        // notice this
        copy: true
    },

});


text:
Q: Why is my controller property 'undefined' when I assign it the result of $resource query()? I have a JSON data structure:
 [
{
"title"  :"a1",
"id"     :"b1",
"name"   :"c1"
},
{
"title"  :"a2",
"id"     :"b2",
"name"   :"c2"
}
 ]

I am accessing is as an external JSON and parsed through a factory method. I want it to assign it to a Javascript variable in my controller.
 function Control($scope,data)

 {

 var e=data.query();   /* getting the external JSON data  */
 alert(e[0].title);

}

It says that e[0] is undefined. Is there any other way I can assign it to a Javascript variable and then traverse through it? Please help.

A: Most likely, @Marty is correct.  If you are using the query() method from the $resource service, it is asynchronous.  This will likely do what you want:
data.query( function( data ) {
  var e = data;
  alert(e[0].title);
});

A: Okay, so $resource can be confusing like this... It immediately gives you a reference to the return object, but doesn't update the object until the asynchronous AJAX call returns... so...
If you put your return value from data.query() in a property on $scope, since it's $watched when you bind it in your view, you'll see it update. HOWEVER, if you're just trying to alert it, it will alert the value before it's been updated.. again because of the async aspect of $resource.
Otherwise, you can get the value the way that @MarkRajcok has shown in his answer.
Here is a psuedo-code illustration of ways you can use $resource query();
app.controller('FooCtrl', function($scope, $resource) {
     var Bar = $resource('/Bar/:id', {id: '@id'});

     // here, we get the result reference and stick it in the scope,
     // relying on a digest to update the value on our screen.
     $scope.data = Bar.query();

     //OR

     //here we already have a reference.
     var test = Bar.query(function() {
          //in here, test has been populated.
          $scope.data2 = test;
     });
     alert(test); //not populated here, yet.

     //OR

     Bar.query(function(x) {
          $scope.data3 = x;
     });
});

This is all done so the object(s) returned can have functions pre-instantiated on them like $save(), etc.


text:
Q: Why can't I iterate over an object which delegates via  __getattr__ to an iterable? An example from the book Core Python Programming on the topic Delegation doesn't seem to be working.. Or may be I didn't understand the topic clearly..
Below is the code, in which the class CapOpen wraps a file object and defines a modified behaviour of file when opened in write mode. It should write all strings in UPPERCASE only.
However when I try to open the file for reading, and iterate over it to print each line, I get the following exception:
Traceback (most recent call last):
  File "D:/_Python Practice/Core Python Programming/chapter_13_Classes/
        WrappingFileObject.py", line 29, in <module>
    for each_line in f:
TypeError: 'CapOpen' object is not iterable

This is strange, because although I haven't explicitly defined iterator methods, I'd expect the calls to be delegated via __getattr__ to the underlying file object. Here's the code. Have I missed anything?
class CapOpen(object):
    def __init__(self, filename, mode='r', buf=-1):
        self.file = open(filename, mode, buf)

    def __str__(self):
        return str(self.file)

    def __repr__(self):
        return `self.file`

    def write(self, line):
        self.file.write(line.upper())

    def __getattr__(self, attr):
        return getattr(self.file, attr)

f = CapOpen('wrappingfile.txt', 'w')
f.write('delegation example\n')
f.write('faye is good\n')
f.write('at delegating\n')
f.close()

f = CapOpen('wrappingfile.txt', 'r')

for each_line in f:   # I am getting Exception Here..
    print each_line,

I am using Python 2.7.

A: For an object to be iterable, its class has to have __iter__ or __getitem__ defined.
__getattr__ is only called when something is being retrieved from the instance, but because there are several ways that iteration is supported, Python is looking first to see if the appropriate methods even exist.
Try this:
class Fake(object):
    def __getattr__(self, name):
        print "Nope, no %s here!" % name
        raise AttributeError

f = Fake()
for not_here in f:
    print not_here

As you can see, the same error is raised: TypeError: 'Fake' object is not iterable.
If you then do this:
print '__getattr__' in Fake.__dict__
print '__iter__' in Fake.__dict__
print '__getitem__' in Fake.__dict__

You can see what Python is seeing:  that neither __iter__ nor __getitem__ exist, so Python does not know how to iterate over it.  While Python could just try and then catch the exception, I suspect the reason why it does not is that catching exceptions is quite a bit slower.
See my answer here for the many ways to make an iterator.

A: This is a non-intuitive consequence of a Python implementation decision for new-style classes:

In addition to bypassing any instance attributes in the interest of
  correctness, implicit special method lookup generally also bypasses
  the __getattribute__() method even of the object's metaclass...
Bypassing the __getattribute__() machinery in this fashion provides
  significant scope for speed optimisations within the interpreter, at
  the cost of some flexibility in the handling of special methods (the
  special method must be set on the class object itself in order to be
  consistently invoked by the interpreter).

This is also explicitly pointed out in the documentation for __getattr__/__getattribute__:

Note
  This method may still be bypassed when looking up special methods as
  the result of implicit invocation via language syntax or built-in
  functions. See Special method lookup for new-style classes.

In other words, you can't rely on __getattr__ to always intercept your method lookups when your attributes are undefined. This is not intuitive, because it is reasonable to expect these implicit lookups to follow the same path as all other clients that access your object. If you call f.__iter__ directly from other code, it will resolve as expected. However, that isn't the case when called directly from the language.
The book you quote is pretty old, so the original example probably used old-style classes. If you remove the inheritance from object, your code will work as intended. That being said, you should avoid writing old style classes, since they will become obsolete in Python 3. If you want to, you can still maintain the delegation style here by implementing __iter__ and immediately delegating to the underlying self.file.__iter__.
Alternatively, inherit from the file object directly and __iter__ will be available by normal lookup, so that will also work.


text:
Q: Change raven menu's power strip options under Budgie I'd like to customize budgie a bit further than what's made available in it's "Budgie Desktop Settings"
For the "Raven" tab we can enable the "Power Strip" but the name is quite false advertizing because out of the three buttons it adds, none are "power"-related, rather they are "session"-related :

*

*Settings (this one strikes me as even less on topic but I guess it's inspired by vanilla ubuntu)

*Lock

*and Logout

I'd like to at the very least have "power". but ideally I'd like to have more options such as restart, why not the same functionality as ubuntu-vanilla where, upon holding alt "power" is replaced with "sleep".
so ideally :

*

*Settings

*Lock

*Hibernate

*and Shutdown

So basically are there customizable files that aren't replaced by an update that I could modify to attain this affect, or some plugin that I could install?


text:
Q: Run bash command whenever ViM is being started So I would like to run the following command whenever ViM starts:
ctags -R .

Is this possible?
Preferably I would like to have something in my ~/.vimrc that does this.
Thanks!

A: You can use :help :!cmd in your .vimrc:
!ctags -R .

To avoid the hit-enter prompt (but still see the ctags output), prepend :silent:
silent !ctags -R .

To completely silence the output (but then you won't notice problems until you implement another notification), use system() instead:
call system('ctags -R .')

To avoid that the run time of ctags delays using Vim, you can start the task asynchronously (on Unix):
call system('ctags -R . &')

A: Solved it by adding this to .vimrc:
" === generate ctags
call system('ctags -R . ')


text:
Q: How to view who gets kicked from my SQL Server Script? I have a maintenance job in SQL that was failing because of an application that was holding a lock for a specific user. I'm now running a script before the step that runs the maintenance job to kick the user. Now the maintenance job runs without issues. I'd like to get output from the step as it runs so I can see in the job activity monitor what gets kicked. How to make the output more verbose?
--Create a cursor
declare mycursor cursor
for

-- Identify any server process id used by your user for the database. Update fields below as required. The username or database name can be removed if you wish to disconnect all users or a user from all databases.
select spid, Loginame, hostname
from master..sysProcesses
where HostName='johnpc' or loginame='browser' and dbid=db_id('approd')

open mycursor

declare @spid int, @loginame varchar(255), @cmd varchar(255), @hostname varchar(255)

-- For each row in the cursor, kill the process by spid
Fetch NEXT FROM MYCursor INTO @spid, @loginame, @hostname
While (@@FETCH_STATUS <> -1)
begin
    select @cmd = 'kill ' + cast(@spid as varchar(5))
    exec(@cmd)
    print @loginame
    Fetch NEXT FROM MYCursor INTO @spid, @loginame, @hostname
end

close mycursor
deallocate mycursor
go

A: In the Job Step Properties, on thew Advanced page, enable the option to include step output in job history:

Then include a PRINT statement in your cursor loop to output the details of each KILL.
Example:
declare @message varchar(max), @spid int, @loginame varchar(255), @cmd varchar(255), @hostname varchar(255)

-- For each row in the cursor, kill the process by spid
Fetch NEXT FROM MYCursor INTO @spid, @loginame, @hostname
While (@@FETCH_STATUS <> -1)
begin
    select @cmd = 'kill ' + cast(@spid as varchar(5))
    exec(@cmd)

    set @message = 'SPID: ' + CAST(@spid AS VARCHAR(5)) + ' | Login: ' + @loginame + ' | Host: ' + @hostname;

    PRINT @message;

    Fetch NEXT FROM MYCursor INTO @spid, @loginame, @hostname
end


text:
Q: How to pass a table-valued parameter to sp_execute_external_script? I have a stored procedure that calls an external script via a SQL Server language extension. I would like for my stored procedure to use a caller supplied table valued parameter (TVP) to then submit input data to the external script:
ALTER procedure [dbo].[testTvp]
(
   @inputTvp dbo.myTvp READONLY
)
AS
BEGIN

   DECLARE @tSqlString nvarchar(100)=N'select * from @inputTvp'

   EXEC sp_execute_external_script
        @language = N'Java',
        @script = N'com.example.TestTvp',
        @input_data_1 = @tSqlString -- this doesn't work

END

When I execute this procedure:
DECLARE @myInput dbo.myTvp

INSERT INTO @myInput values ('a');
INSERT INTO @myInput values ('b');

EXECUTE [dbo].[testTvp] @myInput

I get the following error:

Must declare the table variable "@inputTvp".

I suppose that means that @inputTvp is not visible (out of scope) to sp_execute_external_script.
Is there a way to pass in @inputTvp to sp_execute_external_script?
I know that I could store the @inputTvp data into a temp table and pass in a t-sql string to query from that temp table. But I'm trying to avoid using a temp table.

A: Focusing on Table-Valued Parameters (TVPs) is a bit misleading since the question isn't really concerned with them. The example code, in fact, isn't even using the TVP as a TVP, and would be the same question even if presented as asking about table variables. Meaning, the following adaptation of the OP's example code is really the same question since sp_execute_external_script is being passed a string containing a query and not the @inputTvp variable:
DECLARE @inputTableVariable TABLE
(
  [ID] INT NOT NULL IDENTITY(1, 1) PRIMARY KEY,
  [SomeValue] NVARCHAR(50) NOT NULL
);

DECLARE @tSqlString NVARCHAR(100) = N'SELECT * FROM @inputTableVariable;';

EXEC sp_execute_external_script
    @language = N'Java',
    @script = N'com.example.TestTvp',
    @input_data_1 = @tSqlString; -- this doesn't work

Keep in mind that TVPs are meant to send structured data into SQL Server, not out of it. It's also a variable, hence it would only be available to the local context (i.e. not Dynamic SQL or any other sub-process). Still, just to be sure, I tried the following (in SQL Server 2017 so I couldn't specify "Java" as the language):
EXEC sp_execute_external_script
    @language = N'Java',
    @script = N'com.example.TestTvp',
    @params = N'@inputTableVariable dbo.[testTVP] READONLY';

and received:

Msg 39018, Level 16, State 2, Line XXXXX
  Parameter '@inputTableVariable' uses a data type that is not supported by the runtime for 'R' script. Unsupported types are timestamp, datetime2, datetimeoffset, time, text, ntext, image, hierarchyid, xml, sql_variant and user-defined type.

That being said, you can pass in structured data (avoiding the use of temporary tables), you just need to serialize it as NVARCHAR(MAX) and pass it as a regular parameter (i.e. not an @input_data_1 query). For serialization, you can use either XML or JSON:
Via XML
DECLARE @XmlString NVARCHAR(MAX);

SET @XmlString = (SELECT *
                  FROM   @inputTvp
                  FOR XML AUTO, ROOT('data'));

PRINT @XmlString; -- DEBUG (else comment out)

EXEC sp_execute_external_script
    @language = N'Java',
    @script = N'com.example.TestTvp',
    @params = N'@inputData NVARCHAR(MAX)',
    @inputData = @XmlString;

Via JSON
DECLARE @JsonString NVARCHAR(MAX);

SET @JsonString = (SELECT *
                   FROM   @inputTvp
                   FOR JSON AUTO, ROOT('data'));

PRINT @JsonString; -- DEBUG (else comment out)

EXEC sp_execute_external_script
    @language = N'Java',
    @script = N'com.example.TestTvp',
    @params = N'@inputData NVARCHAR(MAX)',
    @inputData = @JsonString;


text:
Q: Finder Tags just show list of tags, not tagged files? I like the idea of Finder tags and I want to use them. I tried tagging files in Finder. Then I clicked the tag in the sidebar and... it just shows a list of all my tags... instead of the documented behavior listed on Apple's website as well as user forums. Please pardon my impudence for daring to question the absolute wisdom of the Mac user interface and its documentation, but is there anything outside of the listed instructions that I need to do in order to get tagged files to show up? I just wanna use tags.

A: You need to have the tags in the sidebar match the tags on your files.
If you only use files you tagged yourself, on that Mac, then this is rarely an issue. If you have tags from other users, or share across your network with the same colours but different definitions, you need to dig deeper & click "Show all tags" or change which tags show in your favourites.
Tags are in Finder Prefs [prefs for any app can be invoked with  Cmd ⌘   ,  [comma] or from the menu item that shows the App Name, in this case Finder.
If you have inherited files from other users or other machines, these labels may not match what you are expecting. A visit to this pref will "re-think" what all the tags are. You may find the tags are 'similar but not identical'. You need to set visibility by checking the box & also you can drag into your preferred sidebar order.
Here's a [rather awkward] screenshot showing that I have 2 'orange' tags with 2 different names [amongst others]. Files tagged as 'Imminent' are not part of the group tagged as 'Orange'.

If you click "All Tags" then you do get an alphabetical list of all tags in the next column. Clicking any one of those will then show the files tagged in that group.


text:
Q: Graphic in header bloats PDF file size
Possible Duplicate:
Multiple inclusion of the same image gives huge PS file

I recently started to include a graphic in the header of a long PDF document and the file size has grown significantly.  The document is over 2000 pages and before adding the graphic the final PDF was around 10MB.  Adding our company logo, which is in EPS format and around 274KB in size, the final PDF has grown to 45MB.  Ouch!
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[L]{\rule[-2ex]{0pt}{2ex} \includegraphics[height=60pt]{C:/Users/chris/Documents/scm/images/LOGO_CMYK.eps}}
\fancyhead[C]{\textsc{\large{Department}}}
\fancyhead[R]{\bfseries {\Huge Title}}

I suspect each page has its own copy of the graphic.  The intermediate postscript file produced by dvips is now 577MB, from about 45MB.  (274KB * 2000 pages =~ 550MB)
Is there a better way to include this graphic please?  It's against company policy to modify the company logo so I must work with the 274KB EPS file.  Is there a way to include the graphic once, and then reference from each page header?
I'm using latexmk and producing PDFs via PS (latexmk -pdfps), so latex + dvips + ps2pdf (via MiKTeX 2.9).
Thanks,
Chris


text:
Q: google line chart lineWidth is getting thin Im using google line chart for my application, in my chart for first two points the lineWidth is thick and for last two points the lineWidth is very thin. How can i over come this problem, i need to draw a graph with same lineWidth throughout the chart. And when i click over the point the pointSize is enlarged, i dont want to enlarge the pointSize even when the mouse click.

A: set minValue of the hAxis to -1 to the lowest data point of the chart


text:
Q: Can I use qt quick compiler in Qt4.8.5 I see there is one tool Qt Quick Compiler that can compile QML source code into the final binary.
But currently my I'm working on the Qt4.8.5, can I use this tool? or it can only be used in the Qt5.3?

A: Unfortunately you cannot use the tool with older versions of Qt.
According to QtQuickCompiler Known Issues:

The compiler is strictly tied to the Qt version due to its use of internal data structures. At this point we cannot guarantee binary and source compatibilities for these internal data structures and therefore when upgrading to a new Qt version, an update of the compiler is required. It is also necessary to re-compile previously compiled .qml files when upgrading the compiler. This means the compiler is currently not suited for software ecosystems with QML based libraries and independently released applications using those

This would imply that the QtQuickCompiler is strictly tied to Qt 5.3, which is the version it was first released with. Since there are no releases for older versions of Qt, you are out of luck.


text:
Q: Upload multiple files through one single browse button through struts I have a requirement, wherein I need to upload multiple photos through one single browse button. I am using form-bean concept for achieving the same. The issue is how do I send multiple photos path from JSP to Action via Form Bean? I.E. how do I get multiple paths of photos in action file? I am using the below code to send single photo path from JSP which I have achieved successfully. Please guide me on how to upload multiple photos.
    <html:file property="file" styleId="<%=abc%>"

How to upload multiple filer through one single Browse Button through struts?


text:
Q: Change screen with change language using Localization I change language of application using following code
 myLocale = new Locale(lang);
        Resources res = getResources();
        DisplayMetrics dm = res.getDisplayMetrics();
        Configuration conf = res.getConfiguration();
        conf.locale = myLocale;
        res.updateConfiguration(conf, dm);

but I want to change screen with selected language programmatically
eg. If I select english we are using ltr format
    If I use arabic then rtl format.
If I put  android:supportsRtl="true" in manifest.xml then work I change language from setting,But I want it handle programmatically.Is this possible?


text:
Q: Using Colly framework I can't login to the Evernote account I am using colly framework for scraping the website. Am trying to login the Evernote account for scraping some things. But I can't go through it. I used "username" and "password" titles for giving the credentials. Is this the right way ?.
Thank you in advance.
package main

import (
 "log"
 "github.com/gocolly/colly"
)

func main() {
 // create a new collector
 c := colly.NewCollector()

// authenticate
err := c.Post("https://www.evernote.com/Login.action",
map[string]string{"username":
  "XXXXXX@XXX.com", "password": "*********"})

if err != nil {
    log.Fatal("Error : ",err)
}

    // attach callbacks after login
   c.OnResponse(func(r *colly.Response) {
        log.Println("response received", r.StatusCode)
   })

    // start scraping
   c.Visit("https://www.evernote.com/")
}

A: You should try to mimic the browser behavior, take a look at this implementation, I've added comments on each step:
package evernote

import (
    "bytes"
    "errors"
    "fmt"
    "io/ioutil"
    "net/http"
    "net/http/cookiejar"
    "net/url"
    "regexp"
    "strings"
)

const (
    evernoteLoginURL = "https://www.evernote.com/Login.action"
)

var (
    evernoteJSParamsExpr = regexp.MustCompile(`document.getElementById\("(.*)"\).value = "(.*)"`)
    evernoteRedirectExpr = regexp.MustCompile(`Redirecting to <a href="(.*)">`)

    errNoMatches   = errors.New("No matches")
    errRedirectURL = errors.New("Redirect URL not found")
)

// EvernoteClient wraps all methods required to interact with the website.
type EvernoteClient struct {
    Username   string
    Password   string
    httpClient *http.Client

    // These parameters persist during the login process:
    hpts  string
    hptsh string
}

// NewEvernoteClient initializes a new Evernote client.
func NewEvernoteClient(username, password string) *EvernoteClient {
    // Allocate a new cookie jar to mimic the browser behavior:
    cookieJar, _ := cookiejar.New(nil)

    // Fill up basic data:
    c := &EvernoteClient{
        Username: username,
        Password: password,
    }

    // When initializing the http.Client, copy default values from http.DefaultClient
    // Pass a pointer to the cookie jar that was created earlier:
    c.httpClient = &http.Client{
        Transport:     http.DefaultTransport,
        CheckRedirect: http.DefaultClient.CheckRedirect,
        Jar:           cookieJar,
        Timeout:       http.DefaultClient.Timeout,
    }
    return c
}

func (e *EvernoteClient) extractJSParams(body []byte) (err error) {
    matches := evernoteJSParamsExpr.FindAllSubmatch(body, -1)
    if len(matches) == 0 {
        return errNoMatches
    }
    for _, submatches := range matches {
        if len(submatches) < 3 {
            err = errNoMatches
            break
        }
        key := submatches[1]
        val := submatches[2]

        if bytes.Compare(key, hptsKey) == 0 {
            e.hpts = string(val)
        }
        if bytes.Compare(key, hptshKey) == 0 {
            e.hptsh = string(val)
        }
    }
    return nil
}

// Login handles the login action.
func (e *EvernoteClient) Login() error {
    // First step: fetch the login page as a browser visitor would do:
    res, err := e.httpClient.Get(evernoteLoginURL)
    if err != nil {
        return err
    }
    if res.Body == nil {
        return errors.New("No response body")
    }
    body, err := ioutil.ReadAll(res.Body)
    if err != nil {
        return err
    }
    err = e.extractJSParams(body)
    if err != nil {
        return err
    }

    // Second step: we have extracted the "hpts" and "hptsh" parameters
    // We send a request using only the username and setting "evaluateUsername":
    values := &url.Values{}
    values.Set("username", e.Username)
    values.Set("evaluateUsername", "")
    values.Set("analyticsLoginOrigin", "login_action")
    values.Set("clipperFlow", "false")
    values.Set("showSwitchService", "true")
    values.Set("hpts", e.hpts)
    values.Set("hptsh", e.hptsh)

    rawValues := values.Encode()
    req, err := http.NewRequest(http.MethodPost, evernoteLoginURL, bytes.NewBufferString(rawValues))
    if err != nil {
        return err
    }
    req.Header.Set("Accept", "application/json")
    req.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
    req.Header.Set("x-requested-with", "XMLHttpRequest")
    req.Header.Set("referer", evernoteLoginURL)
    res, err = e.httpClient.Do(req)
    if err != nil {
        return err
    }
    body, err = ioutil.ReadAll(res.Body)
    if err != nil {
        return err
    }
    bodyStr := string(body)
    if !strings.Contains(bodyStr, `"usePasswordAuth":true`) {
        return errors.New("Password auth not enabled")
    }

    // Third step: do the final request, append password to form data:
    values.Del("evaluateUsername")
    values.Set("password", e.Password)
    values.Set("login", "Sign in")

    rawValues = values.Encode()
    req, err = http.NewRequest(http.MethodPost, evernoteLoginURL, bytes.NewBufferString(rawValues))
    if err != nil {
        return err
    }
    req.Header.Set("Accept", "text/html")
    req.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
    req.Header.Set("x-requested-with", "XMLHttpRequest")
    req.Header.Set("referer", evernoteLoginURL)
    res, err = e.httpClient.Do(req)
    if err != nil {
        return err
    }

    // Check the body in order to find the redirect URL:
    body, err = ioutil.ReadAll(res.Body)
    if err != nil {
        return err
    }
    bodyStr = string(body)
    matches := evernoteRedirectExpr.FindAllStringSubmatch(bodyStr, -1)
    if len(matches) == 0 {
        return errRedirectURL
    }
    m := matches[0]
    if len(m) < 2 {
        return errRedirectURL
    }
    redirectURL := m[1]
    fmt.Println("Login is ok, redirect URL:", redirectURL)
    return nil
}

After you successfully get the redirect URL, you should be able to send authenticated requests as long as you keep using the HTTP client that was used for the login process, the cookie jar plays a very important role here.
To call this code use:
func main() {
    evernoteClient := NewEvernoteClient("user@company", "password")
    err := evernoteClient.Login()
    if err != nil {
        panic(err)
    }
}


text:
Q: Import ES module in Next.js ERR_REQUIRE_ESM I came upon this error when trying to use ky in a Next.js project:

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /foo/node_modules/ky/index.js

I think the problem is that Webpack (or Babel) is transforming all imports to require()s but ky is a pure ES module.
I got it working by dynamically importing ky before using it but it's not elegant nor efficient.
const handleFormSubmit = async (event) => {
  const ky = (await import("ky")).default;

  const response = await ky
    .get('http://localhost/api/foo')
    .json();
};

Any suggestions?

A: You can try upgrading nextjs to v11.1.0, it has some support for ESM.
See: https://github.com/vercel/next.js/pull/27069
More info in this issue discussion from https://github.com/vercel/next.js/issues/9607#issuecomment-906155992

A: From Next.js 12, support for ES Modules is now enabled by default, as long as the ESM library has "type": "module" in its package.json. Using next-transpile-modules to transpile ESM libraries is no longer required.

Before Next.js 12
Since ky is exported as ESM you can transpile it with next-transpile-modules in next.config.js.
// next.config.js
const withTM = require('next-transpile-modules')(['ky']);

module.exports = withTM(/* your Next.js config */);

A: Since Next.js 12 (official announcement), support for ESM modules is automatically enabled. See #29878.
Since Next.js 12.1, you can add "type": "module" to your package.json. See #33637.

A: NextJS 12 (and maybe 13?) and TypeScript: please see this link, then add --esm to your "dev" line in your main package.json as this user suggests here, and finally, update (or make sure) your tsconfig.server.json (inherits from tsconfig.json) says "module": "ESNext" instead of "module": "commonjs".


text:
Q: Loop through the properties in a model in C# , mVC4 I have view, whose I will be rending it from html helper functions.
@using PartyBiz.Models.Objects
@model IEnumerable<Person>
@Html.PageStructureEntity(Model)

I wrote the below sample method to return content to view:
 public static MvcHtmlString PageStructureEntity(this HtmlHelper helper, Person m)
    {
        TagBuilder
              stdDiv = MvcUtils.GetStdDiv(); //Parent Site Part Version's container

        switch (m.FirstName.GetType().FullName)
        {
            case "System.String":
                TagBuilder input = MvcUtils.GetStdInput();
                input.Attributes.Add("value", m.FirstName);
                stdDiv.InnerHtml = input.ToString();
                break;

            default:
                return null;
        }
        return MvcHtmlString.Create(stdDiv.ToString());
    }

I have to loop through every model object in IEnumerable and every property in that model object, render the inputs or checkboxes or datetimes as per their type.
My problem is I am doing it in a pretty standard style.
Is there any best approach for this to write the code better, something using generics or built helper functions?
Your suggestions helps a lot..

A: You could try using
@Html.EditorForModel()

This will render all the default editor templates for your models properties.
See this for more details


text:
Q: Is $\lim\limits(\prod_{i\leq n} K)\cong\cup_i(\prod_{j\leq i}K)$ true? Consider a family of $K-$vector spaces $\prod_{i\leq n}K\to\prod_{i\leq n+1}K$ by embedding where embedding is done by identifying the basis $(1,0,\dots,0)\to (1,0,\dots,0,0),...$ and similarly for the rest.
$\textbf{Q:}$ Is $\lim\limits_n(\prod_{i\leq n} K)\cong\cup_i(\prod_{j\leq i}K)$ true? Should I conclude $\cup_i(\prod_{j\leq i}K)=\prod_N K$?
Note that   LHS means $\prod_{j\in N}K$ whereas every element of RHS arises from a finite sequence. Do I even have an infinite non-trivial sequence in RHS but it seems that all my sequence on RHS must terminate at finite position? However, I can identify the limit in set theoretical sense and then use $lim_n(\prod_{i\leq n}K)=\sqcup_{n\in N}(\prod_{i\leq n}K)/\sim$ where $\sim$ identifies element by the canonical embedding. What is wrong with my thought process?

A: This answer is intended to sum up the discussion in the comments. With the intention of clearing up some misconceptions, a slightly more categorical analysis is given before arriving at the concrete example of the post.
Take $(V_i)_{i \geq 1}$ a sequence of vector spaces with $V_i \subset V_{i+1}$. This gives a diagram
$$
V_1 \subset V_2 \subset \dots V_n \subset \dots  \tag{$\star$}
$$
over the category $\omega = 1 \to 2 \to 3 \to \dots$ which can be thought of $\mathbb{N}$ as a poset: we have an arrow $n \to m$ iff $n \leq m$. Concretely, the diagram $(\star)$ is given by mapping $i$ to $Fi = V_i$ for each $i \geq 1$ and $n \to m$ which is $n \to n+1 \to \dots \to m$ as the composition of inclusions from each $V_i$ to the next, from $n$ to $m$. Now, having constructed a diagram, one may wonder whether $\lim F$ and $\operatorname{colim} F$ exist, and how they can be described.
Note that in the category $\omega$, we have an initial object (namely $1$). Is is an instructive exercise to prove that if a category $J$ has an initial object $i$ and $F : J \to \mathcal{C}$ is a diagram, then $\lim J = Fi$. Hence, for $(\star)$ we get
$$
\lim J = F(1) = V_1.
$$
As for the colimit of $(\star)$, I claim we have $\operatorname{colim} F \simeq \bigcup_{i \geq 1}V_i$. It suffices to see that the latter verifies the universal property of the colimit: we have inclusion maps $j_r : V_r \to \bigcup_{i \geq 1}V_i$ for each $s$ which commute with the inclusions $V_i \subset  \dots \subset V_{j}$. It suffices to check that they commute for $V_i \subset V_{i+1}$ (why?). Noting the inclusions $ s_k : V_k \hookrightarrow V_{k+1}$ we get that $j_{k+1}s_k(v) = j_{k}(v)$ for each $v \in V_k$. This is because the first expression is looking at $v$ as an element of $V_{k+1}$, and then embedding it in the union, and the latter is directly looking at $v$ as a vector on the union. Hence we have built a cone $(j_r : V_r \to \bigcup_{i \geq 1} V_i)_{r \geq 1}$ under $F$. Finally, let's prove that it is universal in this sense: if we have another cone $(\mu_r  : V_r \to W)_{r \geq 1}$, then the function
$$
\mu : v \in V_r \subset \bigcup_{i \geq 1}V_i \longmapsto \mu_r(v) \in W
$$
is well defined, linear and the only one such that the new cone factorizes via the original inclusions, i.e. $\mu$ is the only linear function such that $\mu j_r = \mu_r$. This completes the proof of $\operatorname{colim} F \simeq \bigcup_{i \geq 1} V_i$.
Now, going back to the original question: here $V_i = \mathbb{k}^i$ and so $\lim F  = \varinjlim V_i = \mathbb{k}$ and $\operatorname{colim} F = \varprojlim V_i = \bigcup_{i \geq 1} \mathbb{k}^i$. Hence if we interpret the limit as an inverse limit (i.e. a colimit) the statement is true. What is false is that $\bigcup_{i \geq 1} \mathbb{k}^i \simeq \mathbb{k}^{\mathbb{N}}$. The former has countable dimension, a basis given by $e_i = (0, \dots, 0, \overbrace{1}^i,0,\dots)$, but the latter does not.


text:
Q: which preposition must be used "through" or "by" In sentences :

*

*
We can derive a closed-form expression through integration of X.

*
The closed-form expression can be derived by integration of X.

*
We can derive the optimal solution through optimization of X.

*
The optimal solution can be derived by optimization of X.

Given to here, we are recommended that to use "through" when we have a process ( i.e., an start point + a procedure and a final result). Also, we should use "by" when we want to focus on method.

Google Results:
"through integration" = 478 k
"by integration" = 710 k
"through optimization" = 206 k
"by optimization" = 320 k

Now the question is, in above context ( Mathematics ) which one we should use? We can infer both a method and a process. ( the integration can be complex and you might need to do some complex calculations in multiple stages). However, google demonstrates the usage of "by" is more frequent.

PS : I think if we use through, we say the significant part of the following is the procedure. However, when we use by, we should expect the reader focusing on the used tool. In fact, we induct the procedure is unimportant and superficial. Am I right ?
Thanks.

A: I think you've found the difference between the two.
If some process is important and it's quite an undertaking, even an ordeal, then 'through' is more appropriate.  "Better shape lies through vigorous exercise."
If the same process is less important in itself, and perhaps it doesn't take up so much resources (computational, time, money, people), then 'by' seems better.


text:
Q: Creating a static module interface in C I'm trying to create a modular interface in my C project that would allow source files to be built selectively and be added and removed without having to change any of the project's core components. I have searched all of the web for a method on how to do this and cannot find anything.
My guess at this stage, would involve something along the lines of each module having it's own source and header files (module_1.c, module_1.h, module_2.c, module_2.h, etc). Each module would likely have to have a structure containing pointers to the needed functions like:
struct module_def {
  char *name;
  void (*module_init) (void);
  void (*module_shutdown) (void);
};

I believe that an array of these definition structures would then need to be accessible by the core code. I just don't know how to have such an array (or anything similar) be generated automatically using a list of enabled modules without resorting to a messy script that creates a new source file containing a list of all the structures during the build process.
At least, that's how I believe this should work.
Ultimately, I'm looking for a way to create a modular coding interface in C that would allow separate modules (source or object files, it doesn't matter) to be selectively linked during build and called by the main application. This is for an embedded solution so dynamic loading, shared libraries, etc cannot work.

A: With gcc, you can use something like that:
(for example in foo_module.c)
struct module_def foo_module {
    ...
};

static void init_module(void) __attribute__ ((constructor));

static void init_module(void) {
    register_my_module(&foo_module);
}

You can put this in each of your module files and your init_module-functions should be called at initialization time (i.e. when the bss is cleared etc, before the main code starts).
Note that this is not portable, but will do well with many embedded platforms, e.g. with avr-gcc and the like.


text:
Q: Oracle Import Issue Could someone please help me with this oracle import error?
I have paste the session transcript in http://dpaste.com/807025/
If you look at my first attempt, there is no error as such but nothing get imported.
If you look at my first attempt, I had to specify the name of the table and then i get the error.
Question :

*

*Is it mandatory to specify the tables to import? Shouldn't the export utility just import all the tables that are present in the dump file?

*How can i solve the error in import? I have 6.75 GB Disk space free but still get this error.
Please guide.

A: The first thing you should try is importing using the SYSTEM user rather than your LOCALDB user. This will allow imp to create users and schema objects as required. However, this may not actually eliminate your errors, it could simply cause different errors to appear.
Your import file contains ALL of the internal oracle specification data for every object, including tablespace specifications. If your XE database isn't configured in the same way as the database you're exporting from, you're going to encounter some other setup issues.
Given the number of unknowns, you might be best served by trying to do something small and simple before trying to achieve your full goals. For example, log in to your XE database as SYSTEM, create the WMOS user and grant them the basics, and then use IMP to import a single small table. Once you get a simple base case working, you should be able to scale up to your full import.
One additional observation: you're using the old-school IMP tool rather than IMPDP, which imposes some constraints on you. If you have access to the main database and can run your export with EXPDP, you might find things better.
For what it's worth, dba.stackexchange.com is full of DBAs and much deeper knowledge for these types of issues than is normally covered here on SO.

A: From the database name used in the script it looks like your using Oracle XE which has size limits on how much storage it will create and use for user data. The limits are 4GB of user data for Oracle XE 10g and 11GB for Oracle XE 11g. That means the create statement that shows in the error is likely going over the limits as it starts the table off with approx 3.4GB of storage.
STORAGE(INITIAL 3409969152

A: To solve this, I finally added a extra data file to my tablespace and import works fine. Thanks all for your feedback. It helped me through to a solution.


text:
Q: Apache + tomcat + jnlp We have an instance of Tomcat behind an Apache. We use mod_jk.
The module config is:
LoadModule jk_module modules/mod_jk.so
<IfModule mod_jk.c>
  JkWorkersFile conf/workers.properties
  JkLogFile     logs/mod_jk.log
  JkLogLevel    info
  JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
</IfModule>

And here the VirtualHost config:
<VirtualHost *:9090>
...
  JkMount  /Web/* worker-Web
  JkMount  /Web worker-Web
</VirtualHost>

The workers.properties file:
worker.list=worker-Web
worker.worker-omiapWeb.port=8209
worker.worker-omiapWeb.host=localhost
worker.worker-omiapWeb.type=ajp13

This config works great for jsp, html... but we have a JNLP file:
<?xml version="1.0" encoding="utf-8"?>
  <jnlp spec="1.0" codebase="$$codebase">
    <information>
      <title>Gestor Impresiones</title>
      <vendor>.</vendor>
    </information>
    <resources locale="es">
      <jar href="gestorImpresiones.jar"/>
      <jar href="jasperreports-1.2.5.jar"/>
      <jar href="commons-httpclient-3.1-beta1.jar"/>
      <jar href="commons-logging-1.1.jar"/>
      <jar href="commons-codec-1.3.jar"/>
      <jar href="commons-javaflow-20060411.jar"/>
      <jar href="commons-collections-3.1.jar"/>
      <jar href="poi-3.0.1-FINAL-20070705.jar"/>
      <jar href="jdic.jar"/>
    </resources>
    <resources os="Windows">
      <jar href="windows/jdic_stub.jar"/>
      <nativelib href="windows/jdic-native.jar"/>
    </resources>
    <resources os="Linux">
      <jar href="linux/jdic_stub.jar"/>
      <nativelib href="linux/jdic-native.jar"/>
    </resources>
    <resources locale="es">
      <j2se version="1.3+" href="http://java.sun.com/products/autodl/j2se"/>
    </resources>
    <security>
      <all-permissions/>
    </security>
    <application-desc main-class="stacks.printing.cliente.GestorImpresionLauncher"/>
  </jnlp>

The problem is that downloading the JNLP resources fails randomly (It fails more if the connection speed are poor).
If we access directly to Tomcat, everything works fine.
Any ideas?
Edited 1:
Apache log error:
[Thu Jul 01 09:51:45 2010] [868:5096] [info] jk_connect.c (566): connect to 127.0.0.1:8209 failed (errno=61)
[Thu Jul 01 09:51:45 2010] [868:5096] [info] jk_ajp_common.c (869): Failed opening socket to (127.0.0.1:8209) (errno=61)
[Thu Jul 01 09:51:45 2010] [868:5096] [error] jk_ajp_common.c (1359): (worker-omiapWeb) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=61)
[Thu Jul 01 09:51:45 2010] [868:5096] [info] jk_ajp_common.c (2186): (worker-omiapWeb) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Thu Jul 01 09:51:45 2010] [868:5096] [error] jk_ajp_common.c (2204): (worker-omiapWeb) Connecting to tomcat failed. Tomcat is probably not started or is listening on the wrong port
[Thu Jul 01 09:51:45 2010] [868:5096] [info] mod_jk.c (2364): Service error=-3 for worker=worker-omiapWeb

Edited 2:
server.xml AJP section:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8209"
       maxThreads="300" connectionTimeout="600000"
       enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

A: Why do you serve the JNLP application from tomcat? WebStart uses plain HTTP GET requests to acces the JNLP file and then the .jar files. You could place these outside of Tomcat, and let Apache do the work alone.

A: Try setting your worker timeouts to higher than default values:

worker.worker-omiapWeb.socket_timeout=60
worker.worker-omiapWeb.connect_timeout=2000
worker.worker-omiapWeb.prepost_timeout=1000
worker.worker-omiapWeb.reply_timeout=30000

That goes in your workers.properties file.  You may have to go higher with one or more of them - we'd need to see your apache log files to be sure which one is causing the issue for you.

A: You may also want to post the bits of your server.xml for the AJP connector. One possibility is that your connector on the Tomcat side doesn't have enough capacity (maxThreads & timeout) to handle the number of connections Apache is sending it.


text:
Q: Not Vanishing Set of a Global Section Affine Let $R$ be a Noetherian ring, $X$ a proper $R$-scheme, $\mathcal{L}$ an ample sheaf and $s \in \Gamma(X, \mathcal{L})$ a global section.
Two questions:

*

*Why is the open set $X_s := \{x \in X | s_a \neq 0 \}$ affine?

*Is $X_s$ affine under weaker conditions? (for example if $X$ not proper or $\mathcal{L}$ not ample)


text:
Q: Collecting Stats on an asp.net mvc site? Hi I need some advice.
I need a way to keep track of user activity on my site, without third party tools (such as google anayltics).
So basically any request that comes to my site I need to fire of an a async task that would collect info on the user and write to DB.  What's the best way to do this?
I have tried to write an async httphandler but I couldn't get to work. It's hit multiple times for each request (for all the resourse files like css jpg ...).

A: I'm currently using log4net to do something similar.
I setup my log4net very similar to what this article did.  After that you can create a logger Attribute that inherits the ActionFilterAttribute that you can attach to your controllers, I personally have a base controller that I applied my logger attribute to.
In your attribute you'll override  OnActionExecuting and log all the information about the currently executing action in your log4net logger that you want.  Just make sure you include base.OnActionExecuting(filtercontext) you don't want to screw up any of the mvc plumbing, you are just hooking into it at a point to do some logging.


text:
Q: Use X data as X axis points in Excel My question regards graph plotting in Excel.
Say you have the following data:
X = [2,4,8,16,32]
Y = [20,40,80,160,320]
Plotting this data into a scatter XY graph, I get the following:

Is there any way for me to control which points are used in the X axis? I want it to have specifically the points [2,4,8,16,32] and not the ones that are assigned automatically by Excel?
Thank you very much in advance!


text:
Q: Gradle upgrade in Android studio I'm using Android Studio 4.0 (latest release) and have a project with Gradle 3.5.1. When I open the project IDE recommends to upgrade the Gradle to 4 and I accept. This upgrades the Gradle to 4.0.0.
As soon as I do this my build fails with the following error message:
A problem occurred configuring project ':app'.

Could not create task ':app:optimizeAppDebug'.
Unnecessarily replacing a task that does not exist is not supported.  Use create() or register() directly instead.  You attempted to replace a task named 'optimizeAppDebug', but there is no existing task with that name.

Any idea how I can fix this? I've searched for the error and people are talking about invalidating the cache and rebuilding which I've tried a few times without any luck.
Thanks

A: I had the same problem. After updating the gradle I invalidated cache and restarted, then cleaned and built my project again and it worked.
I did it like this: File -> Invalidate caches/restart -> Invalidate and Restart when it opened again I did: Build -> Clean Project. Build -> Rebuild Project


text:
Q: Restoring database between different version of SQL Server (SoftwareVersionBuild) i have a question about restoring database from newer version of SQL Server to older, when version differs only in SoftwareVersionBuild.
I know that's not possible to restore database from SQL Server 2012 to 2008, or from 2008 R2 to 2008 etc. but how about situation when i have to restore DB from SQL Server 2008 R2 SP2 (10.50.4033) to version 10.50.2500? (2008R2 SP1).
Well, I know that you'll ask why i just won't try to do it, but unfortunately i don't have access to server with 2008R2 SP1 version, and i'll have to deploy my DB on it soon.
I installed SQL Server 2008 R2 on freshly craeted virtual machine, but exact version of freshly installed SQL Server is 10.50.4000. I managed to successfully restore my test DB from version 10.50.4033 to 10.50.4000, so I guess that it'll work to restore it on version 10.50.2500, too, but I would like to just be sure.
I tried to find information about restoring SQL databases when SQL Server version differs only in SoftwareVersionBuild, but i couldn't find answer.

A: Migrating a database specifically from 2008 R2 SP2 to 2008 R2 SP1 will be fine*.
Migrating up or down service pack levels on the same SQL Server version is generally OK, because the internal database version number usually does not change.
There have been a couple of exceptions to this general rule. The one that might interest you concerns databases where support for 15,000 partitions has been enabled (changing the internal database version). If this scenario might apply to you, download and review the SQL Server Technical Article below:
Support for 15,000 Partitions in SQL Server 2008 SP2 and SQL Server 2008 R2 SP1.
Even so, going directly from a 2008 R2 SP2 instance to SP1 should not present any problems. Always have verified (restored and DBCC-checked) backups just in case.

* Caveat: If the SP2 database had support for 15,000 partitions enabled, it would not be accessible when restored to R2 RTM as an intermediate step. Applying SP1 would then resolve this. Good to know to avoid panic at the RTM stage :)

A:
how about situation when i have to restore DB from SQL Server 2008 R2 SP2 (10.50.4033) to version 10.50.2500? (2008R2 SP1).

The restore will work just fine when restoring from SP2 to SP1. I verified by restoring SQL server SP1 backup to SQL Server RTM. YOU can check using RESTORE HEADERONLY FROM DISK = 'YOUR BACKUP PATH.BAK'.
You have the SoftwareVersionMajor, SoftwareVersionMinor, and SoftwareVersionBuild so that you can know precisely what version of SQL Server was used and whether any service packs, cumulative updates, or hotfixes have been applied.

I know that's not possible to restore database from SQL Server 2012 to 2008, or from 2008 R2 to 2008 etc.

Practically you can restore, but that involves a lot of work (thought I would recommend as a last resource). Some of the newer stuff in higher version will not work, but atleast you can get the data back in the database.
Note: Restoring a database clears the plan cache for the instance of SQL Server thereby causing recompilations.


text:
Q: problem with date() I am using the date() function to display a timestamp from my databse.
$date = date( 'F jS', $news_items['date']);

I know the $news_items['date']; as they return in a YYYY-MM-DD 00:00:00 format.
But after the function call $date dispays as December 31st for all values.

A: $date = date('F jS', strtotime($news_items['date']));

Try that :)

A: That's because date() wants a timestamp and not a string. You're better of with something like this;
$dt   = date_create($news_items['date']);
$date = date_format($dt, 'F jS');

Or in the object oriented way;
$dt   = new DateTime($news_items['date']);
$date = $dt->format('F jS');

A: The correct syntax for date function is given in PHP manual as:
string date  ( string $format  [, int $timestamp  ] )

As you can see the second argument is expected to be an integer, but you are feeding the function with a string.


text:
Q: Node.js working fine, unless with localhost directly I've been at it for hours, can't seem to shake off this error.
socket.io-1.0.3.js:2 GET https://localhost:2000/socket.io/EIO=2&transport=polling&t=1483313078894-0 net::ERR_CONNECTION_CLOSED
My node.js server works good when I log in from alternative sites, but when I try with localhost, this is the error I get. Before this, I kept getting an "https" error, so I added "https" on all links.
Client HTML localhost
<script type="text/javascript" src="https://cdn.socket.io/socket.io-1.0.3.js"></script>
Client Javascript localhost
var socket = io.connect('https://localhost:2000');
Just to be more clear, I'm trying to move my website from web host to my private localhost. Everything works great from web host, but getting errors from localhost

A:
Before this, I kept getting an "https" error, so I added "https" on all links.

It's not enough to just use HTTPS URLs... your server also has to be listening for HTTPS connections.
If you must use HTTPS, you need to set your server up to listen on a different port than regular HTTP (usually HTTPS is on :443), and configure a certificate and key.  You can use self-signed certificates for local testing, but you must get a real certificate (such as using Let's Encrypt, or a paid service) to use this for the rest of the world.


text:
Q: vscode open golang project,Could not import local package
*

*project can be built successfully,it's work.

*vscode(or gopls) show errors 'could not import **** package'

*Goland will not have this problem, But I want to use vscode remote

The project structure is as follows:
Assume modName is MyProject
- GoPath
     * MyProject   -----  open project
         * cmd
             * main
         * internal
             * package1
                 * goFiles   ---- import "MyProject/internal/package2"    //show errors
             * package2
                 * goFiles

What should I change to let the error go away?

A: Packages in Go should b structured as go modules. Read from the documentation or refer here - https://golangbot.com/go-packages/
It is a practise to import packages in go as

github.com/prateekgupta3991/refresher/entities

even though its in the same project, instead of absolute path in your local.
Try to align the package structure in go mod format. Might solve your problem.


text:
Q: Automapper help mapping a complex c# objects I am trying to map from Vehicle object to the Motor object using Automapper
public class Range<T>
{
    public T Min { get; set; }
    public T Max { get; set; }
}

public Enum SpeedType
{
    [Display(Name = "-")] Unknown = 0,
    [Display(Name = "M")] Manual= 1,
    [Display(Name = "A")] Automatic= 2
}

public class Vehicle
{
    public Range<string> Speed { get; set; }
}

public class Motor
{
    public Range<SpeedType?> Speed { get; set; }
}

I have tried using the MapFrom (reading the documentation) without any success. Can someone point me in the right direction. I am not even sure if this can be even mapped using Automapper. I have used automapper in the past for simple mappings.

A: This works for me:
Mapper.Initialize(cfg =>
{
    cfg.CreateMap<string, SpeedType?>().ConvertUsing(speed =>
    {
        switch (speed)
        {
            case "M": return SpeedType.Manual;
            case "A": return SpeedType.Automatic;
            default: return SpeedType.Unknown;
        }
    });

    cfg.CreateMap<Range<string>, Range<SpeedType?>>();
    cfg.CreateMap<Vehicle, Motor>();
});

var vehicle = new Vehicle
{
    Speed = new Range<string>
    {
        Min = "M",
        Max = "A"
    }
};

var motor = Mapper.Map<Vehicle, Motor>(vehicle);

A: I came up with the following mapping to solve my problem.  I wrote a GetEnum custom method
CreateMap<Vehicle,Motor>()
.ForMember(g => g.Speed, opt => opt.MapFrom(u=> new Range<SpeedType?>
                {
                    Min = EnumHelper.GetEnum<SpeedType?>(u.Speed.Min),
                    Max = EnumHelper.GetEnum<SpeedType?>(u.Speed.Max),
                }))


text:
Q: how to remove everything in () while skip col 1 and row 3 I have a data.frame that looks like this:

I want to remove anything within () from col2-3 and skip row 3. what should I do.
Currently I can do the part for the col part but don't know how to skip row 3. Here is my codes:
Sample data can be build using codes:
df<-structure(list(Name = c("Patient Number", "Patients with fever",
"AEDECOD", "DIARRHOEA", "NAUSEA"), Score1 = c("159 (100%)", "159",
"Total", "131 (82.39%)", "92 (57.86%)"), Score2 = c("3", "3",
"test2", "2 (66.67%)", "2 (66.67%)"), Score3 = c("3", "3", "test3",
"2 (66.67%)", "1 (33.33%)")), row.names = c(NA, -5L), class = c("tbl_df",
"tbl", "data.frame"))

The output that I want is sth looks like this:

A: EDIT: I missed the "skip row 3" part of the question - in part because it is still in your example output so it's not clear what you mean. I've added a filter at the end of the question.
You have the right idea using mutate(across()). You can use gsub to replace "spaces followed by anything in parentheses":
library(dplyr)

df %>%
  mutate(across(starts_with("Score"), ~gsub("\\s+\\(.*?\\)", "", .x)))

Result. Note that the columns are type character as you have mixed text + numbers. You might want to mutate using as.numeric() after removing row 3.
# A tibble: 5 x 4
  Name                Score1 Score2 Score3
  <chr>               <chr>  <chr>  <chr>
1 Patient Number      159    3      3
2 Patients with fever 159    3      3
3 AEDECOD             Total  test2  test3
4 DIARRHOEA           131    2      2
5 NAUSEA              92     2      1

One way to remove row 3 is to add a filter. Another way is to use slice(-3).
After that you can mutate the numbers to type numeric.
df %>%
  mutate(across(starts_with("Score"), ~gsub("\\s+\\(.*?\\)", "", .x))) %>%
  # or slice(-3) instead of next line %>%
  filter(Name != "AEDECOD") %>%
  mutate(across(starts_with("Score"), ~as.numeric(.x)))

Result:
# A tibble: 4 x 4
  Name                Score1 Score2 Score3
  <chr>                <dbl>  <dbl>  <dbl>
1 Patient Number         159      3      3
2 Patients with fever    159      3      3
3 DIARRHOEA              131      2      2
4 NAUSEA                  92      2      1


text:
Q: How to check CUSTOM_RINGTONE have assigned to a Contact or not in Android I have designed a app, where i need to know. whether a Custom ringtone have been assigned to a particular contact or not. I just want to check CUSTOM_RINGTONE property column contains null or not.

A: I suggest you looking at the ringtone data in Content Provider. As per the documentation:
http://developer.android.com/reference/android/provider/ContactsContract.ContactOptionsColumns.html#CUSTOM_RINGTONE


text:
Q: Проблема с отображением grid-а Есть код

    $(document).ready(function() {
        /*
        all__buttons=document.querySelectorAll('.header__button');

            [].forEach.call(all__buttons, function(selected__button){
                selected__button.addEventListener('click', function(event){
                    event.target.style.backgroundColor='#5f3ec0';
                    event.target.style.color='#ffffff';

                });
            });
        */

        $('.header__button').click(function(event){
                $('.header__button').removeClass('lilac');
                $(this).addClass('lilac');
                event.target.style.color='#ffffff';
        }
        );

if ((document.documentElement.clientWidth >= 320) and (document.documentElement.clientWidth <= 639))
{
const getItem = `

                                Iphone 11, почему такой же как и Pro Max, может быть большим в 3 строки вот так

                                    <button class="crashvideo">Краш видео</button>

                                    <button class="crashvideo" id="ex2">Краш видео</button>

                                Видео разбор с ответами на самые часто задаваемые вопросы может быть большим в 3 строки, видео разбор с ответами на самые часто задаваемые

                                Читать далее

                        `;

            const getAllItems = () => {
                let content = '';

                for (let i=0; i<4; i++) {
                    content+=getItem;
                }
                return content;
            }

            const renderAllItems = () => {
                document.getElementById('content').innerHTML=getAllItems();
            }

            renderAllItems();
        }

        if ((document.documentElement.clientWidth >= 640) and (document.documentElement.clientWidth <= 1023))
        {
            document.getElementsByClassName('content__article').innerHTML = getItem;

        }

    }

    )
body {
    margin: 0;
    padding: 0;
}

:root {
    --containerfullwidth: 768;
}
.globalcontainer {
    margin-top: 0px;
    margin-right: calc((39/var(--containerfullwidth)*100)*1%);
    margin-bottom: 0px;
    margin-left: calc((39/var(--containerfullwidth)*100)*1%);
    /*height: 100%;*/
}

.header > .header__text {
position: relative;
width: 93px;
height: 24px;
left: 0;
margin-top: 129px;
margin-bottom: 20px;

font-family: TT Norms;
font-style: normal;
font-weight: bold;
font-size: 24px;
line-height: 100%;
/* identical to box height, or 24px */

color: #000000;
}

/*
.header__buttons {
    left: 0;
    top: 193px;
}
*/

.header__button {
    width: 75px;
    height: 30px;
    border-radius: 4px;
    border-color: #5f3ec0;
    background-color: #fff;
    margin-right: 1.75%;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
}

.header__buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 7px 15px 7px 0px;
    overflow: hidden;
    /*margin-right: 10%;*/
}

.content {
    display: grid;
    grid-template-areas: "content__parttext content__parttext"
                         "content__parttext content__parttext"
                         "content__parttext content__parttext"
                         "content__parttext content__parttext";
    grid-template-columns: 1fr 1fr;
}

.content__article {
    grid-area: content__parttext;
}

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test Example</title>
<link rel="stylesheet" type="text/css" href="../css/mobile.css" media="screen and (min-width: 320px) and (max-width: 639px)"></link>
<link rel="stylesheet" type="text/css" href="../css/tablet.css" media="screen and (min-width: 640px) and (max-width: 1023px)"></link>
<link rel="stylesheet" type="text/css" href="../css/desktop.css" media="screen and (min-width: 1024px) and (max-width: 1920px)"></link>

                            Обзоры

                                <button class="header__button">Все</button>
                                <button class="header__button">Видео</button>
                                <button class="header__button">Текст</button>
                                <button class="header__button">Обзоры</button>
                                <button class="header__button">Сравнения</button>
                                <button class="header__button">Краш видео</button>
                                <button class="header__button">Распаковка</button>

                <button class="show__more">Показать еще</button>

                        Контакты

                        +7 (800) 333 32 24

                        +7 (812) 448 68 11

                    <button class="requestcall">
                        Заказать звонок
                    </button>

                            Интернет магазин

                            >

                            Компания

                            >

                            Помощь покупателю

                            >

                            Мы в соц. сетях

                                <embed src="../img/facebook.svg">

                            © 2020 Все права защищены

Он должен отображаться как на https://www.figma.com/file/noqP1gzhrAlGAErPNBgknp/test?node-id=0%3A1 (tablet вид), а у меня рисунки (блок content) после header__buttons не отображаются. Подскажите как исправить отображение.

A: Для затравки
if ((document.documentElement.clientWidth >= 640) **and** document.documentElement.clientWidth <= 1023))

Что такое and?
Тут такой переменной getItem нет, обратите внимание на область видимости
    if ((document.documentElement.clientWidth >= 640) and (document.documentElement.clientWidth <= 1023))
    {
        document.getElementsByClassName('content__article').innerHTML = getItem;
    }

Обратите внимание на document.getElementsByClassName('content__article') там контент не пустой и количество таких элементов не 1

$(document).ready(function() {
        /*
        all__buttons=document.querySelectorAll('.header__button');

            [].forEach.call(all__buttons, function(selected__button){
                selected__button.addEventListener('click', function(event){
                    event.target.style.backgroundColor='#5f3ec0';
                    event.target.style.color='#ffffff';

                });
            });
        */

        $('.header__button').click(function(event){
                $('.header__button').removeClass('lilac');
                $(this).addClass('lilac');
                event.target.style.color='#ffffff';
        }
        );

const getItem = `

                                Iphone 11, почему такой же как и Pro Max, может быть большим в 3 строки вот так

                                    <button class="crashvideo">Краш видео</button>

                                    <button class="crashvideo" id="ex2">Краш видео</button>

                                Видео разбор с ответами на самые часто задаваемые вопросы может быть большим в 3 строки, видео разбор с ответами на самые часто задаваемые

                                Читать далее

                        `;

            const getAllItems = () => {
                let content = '';

                for (let i=0; i<4; i++) {
                    content+=getItem;
                }
                return content;
            }

            const renderAllItems = () => {
                document.getElementById('content').innerHTML=getAllItems();
            }

    if ((document.documentElement.clientWidth >= 320) && (document.documentElement.clientWidth <= 639))
    {
       renderAllItems();
    } else if ((document.documentElement.clientWidth >= 640) && (document.documentElement.clientWidth <= 1023))
    {
        document.getElementsByClassName('content__article')[0].innerHTML = getAllItems();
    } else { // хоть что нибуть вывелось
      renderAllItems();
    }
}

    )
body {
    margin: 0;
    padding: 0;
}

:root {
    --containerfullwidth: 768;
}
.globalcontainer {
    margin-top: 0px;
    margin-right: calc((39/var(--containerfullwidth)*100)*1%);
    margin-bottom: 0px;
    margin-left: calc((39/var(--containerfullwidth)*100)*1%);
    /*height: 100%;*/
}

.header > .header__text {
position: relative;
width: 93px;
height: 24px;
left: 0;
margin-top: 129px;
margin-bottom: 20px;

font-family: TT Norms;
font-style: normal;
font-weight: bold;
font-size: 24px;
line-height: 100%;
/* identical to box height, or 24px */

color: #000000;
}

/*
.header__buttons {
    left: 0;
    top: 193px;
}
*/

.header__button {
    width: 75px;
    height: 30px;
    border-radius: 4px;
    border-color: #5f3ec0;
    background-color: #fff;
    margin-right: 1.75%;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
}

.header__buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 7px 15px 7px 0px;
    overflow: hidden;
    /*margin-right: 10%;*/
}

.content {
    display: grid;
    grid-template-areas: "content__parttext content__parttext"
                         "content__parttext content__parttext"
                         "content__parttext content__parttext"
                         "content__parttext content__parttext";
    grid-template-columns: 1fr 1fr;
}

.content__article {
    grid-area: content__parttext;
}

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test Example</title>
<link rel="stylesheet" type="text/css" href="../css/mobile.css" media="screen and (min-width: 320px) and (max-width: 639px)"></link>
<link rel="stylesheet" type="text/css" href="../css/tablet.css" media="screen and (min-width: 640px) and (max-width: 1023px)"></link>
<link rel="stylesheet" type="text/css" href="../css/desktop.css" media="screen and (min-width: 1024px) and (max-width: 1920px)"></link>

                            Обзоры

                                <button class="header__button">Все</button>
                                <button class="header__button">Видео</button>
                                <button class="header__button">Текст</button>
                                <button class="header__button">Обзоры</button>
                                <button class="header__button">Сравнения</button>
                                <button class="header__button">Краш видео</button>
                                <button class="header__button">Распаковка</button>

                <button class="show__more">Показать еще</button>

                        Контакты

                        +7 (800) 333 32 24

                        +7 (812) 448 68 11

                    <button class="requestcall">
                        Заказать звонок
                    </button>

                            Интернет магазин

                            >

                            Компания

                            >

                            Помощь покупателю

                            >

                            Мы в соц. сетях

                                <embed src="../img/facebook.svg">

                            © 2020 Все права защищены


text:
Q: Unable to find property descriptor useOriginalBody on class org.apache.camel.builder.DeadLetterChannelBuilder I'm trying to use the deadLetterChannelBuilder but can't find the correct properties for it. does anyone know what they are or where to find them?  the one's in the doc don't seem to work. ?
Unable to find property descriptor useOriginalBody on class org.apache.camel.builder.DeadLetterChannelBuilder
<bean id="deadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
    <property name="deadLetterUri" value="${deadLetterQueue}"/>
    <property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
    <property name="useOriginalBody" value="true" />
</bean>

<bean id="redeliveryPolicyConfig" class="org.apache.camel.processor.RedeliveryPolicy">
    <property name="maximumRedeliveries" value="3"/>
    <property name="redeliveryDelay" value="5000" />
</bean>

<camelContext
  id="com.ge.ip.mro.coreCamelContext"
  trace="true"
  xmlns="http://camel.apache.org/schema/blueprint"
  allowUseOriginalMessage="false"
  streamCache="true"
  errorHandlerRef="deadLetterErrorHandler" >

I've also tried allowUseOriginalMessage  but as expected, it is not a deadLetterChannelBuilder property.

A: The correct property is called useOriginalMessage.
<property name="useOriginalMessage" value="true" />


text:
Q: How can i do my discord.py bot recognize multiple args as just one? Im trying to make my discord bot translate a message using web API, but when i execute the command it only uses the first arg (before space) or changing the code it only gets the last arg (after space)
here is my code:
@bot.command(pass_context=False)
async def brus(ctx, args):
    useragent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'
    session = aiohttp.ClientSession(headers={'User-Agent': useragent})
    yandexkey = 'secret key'
    translatebrus = await session.get("https://translate.yandex.net/api/v1.5/tr.json/translate?text=" + args + "&lang=en&key=" + yandexkey)
    translatebrusres = await translatebrus.json()
    translateresult = str(translatebrusres['text'][0]) #here is where i get the translated response
    embed4 = discord.Embed(title="BR-EN TRANSLATION", description=(translateresult), color=0x1aff00)
    await bot.say("", embed=embed4) #i just use this to send the message already formatted to embed
    await bot.say(translatebrusres) #unnecessary, just to see my response
    await bot.say(translatebrus) #unnecessary, just to see my request
    session.close()

and here is my response on discord:
https://i.stack.imgur.com/SFWet.png
on the image, you can see that "mundo" is the last arg, and the translation to english is "world", but "ola" that is the first args it doesn't translate
i have tried using *args, **kwargs, message and str but i didn't get any changes
i have seen other related posts on stackoverflow but none of them work for me
edit:
fixed it using
@bot.command(pass_context=True) #It was pass context FALSE
async def brus(ctx, *, traduzir): #It was using args, was changed to custom arg name (traduzir) and added * before custom arg name to translate all arguments as just one (what i wanted to do)
#and changed the session get to this
translatebrus = await session.get(f"https://translate.yandex.net/api/v1.5/tr.json/translate?text={quote(traduzir)}&lang=pt-en&key=" + yandexkey #thanks Samuel, the quote was helpful, without quote it wont pass the arguments right to be json decoded.

thats it, hope i help someone else ;)

A: I don't have all the information to solve this, but there are a few things I'm suspecting:
a) You specify pass_context=False, yet the first argument to your brus function is is ctx. Could it be that you are unintentionally always putting the first word inside ctx? You might want to use a debugger or print what ctx and args are.
b) The Yandex documentation has the following warning:

Attention.
The source text must be URL-encoded.

I'm suspecting the text you receive in "args" in just a regular string like ola mundo, so you might need to escape it and make it URL safe:
>>> from urllib.parse import quote
>>> quote('This is the text')
'This%20is%20the%20text'

If a) is actually the problem, I still suggest you add the quote() step, otherwise a lot of input will potentially break your bot!


text:
Q: FilterToolBar not returning all matches I have a jqGrid with json data type and loadOnce: true.  I am using the filterToolBar search.  It does not return all matches.  The grid contains a searchable column called Name and has values "Adkins, Joe" and "Adkinson, Jane".  If I type in search string "Adk", the only match returned is "Adkins, Joe".
Here is the grid definition:
function loadmyGrid(dataUrl, selectUrl) {
$("#myGrid").jqGrid({
    url: dataUrl + "?r=" + rand(),
    datatype: "json",
    mtype: 'GET',
    rowNum: -1,
    loadonce: true,
    ignoreCase: true,
    scroll: true,
    scrollOffset: 0,
    gridview: true,
    colNames: ["Employee ID", "Name", "User Name", ""],
    colModel: [
              { name: "EmployeeID", width: "125", align: "center", sortable: false, resizable: false, title: false, search: false },
                    { name: "Name", width: "150", align: "center", sortable: false, resizable: false, title: false },
                    { name: "UserName", width: "125", align: "center", sortable: false, resizable: false, title: false, search: false },
                    { name: "UserKey", key: true, width: "135", align: "center", sortable: false, resizable: false, title: false, formatter: selectButtonFormatter, search: false},
            ],
    emptyrecords: "Nothing to display",
    beforeSelectRow: function () { return false; },
    gridComplete: function () {
        $("#myGrid").setGridHeight("100%");
        $("#myGrid").filterToolbar({searchOnEnter: false, defaultSearch: "cn" })
    }
})

A: Your main error is the usage of rowNum: -1 which is wrong. If you want to prevent local paging of data you should use some large enough value of rowNum. For example rowNum: 1000 or rowNum: 10000.
I recommend you additionally to replace $("#myGrid") inside of any callback (for example gridComplete) to $(this). The usage of "?r=" + rand() part of the url seems me unneeded. The call of $("#myGrid").filterToolbar you should move outside of gridComplete because it can be called only once.
I recommend you additionally to use column templates. It can reduce the code and could make it more manageable and better readable.


text:
Q: File Access problem from asset pack in android from the testing app downloaded from Playstore? I have a question about the file accessing process from the asset folder of android which uses play asset delivery. I have done setup with the play asset delivery for deploying my android application as the size of the app is more than 150Mb.
I followed the google documentation for setting up the play asset delivery module - install_time_asset pack module and moved my asset files to the file structure given below:
Below is the code structure I followed for accessing the files.

Earlier I was not able to access the file in the install_time_asset_pack assets- install_time1.txt so I change the setting from edit configuration to run app from bundle instead of the APK.

From this setting, I am able to access the asset folder files from both main assets and install pack assets.
Now I published the app to Google play console internal testing module for closed testing and downloaded the application from the play store application but during testing that application, I was not able to access the files from assets, what could be the possible reasons for that misbehavior?

A: I found the answer to this question as I was optimizing the apk size I have added the minifyEnabled true which is causing the problem at runtime as it removes a few object classes to reduce the apk size.
After removing this flag, the downloaded apk is running fine now.


text:
Q: Is there a way to make a PR but have the repo private in my github account? I want to contribute to a public repo with a pull request.
I can't seem to find a workaround for it, when I fork the public repo it shows up in my account as well.
However, I don't want that repo to be seen in my github account.

A: To issue a PR on a public repository your fork must also be public. The repo you are issuing the pull request to must be able to access and view your fork. The PR will be public. If accepted, your commits will appear in the public repository.

However, I don't want that repo to be seen in my github account.

Since your fork must be public, the question is why do you not want the fork to be seen on your account? There's probably a better way to accomplish your unstated goal.
Depending on why, I can think of a few work arounds.

*

*Delete your fork after the PR is accepted. This is the simplest thing to do.

*Make another Github account with a different email address just for this PR.

Note that in both cases, the PR and your commits will still be visible in the repo you contributed to.

A: Simple answer: No.
Github does not allow you to do that.
For more information, you can go to Settings of your repo, you will check that it is mentioned clearly inside Danger Zone area.

You cannot change the visibility of a fork. Please duplicate the
repository.

A: Since September 2022, you can make your GitHub profile private.
It won't prevent the forked repository from appearing on your profile, but at least your followers won't be notified. And you can delete this fork as soon as you've submitted your PR.