text:
Q: Caused by: android.database.sqlite.SQLiteException: no such table: I have a problem accessing the DB of my app. I have to load some data from the DB but I keep getting this error:
    09-11 11:29:36.032 21955-23129/com.stella.erica.cookingtime E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
        Process: com.stella.erica.cookingtime, PID: 21955
        java.lang.RuntimeException: An error occured while executing doInBackground()
          at android.os.AsyncTask$3.done(AsyncTask.java:300)
          at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
          at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
          at java.util.concurrent.FutureTask.run(FutureTask.java:242)
          at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
          at java.lang.Thread.run(Thread.java:841)
        Caused by: android.database.sqlite.SQLiteException: no such table: type (code 1): , while compiling: SELECT type, image FROM type
          at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
          at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
          at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
          at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
          at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
          at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
          at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
          at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
          at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161)
          at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032)
          at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1200)
          at com.stella.erica.cookingtime.TypesDataSource.getListofTypes(TypesDataSource.java:36)
          at com.stella.erica.cookingtime.ChoiceActivity$AddChoicesTask.getListOfChoices(ChoiceActivity.java:179)
          at com.stella.erica.cookingtime.ChoiceActivity$AddChoicesTask.doInBackground(ChoiceActivity.java:108)
          at com.stella.erica.cookingtime.ChoiceActivity$AddChoicesTask.doInBackground(ChoiceActivity.java:103)
          at android.os.AsyncTask$2.call(AsyncTask.java:288)
          at java.util.concurrent.FutureTask.run(FutureTask.java:237)
          at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
          at java.lang.Thread.run(Thread.java:841)

