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
36,928
Recent exchange here got me thinking. Nagarjuna's karika, 1.[3](https://pdfs.semanticscholar.org/6fdf/0f7fba9abd29f4151ea20673e21e072463d2.pdf) ([Batchelor](https://www.stephenbatchelor.org/index.php/en/verses-from-the-center)) > > [Na hi svabhāvo bhāvānāṃ pratyayādiṣu vidyate](https://wikisource.org/wiki/M%C5%ABlam...
2020/02/05
[ "https://buddhism.stackexchange.com/questions/36928", "https://buddhism.stackexchange.com", "https://buddhism.stackexchange.com/users/-1/" ]
That is a highly eccentric use of analytic and empirical, that can only cause confusion. Analytic truth typically means truth by definition, or from definition. Empirical, from observation, or events. Both depend on causes and conditions, and their results lack inherent nature. > > "To think ‘it is,’ is eternalism, >...
> > I've asked a question about philosophical reasoning from this phrase. > Suffice to say I was wondering if it can be read as an argument for a > karmically conditioned rebirth > > > Its the opposite. When there is no essence of things nor in conditions, there can be no "rebirth".
36,928
Recent exchange here got me thinking. Nagarjuna's karika, 1.[3](https://pdfs.semanticscholar.org/6fdf/0f7fba9abd29f4151ea20673e21e072463d2.pdf) ([Batchelor](https://www.stephenbatchelor.org/index.php/en/verses-from-the-center)) > > [Na hi svabhāvo bhāvānāṃ pratyayādiṣu vidyate](https://wikisource.org/wiki/M%C5%ABlam...
2020/02/05
[ "https://buddhism.stackexchange.com/questions/36928", "https://buddhism.stackexchange.com", "https://buddhism.stackexchange.com/users/-1/" ]
Subtleties... The *concept* of emptiness is a mental object that is predicated on other things. We only get to the *concept* of emptiness by seeing through and negating the *fullness* (meaningfulness) of other concepts. The experience of emptiness in not predicated on the concept of it. To experience emptiness is to s...
don't think too much :). `The essence of things does not exist in conditions and so on.` It simply means "there is no `self` or `eternal-self` **within** and **behind** causes & conditions". For eg. sometimes when a meditator `sees` everything with non-existence(wave nature) eye, perception of `there is nothing` ...
36,928
Recent exchange here got me thinking. Nagarjuna's karika, 1.[3](https://pdfs.semanticscholar.org/6fdf/0f7fba9abd29f4151ea20673e21e072463d2.pdf) ([Batchelor](https://www.stephenbatchelor.org/index.php/en/verses-from-the-center)) > > [Na hi svabhāvo bhāvānāṃ pratyayādiṣu vidyate](https://wikisource.org/wiki/M%C5%ABlam...
2020/02/05
[ "https://buddhism.stackexchange.com/questions/36928", "https://buddhism.stackexchange.com", "https://buddhism.stackexchange.com/users/-1/" ]
Subtleties... The *concept* of emptiness is a mental object that is predicated on other things. We only get to the *concept* of emptiness by seeing through and negating the *fullness* (meaningfulness) of other concepts. The experience of emptiness in not predicated on the concept of it. To experience emptiness is to s...
I presume you equate emptiness with analysis because on analysis things are empty, and non-emptiness with 'empirical' because to our senses things are non-empty. Is that it? Thus our senses lead us into naive realism, while analysis leads us out again. The complication would be experience, which some folk classify a...
36,928
Recent exchange here got me thinking. Nagarjuna's karika, 1.[3](https://pdfs.semanticscholar.org/6fdf/0f7fba9abd29f4151ea20673e21e072463d2.pdf) ([Batchelor](https://www.stephenbatchelor.org/index.php/en/verses-from-the-center)) > > [Na hi svabhāvo bhāvānāṃ pratyayādiṣu vidyate](https://wikisource.org/wiki/M%C5%ABlam...
2020/02/05
[ "https://buddhism.stackexchange.com/questions/36928", "https://buddhism.stackexchange.com", "https://buddhism.stackexchange.com/users/-1/" ]
Subtleties... The *concept* of emptiness is a mental object that is predicated on other things. We only get to the *concept* of emptiness by seeing through and negating the *fullness* (meaningfulness) of other concepts. The experience of emptiness in not predicated on the concept of it. To experience emptiness is to s...
The argument -- for karma -- is that causes have essences in the exact same way as they bring about their effects > > The essence of things does not exist in conditions and so on... Since there is no effect, what could [be its] non-conditions or conditions? > > > One answer -- to the rhetorical question -- is tha...
36,928
Recent exchange here got me thinking. Nagarjuna's karika, 1.[3](https://pdfs.semanticscholar.org/6fdf/0f7fba9abd29f4151ea20673e21e072463d2.pdf) ([Batchelor](https://www.stephenbatchelor.org/index.php/en/verses-from-the-center)) > > [Na hi svabhāvo bhāvānāṃ pratyayādiṣu vidyate](https://wikisource.org/wiki/M%C5%ABlam...
2020/02/05
[ "https://buddhism.stackexchange.com/questions/36928", "https://buddhism.stackexchange.com", "https://buddhism.stackexchange.com/users/-1/" ]
Subtleties... The *concept* of emptiness is a mental object that is predicated on other things. We only get to the *concept* of emptiness by seeing through and negating the *fullness* (meaningfulness) of other concepts. The experience of emptiness in not predicated on the concept of it. To experience emptiness is to s...
That is a highly eccentric use of analytic and empirical, that can only cause confusion. Analytic truth typically means truth by definition, or from definition. Empirical, from observation, or events. Both depend on causes and conditions, and their results lack inherent nature. > > "To think ‘it is,’ is eternalism, >...
2,553,241
Currently I use a .htaccess redirect to send a (nice) url **/offices/london/whatever** to my script (nasty url) **/db/db.pl?offices-london-whatever** i want the browser url to be nice, with the 301 redirect it isn't so i tried with the RewriteRule but the browser url is still the nasty one. e.g. RewriteRule Offices/L...
2010/03/31
[ "https://Stackoverflow.com/questions/2553241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/306040/" ]
Files that your HTML point to (CSS, JS, links) are searched relative to the document's path. E.g. if your document's URL is `http://localhost/foo/testpage.html`, in this case you must put mentioned `base.js` in `http://localhost/foo/o3djs/`, etc. So, if your localhost is at C:\Server (assuming you use some Windows-lik...
Also make sure you include all the other files needed by the API, most of them can be found here: <http://o3d.googlecode.com/svn/trunk/samples_webgl/o3djs/>
6,143,929
How do I configure Logback to ignore logging on exceptions of a particular type?
2011/05/26
[ "https://Stackoverflow.com/questions/6143929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20774/" ]
You can do it with a simple `EvaluatorFilter`: ``` <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <evaluator> <expression>java.lang.RuntimeException.class.isInstance(throwable)</expression> </evaluator> <onMatch>DENY</onMatch> </filter> ``` Please note that you need the following dep...
This question is 5 years old, but I'm supplying the solution I found just to keep it up to date. I found a solution in the offical docs: <http://logback.qos.ch/manual/layouts.html> For my particular situation, which is a 17 year old web site running plain old servlets (ah, the days), the servlet is now throwing an ex...
6,143,929
How do I configure Logback to ignore logging on exceptions of a particular type?
2011/05/26
[ "https://Stackoverflow.com/questions/6143929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20774/" ]
You can do it with a simple `EvaluatorFilter`: ``` <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <evaluator> <expression>java.lang.RuntimeException.class.isInstance(throwable)</expression> </evaluator> <onMatch>DENY</onMatch> </filter> ``` Please note that you need the following dep...
This is an additional example of the response of [@palacsint](https://stackoverflow.com/a/7368873/984838) that apply when the error is not an exception using [JaninoEventEvaluator](https://logback.qos.ch/manual/filters.html#JaninoEventEvaluator): ```xml <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <ev...
6,143,929
How do I configure Logback to ignore logging on exceptions of a particular type?
2011/05/26
[ "https://Stackoverflow.com/questions/6143929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20774/" ]
This question is 5 years old, but I'm supplying the solution I found just to keep it up to date. I found a solution in the offical docs: <http://logback.qos.ch/manual/layouts.html> For my particular situation, which is a 17 year old web site running plain old servlets (ah, the days), the servlet is now throwing an ex...
This is an additional example of the response of [@palacsint](https://stackoverflow.com/a/7368873/984838) that apply when the error is not an exception using [JaninoEventEvaluator](https://logback.qos.ch/manual/filters.html#JaninoEventEvaluator): ```xml <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <ev...
144,353
I was wondering are there exist any restrictions as to what kind of research can be published. In particular, are there any laws in place that require certain published works to be removed from the public record? It seems fairly odd that you see a dozen negative studies on acts which are illegal, but not a single posi...
2020/02/18
[ "https://academia.stackexchange.com/questions/144353", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/119562/" ]
The existing answers already correctly state that there are of course things that you are not allowed to publish on, period - for example state secrets, or national security related research. Depending on how strict you are about the word "allowed" some industrial research that is covered by a Non-Disclosure Agreement ...
> > are there...any restrictions [on] what...research can be published. > > > Yes. For example, national security laws restrict the publication of certain works and legality of human/animal experimentation restrict others.
49,210,523
I need to know if it's possible to create a UI for my Python application. I created a very simple programm that you can see ***[here](https://github.com/feRpicoral/Biologia)*** and i would like to create a UI, so the user can use it like a "real program", not only in CMD/Python Shell. And another thing: to the user be...
2018/03/10
[ "https://Stackoverflow.com/questions/49210523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9436943/" ]
Tkinter or GTK are both very good. I also recommend using Glade <https://glade.gnome.org/> as a GUI designer with GTK
On the Python Bytes podcast they've dedicated a few recent episodes to discussing the state of Python GUI frameworks starting from [episode 62](https://pythonbytes.fm/episodes/show/62/wooey-and-gooey-are-simple-python-guis). I suggest you give them a listen to get an overview and determine what's most useful to you.
49,210,523
I need to know if it's possible to create a UI for my Python application. I created a very simple programm that you can see ***[here](https://github.com/feRpicoral/Biologia)*** and i would like to create a UI, so the user can use it like a "real program", not only in CMD/Python Shell. And another thing: to the user be...
2018/03/10
[ "https://Stackoverflow.com/questions/49210523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9436943/" ]
Tkinter or GTK are both very good. I also recommend using Glade <https://glade.gnome.org/> as a GUI designer with GTK
Tkinter is an inbuilt GUI module for python. Your computer is likely to be suspicious of any file not from a verified publisher.
53,467,232
I want to change the name of the form field from Page[body] to body lets say. Following is the code for WYSIWYG editor. ``` <?php echo $form->field($model, 'body')->widget( \yii\imperavi\Widget::className(), [ 'plugins' => ['fontcolor', 'video'], ...
2018/11/25
[ "https://Stackoverflow.com/questions/53467232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2787203/" ]
You are clearing the items in each time.You need to move clear out of the loop ``` lstAvailableTrains.Items.Clear(); foreach (string line in lines) { if (line.Contains(stringToSearch)) { lstAvailableTrains.Items.Add(line); } } ```
Use LINQ, and set the ListBox's `ItemsSource` property: ``` using System.Linq; ... lstAvailableTrains.ItemsSource = File.ReadAllLines("pathway").Where(line => line.Contains(stringToSearch)); ```
602,027
I have a floating solar pump with panels putting out 30 volts and 360 watts. The meter shows 30 volts at the pump end but as soon as I connect the 24 volt pump it drops to 3 volts and obviously doesn’t work. It’s not the pump as I have tested it on batteries and it works fine. Can anyone tell me what’s happening, maybe...
2021/12/28
[ "https://electronics.stackexchange.com/questions/602027", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/304017/" ]
You didn't mention your load but try to measure the current flow. If there is no voltage drop anywhere in your system, it's because of your load. In theory, 1. ``` W = I * V ``` 2. ``` 360 = I * 30 => I = 12A (Max at fully charged state) ``` 3. ``` 360 = I * 24 => Iload = 15A ``` 4. ``` 360 = I * 3 => Iload = 120A...
The batteries connected to the end of solar system might not be charged fully! Your meters gave out 30V is not real,it was in floating state. The panel to convert sunlight to electric needs time.
602,027
I have a floating solar pump with panels putting out 30 volts and 360 watts. The meter shows 30 volts at the pump end but as soon as I connect the 24 volt pump it drops to 3 volts and obviously doesn’t work. It’s not the pump as I have tested it on batteries and it works fine. Can anyone tell me what’s happening, maybe...
2021/12/28
[ "https://electronics.stackexchange.com/questions/602027", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/304017/" ]
You didn't mention your load but try to measure the current flow. If there is no voltage drop anywhere in your system, it's because of your load. In theory, 1. ``` W = I * V ``` 2. ``` 360 = I * 30 => I = 12A (Max at fully charged state) ``` 3. ``` 360 = I * 24 => Iload = 15A ``` 4. ``` 360 = I * 3 => Iload = 120A...
Assuming that the solar panels were designed as a package with the pump, the panels should be operating at about 24V when connected to the pump. The collapse of the loaded voltage indicates (normally) that the panel, or part of the panel, is shaded, and can't supply the current required. Abnormally, collapse of the vo...
63,947,684
I am querying some data from the database, and my code looks as below ``` select a.id a.party a.date a.name a.revenue b.company c.cost from a left join b on a.id = b.id left join c on a.id = c.id where a.party = 'cat' and a.date > '2000-01-01' ``` I got a returned table but the table has duplicated rows. Is there ...
2020/09/18
[ "https://Stackoverflow.com/questions/63947684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14198394/" ]
SQL Server has two functions, depending on whether you want a string or a number: ``` [datepart(weekday, col)][1] [datename(weekday, col)][1] ``` You can also use `format()` with the `'dddd'` specification: ``` format(col, 'dddd') ``` This is convenient, because `'ddd'` gives you a three-letter abbreviation. And ...
use `datename` instead of `datepart` with the same parameters to get the name instead of the number
63,947,684
I am querying some data from the database, and my code looks as below ``` select a.id a.party a.date a.name a.revenue b.company c.cost from a left join b on a.id = b.id left join c on a.id = c.id where a.party = 'cat' and a.date > '2000-01-01' ``` I got a returned table but the table has duplicated rows. Is there ...
2020/09/18
[ "https://Stackoverflow.com/questions/63947684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14198394/" ]
SQL Server has two functions, depending on whether you want a string or a number: ``` [datepart(weekday, col)][1] [datename(weekday, col)][1] ``` You can also use `format()` with the `'dddd'` specification: ``` format(col, 'dddd') ``` This is convenient, because `'ddd'` gives you a three-letter abbreviation. And ...
Below should do. The parameter should be slightly different from `datepart`. Use `W` instead of `week` ``` select datename(W, '2020-02-02' ) ```
8,266,673
Ineed to play a short MP4 video on my android app I'm searching info about how to load mp4 videos but i can't find the way to do it on Android 1.5. My app sould be compatible from Android 1.5 to 4.0 I tryed with a lot of tutorials from google, from stackoverflow, from android developers groups, etc.., but i can't make...
2011/11/25
[ "https://Stackoverflow.com/questions/8266673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/479886/" ]
use this link <http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/MediaPlayerDemo_Video.html> ``` path = "/mnt/sdcard/file.mp4"; ``` it will work fine.
@AndroidUser99 you need to use following thing to work mp4 and other in android. 1:[Rockpler free coder may use for android](http://rockplayer.freecoder.org/index_en.html) 2:[android ffmpeg](https://github.com/halfninja/android-ffmpeg-x264) 3:[some SO Question for ffmpeg](https://stackoverflow.com/questions/4725773/...
32,187,352
I have a tree of objects composed with the following structure: ``` interface Node { name: string; children?: Node[]; } ``` Where, for example, `{ name: "foo", children: [ { name: "bar" } ] }` is a valid tree. I'm trying to get the address of an arbitrary node, that can be a leaf, returned as an array of the pat...
2015/08/24
[ "https://Stackoverflow.com/questions/32187352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3825483/" ]
Trying to keep track of the path in a locally-scoped variable won't work as each recursive call creates a new scope. Assuming you want something very similar what you have already, a fairly small change is to make the lookup path of indices be the return value from the method. The base case of the recursive call (when ...
I wrapped the `data` in an array. For all nodes, you may store the references in an object like ``` var lookUp = { 'OCaml':getNode(data, 'OCaml'), 'BASIC': getNode(data, 'BASIC') }; ``` Or you can build the reference with a walk through the object. ```js var data = [{ name: "Languages", children: ...
39,431,804
I have SQL Server 2012 with DB1 , DB2 , Db3 ...> DB50 If I need to view databases in server I use ``` SELECT * FROM sys.databases ``` All databases have same table `Saves` except for five databases that do not have this table. I need to know which databases have table `Saves` - for this I use ``` sp_msforeach...
2016/09/11
[ "https://Stackoverflow.com/questions/39431804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5557934/" ]
Disclaimer: I don't know how to use CodeIgniter, but this is what you do if you want to order by some custom order such as yours: ``` SELECT * FROM your_table WHERE id IN (5, 3, 8, 12, 30, 29, 26, 28, 4, 7) ORDER BY FIELD(id, 5, 3, 8, 12, 30, 29, 26, 28, 4, 7) ``` Now, if you know how to adjust this in CodeIgniter...
Since it is a small data set, either in your controller manipulate the arrays, or do it in your view if you want to. Just pass both the order array as $order and the result set as $results to the view: ``` foreach ($order as $wantedID) { foreach ($results as $result) { if($result['id'] == $wantedID) { ...
39,431,804
I have SQL Server 2012 with DB1 , DB2 , Db3 ...> DB50 If I need to view databases in server I use ``` SELECT * FROM sys.databases ``` All databases have same table `Saves` except for five databases that do not have this table. I need to know which databases have table `Saves` - for this I use ``` sp_msforeach...
2016/09/11
[ "https://Stackoverflow.com/questions/39431804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5557934/" ]
Disclaimer: I don't know how to use CodeIgniter, but this is what you do if you want to order by some custom order such as yours: ``` SELECT * FROM your_table WHERE id IN (5, 3, 8, 12, 30, 29, 26, 28, 4, 7) ORDER BY FIELD(id, 5, 3, 8, 12, 30, 29, 26, 28, 4, 7) ``` Now, if you know how to adjust this in CodeIgniter...
``` $this->db->where_in('id',$arrayIds); $arrayList = implode(',',$arrayIds); $this->db->order_by('FIELD(id,'.$arrayList.")"); ```
47,112,141
UPDATE: Thank you very much for advises! Great community! I specified the task. I need to write a function, which has two arguments: message, text. If message could be created from text letters, function should return true. Otherwise, return false. compose("ohle", "hello"); //should return true compose("elooooo", "h...
2017/11/04
[ "https://Stackoverflow.com/questions/47112141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use `Array.prototype.every()` and `.indexOf()` ```js const compose = (letter, text) => [...text].every(char => letter.indexOf(char) > -1); console.log(compose("ohle", "hello")); console.log(compose("elooooo", "hello")); ```
It doesn't returns 7 true, actually your function logs 7 trues. If you want one result you need: ``` function compose(letter, text){ for(var i = 0, len = letter.length; i < len; i++){ if(!text.includes(letter[i])){ return false; } } return true; } ``` And then you can console...
32,018,628
Is there any way to configure the default number of commits that will be returned by git log? I know you can do `git log -5` to get the last 5 commits, but what if I forget and just do `git log`? I have several aliases for `git log` and would like them all to return something like the last 100 commits unless I specify ...
2015/08/14
[ "https://Stackoverflow.com/questions/32018628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/275593/" ]
If you supply more than one count, the last one takes precedence. For example, `git log -2 -1` shows only one result. So you can supply a default parameter in your alias definition and optionally override it when you run the command. Regarding using `-0` to return everything, just use `-9999999` or similar instead.
For anyone looking at this recently, I tried to do what the accepted answer says but can't get it to work, and found a more recent answer saying you can't name an alias after a built-in git command anymore: <https://stackoverflow.com/a/11226146/14587004>. For anyone wondering how to get close enough, I did `git confi...
11,291,534
I have a Storyboard with a Scrollview with Myview class extended from UIScrollview which implements a method to paint some rects with quartz2d. I'm trying to implement zoom in/out in that Scrollview but theres no way and I can't find the answer anywhere. I have this in my controller (UIwindow): ``` - (void)viewDid...
2012/07/02
[ "https://Stackoverflow.com/questions/11291534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1405024/" ]
try after setting delegate ``` myscrollview.delegate = self; ```
I assume you set your delegate like this: `myscrollview.delegate = self;` In your `viewForZoomingInScrollView:` delegate method you have to return a view you like to zoom an not the scrollview itself.
10,021,882
I have an application requiring the same results given the same random seed. But I find random.randint not threadsafe. I have tried mutex but this does not work. Here is my experiment code (long but simple): ``` import threading import random def child(n, a): g_mutex = threading.Lock() g_mutex.acquire() r...
2012/04/05
[ "https://Stackoverflow.com/questions/10021882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1064959/" ]
You can create separate instances of `random.Random` for each thread ``` >>> import random >>> local_random = random.Random() >>> local_random.seed(1234) >>> local_random.randint(1,1000) 967 ```
From [the documentation for `random`](http://docs.python.org/library/random.html): > > The functions supplied by this module are actually bound methods of a hidden instance of the **random.Random** class. You can instantiate your own instances of Random to get generators that don’t share state. **This is especially u...
10,021,882
I have an application requiring the same results given the same random seed. But I find random.randint not threadsafe. I have tried mutex but this does not work. Here is my experiment code (long but simple): ``` import threading import random def child(n, a): g_mutex = threading.Lock() g_mutex.acquire() r...
2012/04/05
[ "https://Stackoverflow.com/questions/10021882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1064959/" ]
You can create separate instances of `random.Random` for each thread ``` >>> import random >>> local_random = random.Random() >>> local_random.seed(1234) >>> local_random.randint(1,1000) 967 ```
Others have pointed out the proper way to use `random` in a thread safe way. But I feel it's important to point out that the code you wrote would not be thread-safe for anything. ``` def child(n, a): g_mutex = threading.Lock() g_mutex.acquire() random.seed(n) for i in xrange(100): a.append(rand...
87,186
I am new to NLP and would like to build a BERT model for sentiment analysis so I am following [this](https://curiousily.com/posts/sentiment-analysis-with-bert-and-hugging-face-using-pytorch-and-python/) tutorial. However, I am getting the error below: ``` F.softmax(model(input_ids, attention_mask), dim = 1) ``` Whe...
2020/12/27
[ "https://datascience.stackexchange.com/questions/87186", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/109441/" ]
Which transformer version are you using? I had to pin mine to transformer == 3.5.1 to mitigate that problem, when the hugging face team updated their transformer to 4.0 things started to break. Hope it helps
The transformers library uses complex output objects instead of plain tuples as return type since one of the updates after 3.5.1.: ```py from transformers import BertModel, BertTokenizer t = BertTokenizer.from_pretrained('bert-base-uncased') model = BertModel.from_pretrained('bert-base-uncased') o = t.encode_plus('t...
87,186
I am new to NLP and would like to build a BERT model for sentiment analysis so I am following [this](https://curiousily.com/posts/sentiment-analysis-with-bert-and-hugging-face-using-pytorch-and-python/) tutorial. However, I am getting the error below: ``` F.softmax(model(input_ids, attention_mask), dim = 1) ``` Whe...
2020/12/27
[ "https://datascience.stackexchange.com/questions/87186", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/109441/" ]
**How to obtain the same behavior as v3.x in v4.x** In order to obtain the same behavior as version v3.x, you should install sentencepiece additionally: In version v3.x: *pip install transformers* to obtain the same in version v4.x: pip install transformers[sentencepiece] or pip install transformers sentencepiece
Which transformer version are you using? I had to pin mine to transformer == 3.5.1 to mitigate that problem, when the hugging face team updated their transformer to 4.0 things started to break. Hope it helps
87,186
I am new to NLP and would like to build a BERT model for sentiment analysis so I am following [this](https://curiousily.com/posts/sentiment-analysis-with-bert-and-hugging-face-using-pytorch-and-python/) tutorial. However, I am getting the error below: ``` F.softmax(model(input_ids, attention_mask), dim = 1) ``` Whe...
2020/12/27
[ "https://datascience.stackexchange.com/questions/87186", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/109441/" ]
**How to obtain the same behavior as v3.x in v4.x** In order to obtain the same behavior as version v3.x, you should install sentencepiece additionally: In version v3.x: *pip install transformers* to obtain the same in version v4.x: pip install transformers[sentencepiece] or pip install transformers sentencepiece
The transformers library uses complex output objects instead of plain tuples as return type since one of the updates after 3.5.1.: ```py from transformers import BertModel, BertTokenizer t = BertTokenizer.from_pretrained('bert-base-uncased') model = BertModel.from_pretrained('bert-base-uncased') o = t.encode_plus('t...
27,923,773
I'm instantiating the Chosen plugin within a Bootstrap Modal. I'm calling the Chosen plugin after I've launched the modal. All works as expected apart from being able to auto focus the element to allow typing without first clicking into the element. Strangely I'm getting a blue border around the element which would i...
2015/01/13
[ "https://Stackoverflow.com/questions/27923773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/842238/" ]
I found an answer, or a workaround at least. When stepping through the code I noticed that the `trigger('chosen:activate')` method is called before the `$modal.modal()` has completed i.e. the modal has not yet displayed. I simply added an asynchronous delay before calling `chosen:activate` which appears to fix it and...
Your code must work. Here is a simple example base on official documentation. I don't know if your are doing something more in your code that is doing your code don't work. ``` <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Chosen: A jQuery Plugin by Harvest to Tame Unwieldy Select Boxes</ti...
67,115,622
I wrote a macro that now is causing issues with MS Word. I can only open the document in safe mode and cannot figure out how to delete the macro from safe mode. I don't have access to any of the features in safe mode and the macro isn't even showing up. I tried changing the Trust Center settings but none of those optio...
2021/04/15
[ "https://Stackoverflow.com/questions/67115622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15370823/" ]
If you are talking about the "Normal" document in the project explorer, resetting it is easy. [![enter image description here](https://i.stack.imgur.com/MkLue.png)](https://i.stack.imgur.com/MkLue.png) Simply navigate to `%AppData%\Microsoft\Templates` and either delete or rename the Normal.docm file. Once you reopen...
You created an `AutoOpen` macro which only fires when a document is opened. Presumably this macro is stored in your Normal template. When you first start Word the macro should not run as you are not opening a document. If Word doesn’t automatically create a new blank document you can safely do so. You will then be abl...
2,292,644
I want an animation modal (loading please wait) and when the page fully loads it disappears?
2010/02/18
[ "https://Stackoverflow.com/questions/2292644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276522/" ]
The basic idea is fine. The implementation could be improved. In particular, I'm concerned that you have a mutable struct; either make it immutable or turn it into a class. I'd also recommend changing the public fields into public properties with automatic backing fields (and then upper-casing the names). *edit* Here...
There are a few things that I would change in order to follow best practices. First, I would address what the [separation of concerns](http://en.wikipedia.org/wiki/Separation_of_concerns) issue you have. The Rep struct doesn't need to be a nested class, in my opinion, I would remove it, like so (and also call it somet...
2,292,644
I want an animation modal (loading please wait) and when the page fully loads it disappears?
2010/02/18
[ "https://Stackoverflow.com/questions/2292644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276522/" ]
Well, the way ***I*** would do it... ``` Public Class Repository: ObservableCollection<RepositoryItem> { } public class RepositoryItem { public string main {get; set}; public string clean {get; set}; public int curParCount {get; set}; public int totalCount {get; set}; publi...
There are a few things that I would change in order to follow best practices. First, I would address what the [separation of concerns](http://en.wikipedia.org/wiki/Separation_of_concerns) issue you have. The Rep struct doesn't need to be a nested class, in my opinion, I would remove it, like so (and also call it somet...
2,292,644
I want an animation modal (loading please wait) and when the page fully loads it disappears?
2010/02/18
[ "https://Stackoverflow.com/questions/2292644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276522/" ]
ParStart and PartialStart sound like the same thing. You should rename one of those fields to make the name more descriptive. Also, if Par is an abbreviation, then don't abbreviate. You should generally avoid abbreviations(but acronyms are OK if they are well known). The same goes for "Rep" if that is an abbreviation. ...
There are a few things that I would change in order to follow best practices. First, I would address what the [separation of concerns](http://en.wikipedia.org/wiki/Separation_of_concerns) issue you have. The Rep struct doesn't need to be a nested class, in my opinion, I would remove it, like so (and also call it somet...
2,292,644
I want an animation modal (loading please wait) and when the page fully loads it disappears?
2010/02/18
[ "https://Stackoverflow.com/questions/2292644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276522/" ]
``` class RepositoryManager { private static List<Repository> Repo { get; set; } . . . } public class Repository { public string Main { get; set; } public string Clean { get; set; } public int CurParCount { get; set; } ...
There are a few things that I would change in order to follow best practices. First, I would address what the [separation of concerns](http://en.wikipedia.org/wiki/Separation_of_concerns) issue you have. The Rep struct doesn't need to be a nested class, in my opinion, I would remove it, like so (and also call it somet...
2,292,644
I want an animation modal (loading please wait) and when the page fully loads it disappears?
2010/02/18
[ "https://Stackoverflow.com/questions/2292644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276522/" ]
The basic idea is fine. The implementation could be improved. In particular, I'm concerned that you have a mutable struct; either make it immutable or turn it into a class. I'd also recommend changing the public fields into public properties with automatic backing fields (and then upper-casing the names). *edit* Here...
Well, the way ***I*** would do it... ``` Public Class Repository: ObservableCollection<RepositoryItem> { } public class RepositoryItem { public string main {get; set}; public string clean {get; set}; public int curParCount {get; set}; public int totalCount {get; set}; publi...
2,292,644
I want an animation modal (loading please wait) and when the page fully loads it disappears?
2010/02/18
[ "https://Stackoverflow.com/questions/2292644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276522/" ]
The basic idea is fine. The implementation could be improved. In particular, I'm concerned that you have a mutable struct; either make it immutable or turn it into a class. I'd also recommend changing the public fields into public properties with automatic backing fields (and then upper-casing the names). *edit* Here...
ParStart and PartialStart sound like the same thing. You should rename one of those fields to make the name more descriptive. Also, if Par is an abbreviation, then don't abbreviate. You should generally avoid abbreviations(but acronyms are OK if they are well known). The same goes for "Rep" if that is an abbreviation. ...
2,292,644
I want an animation modal (loading please wait) and when the page fully loads it disappears?
2010/02/18
[ "https://Stackoverflow.com/questions/2292644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276522/" ]
The basic idea is fine. The implementation could be improved. In particular, I'm concerned that you have a mutable struct; either make it immutable or turn it into a class. I'd also recommend changing the public fields into public properties with automatic backing fields (and then upper-casing the names). *edit* Here...
``` class RepositoryManager { private static List<Repository> Repo { get; set; } . . . } public class Repository { public string Main { get; set; } public string Clean { get; set; } public int CurParCount { get; set; } ...
2,292,644
I want an animation modal (loading please wait) and when the page fully loads it disappears?
2010/02/18
[ "https://Stackoverflow.com/questions/2292644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276522/" ]
Well, the way ***I*** would do it... ``` Public Class Repository: ObservableCollection<RepositoryItem> { } public class RepositoryItem { public string main {get; set}; public string clean {get; set}; public int curParCount {get; set}; public int totalCount {get; set}; publi...
``` class RepositoryManager { private static List<Repository> Repo { get; set; } . . . } public class Repository { public string Main { get; set; } public string Clean { get; set; } public int CurParCount { get; set; } ...
2,292,644
I want an animation modal (loading please wait) and when the page fully loads it disappears?
2010/02/18
[ "https://Stackoverflow.com/questions/2292644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276522/" ]
ParStart and PartialStart sound like the same thing. You should rename one of those fields to make the name more descriptive. Also, if Par is an abbreviation, then don't abbreviate. You should generally avoid abbreviations(but acronyms are OK if they are well known). The same goes for "Rep" if that is an abbreviation. ...
``` class RepositoryManager { private static List<Repository> Repo { get; set; } . . . } public class Repository { public string Main { get; set; } public string Clean { get; set; } public int CurParCount { get; set; } ...
69,802,311
I want to write a function that checks if a syntax is correct. The part of the syntax I struggle with is this one: ``` < number >: := 2 | 3 | ... ``` I have defined it as: ``` def number(q): letter = q.dequeue() if int(letter) >= 2: return raise error("Number must be grea...
2021/11/01
[ "https://Stackoverflow.com/questions/69802311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17303222/" ]
Assuming you get the entire string, you can do it this way: ``` def validate(q): word = q.dequeue() if word[0] != 'H': raise error("Does not start with H.") if not word[1:].isdigit(): raise error("Value is not numeric.") val = int(word[1:]) if val < 2: raise error("Number mu...
I'm not entirely sure about what type `q` is, or what the `H` in the string represents for example, but this should work for the cases outlined in the question: ```py def number(q): nums = filter(str.isdigit, q) try: first_num = next(nums) except StopIteration: raise error('Enter a string w...
54,799
When producing a bibliography using `biblatex` and the `alphabetic` style, I would like to produce actual cross-references between two `crossref`-entries. For example, if I have several `@inproceedings` entries that define `crossref={proc}` and I have a matching `@proceedings` entry, I would like to generate something ...
2012/05/07
[ "https://tex.stackexchange.com/questions/54799", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/12604/" ]
**Substantially Revised** In the light of the discussion in the comments, I've substantially revised this. ``` \documentclass[]{article} \usepackage[backend=biber,style=alphabetic]{biblatex} \usepackage{filecontents} \begin{filecontents}{my.bib} @inproceedings{inproc1, Author = {Test Author}, Crossref = {pr...
The styles of my [`biblatex-ext` bundle](https://ctan.org/pkg/biblatex-ext) have an option called `citexref` to do this. So you can just replace `style=alphabetic,` with `style=ext-alphabetic,` and add `citexref=true,` to the `biblatex` options and are good to go. ``` \documentclass[]{article} \usepackage[backend=bi...
16,516,046
I have been trying hard to resolve this however yet not succeed I have data structs as follow (which actually is very complex I just simplifies for discussion) : ``` typedef struct node{ struct node* next; void* arg; }node_t; typedef struct queue{ node_t* head; node_t* tail; }queue_t; addQ(queue_t*ptr , int data)...
2013/05/13
[ "https://Stackoverflow.com/questions/16516046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1181347/" ]
This solution got a bit hairy with the double pointers, but I still like it, as it doesn't have to special case what node (first vs the rest) is being checked. I tried to put enough comments in to describe what's going on, but it's still hard for even me to follow at first glance. PSEUDOCODE.. ``` Queue * q; VALUE = ...
Assuming that you already have a function that obtains and removes the next item in the queue, let's call it `getQ(q)`, then you could achieve your goal without even having to know the internals of the queue, by just using the operations you already have, e.g. something like (this won't work because `arg` is a `void`, ...
16,516,046
I have been trying hard to resolve this however yet not succeed I have data structs as follow (which actually is very complex I just simplifies for discussion) : ``` typedef struct node{ struct node* next; void* arg; }node_t; typedef struct queue{ node_t* head; node_t* tail; }queue_t; addQ(queue_t*ptr , int data)...
2013/05/13
[ "https://Stackoverflow.com/questions/16516046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1181347/" ]
This solution got a bit hairy with the double pointers, but I still like it, as it doesn't have to special case what node (first vs the rest) is being checked. I tried to put enough comments in to describe what's going on, but it's still hard for even me to follow at first glance. PSEUDOCODE.. ``` Queue * q; VALUE = ...
Here's an inline solution that doesn't use double pointers. It has to treat the first element and subsequent elements differently since the pointer to adjust changes from the queue structure to the node structure. Also, for subsequent nodes, you have to track the trailing node, since that's where you have to make the ...
852,598
If $n = 51! +1$, Then find no of primes among $n+1,n+2,\ldots, n+50$ Really speaking, I don't have any clue ...
2014/06/30
[ "https://math.stackexchange.com/questions/852598", "https://math.stackexchange.com", "https://math.stackexchange.com/users/80339/" ]
The number $51!$ has as non-trivial factors every natural number preceding $51$. Thus any $51! + 2$, $51! + 3$, etc. will be divisible by $2,3,4,\cdots$ respectively. $$n=51! + 1$$ $$n+a = 51! + (1+a) = \left(\frac{51!}{1+a}+1\right)\cdot (1+a)$$ If $1\leq a \leq 50$ then $\frac{51!}{1+a}$ is an integer and so $a+1$ ...
The offset by $1$ on $51!$ may make it a little confusing. For any integer $2 \leq n \leq 51$, you will have that $51! + n$ is divisible by $n$ because $51!$ is divisible by $n$. This is an equivalent statement to your problem. Now you just need to show $51!$ is divisible by $n$ and that $n$ does not equal $51! + n$.
852,598
If $n = 51! +1$, Then find no of primes among $n+1,n+2,\ldots, n+50$ Really speaking, I don't have any clue ...
2014/06/30
[ "https://math.stackexchange.com/questions/852598", "https://math.stackexchange.com", "https://math.stackexchange.com/users/80339/" ]
First you need to review the definition of the factorial: $$m! = \prod\_{i = 1}^m i = 1 \times 2 \times 3 \times \cdots \times m.$$ This means that $m!$ is divisible by 2, by 3, by 4, by every number up to $m$. Therefore $51!$ is divisible by 2, by 3, by 4 and by every number up to 51 (and a few others greater than 51...
The offset by $1$ on $51!$ may make it a little confusing. For any integer $2 \leq n \leq 51$, you will have that $51! + n$ is divisible by $n$ because $51!$ is divisible by $n$. This is an equivalent statement to your problem. Now you just need to show $51!$ is divisible by $n$ and that $n$ does not equal $51! + n$.
852,598
If $n = 51! +1$, Then find no of primes among $n+1,n+2,\ldots, n+50$ Really speaking, I don't have any clue ...
2014/06/30
[ "https://math.stackexchange.com/questions/852598", "https://math.stackexchange.com", "https://math.stackexchange.com/users/80339/" ]
First you need to review the definition of the factorial: $$m! = \prod\_{i = 1}^m i = 1 \times 2 \times 3 \times \cdots \times m.$$ This means that $m!$ is divisible by 2, by 3, by 4, by every number up to $m$. Therefore $51!$ is divisible by 2, by 3, by 4 and by every number up to 51 (and a few others greater than 51...
The number $51!$ has as non-trivial factors every natural number preceding $51$. Thus any $51! + 2$, $51! + 3$, etc. will be divisible by $2,3,4,\cdots$ respectively. $$n=51! + 1$$ $$n+a = 51! + (1+a) = \left(\frac{51!}{1+a}+1\right)\cdot (1+a)$$ If $1\leq a \leq 50$ then $\frac{51!}{1+a}$ is an integer and so $a+1$ ...
852,598
If $n = 51! +1$, Then find no of primes among $n+1,n+2,\ldots, n+50$ Really speaking, I don't have any clue ...
2014/06/30
[ "https://math.stackexchange.com/questions/852598", "https://math.stackexchange.com", "https://math.stackexchange.com/users/80339/" ]
The number $51!$ has as non-trivial factors every natural number preceding $51$. Thus any $51! + 2$, $51! + 3$, etc. will be divisible by $2,3,4,\cdots$ respectively. $$n=51! + 1$$ $$n+a = 51! + (1+a) = \left(\frac{51!}{1+a}+1\right)\cdot (1+a)$$ If $1\leq a \leq 50$ then $\frac{51!}{1+a}$ is an integer and so $a+1$ ...
In addition to Michael Hardy's answer, which precludes all of n+1 to n+50, you can also prove that n is in fact composite as well using Wilson's Theorem which states that a number n is prime if and only if (n - 1)! ≡ (n-1) mod n. Here, n is (51! + 1), so (n-1)! = 51!!. Therefore, (51! + 1) is prime iff 51!! ≡ 51! mod...
852,598
If $n = 51! +1$, Then find no of primes among $n+1,n+2,\ldots, n+50$ Really speaking, I don't have any clue ...
2014/06/30
[ "https://math.stackexchange.com/questions/852598", "https://math.stackexchange.com", "https://math.stackexchange.com/users/80339/" ]
First you need to review the definition of the factorial: $$m! = \prod\_{i = 1}^m i = 1 \times 2 \times 3 \times \cdots \times m.$$ This means that $m!$ is divisible by 2, by 3, by 4, by every number up to $m$. Therefore $51!$ is divisible by 2, by 3, by 4 and by every number up to 51 (and a few others greater than 51...
In addition to Michael Hardy's answer, which precludes all of n+1 to n+50, you can also prove that n is in fact composite as well using Wilson's Theorem which states that a number n is prime if and only if (n - 1)! ≡ (n-1) mod n. Here, n is (51! + 1), so (n-1)! = 51!!. Therefore, (51! + 1) is prime iff 51!! ≡ 51! mod...
19,344,842
I am new to PHP and I am trying to set multiple parameters to the same value. I have done it the (probably) ugly way. ``` $thpic0 = "thpic_dummy"; $thpic1 = "thpic_dummy"; $thpic2 = "thpic_dummy"; $thpic3 = "thpic_dummy"; etc... $thpic13 = "thpic_dummy"; $thpic14 = "thpic_dummy"; ``` Since the only char changing is ...
2013/10/13
[ "https://Stackoverflow.com/questions/19344842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875935/" ]
The correct syntax is `${…}` instead of `$…{…}`: ``` ${"thpic$i"} = ...; ``` would be the valid syntax. Some further PHP manual lecture about this: <http://php.net/language.variables.variable.php>
You can use variable-variables to achieve what you want: ``` for($i=0;$i<=14;$i++) { $variable = 'thpic' . $i; $$variable = "thpic_dummy"; } ``` You can read more about these in the docs: <http://php.net/manual/en/language.variables.variable.php> Alternatively, you can use the syntax: `${"thpic" . $i} = "t...
19,344,842
I am new to PHP and I am trying to set multiple parameters to the same value. I have done it the (probably) ugly way. ``` $thpic0 = "thpic_dummy"; $thpic1 = "thpic_dummy"; $thpic2 = "thpic_dummy"; $thpic3 = "thpic_dummy"; etc... $thpic13 = "thpic_dummy"; $thpic14 = "thpic_dummy"; ``` Since the only char changing is ...
2013/10/13
[ "https://Stackoverflow.com/questions/19344842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875935/" ]
The correct syntax is `${…}` instead of `$…{…}`: ``` ${"thpic$i"} = ...; ``` would be the valid syntax. Some further PHP manual lecture about this: <http://php.net/language.variables.variable.php>
Your best bet is to probably put this into an array like this: ``` for ($i = 0; $i <= 14; $i++) { $thpic[$i] = "thpic_dummy"; } print_r($thpic); ``` This returns something like this: Array ``` ( [0] => thpic_dummy [1] => thpic_dummy [2] => thpic_dummy [3] => thpic_dummy [4] => thpic_dummy ...
19,344,842
I am new to PHP and I am trying to set multiple parameters to the same value. I have done it the (probably) ugly way. ``` $thpic0 = "thpic_dummy"; $thpic1 = "thpic_dummy"; $thpic2 = "thpic_dummy"; $thpic3 = "thpic_dummy"; etc... $thpic13 = "thpic_dummy"; $thpic14 = "thpic_dummy"; ``` Since the only char changing is ...
2013/10/13
[ "https://Stackoverflow.com/questions/19344842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875935/" ]
The correct syntax is `${…}` instead of `$…{…}`: ``` ${"thpic$i"} = ...; ``` would be the valid syntax. Some further PHP manual lecture about this: <http://php.net/language.variables.variable.php>
you should use any array for this task ``` $thpic = array(); for($i=0;$i<=14;$i++) { $thpic[$i] = "thpic_dummy"; } echo $thpic[1]; ```
19,344,842
I am new to PHP and I am trying to set multiple parameters to the same value. I have done it the (probably) ugly way. ``` $thpic0 = "thpic_dummy"; $thpic1 = "thpic_dummy"; $thpic2 = "thpic_dummy"; $thpic3 = "thpic_dummy"; etc... $thpic13 = "thpic_dummy"; $thpic14 = "thpic_dummy"; ``` Since the only char changing is ...
2013/10/13
[ "https://Stackoverflow.com/questions/19344842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875935/" ]
Your best bet is to probably put this into an array like this: ``` for ($i = 0; $i <= 14; $i++) { $thpic[$i] = "thpic_dummy"; } print_r($thpic); ``` This returns something like this: Array ``` ( [0] => thpic_dummy [1] => thpic_dummy [2] => thpic_dummy [3] => thpic_dummy [4] => thpic_dummy ...
You can use variable-variables to achieve what you want: ``` for($i=0;$i<=14;$i++) { $variable = 'thpic' . $i; $$variable = "thpic_dummy"; } ``` You can read more about these in the docs: <http://php.net/manual/en/language.variables.variable.php> Alternatively, you can use the syntax: `${"thpic" . $i} = "t...
19,344,842
I am new to PHP and I am trying to set multiple parameters to the same value. I have done it the (probably) ugly way. ``` $thpic0 = "thpic_dummy"; $thpic1 = "thpic_dummy"; $thpic2 = "thpic_dummy"; $thpic3 = "thpic_dummy"; etc... $thpic13 = "thpic_dummy"; $thpic14 = "thpic_dummy"; ``` Since the only char changing is ...
2013/10/13
[ "https://Stackoverflow.com/questions/19344842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2875935/" ]
you should use any array for this task ``` $thpic = array(); for($i=0;$i<=14;$i++) { $thpic[$i] = "thpic_dummy"; } echo $thpic[1]; ```
You can use variable-variables to achieve what you want: ``` for($i=0;$i<=14;$i++) { $variable = 'thpic' . $i; $$variable = "thpic_dummy"; } ``` You can read more about these in the docs: <http://php.net/manual/en/language.variables.variable.php> Alternatively, you can use the syntax: `${"thpic" . $i} = "t...
22,737,504
Is there any way to intercept the Android framework's inflation of xml resources (menus and layouts) to change the strings it uses (e.g. for attributes like `android:text="@string/button_trade_commit"`.) I know it's possible to override `getString()` as it's called from an Activity. But framework code doesn't seem to ...
2014/03/29
[ "https://Stackoverflow.com/questions/22737504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/496795/" ]
I don't believe you can override the systems getString() methods the way you are looking at it. It might be worth trying to use a custom attribute and handle the work there: <http://developer.android.com/training/custom-views/create-view.html#customattr>
I don't think you will be able to modify the process Android uses when inflating resources the way you wanted to. What you can do is to simply not provide any strings (`android:text`, etc.) in XML files. You can always obtain a reference to any element in your XML file in the code. Once you have a reference, you can p...
22,737,504
Is there any way to intercept the Android framework's inflation of xml resources (menus and layouts) to change the strings it uses (e.g. for attributes like `android:text="@string/button_trade_commit"`.) I know it's possible to override `getString()` as it's called from an Activity. But framework code doesn't seem to ...
2014/03/29
[ "https://Stackoverflow.com/questions/22737504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/496795/" ]
I don't believe you can override the systems getString() methods the way you are looking at it. It might be worth trying to use a custom attribute and handle the work there: <http://developer.android.com/training/custom-views/create-view.html#customattr>
I am not sure about this, but i think you can examine the source of [Calligraphy](https://github.com/chrisjenx/Calligraphy "Calligrapgy") library for Android. It is overriding system LayoutInflater to change the FontType, so i imagine you can do the same to change the strings.
66,384,030
There's an already built in way that fulfill my request? I know Set are unordered I need to do a vector based Set. I need to know the position of any value of a generic type to place them in the corresponding index of the array, So I can avoid duplications of the elements. I'm not ordering or defining an order of t...
2021/02/26
[ "https://Stackoverflow.com/questions/66384030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12728683/" ]
Maybe something like this? ```cpp std::string line; std::getline(file, line); line = line.substr(1, line.length() - 2); std::istringstream iss(line); iss >> A >> B >> C >> D; ```
``` #include<iostream> #include<vector> #include<ifstream> using namespace std; struct pairs { char ch; int value; }; int main() { vector<pairs> store; ifstream is("koord.txt"); pairs temp; char ch = 'A'; while (is) { ...
66,384,030
There's an already built in way that fulfill my request? I know Set are unordered I need to do a vector based Set. I need to know the position of any value of a generic type to place them in the corresponding index of the array, So I can avoid duplications of the elements. I'm not ordering or defining an order of t...
2021/02/26
[ "https://Stackoverflow.com/questions/66384030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12728683/" ]
Maybe something like this? ```cpp std::string line; std::getline(file, line); line = line.substr(1, line.length() - 2); std::istringstream iss(line); iss >> A >> B >> C >> D; ```
This is what I ended up doing, might not be the most efficient way of doing it but it seems to work. But I will look into `std::istringstream`. It seems like good way to do it. ``` void getFirstLine(int &A, int &B, int &C, int &D) { string myText; string temp; vector<int> save; int size = myText.size()...
935,083
I have a string value in the web.config — for example 2 guids separated by a `","`. I need to query the database dynamically (i.e i have no idea how many values could be separated by a comma in the web.config) and run a select statement on the table passing these values and getting all that is relevant for example: ``...
2009/06/01
[ "https://Stackoverflow.com/questions/935083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Check out Erland Sommarskogs excellent post on this topic: <http://www.sommarskog.se/arrays-in-sql-2005.html> SQL Server 2008 would also offer [table-valued parameters](http://www.sqlteam.com/article/sql-server-2008-table-valued-parameters) in addition to these ways of passing multiple values to the procedure. Marc
You want an "IN" condition. If you *really* trust your web.config and can require the configured elements are also encased in quotes, you can just put it directly into the sql statement: ``` select * from tablename where columnname IN ( "web.config value here" ) ``` But be warned that dynamic sql like this is *very*...
935,083
I have a string value in the web.config — for example 2 guids separated by a `","`. I need to query the database dynamically (i.e i have no idea how many values could be separated by a comma in the web.config) and run a select statement on the table passing these values and getting all that is relevant for example: ``...
2009/06/01
[ "https://Stackoverflow.com/questions/935083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Check out Erland Sommarskogs excellent post on this topic: <http://www.sommarskog.se/arrays-in-sql-2005.html> SQL Server 2008 would also offer [table-valued parameters](http://www.sqlteam.com/article/sql-server-2008-table-valued-parameters) in addition to these ways of passing multiple values to the procedure. Marc
You don't have to send multiple parameters, only one string A posibility is to parse that string into an SQL stored procedure and build a dynamic query Another posibility is to insert the '' characters at every , and use to code below ``` 'aaa','bbb','ccc' myTable ------------ ID Name 1 eee 2 aaa 3 ggg 4 ...
935,083
I have a string value in the web.config — for example 2 guids separated by a `","`. I need to query the database dynamically (i.e i have no idea how many values could be separated by a comma in the web.config) and run a select statement on the table passing these values and getting all that is relevant for example: ``...
2009/06/01
[ "https://Stackoverflow.com/questions/935083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Check out Erland Sommarskogs excellent post on this topic: <http://www.sommarskog.se/arrays-in-sql-2005.html> SQL Server 2008 would also offer [table-valued parameters](http://www.sqlteam.com/article/sql-server-2008-table-valued-parameters) in addition to these ways of passing multiple values to the procedure. Marc
this is based on Erland Sommarskogs article: <http://www.sommarskog.se/arrays-in-sql-2005.html> Before you use my function, you need to set up a "helper" table, you only need to do this one time per database: ``` CREATE TABLE Numbers (Number int NOT NULL, CONSTRAINT PK_Numbers PRIMARY KEY CLUSTERED (Number ASC)...
935,083
I have a string value in the web.config — for example 2 guids separated by a `","`. I need to query the database dynamically (i.e i have no idea how many values could be separated by a comma in the web.config) and run a select statement on the table passing these values and getting all that is relevant for example: ``...
2009/06/01
[ "https://Stackoverflow.com/questions/935083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You want an "IN" condition. If you *really* trust your web.config and can require the configured elements are also encased in quotes, you can just put it directly into the sql statement: ``` select * from tablename where columnname IN ( "web.config value here" ) ``` But be warned that dynamic sql like this is *very*...
You don't have to send multiple parameters, only one string A posibility is to parse that string into an SQL stored procedure and build a dynamic query Another posibility is to insert the '' characters at every , and use to code below ``` 'aaa','bbb','ccc' myTable ------------ ID Name 1 eee 2 aaa 3 ggg 4 ...
935,083
I have a string value in the web.config — for example 2 guids separated by a `","`. I need to query the database dynamically (i.e i have no idea how many values could be separated by a comma in the web.config) and run a select statement on the table passing these values and getting all that is relevant for example: ``...
2009/06/01
[ "https://Stackoverflow.com/questions/935083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
this is based on Erland Sommarskogs article: <http://www.sommarskog.se/arrays-in-sql-2005.html> Before you use my function, you need to set up a "helper" table, you only need to do this one time per database: ``` CREATE TABLE Numbers (Number int NOT NULL, CONSTRAINT PK_Numbers PRIMARY KEY CLUSTERED (Number ASC)...
You don't have to send multiple parameters, only one string A posibility is to parse that string into an SQL stored procedure and build a dynamic query Another posibility is to insert the '' characters at every , and use to code below ``` 'aaa','bbb','ccc' myTable ------------ ID Name 1 eee 2 aaa 3 ggg 4 ...
32,490,269
I am using Spring Cloud and @EnableZuulProxy Is it possible to monitor all routes configured in application.yml using hystrix via /hystrix.stream? In the example below I would like to have a simple way to monitor all request made to the down stream product service. I understand that I can do this on the product service...
2015/09/09
[ "https://Stackoverflow.com/questions/32490269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5318992/" ]
The simple answer is yes. Add `spring-cloud-starter-hystrix` and add `@EnableCircuitBreaker` to your main class. That will enable `/hystrix.stream`. Zuul uses hystrix when forwarding to other services.
I had the same issue and changing `@EnableCircuitBreaker` to `@EnableHystrix` fixed the problem. With `@EnableHystrix` I can see all the routed calls on the Hystrix dashboard. **Update** See comment below, this is indeed not the fix.
15,951,454
Following [this](https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb) question and many others, I'm trying to convert an rgb value to a hex value. Copying/pasting the most used and accepted answer, I've made this script ``` function componentToHex(c) { var hex = c.toString(16); ...
2013/04/11
[ "https://Stackoverflow.com/questions/15951454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1307020/" ]
Use the `parseInt` result directly, not `255` minus the value: ``` var r = parseInt(colors[0]) var g = parseInt(colors[1]) var b = parseInt(colors[2]) ``` You're currently producing the *exact opposite* color by outputting values *complementary* to (rather than *equivalent* to) the input values.
Instead of `255 - parseInt(colors[i])`, it should be `parseInt(colors[i])`. In your current implementation - if red is 0, 255 - 0 = 255, which in hex is FF.
19,896,522
For some reason when I try to write through a pipe with fputc my program doesn't work; however, it works fine when I use the write system call. Here is the part of my code using fputc: ``` FILE *input = fopen(argv[1], "rb"); FILE *toSort = fdopen(ps_fd[1], "wb"); /* close the side of pipe I am not going to...
2013/11/10
[ "https://Stackoverflow.com/questions/19896522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897784/" ]
A simple regex should do the trick: ``` var content = content.replace(/\b_err_(.+?)\b/g, function(match, errorName) { return Lang[errorName] || match; }); ``` This assumes that you do not want strings like `"blah_err_blah"` to be replaced, and defaults to not replacing the text if the error cannot be found in yo...
``` var replace = function(str, object, regexp) { //if property not found string is not replaced return String(str).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name) { return (object[name] != null) ? object[name] : match; }); } ``` This is a format function I've used in several projects th...
19,896,522
For some reason when I try to write through a pipe with fputc my program doesn't work; however, it works fine when I use the write system call. Here is the part of my code using fputc: ``` FILE *input = fopen(argv[1], "rb"); FILE *toSort = fdopen(ps_fd[1], "wb"); /* close the side of pipe I am not going to...
2013/11/10
[ "https://Stackoverflow.com/questions/19896522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897784/" ]
``` var replace = function(str, object, regexp) { //if property not found string is not replaced return String(str).replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name) { return (object[name] != null) ? object[name] : match; }); } ``` This is a format function I've used in several projects th...
One more variation with `split` ``` content = content .split('_err_') .map(function(str, index){ if (index === 0) return str; var whitespace = str.indexOf(' '), key = str.substring(0, whitespace) return Lang[key] + str.substring(whi...
19,896,522
For some reason when I try to write through a pipe with fputc my program doesn't work; however, it works fine when I use the write system call. Here is the part of my code using fputc: ``` FILE *input = fopen(argv[1], "rb"); FILE *toSort = fdopen(ps_fd[1], "wb"); /* close the side of pipe I am not going to...
2013/11/10
[ "https://Stackoverflow.com/questions/19896522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897784/" ]
A simple regex should do the trick: ``` var content = content.replace(/\b_err_(.+?)\b/g, function(match, errorName) { return Lang[errorName] || match; }); ``` This assumes that you do not want strings like `"blah_err_blah"` to be replaced, and defaults to not replacing the text if the error cannot be found in yo...
You can use a callback function, that look if a key matching the error code exists in your `Lang` object, and if so returns the value of that (and otherwise just the key itself, thereby doing no replacement, like so: ``` content.replace(/_err_([a-z_]+)/gi, function(fullmatch, key) { return Lang[key] ? Lang[key] : fu...
19,896,522
For some reason when I try to write through a pipe with fputc my program doesn't work; however, it works fine when I use the write system call. Here is the part of my code using fputc: ``` FILE *input = fopen(argv[1], "rb"); FILE *toSort = fdopen(ps_fd[1], "wb"); /* close the side of pipe I am not going to...
2013/11/10
[ "https://Stackoverflow.com/questions/19896522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897784/" ]
A simple regex should do the trick: ``` var content = content.replace(/\b_err_(.+?)\b/g, function(match, errorName) { return Lang[errorName] || match; }); ``` This assumes that you do not want strings like `"blah_err_blah"` to be replaced, and defaults to not replacing the text if the error cannot be found in yo...
One more variation with `split` ``` content = content .split('_err_') .map(function(str, index){ if (index === 0) return str; var whitespace = str.indexOf(' '), key = str.substring(0, whitespace) return Lang[key] + str.substring(whi...
19,896,522
For some reason when I try to write through a pipe with fputc my program doesn't work; however, it works fine when I use the write system call. Here is the part of my code using fputc: ``` FILE *input = fopen(argv[1], "rb"); FILE *toSort = fdopen(ps_fd[1], "wb"); /* close the side of pipe I am not going to...
2013/11/10
[ "https://Stackoverflow.com/questions/19896522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897784/" ]
You can use a callback function, that look if a key matching the error code exists in your `Lang` object, and if so returns the value of that (and otherwise just the key itself, thereby doing no replacement, like so: ``` content.replace(/_err_([a-z_]+)/gi, function(fullmatch, key) { return Lang[key] ? Lang[key] : fu...
One more variation with `split` ``` content = content .split('_err_') .map(function(str, index){ if (index === 0) return str; var whitespace = str.indexOf(' '), key = str.substring(0, whitespace) return Lang[key] + str.substring(whi...
20,027,569
I'm working on my digital signal processing framework. To provide a data exchange interface, I wrap all buffers in a Data class, which has a reference count based GC mechanism(the system is simple enough so I believe ref count can handle this). It works like this: 1. When a Data instance is constructed, it sets its ...
2013/11/17
[ "https://Stackoverflow.com/questions/20027569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1778496/" ]
In my experience, a memory leak of just one or two regardless of the amount of internal operations indicates a leak of an input or output variable. Check the accounting consistency of the external interface of your system. `std::shared_ptr` is nice because being standard, it is automatically suitable as an external in...
How are you maintaining your counters? If your counter decrement/test is not atomic you might be leaking *decrements* which would prevent the object from ever reaching a refcount of 0.
20,027,569
I'm working on my digital signal processing framework. To provide a data exchange interface, I wrap all buffers in a Data class, which has a reference count based GC mechanism(the system is simple enough so I believe ref count can handle this). It works like this: 1. When a Data instance is constructed, it sets its ...
2013/11/17
[ "https://Stackoverflow.com/questions/20027569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1778496/" ]
In my experience, a memory leak of just one or two regardless of the amount of internal operations indicates a leak of an input or output variable. Check the accounting consistency of the external interface of your system. `std::shared_ptr` is nice because being standard, it is automatically suitable as an external in...
*Step 2. Add n refs when dispatched.* Are modules guaranteed to be dispatched? Based on your simple algorithm statement a created module that is not dispatched has no mechanism by which its ref count would decrement and be deleted.
247,264
Case in point: [![enter image description here](https://i.stack.imgur.com/awWdQ.jpg)](https://i.stack.imgur.com/awWdQ.jpg) [![enter image description here](https://i.stack.imgur.com/TIkmU.jpg)](https://i.stack.imgur.com/TIkmU.jpg) Anyone know what's happening here?
2015/12/11
[ "https://gaming.stackexchange.com/questions/247264", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/106721/" ]
This particular requirement seems to be buggy, and I had the same thing happen to me. I resolved it by logging out and logging in again. Upon entering the game, I was awarded with the Season's Journey progress.
That achievement is buggy. Same thing happened to me, but once I hit 100 extracts, all those achievements unlocked.
52,349,537
This is from Chapter 10, problem 10 of my "Art and Science of Java" book from Stanford( I am a full time physician teaching myself the intro to programming methodology using Java in my spare time[Python is my real goal for future medical research projects], so I am a bloody beginner). I have no mentors in programming a...
2018/09/15
[ "https://Stackoverflow.com/questions/52349537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9660637/" ]
Try this: ``` print([a for a,b in zip(x,y) if b == 'success']) ```
You can use `enumerate()` to loop over the values in a collection and also keep track of the current position. ``` x = ['30', '67', '25.6', '15', '23', '78'] y = ['success', 'fail', 'success', 'live', 'fail', 'success'] new_x = [] for position, word in enumerate(y): if word == 'success': new_x.append(x[p...
62,298,799
I am trying to convert a UTC date String of the format `2020-06-09T06:30:00Z` to a Timezone like `Asia/Calcutta`. The time offset between `UTC` and `Asia/Calcutta` is `+5:30`, so the expected result on converting `2020-06-09T06:30:00Z` to `Asia/Calcutta` is `2020-06-09T12:00:00Z` but I am getting `2020-06-09T01:00:00Z...
2020/06/10
[ "https://Stackoverflow.com/questions/62298799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9141437/" ]
java.time --------- I agree with you, you should strongly prefer to use java.time, the modern Java date and time API. It’s not complicated when you know how. ``` String utcDate = "2020-06-09T06:30:00Z"; String timezone = "Asia/Calcutta"; ZoneId zone = ZoneId.of(timezone); ZonedDateTime zdt = Instant....
Got it work using `SimpleDateFormat` as shown below. But anyone coming across this issue should probably use `ZonedDateTime`. ``` String utcDate = "2020-06-09T06:30:00Z"; String timezone = "Asia/Calcutta"; SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); sdf1.setTimeZone(TimeZone.getTimeZone(...
166,353
Here's a situation I ran into recently, which [other](https://meta.stackexchange.com/questions/88627/how-far-can-i-refactor-someone-elses-code) [meta](https://meta.stackexchange.com/questions/101583/when-is-it-appropriate-to-edit-someone-elses-code) [questions](https://meta.stackexchange.com/questions/124111/incorrect-...
2013/02/05
[ "https://meta.stackexchange.com/questions/166353", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/136311/" ]
Since the indentation of the code is, in and of itself, a part of the problem, I wouldn't edit the indentation at all. I don't know if I feel strongly enough to roll back an edit of someone else who changed the indentation, but I would make a point of keeping my own hands off and address the problem(s) in the answer (o...
I would not edit the code at all. Instead, I'd ask the OP to format his code first: 1. If no reply. I leave. (Which is how I usually treat uninteresting ask-and-forget questions.) 2. If he does and he notices - problem solved. Either answer in comment and/or close as too localized. 3. If he does and doesn't notice - e...
166,353
Here's a situation I ran into recently, which [other](https://meta.stackexchange.com/questions/88627/how-far-can-i-refactor-someone-elses-code) [meta](https://meta.stackexchange.com/questions/101583/when-is-it-appropriate-to-edit-someone-elses-code) [questions](https://meta.stackexchange.com/questions/124111/incorrect-...
2013/02/05
[ "https://meta.stackexchange.com/questions/166353", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/136311/" ]
Since the indentation of the code is, in and of itself, a part of the problem, I wouldn't edit the indentation at all. I don't know if I feel strongly enough to roll back an edit of someone else who changed the indentation, but I would make a point of keeping my own hands off and address the problem(s) in the answer (o...
Why is "tipping them off to the problem" something to avoid? Isn't that what we're here for? I would answer, assuming the lack of brackets is their problem, something like this: --- Your problem is that you don't have brackets after your `if` statement. You seem to believe your code will behave like this: ``` if( fo...
21,455,801
``` void main() { if(-1 > 0U) printf("True\n"); else printf("False\n"); } ``` Is it processor-dependent (big endian/little endian)?
2014/01/30
[ "https://Stackoverflow.com/questions/21455801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1517650/" ]
From [C99 6.3.1.8](http://www.iso-9899.info/n1256.html#6.3.1.8) : > > [...] Otherwise, if the operand that has unsigned integer type has rank greater or equal to the rank of the type of the other operand, then the operand with signed integer type is converted to the type of the operand with unsigned integer type. > ...
A piece of code is Endian-Dependent **only if** it accesses variable `x` using a pointer whose type is smaller in size than the type of `x`. For example: ``` int x = 0x12345678; char* p = (char*)&x; char c = p[0]; // 0x12 on BE and 0x78 on LE ``` Please note the emphasis on **"only if"**, in opposed to **"if and...
71,935,139
**Input** : ``` { "id": "123", "address": [{ "street": "5", "city": "ameerpet", "pin": "500073" }, { "street": "6", "city": "sec", "pin": "500020" }] } ``` Note: ["LAA001","LAA002","LAA003"] -> use this as a variable **Required output**: ``` [{ ...
2022/04/20
[ "https://Stackoverflow.com/questions/71935139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18874998/" ]
One option would be the [`ggtext`](https://wilkelab.org/ggtext/index.html) package which via the theme element `element_markdown` allows to style theme elements via markdown, HTML and CSS. To achieve your desired result you have to wrap the parts of your text for which you want to have different font sizes in a `<span...
While @stefans answer is perfect. I tried to apply what I learned here [ggplot2 two-line label with expression](https://stackoverflow.com/questions/13223846/ggplot2-two-line-label-with-expression) using `draw_label` from `cowplot` package to this use case: ``` library(cowplot) library(ggplot2) # define your axis t...
22,340
I have been playing Civ 5 on difficulty 5 for a bunch of AI's, FFA style. I am having issues getting a good foot hold in my games. I feel as though the other players are expanding towards me first, cutting down on my space to grown. This wouldn't be so bad but it also appears as though I always start within 15 hexes of...
2011/05/17
[ "https://gaming.stackexchange.com/questions/22340", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/9485/" ]
Start with a bigger world? If all you want is room to spread out. In Civ 5 there are actually reasons not to want to spread out so much, if you want to go for culture instead. 4 cities with decent resources is plenty to get you to the modern age, with the added advantage that you'll have 4-5 more social advancements th...
You could also try setting it to archipelago which usually results in every player being on their own little island. This should make the game a little easier by giving you more time to prepare.
48,810,824
I’m having some trouble with getting my zapier REST Hook subscribe working. The Authentication setup is working. I receive the POST subscribe from zapier with the “target\_url,event” data. As soon as I POST any data to the “target\_url” for some reason the unsubscribe url is then called which disables the “target\_url...
2018/02/15
[ "https://Stackoverflow.com/questions/48810824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9365638/" ]
Hope this helps someone. I spent way to long on this. When you are testing your Zap will be automatically put in "Off" mode. As I learned that any Zap that is "Off" will automatically "delete/unsubscribe" a subscribe. But when you turn the Zap to "On" the POST subscribe will be triggered again with a "target\_url" tha...
From the [Zapier documentation](https://zapier.com/developer/documentation/v2/rest-hooks/) it looks like you are supposed to return a 201 to confirm receipt of the subscription. This may be needed to confirm registration on the remote server. You can do this with: ``` http_response_code(201) ``` I realize this is a...
54,242,093
I edit the found script code that displays data from the table. **However, I can not modify a certain thing so that in the Gender column next to the key word: Male, Female an icon appears automatically?** For example: glyphicon glyphicon-heart-empty and glyphicon glyphicon-user. In addition to the word male, the cell's...
2019/01/17
[ "https://Stackoverflow.com/questions/54242093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2816097/" ]
The `Errors` you're using for validation are not *that* `Errors` that should be used. It should work if you will use manually created `Errors`: ``` BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(myClass, "myClass"); ValidationUtils.invokeValidator(validator, myClass, bindingResult); ``` Not...
Since I have different type of annotation based validator on MyClass or on it's fields, I simply used as follows: ``` //org.springframework.validation.SmartValidator @Autowired SmartValidator smartValidator public ResponseEntity<ResponseType> generateResponseExample(@RequestPart(value = "jsonString", required = true) ...
4,453,438
I am planning to create an iphone app which uses CoreData. There might be enhancements added later as new versions of the app. My question is; When using CoreData, what are the factors to keep in mind to ensure if the user upgrades the version, his previous data remains intact ? Like I heard we should keep the.sqlite f...
2010/12/15
[ "https://Stackoverflow.com/questions/4453438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/486205/" ]
Data migration concepts are important to understand if you're going to maintain it over time, since you're likely to want to change at least some things eventually. The ideal is **[Lightweight Migration](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmLightweight.ht...
One thing we have done is to manage two separate core data databases. First, a "read-only" core data database that gets supplied with app updates (assuming you want to be sending data with the app, if not then don't bother with this part). Second, a local core data database (data store) that's stored on the phone that ...
48,033,675
I have a "records" indices structured in Algolia like this `[{ "date": "2018-01-04T13:00:00.000Z", "title": "Record 1", "status": "new", }, { "date": "2018-01-04T14:00:00.000Z", "title": "Record 2" "status": "accepted", }]` Using swift, I'm trying to just get the objects with a "new" status but have had no luck...
2017/12/30
[ "https://Stackoverflow.com/questions/48033675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1514915/" ]
First of all, you have some minor issues in your JSON (some extra `,`), see the correct form: ``` [{ "date": "2018-01-04T13:00:00.000Z", "title": "Record 1", "status": "new" }, { "date": "2018-01-04T14:00:00.000Z", "title": "Record 2", "status": "accepted" }] ``` If the objects are properl...
Did you add a facet on your attribute `status`? The syntax `query.filters = "status:new"` only works with facets. See here for more exemples: <https://www.algolia.com/doc/guides/searching/faceting/#faceting-overview>
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
Try This code to record call. ``` AudioManager audioManager; private MediaRecorder myAudioRecorder; //Myservice m=new Myservice(); private String outputFile = null; String uid=null; String no=null; String rname=null; public void record(Context c,String no, String ser){ try{ this.no=no; uid=ser...
If you are trying to store the audio file to sdcard, try this code. It will work fine. ``` protected void startRecording() { mFileName = Environment.getExternalStorageDirectory().getAbsolutePath(); mFileName += "/audiorecordtest.3gp"; mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRec...
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
Sorry to disappoint you, but you can't, not in the general case. Most Android running phones have the wiring in hardware/firmware so that the media of the call does not pass through the application processor at all - it goes from the audio to the DSP and vice versa, so you cannot access it. You can catch the audio of ...
As I known and I have finshed this kind of job.I mean both the user's voice and the other people's voice.We used the customized ROM of one phone provided by the specificated factory and they also have modificated some security mechanism of the ROM.Another way you can try this: <https://github.com/FR13NDS/call-recorder...
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
Sorry to disappoint you, but you can't, not in the general case. Most Android running phones have the wiring in hardware/firmware so that the media of the call does not pass through the application processor at all - it goes from the audio to the DSP and vice versa, so you cannot access it. You can catch the audio of ...
Try This code to record call. ``` AudioManager audioManager; private MediaRecorder myAudioRecorder; //Myservice m=new Myservice(); private String outputFile = null; String uid=null; String no=null; String rname=null; public void record(Context c,String no, String ser){ try{ this.no=no; uid=ser...
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
Try This code to record call. ``` AudioManager audioManager; private MediaRecorder myAudioRecorder; //Myservice m=new Myservice(); private String outputFile = null; String uid=null; String no=null; String rname=null; public void record(Context c,String no, String ser){ try{ this.no=no; uid=ser...
I didnt try it on Phone, but according doc [MediaRecorder.AudioSource](http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html) you should use `MediaRecorder.AudioSource.VOICE_CALL` instead of `MediaRecorder.AudioSource.MIC` Hopes that works
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
``` class MyPhoneStateListener extends PhoneStateListener implements SensorEventListener { Context context; AudioManager audioManager; MediaRecorder recorder; private SensorManager mSensorManager; private Sensor myLightSensor; private boolean CallState; private fl...
If you are trying to store the audio file to sdcard, try this code. It will work fine. ``` protected void startRecording() { mFileName = Environment.getExternalStorageDirectory().getAbsolutePath(); mFileName += "/audiorecordtest.3gp"; mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRec...
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
``` class MyPhoneStateListener extends PhoneStateListener implements SensorEventListener { Context context; AudioManager audioManager; MediaRecorder recorder; private SensorManager mSensorManager; private Sensor myLightSensor; private boolean CallState; private fl...
I didnt try it on Phone, but according doc [MediaRecorder.AudioSource](http://developer.android.com/reference/android/media/MediaRecorder.AudioSource.html) you should use `MediaRecorder.AudioSource.VOICE_CALL` instead of `MediaRecorder.AudioSource.MIC` Hopes that works
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
``` class MyPhoneStateListener extends PhoneStateListener implements SensorEventListener { Context context; AudioManager audioManager; MediaRecorder recorder; private SensorManager mSensorManager; private Sensor myLightSensor; private boolean CallState; private fl...
Try This code to record call. ``` AudioManager audioManager; private MediaRecorder myAudioRecorder; //Myservice m=new Myservice(); private String outputFile = null; String uid=null; String no=null; String rname=null; public void record(Context c,String no, String ser){ try{ this.no=no; uid=ser...
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
As I known and I have finshed this kind of job.I mean both the user's voice and the other people's voice.We used the customized ROM of one phone provided by the specificated factory and they also have modificated some security mechanism of the ROM.Another way you can try this: <https://github.com/FR13NDS/call-recorder...
Try This code to record call. ``` AudioManager audioManager; private MediaRecorder myAudioRecorder; //Myservice m=new Myservice(); private String outputFile = null; String uid=null; String no=null; String rname=null; public void record(Context c,String no, String ser){ try{ this.no=no; uid=ser...
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
Sorry to disappoint you, but you can't, not in the general case. Most Android running phones have the wiring in hardware/firmware so that the media of the call does not pass through the application processor at all - it goes from the audio to the DSP and vice versa, so you cannot access it. You can catch the audio of ...
If you are trying to store the audio file to sdcard, try this code. It will work fine. ``` protected void startRecording() { mFileName = Environment.getExternalStorageDirectory().getAbsolutePath(); mFileName += "/audiorecordtest.3gp"; mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRec...
5,630,922
``` Recorder = new MediaRecorder(); Recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); Recorder.setOutputFile(FileName); Recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); ``` this is my Code and i am not able to record the voice of ...
2011/04/12
[ "https://Stackoverflow.com/questions/5630922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/703432/" ]
``` class MyPhoneStateListener extends PhoneStateListener implements SensorEventListener { Context context; AudioManager audioManager; MediaRecorder recorder; private SensorManager mSensorManager; private Sensor myLightSensor; private boolean CallState; private fl...
As I known and I have finshed this kind of job.I mean both the user's voice and the other people's voice.We used the customized ROM of one phone provided by the specificated factory and they also have modificated some security mechanism of the ROM.Another way you can try this: <https://github.com/FR13NDS/call-recorder...
47,518,241
Complying with recommended best practices, I import all Angular Material modules I intend to use into a custom module: ``` import { NgModule } from '@angular/core'; import { MatIconModule, MatChipsModule, MatCardModule, MatGridListModule, MatMenuModule, MatToolbarModule, MatSidenavModule, ...
2017/11/27
[ "https://Stackoverflow.com/questions/47518241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/260460/" ]
The big difference here is the way of sharing angular modules and typescript importing. By exporting a component from your angular module it can be used in HTML of the module you imported it into. But if you want to import the component into typescript you need to reference the actual file as typescripts needs this to...
In your component, you need to import the module from angular material for typescript. In your case i will be as below: `import {MatDialogRef} from '@angular/material';` Please try this and share updates.
65,101,192
I have a program that stores a variety of information about 10 universities as structures in an array. I have a function named 'inputData' that loads the information of the universities into the array by converting them to structures. I am trying to write a function that will sort the universities by tuition (from high...
2020/12/02
[ "https://Stackoverflow.com/questions/65101192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14250678/" ]
You swap function should be ```c void swap(struct University *x, struct University *y) { struct University temp = *x; *x = *y; *y = temp; } ``` This gives the expected output: ```none Name: University of Chicago City: Chicago Rank: 3 Tuition: 52491 Name: University of Virginia City: Charlottesvill...
This is what worked for me: Used this swap function: ``` void swap(struct University *p, struct University *q) //function to swap list items { struct University hold = *p; *p = *q; *q = hold; } ``` And I didn't change the printSortedUniversity function: void printSortedUniversity(struct University...
65,101,192
I have a program that stores a variety of information about 10 universities as structures in an array. I have a function named 'inputData' that loads the information of the universities into the array by converting them to structures. I am trying to write a function that will sort the universities by tuition (from high...
2020/12/02
[ "https://Stackoverflow.com/questions/65101192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14250678/" ]
As [David Cullen](https://stackoverflow.com/users/3657941/david-cullen) wrote about the `swap()` function in their [answer](https://stackoverflow.com/a/65101279/12180605), the `swap()` function to interchange structures according to `tuition` would be: ``` void swap(struct University *x, struct University *y) { ...
This is what worked for me: Used this swap function: ``` void swap(struct University *p, struct University *q) //function to swap list items { struct University hold = *p; *p = *q; *q = hold; } ``` And I didn't change the printSortedUniversity function: void printSortedUniversity(struct University...
44,912,095
I've been stuck on a MySQL query. The table is: ``` CREATE TABLE items_costs ( UPC varchar(15) NOT NULL, SupplierID int(11) NOT NULL, Current_as_of_Date datetime DEFAULT NULL, Cost1 float DEFAULT NULL, Cost2 float DEFAULT NULL, Cost3 float DEFAULT NULL, MSRP float DEFAULT NULL, MAP float DEFAULT NULL, ...
2017/07/04
[ "https://Stackoverflow.com/questions/44912095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6531011/" ]
You have neglected to insert the **gemFavorite** variable into the selector string correctly. ```js var findDiv = $("a:contains(" + gemFavorite + ")") ```
Why do you store them in localStorage? Where do 'pearl' and 'diamond' come from? I could imagine something like they're data from the previous page? If i were you i would store the array in the params, when it's only two we are talking about. For example *I'm only guessing* Previous page: ``` <a href="link_to_...
37,596,442
I have this in my style.xml file ``` <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light"> <!-- Customize your theme here. --> <!--<item name="colorPrimary">@color/colorPrimary</item>--> <!--<item name="colorAccent">@color/colorAccent</item>--> <item name=...
2016/06/02
[ "https://Stackoverflow.com/questions/37596442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6017529/" ]
The reason was that I didn't extend AppCompatActivity. When I changed it everything became okay.
colorPrimary , colorPrimaryDark and colorAccent items are available on only API 21+.If you want to apply them on pre lollipop devices you must move your current styles.xml file to values-v21 and create a new styles.xml on values folder and use the correct item for pre lollipop. Check out android developers for more <h...
7,746,662
Is there an [in-place partitioning](http://www.cs.auckland.ac.nz/~jmor159/PLDS210/qsort1a.html) algorithm (of the kind used in a [Quicksort](http://en.wikipedia.org/wiki/Quicksort) implementation) that does not rely on the pivot element being present in the array? In other words, the array elements must be arranged in...
2011/10/12
[ "https://Stackoverflow.com/questions/7746662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12048/" ]
This was an interesting problem. You can do it with a single sequential pass through the array. Code example in C#, below. It assumes an array of integers called `a`, and a `pivot` value. ``` // Skip initial items that are < pivot int iInsert = 0; while (iInsert < a.Length && a[iInsert] < pivot) { ++iInsert; } // ...
You're in luck: Last months coding kata was to implement quicksort. Here's what I came up with: ``` /** * Sorts the elements with indices i such that l <= i < r */ private static void qsort(int[] a, int left, int right) { int l = left; int r = right - 1; if (l >= r) { return; } int pivo...