qid
int64
46k
74.7M
question
stringlengths
54
37.8k
date
stringlengths
10
10
metadata
listlengths
3
3
response_j
stringlengths
29
22k
response_k
stringlengths
26
13.4k
__index_level_0__
int64
0
17.8k
65,814,036
When I want to import a package in python, I can alias it: ``` import package_with_a_very_long_nameeeeee as pl ``` After that statement, I can refer to the package by it alias: ``` pl.foo() ``` julia allows me to do: ``` using PackageWithAVeryLongName pl = PackageWithAVeryLongName pl.foo() ``` But it feels lik...
2021/01/20
[ "https://Stackoverflow.com/questions/65814036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11926170/" ]
This is now possible on the upcoming Julia 1.6 using the exact same syntax as Python uses: ``` julia> import LinearAlgebra as LA julia> typeof(LA) Module help?> LA.svd svd(A; full::Bool = false, alg::Algorithm = default_svd_alg(A)) -> SVD ``` On prior versions, you can do what [@Bill suggests](https://stackoverf...
python: ``` >>> import matplotlib as plt >>> type(plt) <class 'module'> >>> ``` julia: ``` julia> using Plots [ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] julia> const plt = Plots Plots julia> typeof(plt) Module ``` So, it is pretty much the identical effect between languages. What may make t...
17,794
245,465
How do you connect to a remote server via IP address in the manner that TOAD, SqlDeveloper, are able to connect to databases with just the ip address, username, SID and password? Whenever I try to specify and IP address, it seems to be taking it locally. In other words, how should the string for cx\_Oracle.connect() ...
2008/10/29
[ "https://Stackoverflow.com/questions/245465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
```py import cx_Oracle dsn = cx_Oracle.makedsn(host='127.0.0.1', port=1521, sid='your_sid') conn = cx_Oracle.connect(user='your_username', password='your_password', dsn=dsn) conn.close() ```
``` import cx_Oracle ip = '172.30.1.234' port = 1524 SID = 'dev3' dsn_tns = cx_Oracle.makedsn(ip, port, SID) conn = cx_Oracle.connect('dbmylike', 'pass', dsn_tns) print conn.version conn.close() ```
17,795
69,111,185
I'm trying to convert the command line return of `docker container ls -q` into a python list using the os.system library and method. Is there a way to do this using the os library? Essentially I'm trying to check if there are any running containers before I proceed through my code. Thanks in advance!
2021/09/09
[ "https://Stackoverflow.com/questions/69111185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12706523/" ]
Using `src` in the `img` tag to render image ``` <img className="icon" key={item.weather[0].icon} src={`https://openweathermap.org/img/w/${item.weather[0].icon}.png`} /> ``` And put the key in `div` instead in the children.
Not sure why you are doing it, but setting JSX in your state seems strange. Try something like this, assuming `res2.data.list` has the list of values. ``` <div className="five_day_forecast"> <div className="temp_body"> // Display here with Date/Time & Main Temp. <p> {res2.data....
17,805
56,272,161
I'm trying to set up travis build with JDK13, using for it two ways - by setting `jdk` parameter to `openjdkea` - by downloading jdk and setting env variables (installation tested locally), And still `java --version` is 1.8 and it is used in runtime, even maven uses jdk13 for build. Here is my `travis.yml`: ``` la...
2019/05/23
[ "https://Stackoverflow.com/questions/56272161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5427344/" ]
As loadChildren:string is deprecated in angular 8 Change your loadChildren declarations From ``` loadChildren: './production/production.module#ProductionModule' ``` To ``` loadChildren: () => import('./production/production.module').then(m => m.ProductionModule) ``` For more you can ref angular official [git li...
Apparently, it's not the entire `"loadChildren" : ...` which is deprecated. It just will no longer accept strings. Instead you have to specify a function now. The documentation is already available [here](https://fireship.io/snippets/lazy-loaded-routes-angular-v8-ivy/). It comes down to: ``` const routes = [ { ...
17,807
11,980,524
Within brackets, python's slice shorthand auto-generates tuples of slice objects: ``` class Foo(object): def __getitem__(self, key): print key Foo()[1::, 2:20:5] ``` This prints `(slice(1, None, None), slice(2, 20, 5))`. As far as I can tell, however, this shorthand doesn't work outside brackets. Is t...
2012/08/16
[ "https://Stackoverflow.com/questions/11980524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1332492/" ]
NumPy has an [`s_`](http://docs.scipy.org/doc/numpy/reference/generated/numpy.s_.html) object that will do this for you: ```none >>> np.s_[2::2] slice(2, None, 2) ``` You can easily make your own version of this simply by setting `s_ = Foo()` and then using `s_` whenever you want to create a slice easily.
What you see printed out is actually a good clue. You can create slice objects directly through the slice() global function. These can then be passed used to index from lists. ``` s = slice(1, 10, 2) numbers = list(range(20)) print numbers[s] print numbers[1:10:2] ``` This will print the same result twice, [1, 3, 5,...
17,808
24,743,805
In Ruby one can inspect a variable (object) by `p my_obj` so it'll print it as "deep" and in detail as possible. It's useful for logging and debugging. In python I thought it was `print my_obj`, only it didn't print much but `<requests.sessions.Session object at 0x7febcb29b390>` which wasn't useful at all. How do I do...
2014/07/14
[ "https://Stackoverflow.com/questions/24743805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
`dir()` will probably give you what you want: ``` for key in dir(my_obj): print('{}: {}'.format(key, getattr(my_obj, key))) ``` There's a lot more information there that you're expecting though, if I had to guess :)
That is the most universal way to "print" an object, it's just that not every object will have a very useful printout; most probably don't, in fact. If you're working with an object someone else created, you'll often want to look at the documentation to find out how to look at its variables and whatnot. That will ofte...
17,809
46,019,965
I'm trying to access data on IBM COS from Data Science Experience based on this [blog post](https://www.ibm.com/blogs/bluemix/2017/06/access-analyze-data-ibm-cross-region-cloud-object-storage/). First, I select 1.0.8 version of stocator ... ``` !pip install --user --upgrade pixiedust import pixiedust pixiedust.instal...
2017/09/03
[ "https://Stackoverflow.com/questions/46019965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1033422/" ]
No need to install stocator it is already there. As Roland mentioned, new installation most likely would collide with the pre-installed one and cause conflicts. Try ibmos2spark: <https://stackoverflow.com/a/46035893/8558372> Let me know if you still facing problems.
Chris, I usually don't use the 'http://' in the endpoint and that works for me. Not sure if that is the problem here. Here is how I access the COS objects from DSX notebooks ``` endpoint = "s3-api.dal-us-geo.objectstorage.softlayer.net" hconf = sc._jsc.hadoopConfiguration() hconf.set("fs.s3d.service.endpoint",endpoi...
17,816
50,340,906
I kind of know why when I do `migrate` it gives me the message of `no migrations to apply` but I just don't know how to fix it This is what happens. I added a new field named `update` into my model fields. I did a `migration` which created a file called `0003_xxxxx.py` then I did a `migrate` now this worked fine. Bu...
2018/05/15
[ "https://Stackoverflow.com/questions/50340906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2128414/" ]
django keep records of current `migrations` log by table `django_migrations` in your db. something like: [![enter image description here](https://i.stack.imgur.com/4iFvO.jpg)](https://i.stack.imgur.com/4iFvO.jpg) The migrations is a chain structure,it's depend on the parent node.By this table django can know which m...
Or even simply just delete the last migration row from your database you can try the following First, check which row you want to remove ``` SELECT * FROM "public"."django_migrations"; ``` Now pick the last `id` from the above query and execute ``` DELETE FROM "public"."django_migrations" WHERE "id"=replace with ...
17,820
44,504,899
I'm getting something like this. Can anyone please tell me how to fix this. ``` C:\Users\krush\Documents\ML using Python>pip install pocketsphinx Collecting pocketsphinx Using cached pocketsphinx-0.1.3.zip Building wheels for collected packages: pocketsphinx Running setup.py bdist_wheel for pocketsphinx: started ...
2017/06/12
[ "https://Stackoverflow.com/questions/44504899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4813058/" ]
Instead of copying Swig files to the Python folder, you can simply add Swig`s location to the environment variables: 1. Press `Ctrl+S` 2. Type `env` and press `Enter` 3. Double click on `Path` 4. Add the *path-to-Swig* to the last blank line 5. Click `OK` and restart your PC
I was also getting same error, while installing in ubuntu 16.04, I executed following commands: ``` sudo apt-get install -y python python-dev python-pip build-essential swig git libpulse-dev sudo pip install pocketsphinx ``` source: [pocketsphinx-python](https://github.com/cmusphinx/pocketsphinx-python)
17,823
44,221,225
In reference to this question: [python: Two modules and classes with the same name under different packages](https://stackoverflow.com/questions/15720593/python-two-modules-and-classes-with-the-same-name-under-different-packages) Should all modules in a package be uniquely named, regardless of nesting? PEP8 and PEP...
2017/05/27
[ "https://Stackoverflow.com/questions/44221225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3985089/" ]
No, there is no requirement that names at different levels must be different. Each level is a separate namespace. If `foo.utils` and `foo.bar.utils` make sense in your project, just do so. For example, the Python standard library has [`email.message`](https://docs.python.org/3/library/email.message.html) and [`email.m...
Since package is based on the filesystem, you can not, in normal circonstance, have the same packages because files/directories have no duplicate. You can have the same namespace package, of course. It is also possible to have the same package/module name in different paths. They are searched in order, so the first w...
17,833
26,674,433
I am using Windows 8.1 64 bit. I have installed canopy with academic license. My laptop has Nvidia GeForce GT750m I have installed Theano using `python setup.py develop` from Theano's git repository. I have Visual Studio 2013 and Cuda Toolkit 64 bit installed. Cuda samples are working fine. Theanoarc file: ``` [glob...
2014/10/31
[ "https://Stackoverflow.com/questions/26674433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2399329/" ]
Theano do not support Visual Studio compiler. It is needed for cuda, but not for Theano CPU code. This need g++ compiler. Is the canopy package for the compiler correctly installed? What did you do to try to compile with microsoft compiler?
Windows Canopy, like all standard CPython 2.7 distributions for Windows, is compiled with Visual C++ 2008, and that is the compiler that you should use for compiling all non-trivial C extensions for it. The following article includes some links for obtaining this compiler: <https://support.enthought.com/entries/268643...
17,834