Here's my DBhelper
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

 public class TypesDBHelper extends SQLiteOpenHelper {

    // Database creation sql statement
    private static final String DATABASE_CREATE = "create table "
            + DBContracts.TypeTable.TABLE_NAME + "( "
            + DBContracts.TypeTable.COLUMN_ID + " integer primary key autoincrement, "
            + DBContracts.TypeTable.COLUMN_TYPE + " text not null,"
            + DBContracts.TypeTable.COLUMN_IMAGE + "text not null);";

    private static final String DATABASE_INSERT_VALUES = "insert into "
            + DBContracts.TypeTable.TABLE_NAME + "("
            + DBContracts.TypeTable.COLUMN_TYPE + ","
            + DBContracts.TypeTable.COLUMN_IMAGE +
            ") values ('Main course','main_course_image'), " +
            "('Side dish','side_dish_image'), " +
            "('Dessert','dessert_image'), " +
            "('Appetizer','appetizer_image'), " +
            "('Salad','salad_image'), " +
            "('Bread','bread_image'), " +
            "('Breakfast','breakfast_image')," +
            "('Soup','soup_image')," +
            "('Beverage','beverage_image')," +
            "('Sauce','sauce_image')," +
            "('Drink','drink_image')";

    public TypesDBHelper(Context context) {
        super(context, DBContracts.DATABASE_NAME, null, DBContracts.TypeTable.DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase database) {
        database.execSQL(DATABASE_CREATE);
        database.execSQL(DATABASE_INSERT_VALUES);
    }

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

}

Here is my data source access
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;

import java.util.ArrayList;

public class TypesDataSource {

    private SQLiteDatabase database;
    private TypesDBHelper dbHelper;

    public TypesDataSource(Context context){
        this.dbHelper = new TypesDBHelper(context);
    }

    public void open() throws SQLException {
        database = dbHelper.getReadableDatabase();
    }

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

    public ArrayList<String[]> getListofTypes(){
        ArrayList<String[]> types = new ArrayList<>();

        String[] projection = {DBContracts.TypeTable.COLUMN_TYPE, DBContracts.TypeTable.COLUMN_IMAGE};
        Cursor cursor = database.query(DBContracts.TypeTable.TABLE_NAME, projection, null, null, null, null, null);
        cursor.moveToFirst();

        while(!cursor.isAfterLast()){
            Type type = cursorToType(cursor);
            String[] typeToString = {type.getName(), type.getImageName()};
            types.add(typeToString);
            cursor.moveToNext();
        }

        cursor.close();
        return types;
    }

    private Type cursorToType(Cursor cursor){
        Type type = new Type(cursor.getString(0), cursor.getString(1));
        return type;
    }
}

And here's the method from which I'm using my data source (it's in a subclass I made of AsyncTask):
private ArrayList<String[]> getListOfChoices(Context context){

    TypesDataSource dataSource = new TypesDataSource(context);
    try {
        dataSource.open();
    }catch (SQLException e){
        //todo
        Log.e("DBEX", "ECCEZIONE NEL DB");
    }

    ArrayList<String[]> typeList = dataSource.getListofTypes();
    dataSource.close();

    return typeList;
}

I can't figure out why I keep getting this error especially because I have another table in the same DB (with almost identical code) and I don't have problems accessing it.
Thanks in advance for your help.
Edit: I changed the column names as suggested but I get the same error with the new column names. I tried to look for an answer in the links I've been posted but I can't find it in there either...

A: Your error log seems to be complaining about the following SELECT query:
SELECT type, image FROM type

type is not a SQLite keyword, but one possible explanation is that SQLite cannot resolve the type object correctly because it is appearing as both a column and a table.  One fix might be to use the fully qualified name of the table, including the database in which it resides, e.g.
SELECT type, image FROM yourdb.type


text:
Q: No more notification for iMessage with Mavericks I did the upgrade to Mavericks few days ago. I noticed a problem with my iMessage app : I don't get any notification when I received a new message (neither alert, nor badges on the icon in the Dock).
How can I troubleshoot if this is a problem with my computer or account or perhaps my network connection?

A: Go to System Preferences > Notifications.

*

*Make sure that you're not in the 'Do not disturb" mode.

*Check your settings for the Messages app. Enable 'Banners' if they're off (or even 'Alerts').

redpajama_set_name: RedPajamaStackExchange


text:
Q: What does 'closing the distance between' mean? In the larger context:

The poet showed how bad war is. Therefore, closing the distance between the audiences views and the reality of war itself

A: In its literal use, close the distance between means to move one thing closer to a second thing that is at a distance:

close
verb
4 Gradually get nearer to someone or something:
distance
noun
1 The length of the space between two points:

In The Handbook of Foil Fencing, by Allan Skipp, the attacker closes the distance between himself and his opponent:

To close the distance between you and your opponent and therefore gain
  a tactical advantage, you can precede a simple attack with a step
  forwards used as a foot preparation.

Any metaphorical distance can be closed metaphorically. In The Future of Academic Freedom, by Louis Menand, academic freedom closes the metaphorical distance between expectation and reality:

Academic freedom then, is both a guarantor and an exemplification of the ethical practice that constitutes history, the relentless striving to close the distance between what is and what ought to be.

In The Origins of Cultural Differences and Their Impact on Management, by Jack Scarborough a manager attempts to close the metaphorical distance between himself and his workers:

The distance literally divides manager and worker; the worker feels
  dependent upon the manager yet considers the manager unapproachable
  and not to be challenged even when the manager seeks to close the
  distance.

In Ethics for Adversaries, by Arthur Isak Applbaum, lawyers close the metaphorical distance between what a jury might believe and what they believe

If it helps their case, they do everything within their power and the
  rules to close the distance between presenting what could be believed
  and misrepresenting what they actually believe.

In the OP, the poet closes the metaphorical distance between the audience's view of war and the reality of war.

A: Here the 'distance' refers to a distance in knowledge or understanding, rather than a spatial distance. So, 'closing the distance' would mean reducing the difference in knowledge, or making all parties come together in terms of understanding. Synonyms: to bring on the same page, to bridge the [knowledge] gap


text:
Q: Python: How do I count unique list elements and put that count as dictionary values? I'm doing a project for a class. I'm at a stage where I need to count disaster areas. I've defined a function that is supposed to pull the names from the multi-dimensional list, count the # of times each unique element occurs, and then marry those two items as keys & values respectively in a new dictionary. I have managed to do the first part(establish the areas as keys), but I can't figure out how to get the unique counts for how often each area occurs in the list, and assign them as the values.
I've attempted to use a variable to count each one, but the results are all wrong. The counts coming out seem to be random.
# areas affected by each hurricane
areas_affected = [['Central America', 'Mexico', 'Cuba', 'Florida', 'The Bahamas'], ['Lesser Antilles', 'The Bahamas', 'United States East Coast', 'Atlantic Canada'], ['The Bahamas', 'Northeastern United States'], ['Lesser Antilles', 'Jamaica', 'Cayman Islands', 'Cuba', 'The Bahamas', 'Bermuda'], ['The Bahamas', 'Cuba', 'Florida', 'Texas', 'Tamaulipas'], ['Jamaica', 'Yucatn Peninsula'], ['The Bahamas', 'Florida', 'Georgia', 'The Carolinas', 'Virginia'], ['Southeastern United States', 'Northeastern United States', 'Southwestern Quebec'], ['Bermuda', 'New England', 'Atlantic Canada'], ['Lesser Antilles', 'Central America'], ['Texas', 'Louisiana', 'Midwestern United States'], ['Central America'], ['The Caribbean', 'Mexico', 'Texas'], ['Cuba', 'United States Gulf Coast'], ['The Caribbean', 'Central America', 'Mexico', 'United States Gulf Coast'], ['Mexico'], ['The Caribbean', 'United States East coast'], ['The Caribbean', 'Yucatn Peninsula', 'Mexico', 'South Texas'], ['Jamaica', 'Venezuela', 'Central America', 'Hispaniola', 'Mexico'], ['The Caribbean', 'United States East Coast'], ['The Bahamas', 'Florida', 'United States Gulf Coast'], ['Central America', 'Yucatn Peninsula', 'South Florida'], ['Greater Antilles', 'Bahamas', 'Eastern United States', 'Ontario'], ['The Caribbean', 'Venezuela', 'United States Gulf Coast'], ['Windward Islands', 'Jamaica', 'Mexico', 'Texas'], ['Bahamas', 'United States Gulf Coast'], ['Cuba', 'United States Gulf Coast'], ['Greater Antilles', 'Central America', 'Florida'], ['The Caribbean', 'Central America'], ['Nicaragua', 'Honduras'], ['Antilles', 'Venezuela', 'Colombia', 'United States East Coast', 'Atlantic Canada'], ['Cape Verde', 'The Caribbean', 'British Virgin Islands', 'U.S. Virgin Islands', 'Cuba', 'Florida'], ['Lesser Antilles', 'Virgin Islands', 'Puerto Rico', 'Dominican Republic', 'Turks and Caicos Islands'], ['Central America', 'United States Gulf Coast (especially Florida Panhandle)']]

def area_counter(areas_affected):
    areas = {}
    count = 0
    splits = [item[-1].split(",") for item in areas_affected]
    flat = [item for l in splits for item in l]
    for i in range(len(flat)):
        count += 1
        areas[flat[i]] = {"Count": [count]}
    return areas
print(area_counter(areas_affected))

A: Try using a defaultdict with a lambda that returns 0 for uninitialized items
from collections import defaultdict
areas = defaultdict(lambda: 0)

and whenever you use that area as a key just simply update it by one
areas[key] += 1

Let me know if this helps or not

A: You can use the defaultdict from the collections package.
If you prefer to do it manually, you can do it first by extracting all the keys and then counting the occurrences for each key.
keys = set()
for item in areas_affected:
    keys.update(item)

dic = {}
for k in keys:
    counter = 0
    for item in areas_affected:
        if k in item:
            counter += 1

    dic[k] = counter


text:
Q: Cookies don't get attached even after using storage API const iframe = document.createElement("iframe");
iframe.sandbox.add('allow-scripts', 'allow-storage-access-by-user-activation', 'allow-same-origin');
iframe.onload = function () {
    window.addEventListener('load', () => {
        document.getElementById('test-button').addEventListener('click', () => {
            getStorageAccess().then(_ => {
                var xhr = new XMLHttpRequest();
                xhr.open('POST', 'https://example.net/v1/set-key-authorization-cookie/cb325a10-9404-4f77-b615-319415fa945a', true);
                xhr.setRequestHeader('Content-Type', 'application/json');
                xhr.withCredentials = true;
                xhr.send('{"KeyAuthorizationToken": "eyJhbGciOiJFUzI1NiIsImtpZCI6Ij"}');
                xhr.onreadystatechange = function () {
                    if (this.readyState == this.HEADERS_RECEIVED && this.status == 200) {
                        var xhr2 = new XMLHttpRequest();
                        xhr2.open('GET', 'https://example.net/v1/get-key/cb325a10-9404-4f77-b615-319415fa945a?encrypted-key-container=eyJhbGciOiJFUzI1Ni', true);
                        xhr2.withCredentials = true;
                        xhr2.send(null);
                    }
                }
            });
            console.log("The iframe is loaded" + getStorageAccess());
        });
    });
};
document.body.appendChild(iframe);

My inner request xhr2 needs some cookies from xhr request. getStorageAccess promise is resolved but no cookies in request.


text:
Q: Objects are being overwritten when pushing in AngularJs everyone. Using angularjs 1.2v. I have an array in model. The page is quite big so I will try to describe it shortly.
    $scope.model={
      salary,
      position,
      user:
      [{
      name:'',
      address:''
      }]
    }

And functions to add items into that array:
$scope.submitFunc = function(item){
  $model.user.push(item);
}

And this is html file:

     NameLabel
     <input ng-model="item.name" type = text />

     addressLabel
     <input ng-model="item.address" type = text />

   <button ng-click="submitFunc(item)">Submit<>

After clicking button I need my array in model to look like this:
$scope.model={
 'salary': 'some value',
 'position': 'some value',
 'user':[{name: 'value', address:'value2'},
{name: 'value3', address:'value4'},
... ]
}

How to construct Submit function correct it to add new values not just rewrite them? Purpose of this is a form which user is able to fill out random amount of times. And on button click data should go to array and fields should be cleared... Thank you !

A: You need to copy the object. You are passing a reference:
angular.copy(source);

https://docs.angularjs.org/api/ng/function/angular.copy
$scope.submitFunc = function(item){
  $model.user.push(angular.copy(item));
}

A: Try this it will work :

var myApp = angular.module('myApp',[]);

myApp.controller('MyCtrl',function ($scope) {
    $scope.model={
      salary:'',
      position:'',
      user:
      [{
      name:'',
      address:''
      }]
    }
    $scope.submitFunc = function(item){
      $scope.model.user.push(angular.copy(item));
      $scope.model.user.pop(angular.copy(item));
      $scope.model.user.push({
      name:'',
      address:''
      });
      console.log($scope.model);
    }
});

     NameLabel
     <input ng-model="item.name" type = text />

     addressLabel
     <input ng-model="item.address" type = text />

   <button ng-click="submitFunc(item)">Submit</button>


text:
Q: What are the available libraries within Google Colaboratory? TensorFlow is surely supported, and PyTorch isn't.
I found a non-comprehensive list here.
https://dbsnail.com/2017/10/26/quick-check-of-google-colaboratory
Is there an official list of supported libraries somewhere?

A: Most libraries can be installed quickly with a pip or apt.
Python 3
To install pytorch, add a cell with:
!pip3 install -q http://download.pytorch.org/whl/cu80/torch-0.3.0.post4-cp36-cp36m-linux_x86_64.whl && pip3 install -q torchvision
Here's an example notebook
Python 2
For example, to install pytorch, add a cell with the following command:
!pip install -q http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl && pip install -q torchvision
(Installation should take ~25 seconds.)
To install opencv, add a cell with:
!pip install -q opencv-python && apt -qq update && apt -qq install -y libsm6 libxext6
Here's an example notebook

A: !pip freeze shows:
absl-py==0.7.1
alabaster==0.7.12
albumentations==0.1.12
altair==2.4.1
astor==0.7.1
astropy==3.0.5
atari-py==0.1.7
atomicwrites==1.3.0
attrs==19.1.0
audioread==2.1.6
autograd==1.2
Babel==2.6.0
backcall==0.1.0
backports.tempfile==1.0
backports.weakref==1.0.post1
beautifulsoup4==4.6.3
bleach==3.1.0
bokeh==1.0.4
boto==2.49.0
boto3==1.9.115
botocore==1.12.115
Bottleneck==1.2.1
branca==0.3.1
bs4==0.0.1
bz2file==0.98
cachetools==3.1.0
certifi==2019.3.9
cffi==1.12.2
chainer==5.0.0
chardet==3.0.4
Click==7.0
cloudpickle==0.6.1
cmake==3.12.0
colorlover==0.3.0
community==1.0.0b1
contextlib2==0.5.5
convertdate==2.1.3
coverage==3.7.1
coveralls==0.5
crcmod==1.7
cufflinks==0.14.6
cvxopt==1.2.3
cvxpy==1.0.15
cycler==0.10.0
cymem==2.0.2
Cython==0.29.6
cytoolz==0.9.0.1
daft==0.0.4
dask==0.20.2
dataclasses==0.6
datascience==0.10.6
decorator==4.4.0
defusedxml==0.5.0
dill==0.2.9
distributed==1.25.3
Django==2.1.7
dlib==19.16.0
dm-sonnet==1.23
docopt==0.6.2
docutils==0.14
dopamine-rl==1.0.5
easydict==1.9
ecos==2.0.7.post1
editdistance==0.5.3
en-core-web-sm==2.0.0
entrypoints==0.3
enum34==1.1.6
ephem==3.7.6.0
et-xmlfile==1.0.1
fa2==0.3.5
fancyimpute==0.4.2
fastai==1.0.49
fastcache==1.0.2
fastdtw==0.3.2
fastprogress==0.1.20
fastrlock==0.4
fbprophet==0.4.post2
featuretools==0.4.1
filelock==3.0.10
fix-yahoo-finance==0.0.22
Flask==1.0.2
folium==0.8.3
future==0.16.0
gast==0.2.2
GDAL==2.2.2
gdown==3.6.4
gensim==3.6.0
geographiclib==1.49
geopy==1.17.0
gevent==1.4.0
gin-config==0.1.4
glob2==0.6
google==2.0.2
google-api-core==1.8.1
google-api-python-client==1.6.7
google-auth==1.4.2
google-auth-httplib2==0.0.3
google-auth-oauthlib==0.2.0
google-cloud-bigquery==1.8.1
google-cloud-core==0.29.1
google-cloud-language==1.0.2
google-cloud-storage==1.13.2
google-cloud-translate==1.3.3
google-colab==1.0.0
google-resumable-media==0.3.2
googleapis-common-protos==1.5.8
googledrivedownloader==0.3
graph-nets==1.0.3
graphviz==0.10.1
greenlet==0.4.15
grpcio==1.15.0
gspread==3.0.1
gspread-dataframe==3.0.2
gunicorn==19.9.0
gym==0.10.11
h5py==2.8.0
HeapDict==1.0.0
holidays==0.9.10
html5lib==1.0.1
httpimport==0.5.16
httplib2==0.11.3
humanize==0.5.1
hyperopt==0.1.2
ideep4py==2.0.0.post3
idna==2.6
image==1.5.27
imageio==2.4.1
imagesize==1.1.0
imbalanced-learn==0.4.3
imblearn==0.0
imgaug==0.2.8
imutils==0.5.2
inflect==2.1.0
intel-openmp==2019.0
intervaltree==2.1.0
ipykernel==4.6.1
ipython==5.5.0
ipython-genutils==0.2.0
ipython-sql==0.3.9
ipywidgets==7.4.2
itsdangerous==1.1.0
jdcal==1.4
jedi==0.13.3
jieba==0.39
Jinja2==2.10
jmespath==0.9.4
joblib==0.12.5
jpeg4py==0.1.4
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.2.4
jupyter-console==6.0.0
jupyter-core==4.4.0
kaggle==1.5.3
kapre==0.1.3.1
Keras==2.2.4
Keras-Applications==1.0.7
Keras-Preprocessing==1.0.9
keras-vis==0.4.1
kiwisolver==1.0.1
knnimpute==0.1.0
librosa==0.6.3
lightgbm==2.2.3
llvmlite==0.28.0
lmdb==0.94
lucid==0.3.8
lunardate==0.2.0
lxml==4.2.6
magenta==0.3.19
Markdown==3.0.1
MarkupSafe==1.1.1
matplotlib==3.0.3
matplotlib-venn==0.11.5
mesh-tensorflow==0.0.5
mido==1.2.6
mir-eval==0.5
missingno==0.4.1
mistune==0.8.4
mkl==2019.0
mlxtend==0.14.0
mock==2.0.0
more-itertools==6.0.0
moviepy==0.2.3.5
mpi4py==3.0.1
mpmath==1.1.0
msgpack==0.5.6
msgpack-numpy==0.4.3.2
multiprocess==0.70.7
multitasking==0.0.7
murmurhash==1.0.2
music21==5.5.0
natsort==5.5.0
nbconvert==5.4.1
nbformat==4.4.0
networkx==2.2
nibabel==2.3.3
nltk==3.2.5
nose==1.3.7
notebook==5.2.2
np-utils==0.5.10.0
numba==0.40.1
numexpr==2.6.9
numpy==1.14.6
nvidia-ml-py3==7.352.0
oauth2client==4.1.3
oauthlib==3.0.1
okgrade==0.4.3
olefile==0.46
opencv-contrib-python==3.4.3.18
opencv-python==3.4.5.20
openpyxl==2.5.9
osqp==0.5.0
packaging==19.0
pandas==0.22.0
pandas-datareader==0.7.0
pandas-gbq==0.4.1
pandas-profiling==1.4.1
pandocfilters==1.4.2
parso==0.3.4
pathlib==1.0.1
patsy==0.5.1
pbr==5.1.3
pexpect==4.6.0
pickleshare==0.7.5
Pillow==4.1.1
pip-tools==3.4.0
plac==0.9.6
plotly==3.6.1
pluggy==0.7.1
portpicker==1.2.0
prefetch-generator==1.0.1
preshed==2.0.1
pretty-midi==0.2.8
prettytable==0.7.2
progressbar2==3.38.0
prometheus-client==0.6.0
promise==2.2.1
prompt-toolkit==1.0.15
protobuf==3.7.0
psutil==5.4.8
psycopg2==2.7.6.1
ptyprocess==0.6.0
py==1.8.0
pyasn1==0.4.5
pyasn1-modules==0.2.4
pycocotools==2.0.0
pycparser==2.19
pydot==1.3.0
pydot-ng==2.0.0
pydotplus==2.0.2
pyemd==0.5.1
pyglet==1.3.2
Pygments==2.1.3
pygobject==3.26.1
pymc3==3.6
pymongo==3.7.2
pymystem3==0.2.0
PyOpenGL==3.1.0
pyparsing==2.3.1
pyrsistent==0.14.11
pysndfile==1.3.2
PySocks==1.6.8
pystache==0.5.4
pystan==2.18.1.0
pytest==3.6.4
python-apt==1.6.3+ubuntu1
python-chess==0.23.11
python-dateutil==2.5.3
python-louvain==0.13
python-rtmidi==1.2.1
python-slugify==3.0.0
python-utils==2.3.0
pytz==2018.9
PyWavelets==1.0.2
PyYAML==3.13
pyzmq==17.0.0
qtconsole==4.4.3
regex==2018.1.10
requests==2.18.4
requests-oauthlib==1.2.0
resampy==0.2.1
retrying==1.3.3
rpy2==2.9.5
rsa==4.0
s3fs==0.2.0
s3transfer==0.2.0
scikit-image==0.13.1
scikit-learn==0.20.3
scipy==1.1.0
screen-resolution-extra==0.0.0
scs==2.1.0
seaborn==0.7.1
Send2Trash==1.5.0
setuptools-git==1.2
Shapely==1.6.4.post2
simplegeneric==0.8.1
six==1.11.0
sklearn==0.0
smart-open==1.8.0
snowballstemmer==1.2.1
sortedcontainers==2.1.0
spacy==2.0.18
Sphinx==1.8.5
sphinxcontrib-websupport==1.1.0
SQLAlchemy==1.3.1
sqlparse==0.3.0
stable-baselines==2.2.1
statsmodels==0.8.0
sympy==1.1.1
tables==3.4.4
tabulate==0.8.3
tblib==1.3.2
tensor2tensor==1.11.0
tensorboard==1.13.1
tensorboardcolab==0.0.22
tensorflow==1.13.1
tensorflow-estimator==1.13.0
tensorflow-hub==0.3.0
tensorflow-metadata==0.13.0
tensorflow-probability==0.6.0
termcolor==1.1.0
terminado==0.8.1
testpath==0.4.2
text-unidecode==1.2
textblob==0.15.3
textgenrnn==1.4.1
tfds-nightly==1.0.1.dev201903180105
tflearn==0.3.2
Theano==1.0.4
thinc==6.12.1
toolz==0.9.0
torch==1.0.1.post2
torchsummary==1.5.1
torchtext==0.3.1
torchvision==0.2.2.post3
tornado==4.5.3
tqdm==4.28.1
traitlets==4.3.2
tweepy==3.6.0
typing==3.6.6
tzlocal==1.5.1
ujson==1.35
umap-learn==0.3.7
uritemplate==3.0.0
urllib3==1.22
vega-datasets==0.7.0
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.14.1
widgetsnbextension==3.4.2
wordcloud==1.5.0
wrapt==1.10.11
xarray==0.11.3

You can also use pkg_resources to get the list
from pkg_resources import working_set
libs = [x.project_name+' '+x.version for x in working_set]

For now (Mar 2022), the libs are:
['absl-py 1.0.0',
 'alabaster 0.7.12',
 'albumentations 0.1.12',
 'altair 4.2.0',
 'appdirs 1.4.4',
 'argon2-cffi 21.3.0',
 'argon2-cffi-bindings 21.2.0',
 'arviz 0.11.4',
 'astor 0.8.1',
 'astropy 4.3.1',
 'astunparse 1.6.3',
 'atari-py 0.2.9',
 'atomicwrites 1.4.0',
 'attrs 21.4.0',
 'audioread 2.1.9',
 'autograd 1.3',
 'Babel 2.9.1',
 'backcall 0.2.0',
 'beautifulsoup4 4.6.3',
 'bleach 4.1.0',
 'blis 0.4.1',
 'bokeh 2.3.3',
 'Bottleneck 1.3.4',
 'branca 0.4.2',
 'bs4 0.0.1',
 'CacheControl 0.12.10',
 'cached-property 1.5.2',
 'cachetools 4.2.4',
 'catalogue 1.0.0',
 'certifi 2021.10.8',
 'cffi 1.15.0',
 'cftime 1.6.0',
 'chardet 3.0.4',
 'charset-normalizer 2.0.12',
 'click 7.1.2',
 'cloudpickle 1.3.0',
 'cmake 3.12.0',
 'cmdstanpy 0.9.5',
 'colorcet 3.0.0',
 'colorlover 0.3.0',
 'community 1.0.0b1',
 'contextlib2 0.5.5',
 'convertdate 2.4.0',
 'coverage 3.7.1',
 'coveralls 0.5',
 'crcmod 1.7',
 'cufflinks 0.17.3',
 'cvxopt 1.2.7',
 'cvxpy 1.0.31',
 'cycler 0.11.0',
 'cymem 2.0.6',
 'Cython 0.29.28',
 'daft 0.0.4',
 'dask 2.12.0',
 'datascience 0.10.6',
 'debugpy 1.0.0',
 'decorator 4.4.2',
 'defusedxml 0.7.1',
 'descartes 1.1.0',
 'dill 0.3.4',
 'distributed 1.25.3',
 'dlib 19.18.0',
 'dm-tree 0.1.6',
 'docopt 0.6.2',
 'docutils 0.17.1',
 'dopamine-rl 1.0.5',
 'earthengine-api 0.1.301',
 'easydict 1.9',
 'ecos 2.0.10',
 'editdistance 0.5.3',
 'en-core-web-sm 2.2.5',
 'entrypoints 0.4',
 'ephem 4.1.3',
 'et-xmlfile 1.1.0',
 'fa2 0.3.5',
 'fastai 1.0.61',
 'fastdtw 0.3.4',
 'fastprogress 1.0.2',
 'fastrlock 0.8',
 'fbprophet 0.7.1',
 'feather-format 0.4.1',
 'filelock 3.6.0',
 'firebase-admin 4.4.0',
 'fix-yahoo-finance 0.0.22',
 'Flask 1.1.4',
 'flatbuffers 2.0',
 'folium 0.8.3',
 'future 0.16.0',
 'gast 0.5.3',
 'GDAL 2.2.2',
 'gdown 4.2.2',
 'gensim 3.6.0',
 'geographiclib 1.52',
 'geopy 1.17.0',
 'gin-config 0.5.0',
 'glob2 0.7',
 'google 2.0.3',
 'google-api-core 1.26.3',
 'google-api-python-client 1.12.10',
 'google-auth 1.35.0',
 'google-auth-httplib2 0.0.4',
 'google-auth-oauthlib 0.4.6',
 'google-cloud-bigquery 1.21.0',
 'google-cloud-bigquery-storage 1.1.0',
 'google-cloud-core 1.0.3',
 'google-cloud-datastore 1.8.0',
 'google-cloud-firestore 1.7.0',
 'google-cloud-language 1.2.0',
 'google-cloud-storage 1.18.1',
 'google-cloud-translate 1.5.0',
 'google-colab 1.0.0',
 'google-pasta 0.2.0',
 'google-resumable-media 0.4.1',
 'googleapis-common-protos 1.55.0',
 'googledrivedownloader 0.4',
 'graphviz 0.10.1',
 'greenlet 1.1.2',
 'grpcio 1.44.0',
 'gspread 3.4.2',
 'gspread-dataframe 3.0.8',
 'gym 0.17.3',
 'h5py 3.1.0',
 'HeapDict 1.0.1',
 'hijri-converter 2.2.3',
 'holidays 0.10.5.2',
 'holoviews 1.14.8',
 'html5lib 1.0.1',
 'httpimport 0.5.18',
 'httplib2 0.17.4',
 'httplib2shim 0.0.3',
 'humanize 0.5.1',
 'hyperopt 0.1.2',
 'ideep4py 2.0.0.post3',
 'idna 2.10',
 'imageio 2.4.1',
 'imagesize 1.3.0',
 'imbalanced-learn 0.8.1',
 'imblearn 0.0',
 'imgaug 0.2.9',
 'importlib-metadata 4.11.2',
 'importlib-resources 5.4.0',
 'imutils 0.5.4',
 'inflect 2.1.0',
 'iniconfig 1.1.1',
 'intel-openmp 2022.0.2',
 'intervaltree 2.1.0',
 'ipykernel 4.10.1',
 'ipython 5.5.0',
 'ipython-genutils 0.2.0',
 'ipython-sql 0.3.9',
 'ipywidgets 7.6.5',
 'itsdangerous 1.1.0',
 'jax 0.3.1',
 'jaxlib 0.3.0+cuda11.cudnn805',
 'jedi 0.18.1',
 'jieba 0.42.1',
 'Jinja2 2.11.3',
 'joblib 1.1.0',
 'jpeg4py 0.1.4',
 'jsonschema 4.3.3',
 'jupyter 1.0.0',
 'jupyter-client 5.3.5',
 'jupyter-console 5.2.0',
 'jupyter-core 4.9.2',
 'jupyterlab-pygments 0.1.2',
 'jupyterlab-widgets 1.0.2',
 'kaggle 1.5.12',
 'kapre 0.3.7',
 'keras 2.8.0',
 'Keras-Preprocessing 1.1.2',
 'keras-vis 0.4.1',
 'kiwisolver 1.3.2',
 'korean-lunar-calendar 0.2.1',
 'libclang 13.0.0',
 'librosa 0.8.1',
 'lightgbm 2.2.3',
 'llvmlite 0.34.0',
 'lmdb 0.99',
 'LunarCalendar 0.0.9',
 'lxml 4.2.6',
 'Markdown 3.3.6',
 'MarkupSafe 2.0.1',
 'matplotlib 3.2.2',
 'matplotlib-inline 0.1.3',
 'matplotlib-venn 0.11.6',
 'missingno 0.5.1',
 'mistune 0.8.4',
 'mizani 0.6.0',
 'mkl 2019.0',
 'mlxtend 0.14.0',
 'more-itertools 8.12.0',
 'moviepy 0.2.3.5',
 'mpmath 1.2.1',
 'msgpack 1.0.3',
 'multiprocess 0.70.12.2',
 'multitasking 0.0.10',
 'murmurhash 1.0.6',
 'music21 5.5.0',
 'natsort 5.5.0',
 'nbclient 0.5.12',
 'nbconvert 5.6.1',
 'nbformat 5.1.3',
 'nest-asyncio 1.5.4',
 'netCDF4 1.5.8',
 'networkx 2.6.3',
 'nibabel 3.0.2',
 'nltk 3.2.5',
 'notebook 5.3.1',
 'numba 0.51.2',
 'numexpr 2.8.1',
 'numpy 1.21.5',
 'nvidia-ml-py3 7.352.0',
 'oauth2client 4.1.3',
 'oauthlib 3.2.0',
 'okgrade 0.4.3',
 'opencv-contrib-python 4.1.2.30',
 'opencv-python 4.1.2.30',
 'openpyxl 3.0.9',
 'opt-einsum 3.3.0',
 'osqp 0.6.2.post0',
 'packaging 21.3',
 'palettable 3.3.0',
 'pandas 1.3.5',
 'pandas-datareader 0.9.0',
 'pandas-gbq 0.13.3',
 'pandas-profiling 1.4.1',
 'pandocfilters 1.5.0',
 'panel 0.12.1',
 'param 1.12.0',
 'parso 0.8.3',
 'pathlib 1.0.1',
 'patsy 0.5.2',
 'pep517 0.12.0',
 'pexpect 4.8.0',
 'pickleshare 0.7.5',
 'Pillow 7.1.2',
 'pip 21.1.3',
 'pip-tools 6.2.0',
 'plac 1.1.3',
 'plotly 5.5.0',
 'plotnine 0.6.0',
 'pluggy 0.7.1',
 'pooch 1.6.0',
 'portpicker 1.3.9',
 'prefetch-generator 1.0.1',
 'preshed 3.0.6',
 'prettytable 3.2.0',
 'progressbar2 3.38.0',
 'prometheus-client 0.13.1',
 'promise 2.3',
 'prompt-toolkit 1.0.18',
 'protobuf 3.17.3',
 'psutil 5.4.8',
 'psycopg2 2.7.6.1',
 'ptyprocess 0.7.0',
 'py 1.11.0',
 'pyarrow 6.0.1',
 'pyasn1 0.4.8',
 'pyasn1-modules 0.2.8',
 'pycocotools 2.0.4',
 'pycparser 2.21',
 'pyct 0.4.8',
 'pydata-google-auth 1.3.0',
 'pydot 1.3.0',
 'pydot-ng 2.0.0',
 'pydotplus 2.0.2',
 'PyDrive 1.3.1',
 'pyemd 0.5.1',
 'pyerfa 2.0.0.1',
 'pyglet 1.5.0',
 'Pygments 2.6.1',
 'pygobject 3.26.1',
 'pymc3 3.11.4',
 'PyMeeus 0.5.11',
 'pymongo 4.0.2',
 'pymystem3 0.2.0',
 'PyOpenGL 3.1.6',
 'pyparsing 3.0.7',
 'pyrsistent 0.18.1',
 'pysndfile 1.3.8',
 'PySocks 1.7.1',
 'pystan 2.19.1.1',
 'pytest 3.6.4',
 'python-apt 0.0.0',
 'python-chess 0.23.11',
 'python-dateutil 2.8.2',
 'python-louvain 0.16',
 'python-slugify 6.1.1',
 'python-utils 3.1.0',
 'pytz 2018.9',
 'pyviz-comms 2.1.0',
 'PyWavelets 1.2.0',
 'PyYAML 3.13',
 'pyzmq 22.3.0',
 'qdldl 0.1.5.post0',
 'qtconsole 5.2.2',
 'QtPy 2.0.1',
 'regex 2019.12.20',
 'requests 2.23.0',
 'requests-oauthlib 1.3.1',
 'resampy 0.2.2',
 'rpy2 3.4.5',
 'rsa 4.8',
 'scikit-image 0.18.3',
 'scikit-learn 1.0.2',
 'scipy 1.4.1',
 'screen-resolution-extra 0.0.0',
 'scs 3.2.0',
 'seaborn 0.11.2',
 'semver 2.13.0',
 'Send2Trash 1.8.0',
 'setuptools 57.4.0',
 'setuptools-git 1.2',
 'Shapely 1.8.1.post1',
 'simplegeneric 0.8.1',
 'six 1.15.0',
 'sklearn 0.0',
 'sklearn-pandas 1.8.0',
 'smart-open 5.2.1',
 'snowballstemmer 2.2.0',
 'sortedcontainers 2.4.0',
 'SoundFile 0.10.3.post1',
 'spacy 2.2.4',
 'Sphinx 1.8.6',
 'sphinxcontrib-serializinghtml 1.1.5',
 'sphinxcontrib-websupport 1.2.4',
 'SQLAlchemy 1.4.32',
 'sqlparse 0.4.2',
 'srsly 1.0.5',
 'statsmodels 0.10.2',
 'sympy 1.7.1',
 'tables 3.7.0',
 'tabulate 0.8.9',
 'tblib 1.7.0',
 'tenacity 8.0.1',
 'tensorboard 2.8.0',
 'tensorboard-data-server 0.6.1',
 'tensorboard-plugin-wit 1.8.1',
 'tensorflow 2.8.0',
 'tensorflow-datasets 4.0.1',
 'tensorflow-estimator 2.8.0',
 'tensorflow-gcs-config 2.8.0',
 'tensorflow-hub 0.12.0',
 'tensorflow-io-gcs-filesystem 0.24.0',
 'tensorflow-metadata 1.7.0',
 'tensorflow-probability 0.16.0',
 'termcolor 1.1.0',
 'terminado 0.13.3',
 'testpath 0.6.0',
 'text-unidecode 1.3',
 'textblob 0.15.3',
 'Theano-PyMC 1.1.2',
 'thinc 7.4.0',
 'threadpoolctl 3.1.0',
 'tifffile 2021.11.2',
 'tomli 2.0.1',
 'toolz 0.11.2',
 'torch 1.10.0+cu111',
 'torchaudio 0.10.0+cu111',
 'torchsummary 1.5.1',
 'torchtext 0.11.0',
 'torchvision 0.11.1+cu111',
 'tornado 5.1.1',
 'tqdm 4.63.0',
 'traitlets 5.1.1',
 'tweepy 3.10.0',
 'typeguard 2.7.1',
 'typing-extensions 3.10.0.2',
 'tzlocal 1.5.1',
 'uritemplate 3.0.1',
 'urllib3 1.24.3',
 'vega-datasets 0.9.0',
 'wasabi 0.9.0',
 'wcwidth 0.2.5',
 'webencodings 0.5.1',
 'Werkzeug 1.0.1',
 'wheel 0.37.1',
 'widgetsnbextension 3.5.2',
 'wordcloud 1.5.0',
 'wrapt 1.13.3',
 'xarray 0.18.2',
 'xgboost 0.90',
 'xkit 0.0.0',
 'xlrd 1.1.0',
 'xlwt 1.3.0',
 'yellowbrick 1.4',
 'zict 2.1.0',
 'zipp 3.7.0']


text:
Q: Can't get JavaScript Array to work in OOP style Hi currently I'm trying to get following snippet of code to work:
function Entry() {
    var pauses = new Array();
}

Entry.prototype = {
   AddElement: function(aParameter) {
      this.pauses.push(aParameter);
   }
}

Unfortunately this code fails with following error in Safari if I try to call AddElement("Test");
TypeError: Result of expression 'this.pauses' [undefined] is not an object. Does anybody know why?

A: In your code, pauses is a local variable within the Entry() function, not a member on the object constructed by it.
You want to replace var pauses = ... with this.pauses = ....

A: change
var pauses = new Array();

to
this.pauses = new Array();

or, better
this.pauses = [];


text:
Q: Scope issue in Access VBA Dictionary? I'm having a strange problem. I'm new to Access and VBA, so it may be a stupid mistake.
Private backColorCycle As Integer
Private doneRows As New Dictionary

Private Sub AlternateGroupColor()
    If Not doneRows.Exists(Me.JCH_Shape) Then
        '... some stuff that assigns a value to backColorCycle
    Else
        '... some stuff that assigns a value to backColorCycle
    End If

    doneRows.Item(Me.JCH_Shape) = backColorCycle

    Detail.BackColor = QBColor(doneRows.Item(Me.JCH_Shape))
    GroupHeader0.BackColor = QBColor(doneRows.Item(Me.JCH_Shape))
End Sub

AlternateGroupColor() is an event handler that is called repeatedly (by the OnFormat event in Access). Me.JCH_Shape, a string, cycles through a set of values twice: it might be A, B, C, A, B, C as the function is called, so I want to know when a value has been encountered already. I hoped to determine this by storing the value in doneRows and checking to see if the value already exists. However, even though I've checked that Me.JCH_Shape does indeed have different values and doneRows.Item(Me.JCH_Shape) does return the value I expect at the end of the function, doneRows.Count is never greater than 1. It seems as if the changes I make to the dictionary in the sub are reset every time it is called, and I'm not sure why. It feels like a scope problem, but I can't understand why this would happen to a variable that is a member of the class and not just the function.
Any help would be appreciated. Thanks.

A: A Dictionary allows objects to serve as its key. Me.JCH_Shape is an object on your report, so when you do
doneRows.Item(Me.JCH_Shape) = backColorCycle

you are repeatedly re-assigning the value to the Dictionary entry whose key is the Me.JCH_Shape object itself. If you want to store Dictionary items based on the current value of the Me.JCH_Shape object you need to use
doneRows.Item(Me.JCH_Shape.Value) = backColorCycle


text:
Q: how to remove multiple line text from one word to other word I'm scraping data off a web page into text file in that I want to remove some irrelevant content like

      L
      D
      D
      W
      D

I'm trying for output as

 removing other data.
I tried
source = regax.replace(source,
.*
 ","

 ")

but it didn't work. Can anyone point me in the right direction?

A: Use the HTML Agilty Pack - It is an open source HTML parser for .NET.
What is exactly the Html Agility Pack (HAP)?

This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allows you to parse "out of the web" HTML files. The parser is very tolerant with "real world" malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).

You can use this to query HTML and extract whatever data you wish.

If it is ultimately required to extract the text based on Regex patterns as per your requirement, you can do it this way:
Regex regex = new Regex("
(?<Junk>.*)
",
    RegexOptions.None | RegexOptions.Singleline);
var extractedString = regex.Replace(htmlString, "${Junk}");

A: The following will search for all

 string file = "TheEntireFileIsInThisBuffer";
 string pattern = "<div.*
";
 RegEx rgx = new RegEx(pattern);
 string fileWithOutDivs = rgx.Replace(file, System.String.Empty);


text:
Q: How do I get the index of each record displayed on crystal reports? I'm developing winform application using vb.net. I use crystal report in my application. Now i need to store the index of each record that is displaying in current report into database. Then i create another report which displays the index of all the records. My plan is to read the page number of each record and save them on database. I have a group field in the report. I don't know how to scan one by one record and get appropriate page number. I tried the following code to get the field value but did not work.
msgbox(rpt.DataDefinition.FormulaFields("name").Text)

It displayed the formula of that field.
I don't know in which order the records fetched using following.
msgbox(rpt.rows(0).item(0))

Please Help me out....

A: The way your question reads, it sounds like you're trying to generate an "index" for the order records appear in a report and store that index in a database for use in another report.  I am not clear at all what you're trying to do with the page number.
In any case, I need to make something clear: the definition of the report (which you're accessing in your code sample) only represents where data will go when the report is formatted - it is not the actual data itself.
At the most basic level, Crystal Reports takes data out of a database and formats it nicely for you on pages. Rather than trying to take data out of a database, put it into a report, then try to read that report to put it back in a database to make another report, why not just do all your data manipulation at the database level itself before going to a report in the first place?
If you really must have that first report, the easiest option you'll have for getting at the formatted data is to export it to excel and access it programmatically through an Excel API - Crystal Reports doesn't have an API for getting at your formatted data (including things like generated page numbers, whatever you're trying to do with them).

A: You are trying to break few basic rules. For example a report should never change the data. The right way is to handle data processing in a stored procedure or command and to call the report in  a separate process. In such way you will be able to control the data change and data visualization separately.
P.S. You probably mean "Identifier" not "Index"


text:
Q: How to bind base64 image from database into multi-channel apps? I have base64 string image in my database table. I want to load the image from database into my multi-channel app. How do i bind them, direct call the string from database? Thanks a lot.
For now i have this code.
HTML

JS
KioskAppV2.tb_proj_gallery = function(params) {
"use strict";

var shouldReload = false,
    dataSource;

function handletb_proj_galleryModification() {
    shouldReload = true;
}

function handleViewShown() {
    if(shouldReload) {
        shouldReload = false;
        dataSource.load();
    }
}

dataSource = new DevExpress.data.DataSource({
    store: KioskAppV2.db.tb_proj_gallery,
    map: function(item) {
        return new KioskAppV2.tb_proj_galleryViewModel(item);
    }
});

return {
    dataSource: dataSource,
    viewShown: handleViewShown
};

};
The file_name is the column name in tb_proj_gallery table where the image base64 string is save. This code return gallery view with same number of image in the table but the image didnt appear. Its broken. How to make it appear? TQ.

A: use attr binding to bind base64 string image.
//image is observable containing base64 string

Viewmodel:-
var base64string = "//your base64 string";

var Vm = {
   image: ko.observable(base64string)
};
ko.applyBindings(Vm);

Fiddle Demo


text:
Q: URL Amigável com mais de um parâmetro com .htaccess php estou tendo problemas com minha url amigável, tenho um código que já funciona, porém para um diretório especifico.
.htaccess
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$  index.php?url=$1

index.php
$url = (isset($_GET['url'])) ? $_GET['url'] : 'mdjr_home';

$arq_perm = array('mdjr_home','mdjr_contatos','mdjr_orcamento',
    'mdjr_portifolio','mdjr_quem_somos','mdjr_videos','mdjr_teste');

$pasta = "producoes/page_mdjr/pages_menu";

if (substr_count($url,'/') == 0)
{
    $url = explode('/',$url);
    $page = (file_exists("{$pasta}/".$url[0].'.php') && in_array($url[0],$arq_perm)) ? $url[0] : "404";
    $id = intval(isset($url[1]));

}elseif(substr_count($url,'/') == 0)
{
    $page = (file_exists("{$pasta}/".$url.'.php') && in_array($url[1],$arq_perm)) ? $url : "404";
    $id = 0;

    // echo $page;
}

require ("{$pasta}/{$page}.php");

Só adicionado isso ao meu menu .php e minha url amigável do menu funciona,, porém no meu home que é a page principal tenho alguns cards ele me gera essas urls:
mdjr/producoes/controller/controller.php?card=0
mdjr/producoes/controller/controller.php?card=1
mdjr/producoes/controller/controller.php?card=2
mdjr/producoes/controller/controller.php?card=3
mdjr/producoes/controller/controller.php?card=4

pois ao clicar ele abre o link da pagina
mdjr/producoes/controller/controller.php

onde digo o que será exibido em cada coisa,
    porém não sei o que fazer para tanto o código php no meu index.php como o do meu .htaccess funcione ate incluí alguns desses códigos no .htaccess mas não deu certo. tentei adicionar :
RewriteRule ^(.*)\/?(.*)\/?$ index.php?url=$1&card=$2
RewriteRule ^producoes/controller/([a-z0-9-]+)/([0-9]+)/?$/controller.php?url=$2&card=$1 [NC]

RewriteRule ^producoes/controller/.*?$ controller.php?card=$1

Junto com o já existente mas nada funciona, retorna sempre a pagina de erro, sem isso a pagina é aberta normalmente e funciona, mas ao adicionar esses códigos dão erro.

A: Baseado no seu comentário, você gostaria de montar a url na seguinte estrutura: dominio/mdjr/controller/(id ou não), correto? E essa url apontaria pra controller.php.
Poderia usar isso no .htaccess:
RewriteEngine On

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^mdjr/controller\/?$ controller.php?card=0 [NC,QSA]
RewriteRule ^mdjr/controller/([A-Za-z0-9-]+)\/?$ controller.php?card=$1 [NC,QSA]

controller.php
$card = $_GET['card']

Porém, vi que em seu código existe um array com nomes de alguma coisa. Vai me informando melhor pra ir atualizando a resposta caso não seja somente isso.


text:
Q: Omega limit set is invariant In the ODE where $y'=f(y(t))$ and $y(0)=y_0$.
The omega limit set $\omega(y_0)$ is positively invariant and also negatively invariant.
I want to prove first that its positively invariant and then prove its negatively invariant.
But how do I show that using a flow function $(\phi(y,t)$) given that I know only the definition and the identity of flow function and very little understanding of the concept of flow function.
Thankyou for the help!

A: Consider the system
$$
\dot x=f(x),\quad x\in U\subset\mathbf{R}^k,\,f\colon U\to\mathbf R^k,
$$
with the solution
$$
x=x(t;x_0).
$$
By definition point $\bar x$ belongs to omega limit set is there exists a sequence $\{t_n\}$ such that $x(t_n;x_0)\to \bar x$ when $n\to\infty,\,t_n\to\infty$. This means that for any fixed $t$ one has (using the properties of the flow)
$$
x(t_n+t;x_0)=x(t;x(t_n;x_0))\to x(t;\bar x),
$$
which means that if $\bar x$ belongs to omega limit set then the whole orbit containing this point belongs to this set, and since the orbits are invariant this implies that omega limit set is both positive and negative invariant.


text:
Q: How to prove symmetric matrices are orthogonally diagonalizable. I'm trying to prove symmetric matrices are orthogonally diagonalizable but I can't go anywhere. In a textbook, a proof is proceed by two steps.
First assume A is n by n symmetric matrix and it has k geometric multiplicity of $\lambda_0$ .
And let $B_0=\{u_1, ... , u_k\}$ be basis for eigenspace corresponding to $\lambda_0$ and extend $B=\{u_1, ... , u_n\}$ for $R^n$.
Then $AB=B[\lambda I_k \quad X;\; 0 \quad Y ]$. I have understood until here but the textbook said X is zero matrix of $ n\times(n-k)$ which I couldn't go any further.
Second the textbook said considering characteristic
polynomial of $C= [\lambda I_k \quad 0;\; 0 \quad Y ]$ which is similar to A , the algebraic multiplicity of λ0 is the same as the geometric
multiplicity of λ0. But characteristic
polynomial of C is $(\lambda-\lambda_0)^kdet(Y)$ so don't we have to say that the algebraic
multiplicity of λ0 is greater than or equal to the geometric
multiplicity k? I couldn't understand why  the algebraic multiplicity and the geometric
multiplicity of λ0 are same.
Thank you for reading this.

A: If I got your question right, You want to find an orthogonal matrix $X$ such that $X^TAX$ is diagonal. If $\mathbf v_i$ is the i-th eigenvector of $A_{N \times N}$, then
$$
A \mathbf v_i = \lambda_i \mathbf v_i
$$
And we define $V$ as $V = [\mathbf v_1 , ... , \mathbf v_N]^T$ so we could say:
$$
V^TAV = \langle \mathbf v_i,\mathbf v_j\rangle
$$
Hence  $X=V$ and $V^TAV$ is diagonal matrix.


text:
Q: Uncaught TypeError: Cannot call method 'addEventListener' of undefined can't figure out where is the error in this code. Chrome debug console keep saying "Uncaught TypeError: Cannot call method 'addEventListener' of undefined" at line 31!
jewel.dom = (function() {

    var $ = Sizzle;

    function hasClass(el, clsName){

        var regex = new RegExp("(^|\\s) + clsName + (\\s|$)");
        return regex.test(el.className);
    }

    function addClass(el, clsName) {

        if (!hasClass(el,clsName)) {
            el.className += ""+ clsName;
        }
    }

    function removeClass (el, clsName) {

        var regex = new RegExp("(^|\\s)" + clsName + "(\\s|$)");
        el.className = el.className.replace(regex, " ");
    }

    function bind(element, event, handler) {

        if (typeof element == "string") {
            element = $(element)[0];
        }

        element.addEventListener(event, handler, false)
}

    return {
        $:$,
        hasClass : hasClass,
        addClass : addClass,
        removeClass : removeClass,
        bind : bind
    };
;}) ();

A: In my case, this is caused by Evernote Clipper extension script. You will find "Evernote" in comment when you click to that script who throws out the error.

A: Could it be the case that your bind invocation ends up with an undefined element? (e.g. you pass a selector that does not match any of the elements in your DOM)

A: some browsers don't know what "addEventListener" is. Try this:
Element.prototype.setEvent = function(eventName, handler)
{
    if(document.addEventListener)
    {
        this.addEventListener(eventName, handler);
    }
    else
    {
        if(document.attachEvent)
        {
            this.attachEvent("on" + eventName, handler);
        }
    }
}
element.setEvent(eventName, handler);

The same goes for removeEventListener.
Also, try to replace
 element = $(element)[0];

with
 element = $("#" + element);

provided that string contains the id of the element, or
 element = $("." + element)[0];

if the string contains the className of the element.


text:
Q: Getting java.net.UnknownHostException: hostname: Name or service not known while using spring-data-redis-starter I am trying to connect to Redis in cluster mode by using spring-boot-starter-data-redis and lettuce library and getting below exception,
        2019-08-21 00:55:42.695  WARN 75 --- [ioEventLoop-6-1] i.l.c.c.topology.ClusterTopologyRefresh  : Unable to connect to myhostname.service:6379

java.util.concurrent.CompletionException: java.net.UnknownHostException: myhostname.service: Name or service not known
    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292) ~[na:1.8.0_181]
    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308) ~[na:1.8.0_181]
    at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:593) ~[na:1.8.0_181]
    at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577) ~[na:1.8.0_181]
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) ~[na:1.8.0_181]
    at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977) ~[na:1.8.0_181]
    at io.lettuce.core.AbstractRedisClient.lambda$initializeChannelAsync$1(AbstractRedisClient.java:275) ~[lettuce-core-5.0.4.RELEASE.jar!/:na]
    at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.DefaultPromise.setFailure(DefaultPromise.java:112) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.channel.DefaultChannelPromise.setFailure(DefaultChannelPromise.java:89) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:216) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:49) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:188) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:174) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:103) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:978) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:512) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:423) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:482) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:465) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_181]
