Posts

python3 django-admin syntax error

Image
Clash Royale CLAN TAG #URR8PPP python3 django-admin syntax error trying to learn python/django. after installing all the bits and pieces getting this error (see list). please point into right direction. thank you! $ django-admin startproject test1 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/bin/django-admin", line 11, in <module> load_entry_point('Django==2.1', 'console_scripts', 'django-admin')() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 561, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2627, in load_entry_point return ep.load() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py",...

How can I use a not:first-child selector?

Image
Clash Royale CLAN TAG #URR8PPP How can I use a not:first-child selector? I have div tag containing several ul tags. div ul If I trying set CSS properties only for the first ul tag, and this code works: ul div ul:first-child background-color: #900; When I want set CSS properties for each ul tag except the first, I tried this: ul div ul:not:first-child background-color: #900; also this: div ul:not(:first-child) background-color: #900; and this: div ul:first-child:after background-color: #900; But to no effect. How must I write in CSS: "each element, except the first"? 6 Answers 6 One of the versions you posted actually works for all modern browsers (where CSS selectors level 3 are supported): div ul:not(:first-child) background-color: #900; If you need to support legacy browsers, or if you are hindered by the :not selector's limitation (it only accepts a simple selector as an argument) then you can use another technique: :not Define a rule that has g...

Distinguish between null and missing field when mapping (POCO) with mongodb

Image
Clash Royale CLAN TAG #URR8PPP Distinguish between null and missing field when mapping (POCO) with mongodb Lets say i have a class class Person [BsonElement("name")] public string Name get; set; [BsonElement("age")] public int? Age get; set; then in mongo I have [ "name": "Jan", "age": null , "name": "San", "age": 20 , "age": 20 ] Then call collection.Find(filter).Project<Person>(projections).ToListAsync() and then I get back [ "Name": "Jan", "Age": null , "Name": "San", "Age": 20 , "Name": null, "Age": 20 ] Is there a way to see if the field was missing and not just get null back By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these poli...

How do create whatsapp share option in my app

Image
Clash Royale CLAN TAG #URR8PPP How do create whatsapp share option in my app I am new to Android development. I don't know Android Studio and Java. But I am developing an app with the help of Google, YouTube and StackOverflow. Now I want to add share option (Image + text) in my Recyclerview image to Whatsapp. Recyclerview The image is loaded from Firebase storage using Picasso lib. I don't know how to convert Firebase ImageView to bitmap . Firebase Picasso Firebase ImageView bitmap I have added a Share button below each item. How do I create share option in this sharebutton? This is my MainActivity: public class ReviewMainActivity extends AppCompatActivity private static final String APP_ID = "ca-app-pub-8867939169855032~3069406037"; FirebaseDatabase database; DatabaseReference MCR; RecyclerView recyclerView; RecyclerView.LayoutManager layoutManager; FirebaseRecyclerAdapter<ReviewModel, ReviewViewHolder> adapter; @Override protected void onCreat...

How do I write a powershell script to setup a developer environment on Windows?

Image
Clash Royale CLAN TAG #URR8PPP How do I write a powershell script to setup a developer environment on Windows? Stack Overflow, I am working on a PowerShell script to setup a developer environment for my team. I want to have it so that a user can click a shortcut and have the necessary developer tools downloaded and installed for them. These installations should be global and on the PATH. I already have the shortcut that calls the script working. The script itself is what I am having issues with. I am using chocolatey to try and install node on the developers machine's. Here is the code I have written so far devEnv.ps1 echo "Installing Chocolatey package manager, check version with choco" $env: ChocolateyInstall="$Home/chocolatey" iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) echo "Chocolatey installed. Installing NodeJS and NPM via Chocolatey." Start-Process powershell.exe -argument "-No...

Connect Azure app service Logs to ELK

Image
Clash Royale CLAN TAG #URR8PPP Connect Azure app service Logs to ELK I need my azure app service's logs and error logs to be visualized using ELK stack. How to connect these logstash.?. How can I ship my app service logs to logstash.? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Unable to start spring-boot application after configuring spring-session-data-redis

