qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
50,611
Exodus 22:16 “If a man seduces a virgin who is not engaged to anyone and has sex with her, he must pay the customary bride price and marry her. 17But if her father refuses to let him marry her, the man must still pay him an amount equal to the bride price of a virgin. How was this different from rape?
2020/09/12
[ "https://hermeneutics.stackexchange.com/questions/50611", "https://hermeneutics.stackexchange.com", "https://hermeneutics.stackexchange.com/users/35953/" ]
The short answer to the question is "NO". The language here is actually one of "enticement" as the operative word is פָּתָה (pathah), which occurs about 28 times in the OT Hebrew (eg, Gen 9:22, Judges 14:15, 16:5, etc) and is always associated with something pleasant or being enticed or deceived and never implies "rape...
**Exodus 22 Wasn't it a case of rape?** Exodus 22:16-17 > > “If a man seduces a virgin who is not engaged to anyone and has sex > with her, he must pay the customary bride price and marry her. 17But > if her father refuses to let him marry her, the man must still pay him > an amount equal to the bride price of a vir...
24,819,330
I am rediscovering OOP through a GUI application I am writing and would like to understand if it is possible to change a characteristic of all objects instantiated from a class. I have the following code: ``` class myclass(): def __init__(self): self.a = 1 x = myclass() y = myclass() print x.a, y.a # out...
2014/07/18
[ "https://Stackoverflow.com/questions/24819330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903011/" ]
You can have all instances share a variable if you define it as a class variable: ``` >>> class myclass(): ... a = 1 ... def __init__(self): ... self.b = 2 ... >>> x = myclass() >>> y = myclass() >>> x.a 1 >>> myclass.a = 2 # modify the class variable >>> x.a 2 >>> y.a 2 >>> x.b = 3 # modify ...
No, you can't. Object data can't be changed without pointer to the object. Possibly you need class variables and [classmethod](https://stackoverflow.com/questions/12179271/python-classmethod-and-staticmethod-for-beginner): ``` class myclass: a = 1 @classmethod def set_a(cls, val): cls.a = val x = myclass() ...
24,819,330
I am rediscovering OOP through a GUI application I am writing and would like to understand if it is possible to change a characteristic of all objects instantiated from a class. I have the following code: ``` class myclass(): def __init__(self): self.a = 1 x = myclass() y = myclass() print x.a, y.a # out...
2014/07/18
[ "https://Stackoverflow.com/questions/24819330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903011/" ]
You can have all instances share a variable if you define it as a class variable: ``` >>> class myclass(): ... a = 1 ... def __init__(self): ... self.b = 2 ... >>> x = myclass() >>> y = myclass() >>> x.a 1 >>> myclass.a = 2 # modify the class variable >>> x.a 2 >>> y.a 2 >>> x.b = 3 # modify ...
``` class myclass(): a=10 def __init__(self): self.b=0 a=myclass() b=myclass() print a.a,b.a #output 10,10 myclass.a=2 a=myclass() b=myclass() print a.a,b.a #output 2,2 ```
24,819,330
I am rediscovering OOP through a GUI application I am writing and would like to understand if it is possible to change a characteristic of all objects instantiated from a class. I have the following code: ``` class myclass(): def __init__(self): self.a = 1 x = myclass() y = myclass() print x.a, y.a # out...
2014/07/18
[ "https://Stackoverflow.com/questions/24819330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903011/" ]
No, you can't. Object data can't be changed without pointer to the object. Possibly you need class variables and [classmethod](https://stackoverflow.com/questions/12179271/python-classmethod-and-staticmethod-for-beginner): ``` class myclass: a = 1 @classmethod def set_a(cls, val): cls.a = val x = myclass() ...
``` class myclass(): a=10 def __init__(self): self.b=0 a=myclass() b=myclass() print a.a,b.a #output 10,10 myclass.a=2 a=myclass() b=myclass() print a.a,b.a #output 2,2 ```
9,379,047
I have a WPF application with 2 log4net appenders in log4net, the first printing to file and the second should print to console. For some reason I am not being able to show the result on log4net, but I do see it in the file. What is wrong? ``` <?xml version="1.0"?> <configuration> <configSections> <section name...
2012/02/21
[ "https://Stackoverflow.com/questions/9379047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/829174/" ]
Do you see a console pop up when you start the application. It could be you have to configure your application as a console project to have a console window... Otherwise you can check trace info. Normally an appender tries to leave one error message there if he can't log to the desired location. Output window of vis...
Do you call once `XmlConfigurator.Configure()` ?
9,379,047
I have a WPF application with 2 log4net appenders in log4net, the first printing to file and the second should print to console. For some reason I am not being able to show the result on log4net, but I do see it in the file. What is wrong? ``` <?xml version="1.0"?> <configuration> <configSections> <section name...
2012/02/21
[ "https://Stackoverflow.com/questions/9379047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/829174/" ]
If you are wanting to see the messages in the output window in visual studio you should use the following instead: ``` <appender name="TraceAppender" type="log4net.Appender.TraceAppender" > ```
Do you call once `XmlConfigurator.Configure()` ?
9,379,047
I have a WPF application with 2 log4net appenders in log4net, the first printing to file and the second should print to console. For some reason I am not being able to show the result on log4net, but I do see it in the file. What is wrong? ``` <?xml version="1.0"?> <configuration> <configSections> <section name...
2012/02/21
[ "https://Stackoverflow.com/questions/9379047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/829174/" ]
Do you see a console pop up when you start the application. It could be you have to configure your application as a console project to have a console window... Otherwise you can check trace info. Normally an appender tries to leave one error message there if he can't log to the desired location. Output window of vis...
If you are wanting to see the messages in the output window in visual studio you should use the following instead: ``` <appender name="TraceAppender" type="log4net.Appender.TraceAppender" > ```
317
I always hear Chinese people making sentences using 而已 - but I've never quite, 100%, understood how to use this in sentences myself. What is the correct way to apply it, and what is the English equivalent?
2011/12/17
[ "https://chinese.stackexchange.com/questions/317", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/62/" ]
“而已” is always used at the end of a sentence and with words like “仅仅”,"只","不过". A similar word in Chinese is "罢了"(actually, this word comes from 满语). You use the structure "......(part A),不过......(part B)而已" to emphasize the expression that A is just limited within B. You could only use "不过", also, and "而已“ weakens you...
The easy way to understand this is to use an oral English sentence rather than something formal. This is commonly used to mean "...and that's all". For example in English you can say "It's just an exam and that's all". In Chinese this could be said: "这不过是一个考试而已" *Zhè bùguò shì yīgè kǎoshì éryǐ*
1,777
On my WP8 Nokia phone, I have received a audio file ring tone in an email and in a text which I sent to myself from my old phone. How do I save it to be able to use as ring tone?
2013/04/14
[ "https://windowsphone.stackexchange.com/questions/1777", "https://windowsphone.stackexchange.com", "https://windowsphone.stackexchange.com/users/1263/" ]
Technically, you should be able to just "Save as ringtone" when you tap and hold the attachment: > > [Add ringtones to my phone](http://www.windowsphone.com/en-US/how-to/wp8/start/add-ringtones-to-my-phone) > > > To add a ringtone from a text message > > 1. Tap and hold the ringtone file, and then tap Save as r...
First the file you want to use as a ring tone must fit the following [requirements](http://www.windowsphone.com/en-us/how-to/wp7/start/create-ringtones): * In MP3 or WMA format. * Less than 40 seconds. * Less than 1 MB. * Not protected with digital rights management (DRM). And most importantly the item that most peop...
1,777
On my WP8 Nokia phone, I have received a audio file ring tone in an email and in a text which I sent to myself from my old phone. How do I save it to be able to use as ring tone?
2013/04/14
[ "https://windowsphone.stackexchange.com/questions/1777", "https://windowsphone.stackexchange.com", "https://windowsphone.stackexchange.com/users/1263/" ]
Technically, you should be able to just "Save as ringtone" when you tap and hold the attachment: > > [Add ringtones to my phone](http://www.windowsphone.com/en-US/how-to/wp8/start/add-ringtones-to-my-phone) > > > To add a ringtone from a text message > > 1. Tap and hold the ringtone file, and then tap Save as r...
Save it like plain mp3 file and then use [Ringtone Maker](http://www.windowsphone.com/en-us/store/app/ringtone-maker/5a99cbd9-e82a-4892-8264-17a64f9142e5) to transform it into ringtone. ![enter image description here](https://i.stack.imgur.com/pn5OB.png) > > With Ringtone Maker, you can create ringtones from the mus...
11,540,342
I've an iphone app and a web app(in php ), i want to synchronize contacts in iphone app with database records.(from both device and web app ie. user can add/update/delete contacts from device or web app and both database will sync.) Thanks
2012/07/18
[ "https://Stackoverflow.com/questions/11540342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1534593/" ]
Use php-addressbook.sf.net, it includes a Exchange Interface to Sync your iPhone.
your question is not clear anyway I will give you some ideas ``` ABAddressBookRef addressBook = ABAddressBookCreate( ); CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople( addressBook ); CFIndex nPeople = ABAddressBookGetPersonCount( addressBook ); for ( int i = 0; i < nPeople; i++ ) { ABRecordRef ref = CFArray...
282,018
**SimpleQueueable.cls**: ``` public with sharing class SimpleQueueable implements System.Queueable{ public void execute(System.QueueableContext ctxt){ //query the record inserted in calling transaction //make some changes on the record and update the record. } } ``` **Sample code of calling t...
2019/10/19
[ "https://salesforce.stackexchange.com/questions/282018", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/16304/" ]
> > 1. If the calling transaction is failing then queueuable is not executed. > 2. Queueable job is executed after the calling transaction is completed. > > > This is correct. Whenever you invoke Asynchronous Apex (whether Queueable, Batch, Scheduled, or Future), your request is persisted to the queue *when your t...
100% - like all async processing this is handled by creating a record in the database which is consumed by the Salesforce runtime at a later point based on processing availability and schedule. For the async processing to happen, therefore, the transaction must have finished since this is when the database transaction ...
282,018
**SimpleQueueable.cls**: ``` public with sharing class SimpleQueueable implements System.Queueable{ public void execute(System.QueueableContext ctxt){ //query the record inserted in calling transaction //make some changes on the record and update the record. } } ``` **Sample code of calling t...
2019/10/19
[ "https://salesforce.stackexchange.com/questions/282018", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/16304/" ]
100% - like all async processing this is handled by creating a record in the database which is consumed by the Salesforce runtime at a later point based on processing availability and schedule. For the async processing to happen, therefore, the transaction must have finished since this is when the database transaction ...
As a more generic answer: everything that occurs "at the end of a transaction" will not happen if you fail to reach the natural end of the transaction successfully, either by governor limits, an unhandled exception, or an addError/validation rule that causes the records to roll back. This includes scheduling jobs, send...
282,018
**SimpleQueueable.cls**: ``` public with sharing class SimpleQueueable implements System.Queueable{ public void execute(System.QueueableContext ctxt){ //query the record inserted in calling transaction //make some changes on the record and update the record. } } ``` **Sample code of calling t...
2019/10/19
[ "https://salesforce.stackexchange.com/questions/282018", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/16304/" ]
> > 1. If the calling transaction is failing then queueuable is not executed. > 2. Queueable job is executed after the calling transaction is completed. > > > This is correct. Whenever you invoke Asynchronous Apex (whether Queueable, Batch, Scheduled, or Future), your request is persisted to the queue *when your t...
As a more generic answer: everything that occurs "at the end of a transaction" will not happen if you fail to reach the natural end of the transaction successfully, either by governor limits, an unhandled exception, or an addError/validation rule that causes the records to roll back. This includes scheduling jobs, send...
8,407,917
Are there service hooks for [GitHub](http://en.wikipedia.org/wiki/GitHub) wiki repositories? Is there some other mechanism that GitHub provides for me to track wiki edits?
2011/12/06
[ "https://Stackoverflow.com/questions/8407917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/288959/" ]
**Push approach:** Within the [GitHub API documentation](http://developer.github.com/v3/), you can find documentation about setting up [service hooks](http://developer.github.com/v3/repos/hooks/) which can be triggered for one or more events. The `gollum` event is especially raised any time a wiki page is updated. **J...
I set up a Jenkins job to pull our GitHub wiki from <https://github.com/IQSS/dvn.wiki.git> with a build trigger of @daily. In a build step, I'm executing a shell command like this to email us: > > echo "The DVN wiki on GitHub has been updated. Please check for new content at <https://github.com/IQSS/dvn/wiki/_history...
26,561,851
How to create extension method for a generic type? The below code returning error > > Extension method can only be declared in non-generic, non-nested static class > > > Code: ``` public static class PagedList<T> where T : BaseEntity { public static IEnumerable<T> ToPagedList(this IEnumerable<T> source, i...
2014/10/25
[ "https://Stackoverflow.com/questions/26561851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Specify generic types directly on the method and make the class as the error says static and non-generic. ``` public static class PagedList { public static IEnumerable<T> ToPagedList<T>(this IEnumerable<T> source, int pageNumber = 0, int pageSize = 5) where T : BaseEntity { return source.Skip(...
You should listen the error message, you need to declare your extension method inside of a non-generic class.
13,392
I'm excited about the iMac 2011 refresh, but I'm troubled by the news that there are no SATA 3 connections. There's lots of confusion on Mac Rumors and [OWC blogged that there is no SATA 3](http://blog.macsales.com/10002-2011-imacs-no-sata-6gbs-yes-to-multiple-drives). I was wondering if anyone has an iMac 2011 and ca...
2011/05/04
[ "https://apple.stackexchange.com/questions/13392", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/6216/" ]
I don't have a 2011 iMac, however you can trust the statement from OWC that you linked in your question. They bought one, took it apart and unequivocally state that there is NO SATA 3 support. Since they sell the Vertex 3 and the industry is moving towards SATA 3, it would not be in their commercial interest to make...
Whilst there may be no SATA3 controller on board there is nothing to stop a SATA3 to Thunderbolt interface appearing in the future. The lack of SATA3 on the new iMacs is not stopping me from buying one. Thunderbolt will provide all the expansion opportunities I need.
13,392
I'm excited about the iMac 2011 refresh, but I'm troubled by the news that there are no SATA 3 connections. There's lots of confusion on Mac Rumors and [OWC blogged that there is no SATA 3](http://blog.macsales.com/10002-2011-imacs-no-sata-6gbs-yes-to-multiple-drives). I was wondering if anyone has an iMac 2011 and ca...
2011/05/04
[ "https://apple.stackexchange.com/questions/13392", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/6216/" ]
It turns out that there is SATA 3 on board, it just wasn't enabled until 4 May 2011. The Other World Computing [blog](http://blog.macsales.com/10050-firmware-update-enables-6gbs-in-2011-imacs) has the details: > > While [iMac EFI Update 1.6](http://support.apple.com/kb/DL1380) is described > as including “fixes that...
I don't have a 2011 iMac, however you can trust the statement from OWC that you linked in your question. They bought one, took it apart and unequivocally state that there is NO SATA 3 support. Since they sell the Vertex 3 and the industry is moving towards SATA 3, it would not be in their commercial interest to make...
13,392
I'm excited about the iMac 2011 refresh, but I'm troubled by the news that there are no SATA 3 connections. There's lots of confusion on Mac Rumors and [OWC blogged that there is no SATA 3](http://blog.macsales.com/10002-2011-imacs-no-sata-6gbs-yes-to-multiple-drives). I was wondering if anyone has an iMac 2011 and ca...
2011/05/04
[ "https://apple.stackexchange.com/questions/13392", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/6216/" ]
It turns out that there is SATA 3 on board, it just wasn't enabled until 4 May 2011. The Other World Computing [blog](http://blog.macsales.com/10050-firmware-update-enables-6gbs-in-2011-imacs) has the details: > > While [iMac EFI Update 1.6](http://support.apple.com/kb/DL1380) is described > as including “fixes that...
Whilst there may be no SATA3 controller on board there is nothing to stop a SATA3 to Thunderbolt interface appearing in the future. The lack of SATA3 on the new iMacs is not stopping me from buying one. Thunderbolt will provide all the expansion opportunities I need.
15,778
There are a number of "[Pay with tweet](https://webmasters.stackexchange.com/questions/15770/service-to-give-access-to-download-after-tweet-fb-like-etc)" type services where you get access to a download (pdf/ebook etc) if you tweet or Facebook like. Are there any services that do similar for 'normal' links (Blogs etc)...
2011/06/23
[ "https://webmasters.stackexchange.com/questions/15778", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/3406/" ]
It's not effective if you get caught: > > Google works hard to ensure that it > fully discounts links intended to > manipulate search engine results, such > excessive link exchanges and purchased > links that pass PageRank. > > > <http://www.google.com/support/webmasters/bin/answer.py?answer=66736> However ...
This is definitely a grey area and I would think this could very well fall against Google's guidelines. You are manipulating the search engines by buying links. You may not be paying with money but you're giving something of monetary value to users to get backlinks. Those backlinks would never have occurred otherwise. ...
35,520,208
I went through many questions and answers here in stack over flow about setting the minimum date in **UIDatepicker**, I have tried most of it but I am still not able to set the minimum date in **UIDatepicker**. My exact requirement is that for people who are aged above 70 should not sign up with my app. This is the cod...
2016/02/20
[ "https://Stackoverflow.com/questions/35520208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3913001/" ]
I think this is your problem 1. You have your min and max dates the wrong way around. 2. You have set the year to -14. **Update:** Try this code: ``` NSDate *todaysDate = [NSDate date]; NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; NSDateComponents *minDateC...
``` [formatter setDateFormat:@"MMM dd,yyyy"]; NSDate *date = [formatter dateFromString:lblDate.text]; datePicker.minimumDate=date; ```
25,994,048
I have two variables that I have plotted using `matplotlib` scatter function. ![enter image description here](https://i.stack.imgur.com/PR3rb.png) **`I would like to show the 68% confidence region by highlighting it in the plot.`** I know to show it in a histogram, but I don't know how to do it for a 2D plot like this...
2014/09/23
[ "https://Stackoverflow.com/questions/25994048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1469380/" ]
To plot a region between two curves, you could use `pyplot.fill_between()`. As for your confidence region, I was not sure what you wanted to achieve, so I exemplified with simultaneous confidence bands, by modifying the code from: <https://en.wikipedia.org/wiki/Confidence_and_prediction_bands#cite_note-2> ``` import...
First of all **thank you @snake\_charmer** for your answer, **but I have found a simpler way of solving the issue using** `curve_fit` from `scipy.optimize` I fit my data sample using `curve_fit` which gives me my best fit parameters. What it also gives me is the estimated covariance of the parameters. The diagonals of...
63,185,883
I have two functions in React Native Component, in that one should refresh every 10s and another one should refresh every 1s. I have implemented **`setInterval()`** function for refreshing on `componentDidMount()` and **`clearInterval()`** on `componentWillUnmount()`, but am facing trouble it takes only one function wh...
2020/07/31
[ "https://Stackoverflow.com/questions/63185883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4627415/" ]
Issue ===== `clearInterval` works by being passed the reference returned from `setInterval`, i.e. `this.timerId = setInterval(...` and `clearInterval(this.timerId)`. What I suspect is occurring is you edited you code and ran, which set an interval callback (but didn't clear it), and then edited and re-ran your code, ...
What I understood by the example and statement is you want `getBtLevels` and `getBtState` to be called after every 1 sec and `getBtLevelArcs` after every 10 seconds. But what happens is when `getBtState` and `getBtLevels` invoke, their `setState` updates the whole component, which is not acceptable in your case. Ideal...
29,709,156
My wife's birthday is coming up and I would like to create a website similar to Ba Ba Dum: <https://babadum.com/> I have learned HTML5 in school but never learned about its ability to create animated websites. How do I go about making a website like that? Do I have to use Flash or is it fully rendered with HTML5? Lo...
2015/04/17
[ "https://Stackoverflow.com/questions/29709156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4802871/" ]
Although your question is way, way too broad, I'll try to help. The site you linked -as far as I can tell- is made HTML, CSS and JavaScript. There are less and less sites that use Flash, and you shouldn't use that either - it's starting to die out, at last. Be prepared to research a lot - you'll have to learn about C...
Here are a few places I'd recommend going to, all of these have helped me and are a good place to start. * Codecademy - <http://www.codecademy.com/learn> For basic HTML, CSS, JavaScript and jQuery lessons. Best site on the web, I say. Also, recently released AngularJS lessons, which are quite good. * Code school - <h...
806,689
I'm trying to search the DB2 equivalent of [generate\_series()](http://www.postgresql.org/docs/8.3/static/functions-srf.html) (the PostgreSQL-way of generating rows). I obviously don't want to hard-code the rows with a [VALUES](http://www.postgresql.org/docs/8.3/static/sql-values.html) statement. ``` select * from gen...
2009/04/30
[ "https://Stackoverflow.com/questions/806689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24760/" ]
The where clause needs to be a bit more explicit about the bounds of the recursion in order for DB2 to suppress the warning. Here's a slightly adjusted version that does not trigger the warning: ``` with dummy(id) as ( select 2 from SYSIBM.SYSDUMMY1 union all select id + 1 from dummy where id < 4 ) sel...
I managed to write a recursive query that fits : ``` with dummy(id) as ( select 2 from SYSIBM.SYSDUMMY1 union all select id + 1 from dummy where id + 1 between 2 and 4 ) select id from dummy ``` The query can be adapted to whatever for(;;) you can dream of.
12,243
I know that the wave like nature of the electrons allows the qubits to interfere with each other amplifying correct answers and canceling out wrong answers. But what kind of problems that use this kind of phenomena? I am still a beginner in the field so please point out any mistake I made along the way. And if there ar...
2020/05/30
[ "https://quantumcomputing.stackexchange.com/questions/12243", "https://quantumcomputing.stackexchange.com", "https://quantumcomputing.stackexchange.com/users/12207/" ]
If you look in this [paper](https://arxiv.org/abs/quant-ph/9608006), section 7, they give an [[11,1,5]] code, and show that it is the smallest you can have. In general, for these sorts of questions, a great starting point is [Gottesman's thesis](https://arxiv.org/abs/quant-ph/9705052). That's where I found this result...
Another good place to find codes with your desired parameters is this website: <http://www.codetables.de/> The standard format to describe a quantum code is [[n,k,d]], where n is the number of physical qubits whose joint entangled state stores the logical information, k is the number of logical qubits encoded, and d i...
35,867,304
I can't get the finalList filled to use in my html file, it wil run the code to fill it before the promise all code. I need to use this array in my html document so it has to be a this.variable I am using Aurelia. ```js activate() { var repoList = []; var repos = this.http.fetch({Link to github api}) ...
2016/03/08
[ "https://Stackoverflow.com/questions/35867304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6034220/" ]
Something like this should do it. Hard to decipher what's going on in the for loops. ```js activate() { let reposPromise = this.http.fetch({Link to github api}) .then(response => response.json()); let boardsPromise = new Trello().getBoards(); return Promise.all([boardsPromise, reposPromise]) .then(([boa...
I believe Your `finalList` should be set inside the promise handler. Like this. ``` activate() { var repoList = []; //I always use this, and I am not sure what do you mean //by this.finalList, but still I assume you know what you are doing //And hence I use this! var that = this; var repos = this.http.fetc...
21,445,341
It seems that `ic_launcher.png` is the canonical name for launcher icons for Android apps. What does "ic" stand for? My guess is "icon", but that's kind of a strange way to abbreviate it, so I'm wondering if it's something else?
2014/01/30
[ "https://Stackoverflow.com/questions/21445341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/631051/" ]
Your assumption is right. The "ic" stands for "icon".
"It's a 48×48 pixel png file called ic\_launcher.png (ic for icon, launcher for the launcher screen)"
21,445,341
It seems that `ic_launcher.png` is the canonical name for launcher icons for Android apps. What does "ic" stand for? My guess is "icon", but that's kind of a strange way to abbreviate it, so I'm wondering if it's something else?
2014/01/30
[ "https://Stackoverflow.com/questions/21445341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/631051/" ]
Your assumption is right. The "ic" stands for "icon".
From Android's [Icon Design Guidelines: Use common naming conventions for icon assets](https://developer.android.com/guide/practices/ui_guidelines/icon_design#use-common-naming-conventions-for-icon-assets), "ic" stands for "icon".
21,445,341
It seems that `ic_launcher.png` is the canonical name for launcher icons for Android apps. What does "ic" stand for? My guess is "icon", but that's kind of a strange way to abbreviate it, so I'm wondering if it's something else?
2014/01/30
[ "https://Stackoverflow.com/questions/21445341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/631051/" ]
From Android's [Icon Design Guidelines: Use common naming conventions for icon assets](https://developer.android.com/guide/practices/ui_guidelines/icon_design#use-common-naming-conventions-for-icon-assets), "ic" stands for "icon".
"It's a 48×48 pixel png file called ic\_launcher.png (ic for icon, launcher for the launcher screen)"
59,359,100
I have the folowing list : ```py l = [ 'D111_26680270__2019_10.xml', 'D111_26680270__2019_10_generat.PDF', 'D111_26680270__2019_10_generat.xdp', 'D111_32338396__2019_10.xml', 'D111_32338396__2019_10_generat.PDF', 'D111_32338396__2019_10_generat.xdp', 'D111_40037513__2019_10_generat.pdf', ...
2019/12/16
[ "https://Stackoverflow.com/questions/59359100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12524425/" ]
You can do this using `str.split` in a list comprehension ``` >>> data = ['D111_26680270__2019_10.xml', 'D111_26680270__2019_10_generat.PDF', 'D111_26680270__2019_10_generat.xdp', 'D111_32338396__2019_10.xml', 'D111_32338396__2019_10_generat.PDF', 'D111_32338396__2019_10_generat.xdp', 'D111_40037513__2019_10_generat.p...
As you have fixed number used slicing it's efficient and simple way ```py >>> data = ['D111_26680270__2019_10.xml', 'D111_26680270__2019_10_generat.PDF', 'D111_26680270__2019_10_generat.xdp', 'D111_32338396__2019_10.xml', 'D111_32338396__2019_10_generat.PDF', 'D111_32338396__2019_10_generat.xdp', 'D111_40037513__2019_...
33,539,239
I'm trying to automate my Test Cases using Selenium for an OBIEE application. Now, I need to read a value from a tabular report generated. The problem is, the ID of the last cell where the total is, keeps on changing. For example- Currently the id is: db\_saw\_9270\_6\_1610\_0. After refreshing, the ID becomes someth...
2015/11/05
[ "https://Stackoverflow.com/questions/33539239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3934294/" ]
ANSWER UPADTED: The problem with your code is that the submit event occurs even before ajax is called. The following changes have been done in your code HTML ``` <form method="post" action="sub.php" name="myform" id="myform"> <input type="text" name="name" id="test_txt"> <input type="text" name="code_r" id...
Try this: ``` <script> $(function () { $('form[name="myform"]').on('submit', function (e) { e.preventDefault(); var txt = $(this).find("#test_txt").val(); if (txt.length > 0) { $.ajax({ url: "chckvar.php", type: "POST", //async : ...
5,745
Do frames in emacs have a handle the way buffers do? In particular, can I specify that a particular file should be opened in a specified frame? I would like to have two frames where I use one for development and use the other to read documentation and browse tags. (Tagging the question with emacsclient and linux becau...
2014/12/26
[ "https://emacs.stackexchange.com/questions/5745", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/2536/" ]
I think you may want your opened frame in control. If you make certain files automatically opened in another frames, then when you open more than one it will create many frames that becomes unmanageable and defeats your purpose. Since you use Helm and if you use any Helm Projectile command or `helm-find-files` or `hel...
I think it's a bit of wasted effort of trying to make this arrangement, i.e. docs in one frame and code in the other. This is because all Emacs frames share the buffers anyway, so all your arranging comes to naught with a single `ido-switch-buffer`. But when that happens, [ace-window](https://github.com/abo-abo/ace-wi...
5,745
Do frames in emacs have a handle the way buffers do? In particular, can I specify that a particular file should be opened in a specified frame? I would like to have two frames where I use one for development and use the other to read documentation and browse tags. (Tagging the question with emacsclient and linux becau...
2014/12/26
[ "https://emacs.stackexchange.com/questions/5745", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/2536/" ]
You can customize `display-buffer-alist` to achieve what you want, you can read more about the variable by doing `C-h``v``display-buffer-alist``RET`. Basically this variable allows you to register custom functions to display certain buffers. Below if a non-generic solution to your question. I have assumed certain thing...
I think it's a bit of wasted effort of trying to make this arrangement, i.e. docs in one frame and code in the other. This is because all Emacs frames share the buffers anyway, so all your arranging comes to naught with a single `ido-switch-buffer`. But when that happens, [ace-window](https://github.com/abo-abo/ace-wi...
5,745
Do frames in emacs have a handle the way buffers do? In particular, can I specify that a particular file should be opened in a specified frame? I would like to have two frames where I use one for development and use the other to read documentation and browse tags. (Tagging the question with emacsclient and linux becau...
2014/12/26
[ "https://emacs.stackexchange.com/questions/5745", "https://emacs.stackexchange.com", "https://emacs.stackexchange.com/users/2536/" ]
You can customize `display-buffer-alist` to achieve what you want, you can read more about the variable by doing `C-h``v``display-buffer-alist``RET`. Basically this variable allows you to register custom functions to display certain buffers. Below if a non-generic solution to your question. I have assumed certain thing...
I think you may want your opened frame in control. If you make certain files automatically opened in another frames, then when you open more than one it will create many frames that becomes unmanageable and defeats your purpose. Since you use Helm and if you use any Helm Projectile command or `helm-find-files` or `hel...
61,542,932
Hi I am studying and trying to make my website mobile responsive and no matter what I try have had no luck. So I have tried a range of ways to turn a menu into a mobile menu when I resize. I have also been trying to get the content to centre properly when in smaller screen. I have googled alot and worked out most now I...
2020/05/01
[ "https://Stackoverflow.com/questions/61542932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13447516/" ]
You can access the url by typing `zappa status <stage>`, where `<stage>` is probably something like `dev`. See also <https://github.com/Miserlou/Zappa#status> for details. The printout will have your url as well as other status details of your lambda function. This works provided you give full permission access to th...
I had to configure my zappa\_settigs.json by adding these lines: ``` "apigateway_enabled": true, "manage_roles": true, "cors": true, **so the final zappa settings:** { "dev": { "django_settings": "zappatest.settings", "apigateway_enabled": true, "manage_roles": true, "role_arn": "Role_name", "ro...
51,576,905
I am using NSCoding and NSArchiver to persist my iOS App Data. But I want to know if it is equivalent to using zip / unzip software? If not, how does it work?
2018/07/29
[ "https://Stackoverflow.com/questions/51576905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8637708/" ]
You can read the [docs](https://developer.apple.com/documentation/foundation/nsarchiver) to get a rough idea of how `NSArchiver` works: > > [...] provides a way to encode objects into an architecture-independent format that can be stored in a file > > > Basically, it converts an object in memory (and all the othe...
In effect, it is a property list. That is why NSKeyedArchiver has an `outputFormat` property that can be an XML property list or a binary property list. See the documentation on the PropertyListSerialization class for more about what that means. You can actually write an archive to disk, open it as XML, and read it.
20,813,881
Seeking best inputs on correct usage of C# using statement. Can I use `using` statement on a parameter object as in the following uncommon example code snippet (viz., multi-layer application)? Although the code snippet is different from what I feel that the using statement should be in `ProcessFileAndReturnNumberFrom...
2013/12/28
[ "https://Stackoverflow.com/questions/20813881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1660166/" ]
If a method is passed an object that implements `IDisposable`, it's *usually* the responsibility of the caller to manage the lifetime of that object, rather than the callee. ``` public double? ProcessFileAndReturnNumberFromStream() { string fileName = "Test.txt"; Data dat = new Data(); using (StreamReader...
> > Can I use using statement on a parameter object as in the following uncommon example code snippet (viz., multi-layer application)? > > > You can, but it's generally odd to do so. Usually whatever is creating the `StreamReader` would be expecting to "own" it and dispose of it when they're done with it. It woul...
20,813,881
Seeking best inputs on correct usage of C# using statement. Can I use `using` statement on a parameter object as in the following uncommon example code snippet (viz., multi-layer application)? Although the code snippet is different from what I feel that the using statement should be in `ProcessFileAndReturnNumberFrom...
2013/12/28
[ "https://Stackoverflow.com/questions/20813881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1660166/" ]
The caller that is passing the instance of IDisposable should be the one to use the `using` statement. If the callee uses it, the object will be disposed while outside the immediate control of the caller who 'owns' the object.
> > Can I use using statement on a parameter object as in the following uncommon example code snippet (viz., multi-layer application)? > > > You can, but it's generally odd to do so. Usually whatever is creating the `StreamReader` would be expecting to "own" it and dispose of it when they're done with it. It woul...
20,813,881
Seeking best inputs on correct usage of C# using statement. Can I use `using` statement on a parameter object as in the following uncommon example code snippet (viz., multi-layer application)? Although the code snippet is different from what I feel that the using statement should be in `ProcessFileAndReturnNumberFrom...
2013/12/28
[ "https://Stackoverflow.com/questions/20813881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1660166/" ]
> > Can I use using statement on a parameter object as in the following uncommon example code snippet (viz., multi-layer application)? > > > You can, but it's generally odd to do so. Usually whatever is creating the `StreamReader` would be expecting to "own" it and dispose of it when they're done with it. It woul...
Such API would be extremely troublesome. You would never know whether or not the object passed to a method is disposed inside the method or not. Thus, if this is you who create the object and pass it there, you would also never know whether or not you should dispose the object you have just created and passed to the ...
20,813,881
Seeking best inputs on correct usage of C# using statement. Can I use `using` statement on a parameter object as in the following uncommon example code snippet (viz., multi-layer application)? Although the code snippet is different from what I feel that the using statement should be in `ProcessFileAndReturnNumberFrom...
2013/12/28
[ "https://Stackoverflow.com/questions/20813881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1660166/" ]
If a method is passed an object that implements `IDisposable`, it's *usually* the responsibility of the caller to manage the lifetime of that object, rather than the callee. ``` public double? ProcessFileAndReturnNumberFromStream() { string fileName = "Test.txt"; Data dat = new Data(); using (StreamReader...
Such API would be extremely troublesome. You would never know whether or not the object passed to a method is disposed inside the method or not. Thus, if this is you who create the object and pass it there, you would also never know whether or not you should dispose the object you have just created and passed to the ...
20,813,881
Seeking best inputs on correct usage of C# using statement. Can I use `using` statement on a parameter object as in the following uncommon example code snippet (viz., multi-layer application)? Although the code snippet is different from what I feel that the using statement should be in `ProcessFileAndReturnNumberFrom...
2013/12/28
[ "https://Stackoverflow.com/questions/20813881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1660166/" ]
The caller that is passing the instance of IDisposable should be the one to use the `using` statement. If the callee uses it, the object will be disposed while outside the immediate control of the caller who 'owns' the object.
Such API would be extremely troublesome. You would never know whether or not the object passed to a method is disposed inside the method or not. Thus, if this is you who create the object and pass it there, you would also never know whether or not you should dispose the object you have just created and passed to the ...
2,258,768
Is meaning of **"if and only if"** is different in mathematical aspects and English aspect? let's take an example: > > Example:I will go home **if and only if** it is not raining. > > Now according to me in english aspect ,I cannot comment anything about rain if i did not go home, > > but in mathematical ...
2017/04/30
[ "https://math.stackexchange.com/questions/2258768", "https://math.stackexchange.com", "https://math.stackexchange.com/users/441862/" ]
In Mathematics "if and only if" gives you information about both sides of the sentence. Using your example "I will go home **if and only if** it is not raining." Assuming you did go home we conclude that it's not raining, and the other way around assuming it's not raining we conclude that indeed you did go home. On ...
The ''if'' part tells you that "it's not raining" implies that "you will go home" and equivalently that "you don't go home" implies that "it's raining." I think this is because we didn't usually use if and only if in our lives so just have more caught on the either part (??
2,258,768
Is meaning of **"if and only if"** is different in mathematical aspects and English aspect? let's take an example: > > Example:I will go home **if and only if** it is not raining. > > Now according to me in english aspect ,I cannot comment anything about rain if i did not go home, > > but in mathematical ...
2017/04/30
[ "https://math.stackexchange.com/questions/2258768", "https://math.stackexchange.com", "https://math.stackexchange.com/users/441862/" ]
In Mathematics "if and only if" gives you information about both sides of the sentence. Using your example "I will go home **if and only if** it is not raining." Assuming you did go home we conclude that it's not raining, and the other way around assuming it's not raining we conclude that indeed you did go home. On ...
There is indeed a mismatch between the way we typically treat the 'if and only if' statement in English (or any other natural language) and the way we treat the logical $\leftrightarrow$. Take the following example: 'Mary lives in France if and only if Mary lives in Germany' In any natural language would immediately ...
14,511,923
I have a tasks table with a `task_id` column and `parent_id` column for each task. I am trying to build a query that returns for each `task_id`, the number of times this `id` shows in the parent `id` column. I tried this query: ``` SELECT task_id, parent_id, (SELECT COUNT( * ) FROM `tasks` ...
2013/01/24
[ "https://Stackoverflow.com/questions/14511923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1079913/" ]
It seems like you want this: ``` SELECT task_id, parent_id, COUNT(parent_id) AS count_parents FROM tasks GROUP BY task_id, parent_id ```
``` SELECT t2.task_id, t2.parent_id, (SELECT COUNT( * ) FROM `tasks` t1 WHERE t1.parent_id = t2.task_id) AS count_parents FROM tasks t2 ``` I think from your question
14,511,923
I have a tasks table with a `task_id` column and `parent_id` column for each task. I am trying to build a query that returns for each `task_id`, the number of times this `id` shows in the parent `id` column. I tried this query: ``` SELECT task_id, parent_id, (SELECT COUNT( * ) FROM `tasks` ...
2013/01/24
[ "https://Stackoverflow.com/questions/14511923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1079913/" ]
If you want to include all tasks whether they are ever a parent or not, ``` select tasks.task_id,count(parent.parent_id) from tasks left join tasks parent on tasks.task_id=parent.parent_id group by tasks.task_id; ``` If you want only tasks that are parents, it is trivial: ``` select parent_id,count(*) from tasks gr...
It seems like you want this: ``` SELECT task_id, parent_id, COUNT(parent_id) AS count_parents FROM tasks GROUP BY task_id, parent_id ```
14,511,923
I have a tasks table with a `task_id` column and `parent_id` column for each task. I am trying to build a query that returns for each `task_id`, the number of times this `id` shows in the parent `id` column. I tried this query: ``` SELECT task_id, parent_id, (SELECT COUNT( * ) FROM `tasks` ...
2013/01/24
[ "https://Stackoverflow.com/questions/14511923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1079913/" ]
Try this: ``` select task_id,parent_id, count(parent_id) as count_parents from `tasks` group by task_id,parent_id; ``` In this case you need a group by, hope it helps.
``` SELECT t2.task_id, t2.parent_id, (SELECT COUNT( * ) FROM `tasks` t1 WHERE t1.parent_id = t2.task_id) AS count_parents FROM tasks t2 ``` I think from your question
14,511,923
I have a tasks table with a `task_id` column and `parent_id` column for each task. I am trying to build a query that returns for each `task_id`, the number of times this `id` shows in the parent `id` column. I tried this query: ``` SELECT task_id, parent_id, (SELECT COUNT( * ) FROM `tasks` ...
2013/01/24
[ "https://Stackoverflow.com/questions/14511923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1079913/" ]
If you want to include all tasks whether they are ever a parent or not, ``` select tasks.task_id,count(parent.parent_id) from tasks left join tasks parent on tasks.task_id=parent.parent_id group by tasks.task_id; ``` If you want only tasks that are parents, it is trivial: ``` select parent_id,count(*) from tasks gr...
``` SELECT t2.task_id, t2.parent_id, (SELECT COUNT( * ) FROM `tasks` t1 WHERE t1.parent_id = t2.task_id) AS count_parents FROM tasks t2 ``` I think from your question
14,511,923
I have a tasks table with a `task_id` column and `parent_id` column for each task. I am trying to build a query that returns for each `task_id`, the number of times this `id` shows in the parent `id` column. I tried this query: ``` SELECT task_id, parent_id, (SELECT COUNT( * ) FROM `tasks` ...
2013/01/24
[ "https://Stackoverflow.com/questions/14511923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1079913/" ]
If you want to include all tasks whether they are ever a parent or not, ``` select tasks.task_id,count(parent.parent_id) from tasks left join tasks parent on tasks.task_id=parent.parent_id group by tasks.task_id; ``` If you want only tasks that are parents, it is trivial: ``` select parent_id,count(*) from tasks gr...
Try this: ``` select task_id,parent_id, count(parent_id) as count_parents from `tasks` group by task_id,parent_id; ``` In this case you need a group by, hope it helps.
29,337,225
``` method - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation ``` Since this method got deprecated I was wondering how you can access the old location in the NSArray. Does the Array store the location each update. ...
2015/03/30
[ "https://Stackoverflow.com/questions/29337225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3882976/" ]
`locationManager:didUpdateLocations:` returns a list of locations that you haven't seen yet. It may batch together several updates into a single notification. But it doesn't send you data you've already received. If you want to keep track of previous locations that you've already received, you need to store those yours...
I did this using an NSMutableArray that I call locHistory, like this: ``` - (void) locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { [locHistory addObject:locationManager.location]; if ([locHistory count] > 2) { [locHistory removeObjectAtIndex:0]; } //more code... } ...
64,148
Ok, I know this may sound dumb but, here is the thing: I recently removed a cpu, ram and hard disk from my 10-ish year old pc. At first, I did that to understand how the pc was built. Now, the next logical step would be to take it further and rebuild it. But I have no idea how to do that. So here is the simplified ques...
2013/04/02
[ "https://electronics.stackexchange.com/questions/64148", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/22009/" ]
You can't, realistically. A long time ago, computers had wires visible to the naked eye, or were even hand-assembled; [someone is doing a re-enactment of this](http://www.homebrewcpu.com/). These days they're held together on a 6-layer PCB which has been carefully routed to ensure that signals can travel at 1GHz with...
The parts of a computer such as those you mentioned cannot be used without an appropriate motherboard. Anything that could do the job IS a motherboard. Designing/building one is generally outside the scope of abilities for one person - especially one with no training and experience.
64,148
Ok, I know this may sound dumb but, here is the thing: I recently removed a cpu, ram and hard disk from my 10-ish year old pc. At first, I did that to understand how the pc was built. Now, the next logical step would be to take it further and rebuild it. But I have no idea how to do that. So here is the simplified ques...
2013/04/02
[ "https://electronics.stackexchange.com/questions/64148", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/22009/" ]
The parts of a computer such as those you mentioned cannot be used without an appropriate motherboard. Anything that could do the job IS a motherboard. Designing/building one is generally outside the scope of abilities for one person - especially one with no training and experience.
(Your question seems to have been edited, so I might not be answering the same question that the other answerers did.) Programming in assembly can be done on almost any computer or microcontroller you can get. Of these a PC might be the most readily available, but unfortunately the assembly language of the modern Inte...
64,148
Ok, I know this may sound dumb but, here is the thing: I recently removed a cpu, ram and hard disk from my 10-ish year old pc. At first, I did that to understand how the pc was built. Now, the next logical step would be to take it further and rebuild it. But I have no idea how to do that. So here is the simplified ques...
2013/04/02
[ "https://electronics.stackexchange.com/questions/64148", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/22009/" ]
You can't, realistically. A long time ago, computers had wires visible to the naked eye, or were even hand-assembled; [someone is doing a re-enactment of this](http://www.homebrewcpu.com/). These days they're held together on a 6-layer PCB which has been carefully routed to ensure that signals can travel at 1GHz with...
(Your question seems to have been edited, so I might not be answering the same question that the other answerers did.) Programming in assembly can be done on almost any computer or microcontroller you can get. Of these a PC might be the most readily available, but unfortunately the assembly language of the modern Inte...
4,289,588
I am a new mathematics teacher. $\mathbb R$ stands for set of real numbers. I learned that using set notation, a domain can be written $\{X \in \mathbb R\;|\; 4\leq x\leq7\}.$ However, some students write $\{x\;|\;4\leq x\leq7\}$ or $\{x\;|\;x \in \mathbb R, 4\leq x\leq7\}$. Are they correct? For the domain of $|x|,$...
2021/10/28
[ "https://math.stackexchange.com/questions/4289588", "https://math.stackexchange.com", "https://math.stackexchange.com/users/985272/" ]
In most logics connectives with same precedence are associated to the right by default (see a recent [post](https://math.stackexchange.com/questions/4285935/propositional-logic-confused-on-using-operators-with-equal-precedence/4286148#4286148)), so we need to prove $(¬A ∨ ¬B) → ((C → A ∧ B)→ ¬C)$. I'll sketch a proof b...
Those are indeed your targets. So you need raise appropriate assumptions in subproofs aiming for them. The skeleton should look *something* like this (in Fitch style), but will depend somewhat on the rules implemented in your proof system. $$\def\fitch#1#2{~~~~\begin{array}{|l}#1\\\hline#2\end{array}} \fitch{}{\fitch{...
4,289,588
I am a new mathematics teacher. $\mathbb R$ stands for set of real numbers. I learned that using set notation, a domain can be written $\{X \in \mathbb R\;|\; 4\leq x\leq7\}.$ However, some students write $\{x\;|\;4\leq x\leq7\}$ or $\{x\;|\;x \in \mathbb R, 4\leq x\leq7\}$. Are they correct? For the domain of $|x|,$...
2021/10/28
[ "https://math.stackexchange.com/questions/4289588", "https://math.stackexchange.com", "https://math.stackexchange.com/users/985272/" ]
In most logics connectives with same precedence are associated to the right by default (see a recent [post](https://math.stackexchange.com/questions/4285935/propositional-logic-confused-on-using-operators-with-equal-precedence/4286148#4286148)), so we need to prove $(¬A ∨ ¬B) → ((C → A ∧ B)→ ¬C)$. I'll sketch a proof b...
Here's one way to do it, $$\begin{align} \neg A, C \to (A \wedge B), C &\vdash C &&\text{($\in$)}\\ \neg A, C \to (A \wedge B), C &\vdash C \to (A \wedge B) &&\text{($\in$)}\\ \neg A, C \to (A \wedge B), C &\vdash A \wedge B &&\text{($\to -$)}\\ \neg A, C \to (A \wedge B), C &\vdash A &&\text{($\wedge -$)}\\ \neg A, C ...
25,168,828
``` matches = [] done = [] for item in matches: dofunctioneveryloop() done.extent(item) dofunctiononce5min() ``` How can I execute dofunctiononce5min() inside this loop once 5 minute? This is backup to file function is this possible?
2014/08/06
[ "https://Stackoverflow.com/questions/25168828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Not sure I understood the question. I'll assume that you want this function to be executed only once every five minutes, no matter how often it is really called. This might be overkill, but why not use a [decorator](https://stackoverflow.com/q/5929107/1639625)? This will create a new function for the 'decorated' funct...
It is not recommended that you do this way. Perhaps the best approach could be to schedule it on operation system, and it run it task periodically. Anyway, if want to run a statement every x time, here is an example ``` import time for i in range(5): print i time.sleep(3) # seconds ``` Time as parameter sh...
25,168,828
``` matches = [] done = [] for item in matches: dofunctioneveryloop() done.extent(item) dofunctiononce5min() ``` How can I execute dofunctiononce5min() inside this loop once 5 minute? This is backup to file function is this possible?
2014/08/06
[ "https://Stackoverflow.com/questions/25168828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Not sure I understood the question. I'll assume that you want this function to be executed only once every five minutes, no matter how often it is really called. This might be overkill, but why not use a [decorator](https://stackoverflow.com/q/5929107/1639625)? This will create a new function for the 'decorated' funct...
Assuming the loop takes longer than five minutes, you could use time.time() to determine when 5 minutes has been up. ``` import time matches = [] done = [] starttime = time.time() for item in matches: dofunctioneveryloop() done.extent(item) if time.time() - starttime > 300: dofunctiononce5min()...
18,658,017
I've found a bottleneck in my app that keeps growing as data in my files grow (see attached screenshot of VisualVM below). Below is the `getFileContentsAsList` code. How can this be made better performance-wise? I've read several posts on efficient File I/O and some have suggested `Scanner` as a way to efficiently rea...
2013/09/06
[ "https://Stackoverflow.com/questions/18658017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1098361/" ]
The size of an ArrayList is multiplied by 1.5 when necessary. This is O(log(N)). (Doubling was used in Vector.) I would certainly use an O(1) LinkedList here, and BufferedReader.readLine() rather than a Scanner if I was trying to speed it up. It's hard to believe that the time to read one 8k file is seriously a concern...
`ArrayList`s have a good performance at reading and also on writing IF the lenth does not change very often. In your application the length changes very often (size is doubled, when it is full and an element is added) and your application needs to copy your array into an new, longer array. You could use a `LinkedList...
18,658,017
I've found a bottleneck in my app that keeps growing as data in my files grow (see attached screenshot of VisualVM below). Below is the `getFileContentsAsList` code. How can this be made better performance-wise? I've read several posts on efficient File I/O and some have suggested `Scanner` as a way to efficiently rea...
2013/09/06
[ "https://Stackoverflow.com/questions/18658017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1098361/" ]
So, file.io gets to be REAL expensive if you do it a lot...as seen in my screen shot and original code, `getFileContentsAsList`, which contains file.io calls, gets invoked quite a bit (18.425 times). VisualVM is a real gem of a tool to point out bottlenecks like these! After contemplating over various ways to improve ...
`ArrayList`s have a good performance at reading and also on writing IF the lenth does not change very often. In your application the length changes very often (size is doubled, when it is full and an element is added) and your application needs to copy your array into an new, longer array. You could use a `LinkedList...
18,658,017
I've found a bottleneck in my app that keeps growing as data in my files grow (see attached screenshot of VisualVM below). Below is the `getFileContentsAsList` code. How can this be made better performance-wise? I've read several posts on efficient File I/O and some have suggested `Scanner` as a way to efficiently rea...
2013/09/06
[ "https://Stackoverflow.com/questions/18658017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1098361/" ]
So, file.io gets to be REAL expensive if you do it a lot...as seen in my screen shot and original code, `getFileContentsAsList`, which contains file.io calls, gets invoked quite a bit (18.425 times). VisualVM is a real gem of a tool to point out bottlenecks like these! After contemplating over various ways to improve ...
The size of an ArrayList is multiplied by 1.5 when necessary. This is O(log(N)). (Doubling was used in Vector.) I would certainly use an O(1) LinkedList here, and BufferedReader.readLine() rather than a Scanner if I was trying to speed it up. It's hard to believe that the time to read one 8k file is seriously a concern...
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
Use a **[list comprehension](https://docs.python.org/3.4/tutorial/datastructures.html#list-comprehensions)** instead. ``` double_list = [ x*2 for x in n ] ``` Same result, four times shorter, a trillion times more readable. **[Because readability counts](https://www.python.org/dev/peps/pep-0020/)**.
1. Change the `return` statement so that it is not indented to be part of the `for` block. 2. Return the list instead of an item from the list. ``` def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x ```
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
Use a **[list comprehension](https://docs.python.org/3.4/tutorial/datastructures.html#list-comprehensions)** instead. ``` double_list = [ x*2 for x in n ] ``` Same result, four times shorter, a trillion times more readable. **[Because readability counts](https://www.python.org/dev/peps/pep-0020/)**.
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i]*=2 return x print double_list(n) ``` Try this.Returning the list, also check how we re-define variables with arithmetical operations.
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
Use a **[list comprehension](https://docs.python.org/3.4/tutorial/datastructures.html#list-comprehensions)** instead. ``` double_list = [ x*2 for x in n ] ``` Same result, four times shorter, a trillion times more readable. **[Because readability counts](https://www.python.org/dev/peps/pep-0020/)**.
``` n = [3, 5, 7] def double_list(x): t=[i*2 for i in x] return t print (double_list(n)) ``` Another short way for that.
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
Use a **[list comprehension](https://docs.python.org/3.4/tutorial/datastructures.html#list-comprehensions)** instead. ``` double_list = [ x*2 for x in n ] ``` Same result, four times shorter, a trillion times more readable. **[Because readability counts](https://www.python.org/dev/peps/pep-0020/)**.
to add to the options: ``` def double_list(x): return map(lambda num: num*2, x) print double_list([2, 3, 4]) ```
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
1. Change the `return` statement so that it is not indented to be part of the `for` block. 2. Return the list instead of an item from the list. ``` def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x ```
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i]*=2 return x print double_list(n) ``` Try this.Returning the list, also check how we re-define variables with arithmetical operations.
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
1. Change the `return` statement so that it is not indented to be part of the `for` block. 2. Return the list instead of an item from the list. ``` def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x ```
``` n = [3, 5, 7] def double_list(x): t=[i*2 for i in x] return t print (double_list(n)) ``` Another short way for that.
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
1. Change the `return` statement so that it is not indented to be part of the `for` block. 2. Return the list instead of an item from the list. ``` def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x ```
to add to the options: ``` def double_list(x): return map(lambda num: num*2, x) print double_list([2, 3, 4]) ```
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
``` n = [3, 5, 7] def double_list(x): t=[i*2 for i in x] return t print (double_list(n)) ``` Another short way for that.
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i]*=2 return x print double_list(n) ``` Try this.Returning the list, also check how we re-define variables with arithmetical operations.
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
to add to the options: ``` def double_list(x): return map(lambda num: num*2, x) print double_list([2, 3, 4]) ```
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i]*=2 return x print double_list(n) ``` Try this.Returning the list, also check how we re-define variables with arithmetical operations.
27,683,312
``` n = [3, 5, 7] def double_list(x): for i in range(0, len(x)): x[i] = x[i] * 2 return x[i] print double_list(n) ``` For some reason this python script is only returning the first item in the list instead of all three when it runs... Can someone please help me?!
2014/12/29
[ "https://Stackoverflow.com/questions/27683312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4401036/" ]
``` n = [3, 5, 7] def double_list(x): t=[i*2 for i in x] return t print (double_list(n)) ``` Another short way for that.
to add to the options: ``` def double_list(x): return map(lambda num: num*2, x) print double_list([2, 3, 4]) ```
19,353,156
In general, what is the performance cost of an equality comparison between two STL container iterators? I'm only talking about defined operations; that is, comparing two iterators referring to the same object. My specific use-case is that I have a `std::map` that could potentially have very large elements, lots of ele...
2013/10/14
[ "https://Stackoverflow.com/questions/19353156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1830736/" ]
Generally, the *performance* of comparing two iterators depends on the implementation of the STL. However, concerning the *time complexity*, the C++ standard imposes the restriction that comparison of input iterators (and thus forward iterators, bidirectional iterators and random access iterators) takes amortized cons...
Most of STL containers `operator==()` is just raw pointer comparison. Which is meaningless unless it's for boundaries checking. More over, if you are comparing iterators from different containers - it's undefined behaviour. If you override this operator or use external comparison function, perfomance depends on how la...
19,353,156
In general, what is the performance cost of an equality comparison between two STL container iterators? I'm only talking about defined operations; that is, comparing two iterators referring to the same object. My specific use-case is that I have a `std::map` that could potentially have very large elements, lots of ele...
2013/10/14
[ "https://Stackoverflow.com/questions/19353156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1830736/" ]
The [**draft Standard**](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3691.pdf) states that iterator operations are [**amortized constant time**](https://stackoverflow.com/q/200384/819272) **24.2.1 In general [iterator.requirements.general]** > > 8 All the categories of iterators require only those funct...
Most of STL containers `operator==()` is just raw pointer comparison. Which is meaningless unless it's for boundaries checking. More over, if you are comparing iterators from different containers - it's undefined behaviour. If you override this operator or use external comparison function, perfomance depends on how la...
19,709,651
I would like to automate my hive script every day , in order to do that i have an option which is data pipeline. But the problem is there that i am exporting data from dynamo-db to s3 and with a hive script i am manipulating this data. I am giving this input and output in hive-script that's where the problem starts bec...
2013/10/31
[ "https://Stackoverflow.com/questions/19709651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2834892/" ]
You can disable staging on Hive Activity to run any arbitrary Hive Script. ``` stage = false ``` Do something like: ``` { "name": "DefaultActivity1", "id": "ActivityId_1", "type": "HiveActivity", "stage": "false", "scriptUri": "s3://baucket/query.hql", "scriptVariable": [ "param1=value1", "param...
Another alternative to the Hive Activity, is to use an EMR activity as in the following example: ``` { "schedule": { "ref": "DefaultSchedule" }, "name": "EMR Activity name", "step": "command-runner.jar,hive-script,--run-hive-script,--args,-f,s3://bucket/path/query.hql", "runsOn": ...
38,218,952
I am fairly new to the program being used which is MimicView Gambit. From what I know it mimics a node/switch/router to simulate real time activity. What I need to do is using a SNMP walk results to somehow import the .wlk file into mimicview as an agent. An agent is referred to as the node/switch/router. Does anyone...
2016/07/06
[ "https://Stackoverflow.com/questions/38218952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6555015/" ]
Thanks for the question. The quickest answer will come from `support@gambitcomm.com`. The simplest way to create a simulation is to record the device directly, for example, see this [Youtube video](https://www.youtube.com/watch?v=-KctvDus7KU "video"). If you have a walkfile, you can use Simulation->Record File in MI...
I had never heard before about MimicView, but I'm working on similar project. So fast view via Mimic's FAQ seems to give the [answer](http://www.gambitcomm.com/faq/#walkfile). In short, as far as I understand you have to write file using net-snmp `snmpwalk` command with option `-One`, like ``` snmpwalk -One -v2c -cpu...
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes. The function prototype for `free` is even: ``` void free(void *ptr); ```
Yes, but normally it's a sign of poor design. malloc() is typically used to allocate buffers (large arrays of the same primitive type) or objects (structs with fields initialised). In both cases, the malloc and the free should match so, ``` unsigned char *rgba_buffer = malloc(width * height * 4); /* Use the buffe...
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes, it's safe. When allocating memory, the runtime library keeps track of the size of each allocation. When you call free(), it looks up the address, and if it finds an allocation for that address, the correct amount of memory is freed (the block that was allocated at that address).
In C it is perfectly safe, because there are no destructors to call. The memory system keeps track of the size of allocations. In C++ you must delete the same type you *new*, including using the `delete[]` operator to delete new'ed arrays. This is just to make sure destructors are called.
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes. malloc returns `void *` and free takes `void *`, so some of your casts are meaningless, and you're always freeing a `void *` even if you're starting with some other sort of pointer.
yes it is safe.
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes -- `free` takes a pointer to void, so when you call it, the pointer is (implicitly) cast to a pointer to void in any case. The rest of your code isn't quite so safe: ``` void* p = (void*)malloc(sizeof(foo)); ``` You should *not* cast the return from malloc (in C). This can cover up the mistake of forgetting to ...
In C it is perfectly safe, because there are no destructors to call. The memory system keeps track of the size of allocations. In C++ you must delete the same type you *new*, including using the `delete[]` operator to delete new'ed arrays. This is just to make sure destructors are called.
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes, it's safe. When allocating memory, the runtime library keeps track of the size of each allocation. When you call free(), it looks up the address, and if it finds an allocation for that address, the correct amount of memory is freed (the block that was allocated at that address).
Yes, but normally it's a sign of poor design. malloc() is typically used to allocate buffers (large arrays of the same primitive type) or objects (structs with fields initialised). In both cases, the malloc and the free should match so, ``` unsigned char *rgba_buffer = malloc(width * height * 4); /* Use the buffe...
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes. malloc returns `void *` and free takes `void *`, so some of your casts are meaningless, and you're always freeing a `void *` even if you're starting with some other sort of pointer.
Perhaps it doesn't *feel* safe because of the magic happening behind the scenes. The C runtime and/or the OS itself is actively tracking the memory returned by malloc including its size and location. See though it feels like you are passing a typeless pointer back to free(), you in fact passing back a reference to an o...
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes, it's safe. When allocating memory, the runtime library keeps track of the size of each allocation. When you call free(), it looks up the address, and if it finds an allocation for that address, the correct amount of memory is freed (the block that was allocated at that address).
yes it is safe.
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes -- `free` takes a pointer to void, so when you call it, the pointer is (implicitly) cast to a pointer to void in any case. The rest of your code isn't quite so safe: ``` void* p = (void*)malloc(sizeof(foo)); ``` You should *not* cast the return from malloc (in C). This can cover up the mistake of forgetting to ...
yes it is safe.
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes. malloc returns `void *` and free takes `void *`, so some of your casts are meaningless, and you're always freeing a `void *` even if you're starting with some other sort of pointer.
Yes, but normally it's a sign of poor design. malloc() is typically used to allocate buffers (large arrays of the same primitive type) or objects (structs with fields initialised). In both cases, the malloc and the free should match so, ``` unsigned char *rgba_buffer = malloc(width * height * 4); /* Use the buffe...
2,182,103
Consider: ``` struct foo { int a; int b; }; void* p = (void*)malloc(sizeof(struct foo)); ((foo*)p)->a; // Do something. free(p); // Is this safe? ```
2010/02/02
[ "https://Stackoverflow.com/questions/2182103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208397/" ]
Yes, it's safe. When allocating memory, the runtime library keeps track of the size of each allocation. When you call free(), it looks up the address, and if it finds an allocation for that address, the correct amount of memory is freed (the block that was allocated at that address).
Yes -- `free` takes a pointer to void, so when you call it, the pointer is (implicitly) cast to a pointer to void in any case. The rest of your code isn't quite so safe: ``` void* p = (void*)malloc(sizeof(foo)); ``` You should *not* cast the return from malloc (in C). This can cover up the mistake of forgetting to ...
26,879,981
I wanted to try out the python BytesIO class. As an experiment I tried writing to a zip file in memory, and then reading the bytes back out of that zip file. So instead of passing in a file-object to `gzip`, I pass in a `BytesIO` object. Here is the entire script: ``` from io import BytesIO import gzip # write bytes...
2014/11/12
[ "https://Stackoverflow.com/questions/26879981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2213647/" ]
You need to [`seek`](https://docs.python.org/3/library/io.html#io.IOBase.seek) back to the beginning of the file after writing the initial in memory file... ``` myio.seek(0) ```
How about we write and read gzip content in the same context like this? ``` #!/usr/bin/env python from io import BytesIO import gzip content = b"does it work" # write bytes to zip file in memory gzipped_content = None with BytesIO() as myio: with gzip.GzipFile(fileobj=myio, mode='wb') as g: g.write(cont...
26,879,981
I wanted to try out the python BytesIO class. As an experiment I tried writing to a zip file in memory, and then reading the bytes back out of that zip file. So instead of passing in a file-object to `gzip`, I pass in a `BytesIO` object. Here is the entire script: ``` from io import BytesIO import gzip # write bytes...
2014/11/12
[ "https://Stackoverflow.com/questions/26879981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2213647/" ]
You need to [`seek`](https://docs.python.org/3/library/io.html#io.IOBase.seek) back to the beginning of the file after writing the initial in memory file... ``` myio.seek(0) ```
`myio.getvalue()` is an alternative to `seek` that *returns the bytes containing the entire contents of the buffer* ([docs](https://docs.python.org/3/library/io.html#io.BytesIO.getvalue)). It worked for me after facing a similar issue.
26,879,981
I wanted to try out the python BytesIO class. As an experiment I tried writing to a zip file in memory, and then reading the bytes back out of that zip file. So instead of passing in a file-object to `gzip`, I pass in a `BytesIO` object. Here is the entire script: ``` from io import BytesIO import gzip # write bytes...
2014/11/12
[ "https://Stackoverflow.com/questions/26879981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2213647/" ]
How about we write and read gzip content in the same context like this? ``` #!/usr/bin/env python from io import BytesIO import gzip content = b"does it work" # write bytes to zip file in memory gzipped_content = None with BytesIO() as myio: with gzip.GzipFile(fileobj=myio, mode='wb') as g: g.write(cont...
`myio.getvalue()` is an alternative to `seek` that *returns the bytes containing the entire contents of the buffer* ([docs](https://docs.python.org/3/library/io.html#io.BytesIO.getvalue)). It worked for me after facing a similar issue.
52,171,760
Suppose I do the following: ``` $ echo {10..20} 10 11 12 13 14 15 16 17 18 19 20 $ A=10 $ B=20 $ echo {${A}..${B}} {10..20} ``` Why does this not expand as it did the first time? I am trying to set up a "for" loop in a script: ``` for i in {10..20} do echo ${i} done 10 11 12 13 14 15 16 17 18 19 20 ``` But i...
2018/09/04
[ "https://Stackoverflow.com/questions/52171760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3366758/" ]
It does not expand by definition. Taken from the bash manual: > > A sequence expression takes the form {x..y[..incr]}, where x and y are > either integers or single characters, and incr, an optional increment, > is an integer. > > > And > > Brace expansion is performed before any other expansions, and any > ...
Try: ``` for ((i=A; i<=B; i++)) ; do echo $i done ```
64,777,280
I'm making an app in JS with Node.js. I'm trying to use the async/await function. When I execute the code below, the first time that I make a get request it gives to me an empty array, if I make a second get request, it gives to me the array fully. Why did this happen? ``` var sql = `SELECT * FROM Pietanza`; ...
2020/11/10
[ "https://Stackoverflow.com/questions/64777280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13511892/" ]
You are mixing `async/await` and callbacks. That won't work, because `await` won't wait for callbacks to finish. If you want to do it with `await` the syntax is roughly as follows (assuming the database package supports promises) ``` try { let outerresult = await db.query(outersql); ... for (let row of outerres...
It's due to the nature of the **async** request you're making. async requests will run whenever they can run, so you need to wait for them to return their values before you can use them (e.g. to loop through them and display them)
64,777,280
I'm making an app in JS with Node.js. I'm trying to use the async/await function. When I execute the code below, the first time that I make a get request it gives to me an empty array, if I make a second get request, it gives to me the array fully. Why did this happen? ``` var sql = `SELECT * FROM Pietanza`; ...
2020/11/10
[ "https://Stackoverflow.com/questions/64777280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13511892/" ]
The problem is that `db.query` is asynchronous, but since you're using callbacks, it's unlikely that it's returning Promises, so await won't do what you're expecting. If you want to use `await`, you may have to adapt this API. ``` const query = sql => new Promise((resolve, reject) => { db.query(sql, (error, result, ...
It's due to the nature of the **async** request you're making. async requests will run whenever they can run, so you need to wait for them to return their values before you can use them (e.g. to loop through them and display them)
53,229,448
I had created a static variable to save app context since I was going to use it at other places in the class. This variable was getting assigned in the constructor of the class and I was getting the following error - "Do not place Android context classes in static fields (static reference to MyClass which has field app...
2018/11/09
[ "https://Stackoverflow.com/questions/53229448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/697033/" ]
You need to call the `get()` method on the `WeakReference<Context>` in order to extrapolate the `Context` value. `WeakReference<Context>` has no `getPackageManager()` method, that's why you're getting that error.
The whole "context" thing really makes it hard to do layering in Android. Without seeing the class you are trying to access, it is hard to say for certain but one option is to make all the functions static and call them with the context from your other classes. You can pass context to a static function and use it wi...
925,225
I'm new to JQuery In my App, I have some 5 divs. While clicking any one of the div, I want to check whether any other divs have been clicked before Actually in my code I have ``` Text Textarea Dropdown ``` while clicking on Text/textarea/dropdown for the first time (i.e. I need to check whether any of the others i...
2009/05/29
[ "https://Stackoverflow.com/questions/925225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/79980/" ]
Just track it in a variable. The example assumes that "clicked" is defined something (a closure that generates the event handler function would be good) and initilised to a value of "0" or other non-true value. ``` if (clicked) { a(); } else { b(); } clicked = 1; ```
I don't know what exactly you are trying to do. But one possible solution could be to define new attribute for each div, let say "was\_clicked" and when you can do the following: ``` div.click( function(event) { if ( $( "div[was_clicked=true]").length > 0) // some of the div was clicked // you can iterate over...
13,981,621
I have a program that sets proxy settings and it has worked through prior versions of Windows until Windows 8 and IE 10. It sets the keys below. In Windows 8, other browsers (like firefox) recognize the change and use the proxy settings. For IE 10, the global policy goes into effect (settings greyed out) but not the pr...
2012/12/20
[ "https://Stackoverflow.com/questions/13981621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1389528/" ]
[HKEY\_LOCAL\_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxySettingsPerUser"=dword:00000000
Create a .reg file containing your proxy settings for your users. Create a batch file setting it to setting it to run the .reg file with the extension /s On a server using a logon script, tell the logon to run the batch file. Jason
13,981,621
I have a program that sets proxy settings and it has worked through prior versions of Windows until Windows 8 and IE 10. It sets the keys below. In Windows 8, other browsers (like firefox) recognize the change and use the proxy settings. For IE 10, the global policy goes into effect (settings greyed out) but not the pr...
2012/12/20
[ "https://Stackoverflow.com/questions/13981621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1389528/" ]
[HKEY\_LOCAL\_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings] "ProxySettingsPerUser"=dword:00000000
TRY HKEY\_LOCAL\_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings EnableAutoProxyResultCache = dword: 0
2,619,207
is $$(\frac{\partial P}{\partial T})^2=\frac{\partial^2P}{\partial T ^2}$$ holds? thank you
2018/01/24
[ "https://math.stackexchange.com/questions/2619207", "https://math.stackexchange.com", "https://math.stackexchange.com/users/114138/" ]
That equality does not hold; their perceived similarity comes from notation alone. The $^2$ in the RHS refers to the fact that it's a *second* derivative. $$(\frac{\partial P}{\partial T})^2=\frac{\partial P}{\partial T}\cdot\frac{\partial P}{\partial T}$$ and $$\frac{\partial^2P}{\partial T ^2} = \frac{\partial}{\p...
No. Counterexample: $P(T)=T$ $$ \left(\frac{\partial P}{\partial T}\right)^2=1\neq 0=\frac{\partial^2P}{\partial T^2}. $$
2,619,207
is $$(\frac{\partial P}{\partial T})^2=\frac{\partial^2P}{\partial T ^2}$$ holds? thank you
2018/01/24
[ "https://math.stackexchange.com/questions/2619207", "https://math.stackexchange.com", "https://math.stackexchange.com/users/114138/" ]
That equality does not hold; their perceived similarity comes from notation alone. The $^2$ in the RHS refers to the fact that it's a *second* derivative. $$(\frac{\partial P}{\partial T})^2=\frac{\partial P}{\partial T}\cdot\frac{\partial P}{\partial T}$$ and $$\frac{\partial^2P}{\partial T ^2} = \frac{\partial}{\p...
No. $\dfrac{\partial^2P}{\partial T^2}\;$ is denoted with the ewponent at a different place in the numerator and the denominator because it is a contraction for $$\dfrac{\partial }{\partial T}\biggl(\dfrac{\partial }{\partial T}\biggr)(P). $$ For functions of a single variable, equality would mean that $$f''=(f')^2, $...
2,619,207
is $$(\frac{\partial P}{\partial T})^2=\frac{\partial^2P}{\partial T ^2}$$ holds? thank you
2018/01/24
[ "https://math.stackexchange.com/questions/2619207", "https://math.stackexchange.com", "https://math.stackexchange.com/users/114138/" ]
That equality does not hold; their perceived similarity comes from notation alone. The $^2$ in the RHS refers to the fact that it's a *second* derivative. $$(\frac{\partial P}{\partial T})^2=\frac{\partial P}{\partial T}\cdot\frac{\partial P}{\partial T}$$ and $$\frac{\partial^2P}{\partial T ^2} = \frac{\partial}{\p...
No. For example, let $P(T,V)=aT+bV$... Then $\frac {\partial P} {\partial T}=A$, so $(\frac {\partial P} {\partial T})^2=a^2$, but $\frac {\partial ^2 P}{\partial T ^2}=0$...
28,386,890
Has anyone successfully set up VSO & Jenkins & TFS? Server URL: `https://<myproject>.visualstudio.com/DefaultCollection` Login name and user password (using alternative credentials) What domain name did you use? `<domain>\username` If I run the tf command in Command Prompt, it succeeds, but Jenkins shows the same c...
2015/02/07
[ "https://Stackoverflow.com/questions/28386890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3653785/" ]
This is an answer, but may not be what you want to hear. This used to work for us about a year ago. It required someone to stay logged into VisualStudio.com with his MSDN credentials on the build server. Then we simply didn't use credentials in the Jenkins TFS plug-in. Then one day, that simply stopped working. We trie...
You need to configure Jenkins yo use the alternate credentials. It will not work with any other configuration and the credentials are never stored. Every command that you pass must include the same creds.
28,386,890
Has anyone successfully set up VSO & Jenkins & TFS? Server URL: `https://<myproject>.visualstudio.com/DefaultCollection` Login name and user password (using alternative credentials) What domain name did you use? `<domain>\username` If I run the tf command in Command Prompt, it succeeds, but Jenkins shows the same c...
2015/02/07
[ "https://Stackoverflow.com/questions/28386890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3653785/" ]
With the release of [version 4.0.0](https://github.com/jenkinsci/tfs-plugin/releases/tag/tfs-4.0.0 "Release notes on GitHub") of the [Jenkins Team Foundation Server plugin](https://wiki.jenkins-ci.org/display/JENKINS/Team+Foundation+Server+Plugin "TFS plugin wiki page"), Team Foundation Version Control (TFVC) from Visu...
You need to configure Jenkins yo use the alternate credentials. It will not work with any other configuration and the credentials are never stored. Every command that you pass must include the same creds.
28,386,890
Has anyone successfully set up VSO & Jenkins & TFS? Server URL: `https://<myproject>.visualstudio.com/DefaultCollection` Login name and user password (using alternative credentials) What domain name did you use? `<domain>\username` If I run the tf command in Command Prompt, it succeeds, but Jenkins shows the same c...
2015/02/07
[ "https://Stackoverflow.com/questions/28386890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3653785/" ]
With the release of [version 4.0.0](https://github.com/jenkinsci/tfs-plugin/releases/tag/tfs-4.0.0 "Release notes on GitHub") of the [Jenkins Team Foundation Server plugin](https://wiki.jenkins-ci.org/display/JENKINS/Team+Foundation+Server+Plugin "TFS plugin wiki page"), Team Foundation Version Control (TFVC) from Visu...
This is an answer, but may not be what you want to hear. This used to work for us about a year ago. It required someone to stay logged into VisualStudio.com with his MSDN credentials on the build server. Then we simply didn't use credentials in the Jenkins TFS plug-in. Then one day, that simply stopped working. We trie...