Caused by: java.net.UnknownHostException: master1.event-store-service-V-70125f6-2-1566348843-redis.service: Name or service not known
    at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_181]
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[na:1.8.0_181]
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[na:1.8.0_181]
    at java.net.InetAddress.getAllByName0(InetAddress.java:1276) ~[na:1.8.0_181]
    at java.net.InetAddress.getAllByName(InetAddress.java:1192) ~[na:1.8.0_181]
    at java.net.InetAddress.getAllByName(InetAddress.java:1126) ~[na:1.8.0_181]
    at java.net.InetAddress.getByName(InetAddress.java:1076) ~[na:1.8.0_181]
    at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:146) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.util.internal.SocketUtils$8.run(SocketUtils.java:143) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_181]
    at io.netty.util.internal.SocketUtils.addressByName(SocketUtils.java:143) ~[netty-common-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.resolver.DefaultNameResolver.doResolve(DefaultNameResolver.java:43) ~[netty-resolver-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:63) ~[netty-resolver-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:55) ~[netty-resolver-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:57) ~[netty-resolver-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:32) ~[netty-resolver-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.resolver.AbstractAddressResolver.resolve(AbstractAddressResolver.java:108) ~[netty-resolver-4.1.25.Final.jar!/:4.1.25.Final]
    at io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:208) ~[netty-transport-4.1.25.Final.jar!/:4.1.25.Final]
    ... 18 common frames omitted

Note: "myhostname.service" is due to I am using consul and I can ping myhostname.service also can connect to it using "redis-cli -c -h myhostname.service -p 6379" command.
My code to connect to redis is,
@Configuration
@ConfigurationProperties(prefix = "redis")
public class LettuceCacheConfig {

    private static Logger logger = LoggerFactory.getLogger(LettuceCacheConfig.class);
    private static Long topologyRefreshDuration = 10L;
    private static int maxRedirects = 3;

    private String servers;
    private String profileName;
    private String password;

    private PoolConfig poolConfig = new PoolConfig();

    class PoolConfig {
        int maxTotal;
        int maxIdle;
        int minIdle;

        public PoolConfig() {
        }
    }

    public LettuceClientConfiguration getLettuceClientConfig() {
        final ClusterTopologyRefreshOptions options = ClusterTopologyRefreshOptions.builder()
                .enablePeriodicRefresh(Duration.of(topologyRefreshDuration, ChronoUnit.MINUTES))
                .enableAllAdaptiveRefreshTriggers().dynamicRefreshSources(true).build();

        final LettuceClientConfiguration lettuceClientConfig = LettuceClientConfiguration.builder()
                .clientOptions(ClusterClientOptions.builder().topologyRefreshOptions(options)
                        .validateClusterNodeMembership(false).build())
                .build();

        return lettuceClientConfig;
    }

    private GenericObjectPoolConfig getPoolingConfiguration() {
        final GenericObjectPoolConfig config = new GenericObjectPoolConfig();
        config.setMaxIdle(this.poolConfig.getMaxIdle());
        config.setMaxTotal(this.poolConfig.getMaxTotal());
        config.setMinIdle(this.poolConfig.getMinIdle());
        return config;
    }

    public RedisClusterConfiguration getClusterConfiguration() {
        final RedisClusterConfiguration clusterConfiguration = new RedisClusterConfiguration();//new RedisClusterConfiguration(getRedisServers());
        String hostPort = getRedisServers().get(0);
        String tokens[] = hostPort.split(":");
        logger.info("REDIS HOST IS {}", tokens[0]);
        logger.info("REDIS PORT IS {}", tokens[1]);
        clusterConfiguration.clusterNode(tokens[0], Integer.parseInt(tokens[1]));
        clusterConfiguration.setMaxRedirects(maxRedirects);
        logger.info("PASSWORD is {}",password);
        clusterConfiguration.setPassword(RedisPassword.of(password));
        return clusterConfiguration;
    }

    private List<String> getRedisServers() {
        String tokens[] = servers.split(",");
        logger.debug("Redis Servers are {}", Arrays.toString(tokens));
        return Arrays.asList(tokens);
    }

    @Bean
    public RedisConnectionFactory getLettuceConnectionFactory() {
        return new LettuceConnectionFactory(getClusterConfiguration(),
         getLettuceClientConfig());
    }

}

Since I was getting exception at java.net.InetAddress.getByName("hostname") I tried,

*

*running a redis-cli from my app container to connect to redis cluster containers it was successful.(as mentioned above.)

*Since I was getting exception at java.net.InetAddress.getByName("hostname") I tried same method from inside of my app container using my redis hostname. It was successful and did not throw UnknownHostException.

*Pinging to the redis host from app container works.

*I did set up redis-cluster on local machine it works fine with above code only change was I provided 127.0.0.1:6379 instead of hostname.service:6379.
I am using spring-boot-starter-parent:2.0.3.RELEASE and lettuce-core:5.0.4. Is there any issue with the code?

A: I can not say this answers this question completely but got the reason for the issue. Issue is when app containers startup, redis containers/service is not still registered with the consul, so look up for redis containers with the lookup name say "master1.redis.service" returns UnknownHostException. But since I was running redis-cli and ping after a while there was no connection issue. I verified this by restarting app containers while keeping the Redis containers up and then there was no UnknownHostException. The reason unknow to me was if initially if there was UnknowHostException why ClusterTopologyRefreshOptions did not work? As per my thinking it should have looked up the hostname again after some duration and would have got the resolution/ip from the consul. But that did not happen


text:
Q: Boost converter design help I need help on a 12v-220v Boost converter design. the converter is to have a feedback system that keeps the output voltage steady even when the input voltage drops. I have done a lot of reading and designs using a NE555 as the control system but it seems all my calculations are wrong. I am able to get a 250v output but if I add a load to it the output voltage drops drastically. I'm really confused. I need to use it for an inverter project in an exhibition next month. So please I need help.
I will attach the screen shot of the simulation on proteus 8.

A:
I am able to get a 250v output but if I add a load to it the output
  voltage drops drastically.

A standard boost regulator circuit transfers energy each switching cycle. It isn't equivalent to a transformer and so loading effects change the output voltage considerably. For instance, during the period when the transistor is on, the inductor is effectively grounded and current rises linearly to some value. You have "charged" the inductor with energy: -
Energy = \$\dfrac{L.I^2}{2}\$
When the transistor opens, this energy has nowhere to go but through D1 to the output capacitor and load. If you store 0.1 mJ and then release it to the load/cap and you do this 100,000 times per second, you are actually forcing a power of 10 watts to the output. Clearly if there is no load current, the output voltage keeps rising (due to charging the cap) and after a short period of time you get smoke.
To turn this system into a voltage regulator requires that the duty cycle be controlled by an error amplifier. In other words, to keep the output regulated on virtually an open circuit requires that the duty cycle is almost zero. As load current increases, the duty cycle MUST increase to maintain good voltage regulation.

A: No you can't build a 12v to 220v booster circuit like that because the voltage ratio for input to output is more than 18. at least not with the simple basic booster circuit that you are having there. Common power ratio for practical booster circuit is 2-3, which means, if you have 12v input, the maximum practical output voltage would be 12x3=36v; For your project, you really need a transformer circuit. Turn your 12vdc to 12vac using your 555 chip, then step-up the voltage using transformer.


text:
Q: Access object by reference What will be the output of following program? I am not aware of object assignment or references.
class ObjEx
{
    public static void main(String arg[])
    {
        ObjEx ob=new ObjEx();
        Object o = ob;

    if(o==ob)
        System.out.println("1");
    if(o!=ob)
        System.out.println("10");
    if(o.equals(ob))
        System.out.println("101");
    if(ob.equals(o))
        System.out.println("1101");

    }
}

Options: A)1    (B)10    (C)101     (D)1101
Please explain me that what will be output and how is it possible?
I am getting output on my screen as but I am not getting this program:
1
101
1101