Image
Clash Royale CLAN TAG #URR8PPP Unable to start spring-boot application after configuring spring-session-data-redis After configuring spring-session-data-redis in a demo spring-boot project, bootRun task fails with the following message: spring-session-data-redis bootRun *************************** APPLICATION FAILED TO START *************************** Description: Parameter 0 of method redisTemplate in org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration required a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' that could not be found. - Bean method 'redisConnectionFactory' not loaded because @ConditionalOnClass did not find required classes 'org.apache.commons.pool2.impl.GenericObjectPool', 'redis.clients.jedis.Jedis' - Bean method 'redisConnectionFactory' not loaded because @ConditionalOnClass did not find required class 'io.lettuce.core.RedisClient' Action: Consider revisiting...

Can I add a channel to a specific conda environment?

Image
Clash Royale CLAN TAG #URR8PPP Can I add a channel to a specific conda environment? I want to add a conda channel to a specific conda environment but when I use conda config --add channels glotzer that channel is now available from all my conda environments. In addition to testing an install from another environment, the ~/.condarc file has the following: ~/.condarc channels: - glotzer - defaults How would I configure conda so the channel is only available from a specific environment? I did find in the channel documentation that for conda >= 4.1.0, putting channels at the bottom of the ~/.condarc will prevent added channels from overiding the core package set. ~/.condarc By default conda now prefers packages from a higher priority channel over any version from a lower priority channel. Therefore you can now safely put channels at the bottom of your channel list to provide additional packages that are not in the default channels, and still be confident that these channels...

Swift - After loading subview from xib to UIScrollView, scroll is not working and subview is going out of bounds

Image
Clash Royale CLAN TAG #URR8PPP Swift - After loading subview from xib to UIScrollView, scroll is not working and subview is going out of bounds I have the following scenario: View1.xib UIView Im having a coco touch class of type UIView for loading the Nib named View1. Also I have made it as owner of the previous xib. Below is the code I'm using to load the view: override init(frame: CGRect) super.init(frame: frame) commitInit() required init?(coder aDecoder: NSCoder) super.init(coder: aDecoder) commitInit() private func commitInit() Bundle.main.loadNibNamed("View1", owner: self, options: nil) containerView.frame = self.bounds containerView.autoresizingMask = [.flexibleHeight, .flexibleWidth] addSubview(containerView) Now in the storyboard I included the scrollview and a sub UIView under it. I have defined the Subview type as View1. ScrollView in main storyboard Scrollview constraints ScrollView Properties Emulator Now when I'm running the project I...

Memory Management in Windows Forms Application : Loading and Closing Forms

Image
Clash Royale CLAN TAG #URR8PPP Memory Management in Windows Forms Application : Loading and Closing Forms This is my first time asking on a forum... An advanced apology if I'm too detailed... I have created a program that loads some forms (like a menu for a system) and a part of the program (a form) displays the contents of a table in a database in a listview (this part is working fine). When I access that form at the start of the program, it finishes loading for about 4-5 seconds. Here's the problem... When I access parts of the program a lot of times (e.g. going back and forth around two forms) then I access the form that displays the table, the loading gets slower... InitializeComponent(); //I just did this to travel back and forth to two forms easier... if (MessageBox.Show("", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.OK) Form2 f = new Form2(); this.Hide(); f.ShowDialog(); thi...

Angular Material 2 Tabs with fixed (sticky) tab labels

Image
Clash Royale CLAN TAG #URR8PPP Angular Material 2 Tabs with fixed (sticky) tab labels I have a layout using Angular Material 2 mat-sidenav layout with a mat-tab layout in the mat-sidenav-content section. I am trying to make the mat-tab-labels sticky so they are always visible, and still allow the dynamic tab-content to scroll. I can get the labels to stay fixed by setting overflow: hidden on the mat-sidenav-content and then set overflow: scroll on the mat-tab-body-wrapper element, but I have to set a fixed height to get the tab-content to scroll, but I have dynamic content so a fixed height isn't an option. Is there a way I can get my sticky labels and scrolling too without setting a fixed height? mat-sidenav mat-sidenav-content mat-tab-labels overflow: hidden mat-sidenav-content overflow: scroll mat-tab-body-wrapper tab-content Below is a demo. Shrink the vertical height of your window until it covers part of the "Large content" div. It will not scroll. Then u...

