Can I upgrade my Android Studio version from 2.3.3 to 3.0 in windows?

Uncategorized
Question: I can't update my Android Studio app from 2.3.3 to 3.0... I am not getting any update notifications either! Can't I update this? If I can't, how should I get the newer features of Android studio 3? NB: I am using windows 10 Answer: android studio 3.0 stable version haven't released yet. you will get when it will release. u can also get 3.0 beta version. it may have some bug. click here to get 3.0 beta 2 Read more
Read More

Module’s function output to variable in saltstack state

Uncategorized
Question: I'm trying to develop a simple formula for Saltstack which would flush all iptables rules and apply another formula with updated rules, for that I need to switch INPUT policy to ACCEPT and then flush the rules. I'm trying to verify that in following way:{% set policy = salt['pillar.get']('iptables.get_policy','') %} {% if policy == "ACCEPT" %} flush rules:iptables.flush:require:- default to accept {% endif %} Full code of my sls looks like:include:- iptables default to accept:iptables.set_policy:- chain: INPUT - policy: ACCEPT {% set policy = salt['iptables.get_policy'] %} {% if policy == "ACCEPT" %} flush rules:iptables.flush:require:- default to accept {% endif %} iptables reapply:require:- sls: iptables Apparently that doesn't work, could anyone advise what I'm doing wrong and if that's possible at all? Answer: Read more
Read More

How do you convert parameters from char to int in the main function for C?