A: Here if(o==ob) you are comparing references
and for the last 2 cases:
if(o.equals(ob))
if(ob.equals(o))

In java equals is an operation to compare the objects and this operation is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.


text:
Q: ActionView::Template::Error: undefined method `config' for # I wrote a full rails engine, and trying to test (with RSpec) my controller.
Error only occurred, when render method called. On return or redirect methods all works fine. And problem only with tests. I use dummy app.
stack:
  # Failure/Error: get(:search, params)
  ActionView::Template::Error:
      undefined method `config' for #<Rails::App:0x000000034d9ee8>
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.15/lib/rails.rb:78:in `root'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/template.rb:175:in `inspect'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/template.rb:334:in `identifier_method_name'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/template.rb:330:in `method_name'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/template.rb:267:in `compile'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/template.rb:244:in `block in compile!'
  # <internal:prelude>:10:in `synchronize'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/template.rb:232:in `compile!'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/template.rb:144:in `block in render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/notifications.rb:123:in `block in instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/notifications.rb:123:in `instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/template.rb:143:in `render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/notifications.rb:123:in `block in instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/notifications.rb:123:in `instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/renderer/template_renderer.rb:45:in `render_template'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/renderer/template_renderer.rb:18:in `render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/renderer/renderer.rb:36:in `render_template'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_view/renderer/renderer.rb:17:in `render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/abstract_controller/rendering.rb:110:in `_render_template'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/streaming.rb:225:in `_render_template'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/abstract_controller/rendering.rb:103:in `render_to_body'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/abstract_controller/rendering.rb:88:in `render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/rendering.rb:16:in `render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
  # /home/shooma/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/core_ext/benchmark.rb:5:in `ms'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.15/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/instrumentation.rb:39:in `render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/abstract_controller/base.rb:167:in `process_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/rendering.rb:10:in `process_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:403:in `_run__3295526729938120009__process_action__2756155078140629527__callbacks'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:405:in `__run_callback'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/callbacks.rb:81:in `run_callbacks'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/abstract_controller/callbacks.rb:17:in `process_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/rescue.rb:29:in `process_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/notifications.rb:123:in `block in instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.15/lib/active_support/notifications.rb:123:in `instrument'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.15/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/abstract_controller/base.rb:121:in `process'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/abstract_controller/rendering.rb:45:in `process'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/metal/testing.rb:17:in `process_with_new_base_test'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/test_case.rb:490:in `process'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/test_case.rb:54:in `process'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.2.15/lib/action_controller/test_case.rb:407:in `get'
  # ./spec/controllers/pretty_search_controller_spec.rb:37:in `block (5 levels) in <top (required)>'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example.rb:114:in `instance_eval'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example.rb:114:in `block in run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_exec'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_eval_with_args'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example.rb:247:in `instance_eval_with_args'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/hooks.rb:106:in `block (2 levels) in run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/hooks.rb:104:in `call'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/hooks.rb:104:in `run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/hooks.rb:446:in `run_hook'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:340:in `run_around_each_hooks'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example.rb:256:in `with_around_each_hooks'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example.rb:111:in `run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:390:in `block in run_examples'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:386:in `map'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:386:in `run_examples'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:371:in `run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:372:in `block in run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:372:in `map'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:372:in `run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:372:in `block in run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:372:in `map'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:372:in `run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:372:in `block in run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:372:in `map'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/example_group.rb:372:in `run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/command_line.rb:28:in `map'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/command_line.rb:28:in `block in run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/reporter.rb:58:in `report'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/command_line.rb:25:in `run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/runner.rb:80:in `run'
  # /home/shooma/.rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.14.6/lib/rspec/core/runner.rb:17:in `block in autorun'