Is it possible to modify GNOME desktop file metadata from non-GUI session using gio?

Image
Clash Royale CLAN TAG #URR8PPP Is it possible to modify GNOME desktop file metadata from non-GUI session using gio? Running CentOS 7 with GNOME 3.22.2, and I am trying to write an Ansible playbook to copy icons from /usr/share/applications to a pre-defined user's desktop and then grant trusted permission (Using gio set "metadata::trusted" yes ). gio set "metadata::trusted" yes When I try to see the writeable attributes of the desktop icon from a terminal session using gio info -w /home/demo/Desktop/google-chrome.desktop , I get this result: gio info -w /home/demo/Desktop/google-chrome.desktop Settable attributes: standard::symlink-target (bytestring) time::access (uint64, Keep with file when moved) time::access-usec (uint32, Keep with file when moved) time::modified (uint64, Copy with file, Keep with file when moved) time::modified-usec (uint32, Copy with file, Keep with file when moved) unix::gid (uint32, Keep with file when moved) unix::mode (uint32,...

How to handle weirdly combined websocket messages?

Image
Clash Royale CLAN TAG #URR8PPP How to handle weirdly combined websocket messages? I'm connecting to an external websocket api using the node ws library (node 10.8.0 on Ubuntu 16.04). I've got a listener which simply parses the json and passes it to the callback: this.ws.on('message', (rawdata) => let data = null; try data = JSON.parse(rawdata); catch (e) console.log('Failed parsing the following string as json: ' + rawdata); return; mycallback(data); ); I now receive errors in which the rawData looks as follows (I formatted and removed irrelevant contents): rawData �~A "id": 1, etc.. �~� { "id": 2, etc.. I then wondered; what are these characters? Seeing the structure I initially thought that the first weird sign must be an opening bracket of an array ( [ ) and the second one a comma ( , ) so that it creates an array of objects. [ , I then investigated the problem further by writing the rawdata to a file whenever it enco...

Tomcat slowly outputs the rendered content from Ruby On Rails 5.2

Image
Clash Royale CLAN TAG #URR8PPP Tomcat slowly outputs the rendered content from Ruby On Rails 5.2 I'm having trouble running my Rails 5.2 app in Tomcat with JRuby. The complete application got developed using JRuby. When we were using Rails 3 everything worked fine but now, after an upgrade to Rails 5.2 we run into the following issue. We start a request and the page gets directly rendered according to the logs but tomcat doesn't send the results after receiving the response from rails. It takes about 1 min until tomcat sends the response to the browser / client. Aug 08, 2018 3:07:22 PM org.apache.catalina.core.ApplicationContext log INFO: I, [2018-08-08T15:07:22.510615 #29113] INFO -- : [32c6ec9d-ce00-4e80-a881-90841fb3e608] Completed 200 OK in 921ms (Views: 656.0ms) JRuby 9.1.17 Tomcat: 7 Our warble.rb has the following config lines: config.dirs = %w(app config lib log vendor tmp) config.webxml.jruby.min.runtimes = 4 config.webxml.jruby.max.runtimes = 4 config.webxml.jru...

Match word (starting with plus symbol) in pandas data frames

Image
Clash Royale CLAN TAG #URR8PPP Match word (starting with plus symbol) in pandas data frames I have two pandas data frames. I would like to find matching strings in one specific column ("keyword") exist in both data frames. keyword adGroup goal6Value adCost [aaaa] (not set) 0 0.0 +bb +bb (not set) 0 0.0 +cc +cc (not set) 2072 0.0 [dddd] (not set) 0 0.0 The second data frame: keyword status Max Min [aaaa] (not set) 0.1 0.0 +bb +bb (not set) 0.2 0.0 +ff +ff (not set) 0.1 0.0 [gggg] (not set) 0.3 0.0 I would like the output to return all columns if the keyword is available in both data frames (keyword column). The output should look like this: keyword status Max Min adGroup goal6Value adCost [aaaa] (not set) 0.1 0.0 (not set) 0 0.0 +bb +bb (not set) 0.2 0.0 (not set) 0 0.0 I have changed the data type for keyword column into string for both data frames. I have tried these options: pd.merge(df1, df2, on='keyword') and df1.set_index('keyword').join(df2.set_ind...