Uncategorized
Question: I have this code: int main(int argc, char *argv[]) { int num = *argv[1]; When I run the function in terminal with a parameter: for example, if I were to call ./main 17, I want num = 17. However, with this code, num = 49 (ASCII value for 1 because argv is an array of characters). How would I get it to read num = 17 as an int? Playing around with the code, I can get it to convert the parameter into an int, but it will still only read/convert the first value (1 instead of 17). I'm new to C and the concept of pointers/pointers to arrays is still confusing to me. Shouldn't *argv[1] return the value of the second char in the array? Why does it…
Read More

Meta query is wrong written?

Uncategorized
Question: I have custom venue finder, where the user can select County - State and City to find a venue. So far so good, but I got the following problem. When I select Caribben Islands as country, Anguilla as state and Shoal Bay Village as city, I got 1 venue, which is correct., but if select again Carribben Islands as a country, Anguilla as a state and this time as a City I select Any i got 0 venues. It should get the venue from the city: Shoal Bay Village. Here's condition for this:if ( !empty( $state_id ) && empty( $city_id ) && !empty( $country_id ) ) { // use state if no cities were specified. $_meta_query[] = array( 'key' => 'venue_state', 'value' => $state_id, 'compare' => '=' ); Any…
Read More

.tiffs in PIL: OSError: decoder tiff_jpeg not available

Uncategorized
Question: So, I'm attempting to run the following code:from PIL import Image multi_image = "multi_image.tif" multi = Image.open(multi_image) multi.seek(2) multi.save("test.tif") It's a three page tif, wherein I'm trying to grab the second page, which results in:Traceback (most recent call last):File "C:Pythonlibsite-packagesPILImage.py", line 419, in _getdecoder decoder = getattr(core, decoder_name + "_decoder") AttributeError: module 'PIL._imaging' has no attribute 'tiff_jpeg_decoder' During handling of the above exception, another exception occurred: Traceback (most recent call last):File "C:UsersWillDesktoptiffer.py", line 6, in multi.save("test.tif") File "C:Pythonlibsite-packagesPILImage.py", line 1860, in save self.load() File "C:Pythonlibsite-packagesPILTiffImagePlugin.py", line 1013, in load return super(TiffImageFile, self).load() File "C:Pythonlibsite-packagesPILImageFile.py", line 202, in load args, self.decoderconfig) File "C:Pythonlibsite-packagesPILImage.py", line 423, in _getdecoder raise IOError("decoder %s not available" % decoder_name) OSError: decoder tiff_jpeg not available I've installed: tiff-3.8.2-1.exe, as well as set the install to my…
Read More

Error when pulling from server

Uncategorized
Question: I am getting an error when I try to pull from my remote webserver, the error is fatal: Couldn't find remote ref master fatal: The remote end hung up unexpectedly This is after I run the command git fetch live master or git pull live master If I run git branch though it does not show anything it just moves on to the next line. Thanks Answer: Check your .git/config file, in section [branch "master"] you must have:[branch "master"] remote = live merge = refs/heads/master After that, just run command git branch -a you will see all available branches. Read more
Read More

is it possible to do the Merge Replication in databases that having two different database structures?

Uncategorized
Question: is it possible to do the Merge Replication in databases that having two different database structures ? Answer: Do you mean the database has different objects (tables, stored procedures, etc.) - yes definitely. Merge replication is only based on the tables in replication so tables outside that have no impact. You cannot however have differences in the table schema for tables that are replicated. You can have indexes, triggers, etc. different though on those tables (although it may cause replication issues). Read more
Read More

How to quickly evaluate the performance of a deep network

Uncategorized
Question: Are there some quick sanity checks for neural networks? Usually I can run one or two tests (+200 epochs) per day. Are there ways to make a quick guess about the performance of the network. The only one I know of is to try to overfit the network to a very small sample of data. If it's not possible to achieve 0 loss then the network probably will not perform well on the whole dataset. Answer: Read more
Read More

How to get the current, “real”, background image size, when background-size is cover?

Uncategorized
Question: This might have been asked before and I tried the answer given in this thread: How to get dimensions for a background image when background-size is set to contain? But in this case, the background-size is set to cover, instead of contain. The background size is originally 1920x1080. I have a div-element which basically always scales its width and height to 100%, meanwhile the background-image if the said div is set to cover. 1920 / 1080 gives us a ratio of about 1.7, so whenever the browser widow is scaled like so that the div's width/height ration is over or under 1.7 aka. not in the correct ratio - things break. So I need a way to calculate what is the size of the background image to correctly set…
Read More

Jenkins…Modify XML Tag value in xml file using Groovy in Jenkins

Uncategorized
Question: I am using jenkins for automated deployment. I needs to modify xml tag value in xml file using groovy script. I am using below groovy code. When I try to edit xml tag value I am receiving error unclassified field xml.uti.node error. Node xml = xmlParser.parse(new File("c:/abc/test.xml")) xml.DeployerServer.host[0] = '172.20.204.49:7100' FileWriter fileWriter = new FileWriter("c:/abc/test.xml") XmlNodePrinter nodePrinter = new XmlNodePrinter(new PrintWriter(fileWriter)) nodePrinter.setPreserveWhitespace(true) nodePrinter.print(xml) I need to modify host tag value and host is available inside DeployerServer tag. Any help will be much appreciated. Answer: Read more
Read More

How do you save a setting for showing a form in C#? [duplicate]

Uncategorized
Question: This question already has an answer here:How to properly save application data for later use 2 answers i'm creating two windows forms in C#. One is the startup form, and the other one is the main form. I want to give a setting in the main form with a Checkbox, and i want it to show the startup form when it the Checkbox is checked. And when it is not, it will not show the startup form and continue directly to the main form. Here's the screenshot i've provided regarding the setting i've made in Visual Studio: Here's the code i've managed to make so far :C private void checkBox4_CheckedChanged(object sender, EventArgs e) { if (checkBox4.Checked == true) { Startup s = new Startup(); s.Visible = true; } if…
Read More

Fragment on addToBackStack(“”) duplicating values on back press

Uncategorized
Question: I have my Fragment addToBackStack("") to move back when I press the back button. However the main activity where it is a list view double its data when I press the back button. Question: Why is the listview (MainActivity) doubling it's value/data on press of back and how do I fix this? Here's is the code I am using to proceed next to another fragment and move back to its state. getFragmentManager().beginTransaction().addToBackStack("sd").replace(R.id.mainLayout, mFragment).commit(); Answer: Read more
Read More

read chunk(media file) one by one from mongodb and save in local file system as file using go

Uncategorized
Question: i want to read media(images,audio,videos) files store in mongodb and store those files in local file system as a original media file using golang db content more than 800,000 of records so i have to read one buy one. sample data in mongodb { "_id" : ObjectId("5768e2b34f32820100b74249"), "files_id" : ObjectId("5768e2b34f32820100b74248"), "n" : 0, "data" : { "$binary" : "UklGRnY8AwBXQVZFZm10IBAAAAABAAEAESsAACJWAAACABAAZGF0YYQzAwD//wEAAgADAAQABgAGAAcACAAKAAoACgALAAwADAAOAA8AEAAQABEAEQATABQAFQAUABUAFgAXABYAGQAZA... } image package main import ( "fmt" //"log" "encoding/json" "gopkg.in/mgo.v2" "time" "io/ioutil" "gopkg.in/mgo.v2/bson" //"os" ) const ( hosts = "10.0.0.1" database = "123test" username = "123" password = "123" collection = "messages" ) func main() { info := &mgo.DialInfo{ Addrs: []string{hosts}, Timeout: 200 * time.Second, Database: database, Username: username, Password: password, } session, err1 := mgo.DialWithInfo(info) if err1 != nil { panic(err1) } db := mgo.Database{} db.Session = session db.Name…
Read More

How to enable disable component in vuejs

Uncategorized
Question: I'm developing a small application in VueJs where I'm having a div element and trying to show element if the data value is 1 and hide if the data value is 0, for this I'm having v-model as withClient something like this: With client*: Yes No And the element which needs to be hidden: Clients: I've computed property as withClientSelection:withClientSelection() { if(this.withClient === 0) { this.clientParticipants = '' return false } else { return true } } But somehow I'm not able to get this. Help me on this. Thanks Answer: It's actually very simple, you should use this.withClient === '0' instead of this.withClient === 0 I also overlooked this part and verified your code myself first, here's a fully working example that I used. Vue.component('v-select', VueSelect.VueSelect); const app…
Read More