In which direction i should dig?
engine on GitHub
UPD:
when in controller call render - I got error.
but if in controller call render :text => 'foo' - test passes.
problem somewhere in dummy application config. but i can't locate it.
UPD2:
falling spec:
  context 'action should return @options and @results' do
    it '@options should be an instance variable, which eq hash of three keys' do
      get(:search, params)
      # do something
    end
  end

controller:
def search
  # do something
  render
end

RESOLUTION:
It was my fault. Problem was in overloading some internal rails classes in test environment. Sorry for spent time, @sameera207, and thank you for participation.

A: the difference between render and redirect is, redirect loads your redirected action but render doesn't,
Ex:
  def new
    @user = User.new
  end

  def create
    if <some conditions>
       redirect_to 'new'
    else
       render 'new'
    end
  end

so when you call render, it doesnt create User.new, only redirect will. So probably you are rendering an action which loads something from config.
So the solutions would be
def new
        @user = User.new
      end

      def create
        if <some conditions>
           redirect_to 'new'
        else
           @user = User.new
           render 'new'
        end
      end

I hope u get the idea. and if you could post the spec someone might be able to help easier ..


text:
Q: Problems gen_tcp:accept I've made a tcp server witch spawns a process to listen incoming connections. Here is the sample code (removed a few things from my original code):
module a:
main([]) ->
    { ok, Pid } = b:start(),
    receive
            _ ->
                    ok
    end.

module b:
-define(TCP_OPTIONS, [binary, { active, false}, { packet, 0 } , {reuseaddr, true}]).

...

start_link(Port) ->
    Pid = spawn_link(server_listener, init, [ Port ]),
    { ok , self() }.

init(Port, Processor) ->
    case gen_tcp:listen(Port, ?TCP_OPTIONS) of
     { ok , LSocket } ->
           accept_loop(LSocket);
     { error, Reason } ->
        { stop, Reason }
     end.

accept_loop( LSocket) ->
  ?LOG("Current socket acceptor PID [~w]~n", [self()]),
  case gen_tcp:accept(LSocket) of
      { ok, Socket } ->
      %do stuff here
         spawn(server_listener , accept_loop, [ LSocket ]);
      { error, Reason }  ->
         ?LOG("Error accepting socket! [ ~s ]~n", [ Reason ])
  end.

The problem is: EVERY time that I try to connect from telnet on this port, I'm receiving an error { error, closed } on gen_tcp:accept. This is already driving me nuts trying to figure out what is happening.
Thanks,

A: Your "accept loop" isn't really a loop... and it is contrived.
You probably want "do_accept_loop" and a proper "server_loop" for handling a connection. Have a look at this.
You want something along the lines of:
% Call echo:listen(Port) to start the service.
listen(Port) ->
    {ok, LSocket} = gen_tcp:listen(Port, ?TCP_OPTIONS),
    accept(LSocket).

% Wait for incoming connections and spawn the echo loop when we get one.
accept(LSocket) ->
    {ok, Socket} = gen_tcp:accept(LSocket),
    spawn(fun() -> loop(Socket) end),
    accept(LSocket).

% Echo back whatever data we receive on Socket.
loop(Socket) ->
    case gen_tcp:recv(Socket, 0) of
        {ok, Data} ->
            gen_tcp:send(Socket, Data),
            loop(Socket);
        {error, closed} ->
            ok
    end.


text: Q: CAML query to show all pages in sharepoint with page link and contact I want to use a CAML query to get a report that will show me all the pages, their links and the contact for the page.  We have over 2000 pages and we're moving to modern sharepoint from the 2013.  I need this to help identify page owners and next steps.


text:
Q: Delete multiple files - Receive only one authentication prompt I'm trying to create a script to delete multiple files in the same folder without having to authenticate twice. I've tried a bunch of things but I'm super new to AppleScript and I keep striking out. Any assistance is greatly appreciated.
set colorProfiles to (POSIX file "/Library/ColorSync/Profiles")
set coatedToDelete to "Pantone+ Solid Coated.csv"
set uncoatedToDelete to "Pantone+ Solid Uncoated.csv"

try
    --Notification window with info
    display dialog ("This script will automagically delete your outdated Pantone color books. Please make sure an admin is nearby to authenticate (twice) if prompted.") with icon note

    --Deletes both Pantone+ .csv files
    tell application "Finder"
        delete file (coatedToDelete of folder colorProfiles)
        delete file (uncoatedToDelete of folder colorProfiles)

    end tell
    --Successful deletion notification
    display dialog ("The outdated color book deletion was successful!") buttons {"Great!"} with icon note

on error
    --Error message notification
    display dialog ("This script was unable to delete your legacy Pantone color books.") buttons {"OK"} with icon caution
end try

A: Use the shell command rm, it can delete multiple files in one line with one authentication. The difference to the Finder is that the files are deleted immediately instead of being moved to the trash folder.
set colorProfiles to "/Library/ColorSync/Profiles/"
set coatedToDelete to colorProfiles & "Pantone+ Solid Coated.csv"
set uncoatedToDelete to colorProfiles & "Pantone+ Solid Uncoated.csv"

try
  --Notification window with info
  display dialog ("This script will automagically delete your outdated Pantone color books. Please make sure an admin is nearby to authenticate (twice) if prompted.") with icon note

  --Deletes both Pantone+ .csv files
  do shell script "/bin/rm " & quoted form of coatedToDelete & space & quoted form of uncoatedToDelete with administrator privileges

  --Successful deletion notification
  display dialog ("The outdated color book deletion was successful!") buttons {"Great!"} with icon note

on error
  --Error message notification
  display dialog ("This script was unable to delete your legacy Pantone color books.") buttons {"OK"} with icon caution
end try


text:
Q: Magento 2 overriding a vendor xml file I want to override an xml file of an extension module into my custom module, how can I do it?

A: You can do like this in your custom Module:-

Your_VendorName\Your_ModuleName\etc\di.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
     <preference for="Magento\Framework\View\Element\Html\Select" type="Your_VendorName\Your_ModuleName\Model\Framework\View\Element\Html\Select" />
</config>


text:
Q: Health lowering but no disease in my active effects My health was at 175, now it's at 150. I have not changed armor or necklaces. If I go to a temple and get a blessing, my health goes back to 175. But then it will drop back down again after a day or two. And under my active effects it's not showing any diseases. Does anyone know what is going on?
I'm playing on the Xbox 360.

A: It sounds like Fortify Health where your health is temporarily boosted thanks to enchantments/effects of equipment and potions

Fortify Health is an enchantment and an alchemical effect that temporarily increases the maximum health for a limited time.

This would explain why your health is boosted but then after a while it drops. Salvaged/bought Fortify Health Potions normally have the effect last for 60 seconds.
There is a Blessing of Arkay which

Increases your health by 25 points.

Which would explain it and your health is dropping by 25 points because the blessing has worn off. if you keep an eye on the time you should notice the change after eight real-time hours of gameplay. if you check the Active Effects category of your Spells Menu you should see "Blessing of Arkay" there


text:
Q: How do you check for a valid session in Struts 2 jsp? I have an include jsp on all my pages which includes js files, css files, etc.  This include jsp also refers to the session with "".
On the last page of my application, the action does a session.invalidate on the HttpSession object.
So when the last the last page of my application appears and runs the "", I get the following error since the session is invalidated

2011-10-19 10:30:59,134 WARN com.opensymphony.xwork2.ognl.OgnlValueStack - Caught an exception while evaluating expression '#session.user.isWhatever()' against value stack
  java.lang.IllegalStateException: getAttribute: Session already invalidated
      at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1062)
      at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
      at org.apache.struts2.dispatcher.SessionMap.get(SessionMap.java:165)
      at ognl.MapPropertyAccessor.getProperty(MapPropertyAccessor.java:76)

I have tried "#session neq null" to stop the error from appearing but that doesn't work.
Is there anyway/condition to use to stop this error?  How does one check if the session is valid in the jsp in Struts 2?

A: Check for the presence of a known session value--in your case, #session.user. You shouldn't have to do an explicit null check, IIRC (could be wrong). Depending on how things are actually working in your app, you can also check for isNew, although that seems like it shouldn't be necessary.
The session will "never" be null--unless explicitly directed otherwise, just hitting a JSP page will create one.


text:
Q: SimpleITK - Coronal/sagittal views problems with size I'm trying to extract the all three views (Axial, Sagittal and Coronal) from a CTA in DICOM format, using the SimpleItk library.
I can correctly read the series from a given directory:
    ...
    import SimpleITK as sitk
    ...
    reader = sitk.ImageSeriesReader()
    dicom_names = reader.GetGDCMSeriesFileNames(input_dir)
    reader.SetFileNames(dicom_names)
    # Execute the reader
    image = reader.Execute()
    ...

and then, using numpy arrays as stated in this questions, I'm able to extract and save the 3 views.
    ...
    image_array = sitk.GetArrayFromImage(image)
    ...
    for i in range(image_array.shape[0]):
        output_file_name = axial_out_dir + 'axial_' + str(i) + '.png'
        logging.debug('Saving image to ' + output_file_name)
        imageio.imwrite(output_file_name, convert_img(image_array[i, :, :], axial_min, axial_max), format='png')
    ...

The other 2 are made by saving image_array[:, i, :] and image_array[:, :, i], while convert_img(..) is a function that only converts the data type, so it does not alter any shape.
However, the coronal and sagittal views are stretched, rotated and with wide black band (in some slice they are very wide).
Here's the screenshot from Slicer3d:

while this is the output of my code:
Axial

Sagittal

Coronal

Image shape is 512x512x1723, which result in axial pngs being 512x512 pixel, coronal and sagittal being 512x1723, thus this seems correct.
Should I try using PermuteAxes filter? The problem is that I was not able to find any documentation regarding its use in python (neither in other language due to 404 in documentation page)
There is also a way to improve the contrast? I have used the AdaptiveHistogramEqualization filter from simpleitk but it's way worse than Slicer3D visualization, other than being very slow.
Any help is appreciated, thank you!

A: When you convert your SimpleITK image to a NumPy array, all the pixel spacing information is lost (as the comments above suggest).  If you do everything in SimpleITK, it retains that spacing information.
It's very easy to extract slices in X, Y and Z from an image in SimpleITK using python's array slicing:
import SimpleITK as sitk

# a blank test image
img = sitk.Image([100, 101, 102], sitk.sitkUInt8)

# non-uniform spacing, for illustration
img.SetSpacing([1.0, 1.1, 1.2])

# select the 42nd Z slice
zimg = img[:, :, 42]

#select the 0th X slice
ximg = img[0, :, :]

#select the 100th Y slice
yimg = img[:, 100, :]

#print the spacing to show it's retained
print(yimg.GetSpacing())

A: Answering my own question if someone need it.
Given the fact that I need to use the slices in a deep learning framework and for data augmentation, I need them to be resampled in a new spacing which is (1.0, 1.0, 1.0).
Solved it by using this function:
def resample_image(itk_image, out_spacing=(1.0, 1.0, 1.0)):
    """
    Resample itk_image to new out_spacing
    :param itk_image: the input image
    :param out_spacing: the desired spacing
    :return: the resampled image
    """
    # get original spacing and size
    original_spacing = itk_image.GetSpacing()
    original_size = itk_image.GetSize()
    # calculate new size
    out_size = [
        int(np.round(original_size[0] * (original_spacing[0] / out_spacing[0]))),
        int(np.round(original_size[1] * (original_spacing[1] / out_spacing[1]))),
        int(np.round(original_size[2] * (original_spacing[2] / out_spacing[2])))
    ]
    # instantiate resample filter with properties and execute it
    resample = sitk.ResampleImageFilter()
    resample.SetOutputSpacing(out_spacing)
    resample.SetSize(out_size)
    resample.SetOutputDirection(itk_image.GetDirection())
    resample.SetOutputOrigin(itk_image.GetOrigin())
    resample.SetTransform(sitk.Transform())
    resample.SetDefaultPixelValue(itk_image.GetPixelIDValue())
    resample.SetInterpolator(sitk.sitkNearestNeighbor)
    return resample.Execute(itk_image)

and then saving by using numpy arrays as stated in the original question.

A: I might be late, but you could use Torchio for this. I think a good solution for your case is to use the CLI tool that is installed with TorchIO:
$ tiohd your_image.nii.gz
ScalarImage(shape: (1, 512, 512, 1723); spacing: (0.50, 0.50, 1.00); orientation: RAS+; memory: 1.7 GiB; dtype: torch.ShortTensor)
$ torchio-transform your_image.nii.gz Resample one_iso.nii.gz
$ tiohd one_iso.nii.gz
ScalarImage(shape: (1, 256, 256, 1723); spacing: (1.00, 1.00, 1.00); orientation: RAS+; memory: 430.8 MiB; dtype: torch.ShortTensor)

This works because 1 mm is the default target resolution for the Resample transform.
You can also manipulate your images using the normal Python interface for TorchIO, of course.
Disclaimer: I'm the main developer of TorchIO.


text:
Q: Find out Fixed Points Consider a set $M$ of all possible square matrices of dimension $k$ over a finite field $F_p$. Consider a map $f$ defined on $M$ as $f(X)=X^2+C$ where $X \in M$ and C is an arbitrary fixed matrix from the set $M$.
It is worth mentioning that the operations addition and multiplication on M are over finite field $F_p$.
How to determine analytically the fixed points and periodic points of different period.
Answers even in case of $p=2$ is highly appreciated.

A: Just to get you started. $k=p=2$
$C=\left(\begin{array}{cc}1 & 0\\ 0 & 0\end{array}\right),\left(\begin{array}{cc}0 & 0\\ 0 & 1\end{array}\right),\left(\begin{array}{cc}1 & 1\\ 0 & 0\end{array}\right),\left(\begin{array}{cc}1 & 0\\ 1 & 0\end{array}\right),\left(\begin{array}{cc}0 & 1\\ 0 & 1\end{array}\right),\left(\begin{array}{cc}0 & 0\\ 1 & 1\end{array}\right),\left(\begin{array}{cc}0 & 1\\ 1 & 0\end{array}\right),\left(\begin{array}{cc}1 & 1\\ 1 & 0\end{array}\right),\left(\begin{array}{cc}1 & 0\\ 1 & 1\end{array}\right),\left(\begin{array}{cc}1 & 1\\ 0 & 1\end{array}\right),\left(\begin{array}{cc}0 & 1\\ 1 & 1\end{array}\right)$
no solutions.
$C=\left(\begin{array}{cc}0 & 0\\ 0 & 0\end{array}\right)$, 8 solutions: $X=C,\left(\begin{array}{cc}0 & 0\\ 0 & 1\end{array}\right),\left(\begin{array}{cc}1 & 0\\ 0 & 0\end{array}\right),I,\left(\begin{array}{cc}1 & 1\\ 0 & 0\end{array}\right),\left(\begin{array}{cc}1 & 0\\ 1 & 0\end{array}\right),\left(\begin{array}{cc}0 & 1\\ 0 & 1\end{array}\right),\left(\begin{array}{cc}0 & 0\\ 1 & 1\end{array}\right)$.
$C=\left(\begin{array}{cc}0 & 1\\ 0 & 0\end{array}\right)$ or $\left(\begin{array}{cc}0 & 0\\ 1 & 0\end{array}\right)$, 2 solutions: $X=C,C+I$
$C=I$, 2 solutions: $X=\left(\begin{array}{cc}1 & 1\\ 1 & 0\end{array}\right),\left(\begin{array}{cc}0 & 1\\ 1 & 1\end{array}\right)$
$C=\left(\begin{array}{cc}1 & 1\\ 1 & 1\end{array}\right)$, 2 solutions: $X=C,\left(\begin{array}{cc}0 & 1\\ 1 & 0\end{array}\right)$.
I hope I have understood you correctly. The above does not look promising for a neat general solution!


text:
Q: join two subqueries syntax error using mysql I am using the following code in sql and it gives me syntax error. Can anyone help me find out why? Thanks!
(
select accepter_id, count(*) as accept_cnt
from request_accepted
group by accepter_id) a
left join
(
select requester_id, count(*) as request_cnt
from request_accepted
group by requester_id) b
on a.accepter_id = b.requester_id

A: It's a little bit hard without the definition for request_accepted, but here is my trial for you:
select a.accepter_id,
    (SELECT COUNT(*) FROM request_accepted ac WHERE ac.accepter_id = a.accepter_id) AS accept_cnt,
    b.requester_id,
    (SELECT COUNT(*) FROM request_accepted bc WHERE bc.requester_id = b.requester_id) AS request_cnt
from request_accepted a
left join request_accepted b
on a.accepter_id = b.requester_id
GROUP BY a.accepter_id, b.requester_id


text:
Q: How to check for the existence of a subscript operator? I want to write a type trait which uses SFINAE to check a type for the existence of a subscript expression. My initial attempt below seems to work when the subscript expression is possible but does not work when the bracket operator does not exist.
#include <iostream>
#include <vector>
#include <cassert>

template<class T, class Index>
struct has_subscript_operator_impl
{
  template<class T1,
           class Reference = decltype(
             (*std::declval<T*>())[std::declval<Index>()]
           ),
           class = typename std::enable_if<
             !std::is_void<Reference>::value
           >::type>
  static std::true_type test(int);

  template<class>
  static std::false_type test(...);

  using type = decltype(test<T>(0));
};

template<class T, class Index>
using has_subscript_operator = typename has_subscript_operator_impl<T,Index>::type;

struct doesnt_have_it {};

struct returns_void
{
  void operator[](int) {}
};

struct returns_int
{
  int operator[](int) { return 0; }
};

int main()
{
  std::cout << "has_subscript_operator<doesnt_have_it,int>: " << has_subscript_operator<doesnt_have_it,int>::value << std::endl;
  assert((!has_subscript_operator<doesnt_have_it,int>::value));

  std::cout << "has_subscript_operator<returns_void,int>: " << has_subscript_operator<returns_void,int>::value << std::endl;
  assert((!has_subscript_operator<returns_void,int>::value));

  std::cout << "has_subscript_operator<returns_int,int>: " << has_subscript_operator<returns_int,int>::value << std::endl;
  assert((has_subscript_operator<returns_int,int>::value));

  std::cout << "has_subscript_operator<int*,int>: " << has_subscript_operator<int*,int>::value << std::endl;
  assert((has_subscript_operator<int*,int>::value));

  std::cout << "has_subscript_operator<std::vector<int>,int>: " << has_subscript_operator<std::vector<int>,int>::value << std::endl;
  assert((has_subscript_operator<returns_int,int>::value));

  return 0;
}

clang-3.4's output:
$ clang -std=c++11 -I. -lstdc++ test_has_subscript_operator.cpp
test_has_subscript_operator.cpp:10:14: error: type 'doesnt_have_it' does not provide a subscript operator
             (*std::declval<T*>())[std::declval<Index>()]
             ^~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
test_has_subscript_operator.cpp:25:1: note: in instantiation of template class 'has_subscript_operator_impl<doesnt_have_it, int>' requested here
using has_subscript_operator = typename has_subscript_operator_impl<T,Index>::type;
^
test_has_subscript_operator.cpp:41:66: note: in instantiation of template type alias 'has_subscript_operator' requested here
  std::cout << "has_subscript_operator<doesnt_have_it,int>: " << has_subscript_operator<doesnt_have_it,int>::value << std::endl;
                                                                 ^
1 error generated.

How can I fix my has_subscript_operator such that it works correctly for all types?

A: SFINAE only works when substitution failure happens in the immediate context. The template parameter Index is already known by the time the member function template test is being instantiated, so instead of substitution failure you get a hard error.
The trick to working around this is to deduce Index again by adding an additional template type parameter to test and default it to Index.
template<class T1,
       class IndexDeduced = Index,  // <--- here
       class Reference = decltype(
         (*std::declval<T*>())[std::declval<IndexDeduced>()] // and use that here
       ),
       class = typename std::enable_if<
         !std::is_void<Reference>::value
       >::type>
static std::true_type test(int);

Now your code works as intended.
Live demo

A: Once you have C++11, it's a lot easier to write type traits... you don't need to use the ellipsis overload trick. You can just use your decltype expression directly with the help of the magical:
template <typename... >
using void_t = void;

We have our base case:
template<class T, class Index, typename = void>
struct has_subscript_operator : std::false_type { };

And our expression SFINAE valid case:
template<class T, class Index>
struct has_subscript_operator<T, Index, void_t<
    decltype(std::declval<T>()[std::declval<Index>()])
>> : std::true_type { };

And then you can write the same alias:
template <class T, class Index>
using has_subscript_operator_t = typename has_subscript_operator<T, Index>::type;

You can also use @Yakk's favorite method, which given this boilerplate that he copies in every answer:
namespace details {
  template<class...>struct voider{using type=void;};
  template<class...Ts>using void_t=typename voider<Ts...>::type;

  template<template<class...>class Z, class, class...Ts>
  struct can_apply:
    std::false_type
  {};
  template<template<class...>class Z, class...Ts>
  struct can_apply<Z, void_t<Z<Ts...>>, Ts...>:
    std::true_type
  {};
}
template<template<class...>class Z, class...Ts>
using can_apply=details::can_apply<Z,void,Ts...>;

You can then simply write properties:
template <class T, class Index>
using subscript_t = decltype(std::declval<T>()[std::declval<Index>()]);

template <class T, class Index>
using has_subscript = can_apply<subscript_t, T, Index>;

A: With C++20 Concepts:
template<class T, class I = std::size_t>
concept indexible = requires (T& t, const I& i) {
  {t[i]};
};

Usage:
static_assert(not indexible<std::list<int>>);
static_assert(    indexible<std::string>);
static_assert(    indexible<std::vector<bool>>);

static_assert(not indexible<std::map<std::string, int>>);
static_assert(    indexible<std::map<std::string, int>, std::string>);
static_assert(not indexible<const std::map<std::string, int>, std::string>);

struct any {
  template<class T>
  operator const T&() const;
};

static_assert(    indexible<std::map<std::string, int>, any>);
static_assert(    indexible<std::map<char*, int>, any>);

struct Foo {
    int operator[](int i);
    int operator[](double i);
};

static_assert(not indexible<Foo, any>);

Live demo: https://godbolt.org/z/7GWK4PvM8
Note that the usage with any will fail if operator[] is overloaded with different parameter types.


text:
Q: Acessar uma propriedade de um objeto salvo no localstorage Após realizar o login, eu salvo no meu localStorage o id e token de um usuário através de um objeto que nomeio de currentUser.
Como eu posso acessar a propriedade id e token desse objeto ao recuperar pelo localStorage?
O que eu tentei:
var USUARIO = localStorage.getItem('currentUser')
const TOKEN = JSON.parse(USUARIO.id);
const CLIENT_ID = JSON.parse(USUARIO.token);

porém eu recebo:

"Property 'id' does not exist on type 'string'"

Tem alguma forma de recuperar esse objeto e atribuir pra variável token e client_id?

A: O erro dá a dica: a variável USUARIO é uma string. Você deve convertê-la antes:
var USUARIO = JSON.parse(localStorage.getItem('currentUser'));
const TOKEN = USUARIO.id;
const CLIENT_ID = USUARIO.token;