qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
172,847
This is a minor problem but when putting units on graphics I sometimes get italics and sometimes not. I get italics when there are superscripts. Thus ``` Plot[Sin[x], {x, 0, 2 π}, Frame -> True, FrameLabel -> {" m \!\(\*SuperscriptBox[\(m\), \(2\)]\)\* StyleBox[\( \!\(\* StyleBox[\" \",\nFontSlant->\"Italic\"]\)\)]...
2018/05/08
[ "https://mathematica.stackexchange.com/questions/172847", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/12558/" ]
[`Plot`](http://reference.wolfram.com/language/ref/Plot) by default uses `FormatType->TraditionalForm`, and in [`TraditionalForm`](http://reference.wolfram.com/language/ref/TraditionalForm) single letter *variables* are italicized. Consider: ``` {"m", m, m^2} // TraditionalForm ``` [![enter image description here](h...
An example, just to summarize the main points: ``` test = Text[ Style[#, FontSlant -> Plain, FontSize -> 32], {0, 0}] & /@ {Indexed[P, {i, j}], P} Graphics /@ test ``` [![italic](https://i.stack.imgur.com/OGCAP.jpg)](https://i.stack.imgur.com/OGCAP.jpg) ``` Graphics[#, FormatType -> StandardForm] & /@ te...
34,915,769
I am trying to retrieve categories from the `category` taxonomy of the `custom post` type By the below codes : ``` $categories = get_categories(array( 'type' => 'ad_listing', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'ASC', ...
2016/01/21
[ "https://Stackoverflow.com/questions/34915769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4740633/" ]
It will work, ``` $cat_args = array( 'parent' => 0, 'hide_empty' => 0, 'order' => 'ASC', ); $categories = get_categories($cat_args); foreach($categories as $category){ echo get_cat_name($category->term_id); }...
Here is the code work for me. ``` global $wpdb; $all_cats = array(); $args = array( 'taxonomy' => 'product_cat', 'orderby' => 'name', 'field' => 'name', 'order' => 'ASC', 'hide_empty' => false ); $all_cats = get_categories($args); echo '<pre>'; print_r($all_cats); ```
40,228,718
Not sure how how to fomulate the question, but this is the case: ``` interface X { some: number } let arr1: Array<X> = Array.from([{ some: 1, another: 2 }]) // no error let arr2: Array<X> = Array.from<X>([{ some: 1, another: 2 }]) // will error ``` ([code in playground](http://www.typescriptlang.org/play/index.ht...
2016/10/24
[ "https://Stackoverflow.com/questions/40228718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/733596/" ]
> > But whenever the page attempts to load, it crashes with the error "Failed to assign to property 'Windows.UI.Xaml.EventTrigger.RoutedEvent'." Why does this not work? > > > As @Clemens said, problem is in Windows Runtime XAML, the default behavior for event triggers and the only event that can be used to invoke ...
I know it's too late for answering the question but for those who will be having the same issue. you can use this XAML code: ``` <Image x:Name="TumbImage" Opacity="0" ...> <i:Interaction.Behaviors> <core:EventTriggerBehavior EventName="ImageOpened"> <media:ControlStoryboardAction Storyboard="{StaticResource...
14,870,046
Hi I am new to Hadoop and NoSQL technologies. I started learning with world-count program by reading file stored in HDFS and and processing it. Now I want to use Hadoop with MongoDB. Started program from [here](http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-hadoop/) . **Now here is confusion with me ...
2013/02/14
[ "https://Stackoverflow.com/questions/14870046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1004981/" ]
It seems Chrome is in error. The [CSS 2.1 spec](http://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align) says > > The baseline of an 'inline-block' is the baseline of its last line box > in the normal flow, unless it has either no in-flow line boxes or if > its 'overflow' property has a computed value other ...
Try This ``` <!doctype html> <html> <head> <style> .a { display: inline; overflow: hidden; color: red; } </style> </head> <body> baseline__<div class="a">test</div>__baseline </body> </html> ```
5,595,469
I am new to the kohana php framework. In the modules folder in kohana 3.1, there are many empty files extending the existing classes. Should I write my code in those empty files? If yes, do I have to make any changes in bootstrap? If not, where should I place these files? Should they be in a subfolder inside the Appl...
2011/04/08
[ "https://Stackoverflow.com/questions/5595469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/691288/" ]
You have to check if it was clean request or not. Otherwise you will fall into infinite loop Here is an *example* from one of my projects: .htaccess ``` RewriteEngine On RewriteRule ^game/([0-9]+)/ /game.php?newid=$1 ``` game.php ``` if (isset($_GET['id'])) { $row = dbgetrow("SELECT * FROM games WHERE id = %s"...
If you are running Apache you can use the mod\_rewrite module and set the rules in a .htaccess file in your httpdocs folders or web root. I don't see any reason to invoke a PHP process to do redirection when lower level components will do the job far better. [An example from Simon Carletti](http://www.simonecarletti.c...
7,933,505
How can create a mask input for number that have percent by jQuery? Do I make input just accept until three numbers and put percent sign after numbers while user finished typing(`keyup`)? **I don't use plugins.** Example: **1%** Or **30%** Or **99%** Or **100%** Or **200%** ``` <input name="number" class="num_perce...
2011/10/28
[ "https://Stackoverflow.com/questions/7933505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1004952/" ]
You're better off not using JavaScript for this. Besides the problems that come with using `onkeyup` for detecting text input, you also have the hassle of parsing the resulting string back to a number in your client/server scripts. If you want the percent sign to look integrated, you could do something like this: ``` ...
```js function setPercentageMask() { let input = $('.percent'); input.mask('##0,00', {reverse: true}); input.bind("change keyup", function() { isBetweenPercentage($(this)); }); } function isBetweenPercentage(input) { let myNumber = (input.val()) ? parseFloat(input.val()) : 0; (myNumber....
3,777
First of all, if you didn't know (and I can only hope you did), Programmers Stack Exchange has it's [own community blog](http://programmers.blogoverflow.com/) that anybody can contribute to. So, if you haven't been reading it, start now :-)! Anyways, currently we have very few solid contributors to the blog. We starte...
2012/07/12
[ "https://softwareengineering.meta.stackexchange.com/questions/3777", "https://softwareengineering.meta.stackexchange.com", "https://softwareengineering.meta.stackexchange.com/users/34364/" ]
Justin Kohlhepp --------------- **Writer, 1 post every 1-2 months** I maintain my own blog at the moment at [RationalGeek.com](http://rationalgeek.com/blog). The topics I write about are pretty well aligned to the subject matter of Programmers.SE. I'd be glad to contribute some posts to P.SE blog as long as I can als...
Le Do Hoang Long ================ *Writer, 1 post every 1,2 months & proofreader* I maintain a simple blog at <https://ledohoanglong.wordpress.com>. My English writing skill may be not very good, but I'm willing to learn.
490,939
I am using the following lines to create two columns ``` \begin{columns} \begin{column}{0.5\textwidth} some text here some text here some text here some text here some text here \end{column} \begin{column}{0.5\textwidth} some text here some text here some text here some text here some text here some text her...
2019/05/15
[ "https://tex.stackexchange.com/questions/490939", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/161646/" ]
**1. multicol** Here is a solution using [multicols](https://ctan.org/pkg/multicol), because initially I had no reference to the package that has the definition of the environment `column` and `columns`. I have added a `minipage` of fixed height and width inside the columns, and the text inside the `minipage`. You c...
If the columns are top aligned, they will look as if they have the same height (even if they don't actually have it). It makes no sense to add additional minipages inside the columns, because they are minipages themselves. ``` \documentclass{beamer} \begin{document} \begin{frame} \begin{columns}[T] \begin{column}{0.5...
4,129,599
I want to notify a user about her being also logged in from other computer(s), with an option to close these other sessions. Unfortunately it'd not immediately obvious how to do it in Django without hacking the database directly.
2010/11/09
[ "https://Stackoverflow.com/questions/4129599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/489566/" ]
Oracle and java play fairly well with each other, and this is may be a new idea if you're feeling adventerous. Java does this pretty easily, but i'm away from an oracle box and unable to test. This really hurts i'm not in front of an oracle machine at the moment. To make sure I remembered correctly, I used steps from h...
If the 'HEX' values are from a Mainframe, then perhaps they are EBCDIC (Extended Binary Coded Decimal Interchange Code) and not HEX? I don't have time to reason it out right now but try this page for ideas/clues? <http://www.simotime.com/asc2ebc1.htm> Of course I may be barking up the wrong tree :) Assume 50 34 2E is ...
48,592,613
I am switching from basic R plot tools to ggplot2 and am struggling with one issue. In basic R you can control distance to each of four axes (or the "box") by setting margins. Resulting margins are fixed and do not depend on what you plot. These allows me to produce plots for my papers with exactly same plot area size...
2018/02/03
[ "https://Stackoverflow.com/questions/48592613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3458955/" ]
Following the approach suggested by [Stewart Ross](https://stackoverflow.com/users/1649060/stewart-ross) in [this message](https://stackoverflow.com/a/48595363/3458955), I ended up in the similar [thread](https://stackoverflow.com/questions/36198451/specify-widths-and-heights-of-plots-with-grid-arrange/36198587). I pla...
Although there are many theme options in ggplot2, there does not appear to be an option which sets a fixed margin space for the axes (or if there is it is well hidden). The `cowplot` package has an align\_plots function which can align one or both axes in a list of plots. `align_plots` returns a list, each component of...
5,766,318
I am not sure it is me or what but I am having a problem converting a double to string. here is my code: ``` double total = 44; String total2 = Double.toString(total); ``` Am i doing something wrong or am i missing a step here. I get error `NumberFormatException` when trying to convert this. ``` totalCost.setOnTo...
2011/04/23
[ "https://Stackoverflow.com/questions/5766318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/637146/" ]
Using Double.toString(), if the number is too small or too large, you will get a scientific notation like this: 3.4875546345347673E-6. There are several ways to have more control of output string format. ``` double num = 0.000074635638; // use Double.toString() System.out.println(Double.toString(num)); // result: 7.4...
There are three ways to convert **double to String**. 1. Double.toString(d) 2. String.valueOf(d) 3. ""+d public class DoubleToString { ``` public static void main(String[] args) { double d = 122; System.out.println(Double.toString(d)); System.out.println(String.valueOf(d)); System.out.println(""+d); ...
28,422,989
I used javascript to hide `div` depend on `radio button` value for example I unhide `div` `#one` and fill up input fields and realize I'm in the wrong transaction and click the radio button to change the desire transaction but without clean up all input fields. is there any way to clean up input values(I mean by clean...
2015/02/10
[ "https://Stackoverflow.com/questions/28422989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1954060/" ]
maybe this could give you idea how on the javascript ``` <script> function showhidediv( rad ) { var rads = document.getElementsByName( rad.name ); document.getElementById( 'one' ).style.display = ( rads[0].checked ) ? 'block' : 'none'; document.getElementById( 'two' ).style.display = ( rad...
I've created this function to clear data from inputs, but it can also help you to read an element contained in the parent div, read the values and decide what to do.. ``` function clear_inputs(div){ parent_content=document.getElementById(div); child_elements=parent_content.getElementsByTagName('input'...
430,199
Let $\chi$ be a primitive character mod $p$ (prime) and $\rho = \beta + i \gamma$ be a non-trivial zero of $L(s, \chi)$. I am reading a paper by Ihara and Murty where they use following estimate : $\left|\frac{1}{\rho(1-\rho)} \right| \ll \log p \;$ for $\; |\gamma| \leq 1$. (We can assume $\rho$ is not the possible ...
2022/09/11
[ "https://mathoverflow.net/questions/430199", "https://mathoverflow.net", "https://mathoverflow.net/users/477598/" ]
This follows from Noam's answer and the classical zero-free region for Dirichlet $L$-functions. For a specific reference, see Davenport's *Multiplicative Number Theory*, Chapter 14. The result quoted below can be found on page 93: **Theorem.** There exists a positive absolute constant $c$ with the following property. ...
We must assume that $1-\rho$ is not exceptional either. Then both $|\rho|$ and $|1-\rho|$ are $\gg 1 / \log p$, and the desired inequality follows, for instance because $$ \frac1{\rho (1-\rho)} = \frac1\rho + \frac1{1-\rho}. $$
613,231
Heyo! I'm currently working on a non-lfs system from scratch with busybox as the star. Now, my login says: ``` (none) login: ``` Hence, my hostname is broken. `hostname` brings me `(none)` too. The guide I was following told me to throw the hostname to `/etc/HOSTNAME`. I've also tried `/etc/hostname`. No matter wha...
2020/10/06
[ "https://unix.stackexchange.com/questions/613231", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/382366/" ]
The `hostname` commands in common toolsets, including BusyBox, do not fall back to files when querying the hostname. They report solely what the kernel returns to them as the hostname from a system call, which the kernel initializes to a string such as "(none)", changeable by reconfiguring and rebuilding the kernel. (I...
So you are building this system from scratch and you are asking where the hostname is configured? The simple answer is that it isn't. The current hostname is stored inside the kernel and like most things kernel, it doesn't read any files by default. *Something* in your system startup must read a config file (of your ...
4,325,066
I have created a table with HTML and want to integrate a search box. How do i do that? Can you recommend a good jQuery plugin or better a complete tutorial?
2010/12/01
[ "https://Stackoverflow.com/questions/4325066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/526647/" ]
There are great answers. But [this](http://blogs.digitss.com/about/) guy did what i Really wanted. it's slighly different from previous answers HTML ``` <label for="kwd_search">Search:</label> <input type="text" id="kwd_search" value=""/> <table id="my-table" border="1" style="border-collapse:collapse"> <thead> ...
Thanks David Thomas Good Solution. Following makes it perfect. ``` $(document).ready( function(){ $('#searchbox').keyup( function(){ var searchText = $(this).val(); if (searchText.length > 0) { $('tbody td:contains('+searchText+')') .addClass('s...
28,762,180
I want to sort the [select2](https://select2.org/) options in alphabetical order. I have the following code and would like to know, how can this be achieved: ``` <select name="list" id="mylist" style="width:140px;"> <option>United States</option> <option>Austria</option> <option>Alabama</option> <optio...
2015/02/27
[ "https://Stackoverflow.com/questions/28762180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3592650/" ]
Select2 API v3.x (`sortResults`) ================================ You can sort elements using `sortResults` callback option with [`String.localeCompare()`](https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/String/localeCompare): ```js $( '#mylist' ).select2({ /* Sort data using local...
Take a look in this code: ``` $('#your_select').select2({ /* Sort data using lowercase comparison */ sorter: data => data.sort((a,b) => a.text.toLowerCase() > b.text.toLowerCase() ? 0 : -1) }); ``` I hope it has been helped you! =)
17,544,190
I have a page that the user can upload an image to and then move around and resize using jquery draggable and jquery resizable. To save on mutilple requests to the server, would it be posible to use the locally stored version of the image to speed things up and then have a save button which would only upload the image...
2013/07/09
[ "https://Stackoverflow.com/questions/17544190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1095504/" ]
Do somthing like this- ``` var url = $('a').attr('href'); if(verify url is of type image here){ //true } else{ //false } ```
Use regexp to check for strings in the href attribute: ``` var patt=/(png|jpg|gif)/g; if(patt.test($('a').attr('href'))){ //do something if image } else { //do something else } ```
50,566,868
How to change background color of `TabBar` without changing the `AppBar`? The `TabBar` does not have a `background` property, is there a workaround?
2018/05/28
[ "https://Stackoverflow.com/questions/50566868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4222924/" ]
So if you are looking for to change the specific tab color and then you can try the following code: 1. Create a variable of color: Color tabColor=Colors.green; 2. Create onTap method inside the TabBar and inside the tab bar create `setState()` method code is given below: ```dart onTap: (index) { setState(() { ...
for use with SliverPersistenHeader (e.t.c collapsing with sliver appbar in nested scrollview) ``` class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate { _SliverAppBarDelegate(this._tabBar); final TabBar _tabBar; @override double get minExtent => _tabBar.preferredSize.height; @override dou...
68,538,522
I have a data frame of household members containing 3 integer columns, 'hid', 'sub', and 'age'. I'd like to create a new logical variable in the data frame called 'hh' representing the household head, defined as follows: 1. If there is only 1 member in the household, then the value is TRUE, 2. If there are 2 or more m...
2021/07/27
[ "https://Stackoverflow.com/questions/68538522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7514527/" ]
You can `arrange` the data in such a way that the first row of each group is the `hh` value you are looking for. ``` library(dplyr) d %>% arrange(hid, !between(age, 18, 65), sub) %>% mutate(hh = !duplicated(hid)) # hid sub age hh # <dbl> <dbl> <dbl> <lgl> # 1 1 2 55 TRUE # 2 1 1...
An option with `case_when`, each case\_when is translating your conditions 1 to 3 into code: ``` library(dplyr) d %>% group_by(hid) %>% mutate(hh = case_when(max(sub) == 1 ~ TRUE, max(sub) > 1 & between(age, 18, 65) & sub...
32,902,360
For instance I have a database of cars, which have a field called manufacture. ``` car: { _id: <ObjectId>, manufacture: "Opel", model: "Astra" } ``` How can I get all manufactures without repeating them using the latest implementation official C# driver for MongoDB? I'd like this to be done in my re...
2015/10/02
[ "https://Stackoverflow.com/questions/32902360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5397012/" ]
This should do it ``` var db = database.GetCollection<BsonDocument>("cars"); FieldDefinition<BsonDocument, string> field = "car.manufacture"; FilterDefinition<BsonDocument> filter = new BsonDocument(); var a = db.DistinctAsync(field, filter).GetAwaiter().GetResult().ToListAsync().GetA...
Use the `Distinct()` method: <http://api.mongodb.org/csharp/current/html/M_MongoDB_Driver_MongoCollection_Distinct.htm> The field name should be passed as a string, some generic MongoDB examples: <http://docs.mongodb.org/manual/reference/method/db.collection.distinct/> Following [some examples](http://docs.mongodb.or...
109,439
I have a permanent email aliasing from my previous institute. My current academic affiliation (let's pretend it is Horvord University) does NOT give me a permanent email address. Now, I am going to submit a paper to a journal and I wonder if it is considered professionally appropriate if I list Horvord as my affiliat...
2018/05/09
[ "https://academia.stackexchange.com/questions/109439", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/69151/" ]
Adding an acknowledgment essentially doesn't cost anything, so there's little reason why the authors wouldn't want to do it if you helped; however it is true that there is still some awkwardness involved in asking others to credit you. One way to defuse the awkwardness could be to focus on tangible practical reasons w...
If I were in your place, I would not ask to be mentioned in acknowledgments, especially if you are planning to work with authors in the future. Not all battles are equally important, think in the long run :) p.s. if the authorship were discussed, I would say fight for it, but acknowledgments...I would not.
29,438,562
**Description of the Problem** As NPAPI plugins will be deprecated in Chrome (maybe in Firefox too soon) and being part of a project ([WebChimera](http://www.webchimera.org/)) that is based on an NPAPI plugin. I've been thinking of different solutions to keep NPAPI support in browsers. (as porting this plugin to NaCL ...
2015/04/03
[ "https://Stackoverflow.com/questions/29438562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2769366/" ]
This would involve a lot of painful hackery. You'd have to solve most of these issues on all platforms independently and rely on a lot of implementation details. As a possible alternative, check out the [plans for FireBreath 2.0](http://www.firebreath.org/x/kQCt) which will support plugins which can be loaded via NPAP...
Now it's possible to use libvlc to play video directly on NW.js/Electron page: <https://www.npmjs.com/package/webchimera.js> What this project is: it's low level (written in C++) addon which use libvlc and allow decode video frames to JS ArrayBuffer object. In turn this ArrayBuffer object could be drawn on HTML5 canva...
74,588
I would like to install a "panic button" on my phone's home screen or lock screen that would send a predefined sms/text message to a selected group of people. I am NOT looking for a group sms app where you first need to wait for the app to start up, then need to select the group, then type a message, then handle vario...
2014/06/21
[ "https://android.stackexchange.com/questions/74588", "https://android.stackexchange.com", "https://android.stackexchange.com/users/64518/" ]
Yes. It is possible to have more space allocated for personal use. First, I would suggest that your download [Terminal Emulator](https://play.google.com/store/apps/details?id=jackpal.androidterm&hl=en) and run the command `df` in it to get the memory allocated for each partition (ie `/system`, `/data` etc). The space...
Well u did not specify your Android OS so let's go by the default answer 1. Basically in Android Device the operating system(jelly bean, Kit Kat) occupies a lot of space for the phone to operate(drivers for Wi-Fi, HD display etc.) and remind you its pre determined and can also vary after an update. 2. Due to which the...
5,285,572
I have a form to signup with the code below: ``` <form method="post"> Username<input type="text" size="12" maxlength="16" name="username"><br /> Password<input type="password" size="12" maxlength="32" name="password"><br /> <input type="submit" name="submit" value="Sign Up!" /> </form> ``` And then I have it too che...
2011/03/12
[ "https://Stackoverflow.com/questions/5285572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/654182/" ]
First of all: Don't use concatenated strings to insert values to the database. This is a major security hole, it can be exploited using a technique called SQL-Injection. You can prevent this by using so called [Prepared Statements](http://www.petefreitag.com/item/356.cfm). And this should solve your problem: You proba...
$username =$POST['username'] is wrong. You forgot \_ . It must be $username = $\_POST['username'].
561,203
I am using a web service to query data from a table. Then I have to send it to a user who wants it as a DataTable. Can I serialize the data? Or should I send it as A DataSet. I am new to Web Services, so I am not sure the best way to do it.
2009/02/18
[ "https://Stackoverflow.com/questions/561203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67854/" ]
You can send the data as a xml string from a dataset by `DataSet.GetXml()` And than the user can deserialize it with `DataSet.ReadXml()` And get the datatable from the dataset by `DataSet.Tables` Good luck
You can transfer DataTable's over a Web Service. So that is probably your best option, becuase that is what the client asked for.
33,798,100
I am using elasticsearch dsl to search on elasticsearch : <https://elasticsearch-dsl.readthedocs.org/en/latest/> How can i filter specific fields while making a search query: I know its supported in elasticsearch: <https://www.elastic.co/guide/en/elasticsearch/reference/1.4/search-request-fields.html> Just dont know...
2015/11/19
[ "https://Stackoverflow.com/questions/33798100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3027854/" ]
When you have your `Search` object you can call the `.fields()` function on it and specify which fields you want to return: ``` s = search.Search() s = s.fields(["field1", "field2"]) ... ``` It's not explicitly mentioned in the documentation, but you can see the `fields` function in the [source for the `search.py` f...
i use that for all fields : ``` from elasticsearch_dsl import Q, Search from elasticsearch import Elasticsearch client = Elasticsearch('localhost:9200') q = Q("multi_match", query='STRING_TO_SEARCH', fields=['_all']) result = Search(index='YOUR_INDEX').using(client).query(q).execute() ``` or for specific fields :...
14,916,520
Hi Im studying for my scja exam and have a question about string passing by ref/value and how they are immutable. The following code outputs "abc abcfg". What I want to know is why is this happening? Im not understanding what happens inside of method f. String is passed by value so surely it should change to "abcde" ...
2013/02/16
[ "https://Stackoverflow.com/questions/14916520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/655283/" ]
This line of code: ``` b += "de"; ``` Roughly translates to: ``` b = b + "de"; ``` Which creates a new String and stores it in the local variable 'b'. The reference outside the method is not changed in anyway by this. There are a couple of key things to remember when trying to understand how/why this works this w...
Your creating a new object of String when you say something like b+="de" Its like saying b = new String(b+"de"); If you really want to keep the value passed in then use a stringBuilder like this: ``` StringBuilder a =new StringBuilder("abc"); StringBuilder b = a; f(b); b.append("fg"); ...
166,694
It has beeen a long time since I've asked a question, however the narrative to my question is quite simple: How do I push back against upper management "innovations" and simple "requests"? Questions that I found tremendously helpful were: * [How can I push back against a boss who wants us to work four 16-hour days i...
2020/11/11
[ "https://workplace.stackexchange.com/questions/166694", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/38289/" ]
Your question reads like a rant. Instead of pushing back, why not just go along with it? You have no stake in the success or failure of the company other than your current paycheck, and since your plan is to leave as soon as the opportunity arises, why do you care? At the end of the day, they pay you to perform work. ...
Pushing back against upper management innovations and requests for improvement? Hold on. It is top management's job to know what they need. However, you can push back on how that information is collected and presented. The problem is that you, in IT, are expected to know the business objectives and work to further tho...
29,810,389
I must calculate time between several dates, but this fields are not date type, this fields are varchar, so I must convert them. For example I have this values: ``` CODIGO SUMILLA_HDR1 SUMILLA_HDR2 N050044 07/01/2015 10:58 09/01/2015 12:32:36 N050044 07/01/2015 10:58 09/01/2015 11:58:10 ``` If I conve...
2015/04/22
[ "https://Stackoverflow.com/questions/29810389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4591130/" ]
`sed` is the wrong tool for any task involving multi-line blocks of input because it's line-oriented. You should be using awk as it's record-oriented and so can treat each multi-line block of input a easily as sed can handle lines of input. ``` $ awk -v RS= -v ORS='\n\n' '{sub(/xyz/,"abc"); sub(/network:[^\n]+/,"netwo...
If you're just trying to swap text I'd probably chain seds and then store the output in a temporary file and then cat it back into the original file - probably not the best solution, but its the first that comes to mind. I have this in a script.sh ``` #!/bin/bash while read line do echo $line | sed s/xyz/temp1/g | s...
1,103,668
I wanted to convert my TP-Link WR841N into an Openflow switch for which I followed the guide at kickstartSDN.com Since there was no instruction on which image to download, I accidentally upgraded router with the OpenWRT upgrade image and now I cannot telnet 192.168.1.1 into my router. I have enabled telnet and have a...
2016/07/21
[ "https://superuser.com/questions/1103668", "https://superuser.com", "https://superuser.com/users/619892/" ]
TP-Link WR841N router supports flash from TFTP server. If you want to revert, download latest firmware for your router with correct HW revision from TP-Link website. Then download some TFTP server. For example you can use <http://tftpd32.jounin.net/>. Run TFTP server in directory with firmware file (or in tftpd32 y...
Go to Luci Web interface <http://TPLIN-IP-ADDRESS> , login (with root), and select choose the System menu, "Backup/Flash firmware", "Restore backup". There are also options to recover it via TFTP described here: <https://wiki.openwrt.org/toh/tp-link/tl-wr841nd>
3,879,607
There is this table that is being generated on a monthly basis. Basically the table structure of all *monthly* tables is the same. Since it would be a lot of work to map the same entity just with a different table name, Is it possible to change the table name of an entity as follows on runtime since they have the sam...
2010/10/07
[ "https://Stackoverflow.com/questions/3879607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392222/" ]
I cannot imagine a good way to map this. If this is a legacy database, you'll have a hard time using JPA to access it. If, however, the database layout is under your control, then I'd change it. Having multiple tables with the exact same layout is usually bad design. You could achieve the same result by having only on...
I could not figure this one either, had a similar requirement. Since my table name changed relatively infrequently (daily) , I ended up defining a DB alias to the "active" table at the RDBMS (I am using DB2) and referenced the table alias name in the @Table annotation. I am fully aware this is not strictly what the ...
1,551
I have seen many ways to address a bhikkhu, and I'm wondering about the proper way to address a bhikkhu, in writing?
2014/06/27
[ "https://buddhism.stackexchange.com/questions/1551", "https://buddhism.stackexchange.com", "https://buddhism.stackexchange.com/users/89/" ]
**Bhante** is the preferred mode of address if you are addressing the bhikkhu respectfully; note that it is masculine, so for bhikkhunis, **Ayye** is correct (mostly they use ayya, but I don't think that is technically correct). In English, **Venerable x** and **Reverend x** would also be suitable expressions of respec...
Whatever identifies that specific monk. That's the purpose of a name. I tend to use only their monastic name or, if they teach, I use 'teacher' in their local idiom. Keep things simple & respectable. As for a "proper way", there are as many answers as there are people, I guess.
37,267,811
In a dataframe there are 4 columns col1,col1\_id,col2,col2\_id, I want to locate col\_2 values in col\_1 then if is there any match respective col1\_id should be append to col2\_id. ``` col_1 col1_id col_2 col2_id A 1 NaN NaN B 2 K NaN D 3 A NaN J ...
2016/05/17
[ "https://Stackoverflow.com/questions/37267811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5435253/" ]
Guava has a [`Table`](http://google.github.io/guava/releases/snapshot/api/docs/com/google/common/collect/Table.html) structure that looks like you could use, it has [`containsValue(...)`](http://google.github.io/guava/releases/snapshot/api/docs/com/google/common/collect/Table.html#containsValue(java.lang.Object)) metho...
just in this case, I would use a String[][] because you can access the elements with a complexity of O(1) but as I said, only in this case. If the number of the rows or columns is dynamically modified then I'd use `List<List<String>>`, more exactly ArrayList
71,943,129
I have a two divs, Parent and Child. And I need to make Child fill all available height of Parent. But for some reason I have this padding at the bottom. I can remove it only when I use height `105%` for Child But this is obviously not the best solution. I tried to use `align-items: stretch`, but it didn't do anyt...
2022/04/20
[ "https://Stackoverflow.com/questions/71943129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17564445/" ]
Use `flex-basis: 100%;` on the flex item. ```css html, body { margin: 0; height: 100%; } body>div:first-child { width: 100%; height: 100%; display: flex; flex-direction: row; box-sizing: content-box; } div>div { flex-basis: 100%; background-color: red; } ``` ```html <div> <div>foo</div> </div> `...
Here's a few basics already laid out. I reformatted it a bit too for readability. You had background-color as backgroundColor, as well as 100% to '100%'. If you take this as a basis, just change the width and height of it to 100% and you should have no problem. The larger change was setting the position, and ensuring ...
29,413,290
I am studying Spring MVC and I have the following doubts: 1. **What exactly is the purpose of the session scope?** Reading the documentation I know that this scopes a bean definition to an HTTP session. Only valid in the context of a web-aware Spring ApplicationContext. And also that a new instance is created once pe...
2015/04/02
[ "https://Stackoverflow.com/questions/29413290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1833945/" ]
1. You use spring session beans for beans which are stateful and their state differs per user. These can be for example preferences of currently logged in user. 2. Default scope of bean in spring is singleton and it is no different in Web Application context. Note than in web environment you can use also REQUEST scope...
I had the same problem, I was using: ``` @Component @Scope("session") ``` And this made the magic for me: ``` @Component @Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS) ``` I hope it helps ;-)
8,767,004
Is there a quick and dirty way to get the value of one column from one row? Right now I use something like this: ``` $result = mysql_query("SELECT value FROM table WHERE row_id='1'"); $row = mysql_fetch_array($result); return $row['value']; ``` It seems there must be able to consolidate the second and third lines. ...
2012/01/07
[ "https://Stackoverflow.com/questions/8767004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/700579/" ]
use this hacker) ``` $result = mysql_result(mysql_query("SELECT value FROM table WHERE row_id='1'"), 0); ```
You can use GROUP\_CONCAT ( <http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat> ) function to make them into one field.
44,622,891
I know this kind of question is ask in many different ways, and I know that's annoying for answering so much same question, but as I google it, search in Stackoverflow I can't really find a nice answer, the answer I'm asking is based on views like easy for answering API request (which is in JSON format) and in the view...
2017/06/19
[ "https://Stackoverflow.com/questions/44622891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6616756/" ]
@Laurent's answer gave me the lead but Bazel didn't accept relative paths and required I add both `classes` and `test-classes` folders under `target` to delete the package so I decided to answer with the complete solution: ``` #!/bin/bash #find all the target folders under the current working dir target_folders=$(find...
Can you use your shell to find the list of packages to ignore? ``` deleted=$(find . -name target -type d) bazel build //... --deleted_packages="$deleted" ```
169,888
In the school laboratory, a friend tried the famous Cannizzaro reaction for benzaldehyde. Some $\ce{NaOH}$ was added to benzaldehyde, and the solution was stirred for 30 minutes. What came as a surprise was that, after this time interval, a big, bright yellow, gooey-looking blob appeared in the flask. As can be [seen]...
2022/12/12
[ "https://chemistry.stackexchange.com/questions/169888", "https://chemistry.stackexchange.com", "https://chemistry.stackexchange.com/users/125707/" ]
Robert DiGiovanni's answer comes close. Benzyl alcohol can indeed precipitate during the intermediate stage, but [it is colorless](https://en.wikipedia.org/wiki/Benzyl_alcohol). Because benzyl alcohol has some weak acidity, it can be partially deprotonated by a base as strong as sodium hydroxide, giving $\ce{C6H5-CH2-O...
Benzyl alcohol has a lower solubility (4 g/100 ml) than sodium benzoate (63 g/100 ml) or benzaldehyde (7 gram/100 ml) in water. The presence of NaOH contributed to the "salting out" of the more nonpolar benzyl alcohol, plus some other impurities, forming your "blob". Benzaldedyde and benzyl alcohol are also (surprisi...
1,145,442
I have been trying to figure out how to get rid of these symbols that show up on my Chromebook (on only some webpages): [![symbols](https://i.stack.imgur.com/aaFZp.png)](https://i.stack.imgur.com/aaFZp.png) When I copy them and paste them, they show the correct words. How can I get rid of these words without resetti...
2016/11/13
[ "https://superuser.com/questions/1145442", "https://superuser.com", "https://superuser.com/users/656599/" ]
By resting all of my settings it worked, I had probably clicked and changed some setting.
Take a look at the language settings under Language and Input Settings. If you have more than one language, check which is set as "Google Chrome OS is displayed in this language". Also try clearing "cached images and files" under Settings / More Tools / Clear Browsing Data.
40,509,422
As I understand, a BSP (Board Support Package) contains bootloader, kernel and device driver which help OS to work on HW. But I'm confused because OS also contains a kernel. So what is the difference between the kernel in OS and the kernel in BSP?
2016/11/09
[ "https://Stackoverflow.com/questions/40509422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3831520/" ]
What a BSP comprises of depends on context; generically it is code or libraries to support a specific board design. That may be provided as generic code from the board supplier for use in a bare-metal system or for integrating with an OS, or it may be specific to a particular OS, or it may even include an OS. In any ca...
vxWorks kernel which you can run on a Board contains vxWorks core kernel and "other components" which may change from one environment. Core kernel contains essential programs such as Scheduler, Memory manager, Basic File systems, security features etc. These "other components" which are part of BSP may be optional or m...
242,830
Setup as follows: * One gateway/firewall * One switch * Two servers behind firewall with 2 NICs each. Each NIC is connected to the switch. The servers are running Ubuntu server. One of the two NICs is now used for all traffic. What I want is for all traffic between the two local servers to use the second currentl...
2011/03/03
[ "https://serverfault.com/questions/242830", "https://serverfault.com", "https://serverfault.com/users/72976/" ]
You're on the right track: a static route is definitely what you want to use to ensure traffic between those hosts travels on a specific interface. Here's a doc that might help: <http://www.ubuntugeek.com/howto-add-permanent-static-routes-in-ubuntu.html>
Sorry, perhaps I totally misunderstand, but can't you just use an internal DNS name to your server (using /etc/hosts) that would map to the IP of the second NIC ?
3,146,358
Ok, this may be not the most clear title, but my question is straightforward. Say we choose $n$ integers $\{ z\_1,\dots,z\_n \}$ and we construct the polynomial $$ P(x) = \prod\_{i=1}^n (x-z\_i). $$ Are the all the roots of the polynomial $P(x) + 1$ irrational?
2019/03/13
[ "https://math.stackexchange.com/questions/3146358", "https://math.stackexchange.com", "https://math.stackexchange.com/users/21719/" ]
It's very easy to show the given relations . And we are gonna work with some basic properties of a field. Let( F ,+, .) Is our field . Now it's given, 1+1=0. Now if , a belongs to F then by using the property, a.(b+c)=a.b+a.c , for all , a,b,c belongs to F , we can write, a.(1+1)=a.1+a.1 = a+a , as '1' is multiplica...
> > I am a bit unsure as to that the question is asking, do I assume $F$ is a field $\{0,1\}$? > > > Let's read through the requirements of the problem carefully. All that is given to us is: "Let $F$ be a field." So we know $F$ is a field -- we don't know how many elements it has, but all fields at least have a ze...
54,107,105
In my current project we have permanently disabled form controls. In those cases the form element is replaced with a `span` element on the server-side. That creates code like this: ``` <label for="foo">Foo</label> <span id="foo">Bar</span> ``` **Question 1**: Is having a `label` element without any associated form ...
2019/01/09
[ "https://Stackoverflow.com/questions/54107105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3744304/" ]
As the spec itself says > > The for attribute may be specified to indicate a form control with which the caption is to be associated. If the attribute is specified, the attribute's value must be the ID of a labelable form-associated element in the same Document as the label element. > > > *The for attribute may b...
As mentioned in an answer referenced by one of the comments, a `<span>` tag should be used in place of a `<label>` when not referring directly to an `<input>` element. It is semantically incorrect to do otherwise. **Correct:** ``` <span>This is an image</span> <img src="https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefaul...
51,635,155
I have the need to select the last enter for each Passcode for each department. Each department has a 3 digit passcode, each person is given a code based on department. i.e. dept A has numbers 000-099, dept B has 100-199, dept C 201-299 and so on upto 999. The database holds name and passcode for each person. J smith ...
2018/08/01
[ "https://Stackoverflow.com/questions/51635155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can write it shorter using `Optional` and mapping: ``` private boolean isSequenceSuccessful() { return Optional.of(doSomething()) .flatMap(result1 -> doAnotherThing(result1)) .flatMap(result2 -> doSomethingElse(result2)) .map(result3 -> doMoreStuff(result3)) .orE...
You could use the `map` method: ``` private boolean isSequenceSuccessful() { Optional<byte[]> result = doSomething().map(this::doAnotherThing) .map(this::doSomethingElse); if (result.isPresent()) return doMoreStuff(result.get()); else return false; } ```
71,019,093
Seems simple to me.. I want to do something along the lines of =Countif(A2:X , "Yes") I would wrap this in an arrayformula with a simple IF(A2:A = "" ,"" ..... I want it to bring back the number of "Yes" per row So if row 2 has 12 yes' then bring back 12, row 3 has 7 so 7 etc This has worked to an extent but bring...
2022/02/07
[ "https://Stackoverflow.com/questions/71019093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18141666/" ]
Try: ``` =ArrayFormula(IF(A2:A="",,MMult(N(A2:X="Yes"),Sequence(Columns(A2:X))^0))) ``` Or ``` =ArrayFormula(IF(A2:A="",,Len(RegexReplace(RegexReplace(Transpose(Query(Transpose(A2:X),,9^9)),"(?i)\bYes\b","~"),"[^~]",)))) ``` Or ``` =ArrayFormula(IF(A2:A="",,Len(Substitute(Transpose(Query(Transpose(IF(A2:X<>"Yes"...
Though it is a bit tedious, couldn't you do this: ``` =COUNTIF(A2:A, "Yes") + COUNTIF(B2:B, "Yes") + COUNTIF(C2:C, "Yes") + COUNTIF(D2:D, "Yes") + COUNTIF(E2:E, "Yes") + COUNTIF(F2:F, "Yes") + COUNTIF(G2:G, "Yes") + COUNTIF(H2:H, "Yes") + COUNTIF(I2:I, "Yes") + COUNTIF(J2:J, "Yes") + COUNTIF(K2:K, "Yes") + COUNTIF(L2:...
38,369,685
So I'm new to AngularJS and NodeJS, trying to create a simple ng-table using <http://l-lin.github.io/angular-datatables/#/angularWayDataChange> App.js ``` var app=angular.module('two_way',['datatables', 'ngResource']); ``` Here is the controller, ``` app.controller('two_way_control',function($resource,$scope,$htt...
2016/07/14
[ "https://Stackoverflow.com/questions/38369685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5569851/" ]
You should be implementing `ImagePickerDelegate` as well, because delegate is of type `ImagePickerDelegate`. Change as follow ``` class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UINavigationBarDelegate, ImagePickerDelegate { ``` Make sure you implement protocol methods. **EDIT 1*...
if you are implement the `ImagePickerController` then you need to add the following delegate **UINavigationControllerDelegate,UIImagePickerControllerDelegate** on your class at the same time you need to implement the following delegate methods also ``` func imagePickerController(picker: UIImagePickerController, didFi...
13,218,551
There's a part of the selection sort algorithm that I don't understand. In the latter part of the code (where the `temp` variable is used, why are `L[i]` and `L[minIndx]` assigned values? Aren't those values themselves? Can't only variables be assigned values? ``` def selSort(L): for i in range(len(L) - 1): ...
2012/11/04
[ "https://Stackoverflow.com/questions/13218551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1552159/" ]
The significance of `static` with a class definition is not whether the class can be instantiated or not, but rather whether the class must be instantiated from within a non-static method of the outer class or not. Non-static inner class instances are tied to the instance that created them -- there's a pointer in the ...
> > Can the class be instantiated with the static keyword in java ? eg : static class c1(){ } > > > Your terminology is incorrect. "Instantiating a class" means creating an instance of the class; i.e. *creating an object*. This is done using the `new` operation. Your example is really about *declaring* a class. H...
368,354
I have multiple websites on my Windows Server 2003 vps, running apache2 via xampp. I am using openssl. When I only had SSL enabled on the 1 site (I have 2 active), everything worked fine - but now I am having problems. I cannot access <https://liamwli.co.uk> (or the non-secure variant), as google chrome gives an erro...
2012/03/10
[ "https://serverfault.com/questions/368354", "https://serverfault.com", "https://serverfault.com/users/110064/" ]
I found the solution. There were two gateways defined in /etc/network/interfaces while you simple can't have more then one gateway. It makes no sense. A gateway is an IP you send ALL traffic to. If you would have two, your routing table would have a double entry for dest 0.0.0.0 and the system can't handle this. The ...
Are you sure you're not in the ILO port?
3,622,853
Rails's `script/server` is just a few lines: ``` #!/usr/bin/env ruby require File.expand_path('../../config/boot', __FILE__) require 'commands/server' ``` I wonder where the `server` file is? I tried a ``` find . -name 'server.*' find . -name 'server' ``` but can't find it
2010/09/01
[ "https://Stackoverflow.com/questions/3622853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/325418/" ]
You have to look for the files in your related gem repo. Your Ruby is located at ``` which ruby ``` Your Rails gem is ``` bundle show rails ``` You can go to the dir with ``` cd `bundle show rails`/lib/commands ``` Then, open `server.rb`
In linux they are more likely to be under ``` /usr/lib/ruby/gems/ruby_version/gems/rails_version/lib/commands ``` ruby\_version and rails\_version depends on which versions you are using. The directory structure will also depend on whether or not you are using rvm, but hopefully you can find your way once you get t...
727,898
Instead of a \*.cs code behind or beside I'd like to have a \*.js file. I'm developing a MVC application an have no need for a code beside because I have controllers, but in certain cases it'd be nice to have a JavaScript code beside or some way to associate the file to the page it's being used on. I suppose I could ju...
2009/04/07
[ "https://Stackoverflow.com/questions/727898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50711/" ]
Absolutely - but you'll have to edit the project file by hand. Find your "child" file's entry, and change it to be a non-self-closing element, and add a child element to say what it depends on. Here's an example for a .cs file being compiled: ``` <Compile Include="AssertCount.cs"> <DependentUpon>MoreEnumerable.cs</D...
You can edit by hand the project file, has John Skeed suggested, or you can also have a look on the [File Nesting Extension for Visual Studio](https://visualstudiogallery.msdn.microsoft.com/3ebde8fb-26d8-4374-a0eb-1e4e2665070c) that will do the job for you.
43,917,084
I'm facing an issue installing angular-cli locally. I'm on Ubuntu 16.04.2 LTS with following versions of node.js and npm: ``` node: v7.10.0 npm: 3.10.10 ``` I tried to install angluar-cli using the following command: ``` $npm install -g @angular/cli@1.0.0 ``` this worked fine and completed with following warning...
2017/05/11
[ "https://Stackoverflow.com/questions/43917084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/514434/" ]
Just do this on command line: ``` sudo npm uninstall -g @angular/cli sudo npm cache verify sudo npm install -g @angular/cli --unsafe-perm=true --allow-root ``` Found here:[Error: EACCES: permission denied, mkdir...](https://github.com/npm/npm/issues/17268)! This fix the npm EACCES permission denied which brake the ...
I resolve this problem by learning this article : [Fixing npm permissions](https://docs.npmjs.com/getting-started/fixing-npm-permissions#option-2-change-npms-default-directory-to-another-directory)
37,239,344
i have an rss link. sample.rss. i open it in firefox and opens well. in that page i try: ``` $('h3>a>span').each(function () { $(this).parent().after("<p>Test</p>") }) ``` it works but when i try ``` $("h3>a>span").each(function(){ url1 = 'https://www.google.co.in/search?q="'+this.textContent+'"' console....
2016/05/15
[ "https://Stackoverflow.com/questions/37239344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2897115/" ]
The variable declaration inside `Car()` are local variables, not initializations of the member variables. To initialize the member variables, just do this (it's a [member initializer list](https://stackoverflow.com/q/1711990/3425536)): ``` Car() : carName("X"), carNumber(0) {} ``` and put the definition of `countOfI...
The error messages have nothing to do with static variables or static methods. The keyword `friend` is in front of `print()`, make it a non-member function (note the last error message) and then can't access the member variables directly. According to the usage it should be a member function, so just remove the keywor...
9,055,990
I've taken over a wordpress e-comm (although this question is more about profiling generally) site which has a performance issue which seemingly only affects one specific area in the admin section of the CMS. When trying to edit one particular type of product, which has a large number of attributes attached to it, the ...
2012/01/29
[ "https://Stackoverflow.com/questions/9055990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1176822/" ]
`$dbc = mysqli_connect` must precede all the `mysqli_real_escape_string` calls to make it work. This is because **you need an active mysqli connection to use that function.**
`$dbc = mysqli_connect` must precede all the `mysqli_real_escape_string` calls to make it work. This is because you need an active mysqli connection to use that function. What does this one means. Need it more detailed?
27,137
I'd like to take a folder of images of various sizes and have them cropped into a 600x600 grid square, cut out from the middle of the image. Is there a program that can automatically resize and crop to these dimensions, and then output as a compressed .png file? For images that are smaller than 600x600, I'd like the pr...
2012/09/12
[ "https://photo.stackexchange.com/questions/27137", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/11559/" ]
If you like programing, you can use [Python](http://www.python.org/) (computer language) and an excellent library know has [PIL](http://www.pythonware.com/products/pil/) to crop, re-size, plot histograms, get individual pixel vales, etc... on a programmatic level. Thus you can easily write a simple script to find all i...
Look for Phatch (Linux, Mac, Windows), it's exactly what you are looking for : <http://photobatch.stani.be/download/index.html>
810,586
Let $c\in\mathbb{R}\setminus\{ 1\}$, $c>0$. Let $U\_i = \left\lbrace U\_{i, 0}, U\_{i, 1}, \dots \right\rbrace$, $U\_i\in\mathbb{R}^\mathbb{N}$. We know that $U\_{n+1,k}=\frac{c^{n+1}}{c^{n+1}-1}U\_{n,k+1}-\frac{1}{c^{n+1}-1}U\_{n,k}$. (As @TedShifrin pointed out, it can also be written $U\_{n+1,k}=U\_{n,k+1}+\frac{...
2014/05/26
[ "https://math.stackexchange.com/questions/810586", "https://math.stackexchange.com", "https://math.stackexchange.com/users/150347/" ]
Let $S$ be the shift operator on sequences. That is, for any sequence, $a$, $$ (Sa)\_i=a\_{i+1}\tag{1} $$ Then, the recursion becomes $$ U\_n=\frac{c^nS-I}{c^n-1}U\_{n-1}\tag{2} $$ Consider the polynomial $$ \prod\_{k=1}^n\left(c^kx-1\right)=\sum\_{p=0}^na\_{n,p}x^p\tag{3} $$ We have that $a\_{n,0}=(-1)^n$ and since ea...
Here’s what I hope is a good start. I’m stuck at the very end, but maybe you can finish it up. (It is homework, after all.) The special functions experts might have a quicker way to answer this, I imagine. For $h=0$, the desired result is exactly what “we know.” Use induction, and assume the result for $h<M$. $$ \be...
74,217
I have already gone through [this question](https://travel.stackexchange.com/questions/4868/empty-suitcase-on-flight) about empty suitcases. However, it does not address protecting the suitcases from possible damage. My friend (who is a foreign student studying in Germany) would like to take 2 empty large suitcases to ...
2016/07/24
[ "https://travel.stackexchange.com/questions/74217", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/46639/" ]
I had to do something slightly similar once with some half-empty suitcases that would have large heavy things piled on top of them while moving house. What worked quite well for me was to take large, sturdy, readily available bag-like things such as: * Heavy duty bin bags * Duvet covers, large pillow cases * Sleeping ...
I thought there might be some dedicated packing material for doing this and there is [this](http://rads.stackoverflow.com/amzn/click/B0141MR8YI) on Amazon as an example, but it doesn't look very practical. However, there are some super cheap [airbeds](http://www.walmart.com/ip/Intex-Twin-Classic-Downy-Airbed-Mattress/2...
30,461,969
I try to make a local HTTPS connection to a XMLRPC api. Since I upgrade to python 2.7.9 that [enable by default certificates verification](https://www.python.org/dev/peps/pep-0476/), I got a CERTIFICATE\_VERIFY\_FAILED error when I use my API ``` >>> test=xmlrpclib.ServerProxy('https://admin:bz15h9v9n@localhost:9999/A...
2015/05/26
[ "https://Stackoverflow.com/questions/30461969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/866886/" ]
I think another way to disable certificate verification could be: ``` import xmlrpclib import ssl s=ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) s.verify_mode=ssl.CERT_NONE test=xmlrpclib.Server('https://admin:bz15h9v9n@localhost:9999/API',verbose=0,context=s) ```
With Python 2.6.6 for example: ``` s = xmlrpclib.ServerProxy('https://admin:bz15h9v9n@localhost:9999/API', transport=None, encoding=None, verbose=0,allow_none=0, use_datetime=0) ``` It works for me...
41,153,221
I'm looking to change the background color of all pages with /cutticket in the URL using jquery. Right now I have the following but I am not seeing any visible change. No console errors at the moment. ``` if (window.location.href.indexOf("/cutticket") > -1) { document.body.style.backgroundColor = "red"; } ```
2016/12/14
[ "https://Stackoverflow.com/questions/41153221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2948393/" ]
Your code works. Simply include: ``` <script> if (window.location.href.indexOf("/cutticket") > -1) { document.body.style.backgroundColor = "red"; } </script> ``` just before: ``` </body> </html> ``` **Reason:** The script makes a reference to `<body>` - so for the script to work properly, the browser must ha...
I had done it something like this: ``` <script> var base = "http://0.0.0.0:8881" var url = document.URL; if (!(url == base + "/asda")) { document.body.style.backgroundColor = "red"; } </script> ```
31,928,868
When it comes to the M Developer Preview runtime permissions, according to [Google](https://plus.google.com/+AndroidDevelopers/posts/8aaudh5n1zM?linkId=16190516): 1. If you have never asked for a certain permission before, just ask for it 2. If you asked before, and the user said "no", and the user then tries doing so...
2015/08/10
[ "https://Stackoverflow.com/questions/31928868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115145/" ]
I know I am posting very late, but detailed example may be helpful for someone. **What I have noticed is, if we check the shouldShowRequestPermissionRationale() flag in to onRequestPermissionsResult() callback method, it shows only two states.** State 1:-Return true:-- Any time user clicks Deny permissions (including...
Regarding MLProgrammer-CiM's answer, I have an idea of how to solve the scenario in which the user revokes the permission after the boolean stored in SharedPrefrences is already true, simply create another constant boolean, if the first one called for example: `Constant.FIRST_TIME_REQUEST` (which its default state wil...
16,490,323
Say my data looks like this: ``` Item 1 Item 2 Item 3 SubKey1:SubValue1 SubKey2:SubValue2 Item 4 SubKey1:SubValue1 Item 5 SubKey1:SubValue1 SubKey2:SubValue2 SubKey3:SubValue3 ``` Is there a data structure that supports this or would I need to create a new type?
2013/05/10
[ "https://Stackoverflow.com/questions/16490323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1406734/" ]
If everything that you want is a string, you could use this: ``` Dictionary<string, Dictionary<string, string>> ``` You would use it like this: ``` var myItems = new Dictionary<string, Dictionary<string, string>>(); myItems.Add("Item 1", null); myItems.Add("Item 2", null); var subDictionary1 = new Dictionary<stri...
From what I see you could use a `List<Dictionary<string, string>>` In the first two items you could just have an empty dictionary (or a null). But it depends a bit on what you want to do with it.
42,531,286
Have a XML string like below: ``` <stages> <params/> <test description=""/> </stages> ``` I want to add the following XML string after `<test desc.../>` tag OR before the end of stages i.e. `</stages>` ``` <stage id="myId" level="1"> ``` and all subsequent stages. Post-addition it should like ``` <stages> ...
2017/03/01
[ "https://Stackoverflow.com/questions/42531286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/786676/" ]
You are including a folder within the search pattern which isn't expected. According to the [docs](https://msdn.microsoft.com/en-us/library/wz42302f(v=vs.110).aspx): > > searchPattern Type: System.String The search string to match against > the names of files in path. This parameter can contain a combination > of v...
The second parameter, the search pattern, works only for filenames. So you'll need to iterate the directories you want to search, then call `Directory.GetFiles(directory, "test*.doc")` on each directory. How to write that code depends on how robust you want it to be and what assumptions you want to make (e.g. *"all De...
67,851,335
I have two lists of data frames. In each list a data frame has a column with the same name and values. As an example: ``` x <- list(data.frame(i=as.character(1:5),x=rnorm(5),z=rnorm(5)), data.frame(i=as.character(1:5),x=rnorm(5),z=rnorm(5))) y <- list(data.frame(i=as.character(5:1),x1=rnorm(5),z1=rnorm(5)),...
2021/06/05
[ "https://Stackoverflow.com/questions/67851335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4801942/" ]
It looks like this is what you want: ``` map2(x, y, ~ inner_join(.x, .y)) ``` ``` [[1]] i x z x1 z1 1 1 0.7715183 -0.6933826 -0.3335239 0.5957587 2 2 -0.3824746 -0.7248827 -1.6736241 -1.2248904 3 3 0.3412777 -0.3711940 0.9334678 0.4043867 4 4 -0.4225862 -1.6653314 1.0369985 ...
Using `data.table` ``` library(data.table) Map(function(u, v) setDT(u)[v, on = .(i)], x, y) ```
25,624,213
Whenever I use `$model->attributes=$_POST['Users']` ,it saves Data from User form. When I use `$model->setAttributes($_POST['Users'])`,it also saves Data from User form. So please can anyone clarify the difference between the two codes ?
2014/09/02
[ "https://Stackoverflow.com/questions/25624213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2240375/" ]
There is absolutely no difference. When you try to assign a property that is not defined as a PHP class property (such as `attributes` here) on a [component](http://www.yiiframework.com/doc/guide/1.1/en/basics.component), Yii by convention calls the similarly-named setter method `setAttributes` instead. If no such met...
There is no difference. array\_merge used to merge attributes, if set later
37,392
When reading fantasy novels, I have as a rule been left with the impression that exact timekeeping is either avoided as a topic, or referred to only vaguely and obliquely. In many cases, the author would freely use "hours" as a metonymy for a part of the day spent doing something, however never actually imply that thes...
2016/03/04
[ "https://worldbuilding.stackexchange.com/questions/37392", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/18451/" ]
Clocks are not the only way to keep track of time. I think we all agree that the purpose of clocks is to synchronize the activity of multiple people over an area. We like to say things like "At 12:30 I will go to the store." However, is is also possible to synchronize actions based on events. "I will go to the store a...
Even in industrial age, like the town I grew up in, in the past the only way to tell time was by the factory siren, telling people the shift was over - like a medieval belltower ringing vespers etc. Sundials are not too useful since you need sun, so that they do not work in cloudy weather, and of course only in daytime...
6,496,628
Good afternoon, We are currently using STL multimap and STL set to cache memory mapped file regions. We would like our cache to have only unique entries. We wondering if there is a way for STL set and STL map to be faster than STL multiset and STL multimap for preventing duplicate entries. We are using the following c...
2011/06/27
[ "https://Stackoverflow.com/questions/6496628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/557534/" ]
There's a lot of stuff to read here, and optimization of the complex container types is a tricky problem. I've spent a fair bit of time working on similar problems, so I'll try to point out some things that have helped me. Firstly, the usual way to make your code faster is *don't use binary trees when vectors will do*...
Here is a generic situation: ``` #include <cstddef> // for size_t #include <set> // for std::set #include <algorithm> // for std::swap #include <ostream> // for std::ostream struct Range { int start, end; // interpret as [start, end), so Range(n,n) is empty! Range(int s, int e) : start(s), end(e) { ...
1,047,053
I have tried solving this problem but my answer is not correct **Problem** In a cinema festival , 30 movies are scheduled every night in the following categories: * 10 in horror movies (H), * 15 in comedy movies (C), * 5 in documentaries (D) A guest is allowed to watch 1 movie each night during the 5 night that he ...
2014/12/01
[ "https://math.stackexchange.com/questions/1047053", "https://math.stackexchange.com", "https://math.stackexchange.com/users/196814/" ]
Your result would be correct if, in addition to selecting which movies to watch, your guest were also identifying a *favorite* movie from each genre -- i.e., he would first pick a favorite from each of the three categories, and then pick two more movies from what's left over. But since the problem doesn't ask for him t...
Your method, of selecting one from each category then selecting any two others and permutating, will suffer from over counting.   Since it counts both all the ways to select, say "The Ring" as one of the ones, and all the ways to select it as one of the other two. --- There are $5!$ ways to watch five different movie...
25,223,768
I want to create a user menu, that looks like this: ![enter image description here](https://i.stack.imgur.com/YuZZ5.png) When I create such a menu with bootstrap, its full width and not aligned under the button. So it looks like this: ![enter image description here](https://i.stack.imgur.com/Xjtpv.png) So how could I...
2014/08/09
[ "https://Stackoverflow.com/questions/25223768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2977288/" ]
If you stepped through your program with a debugger you'd find out that the following is your problem: ``` strcpy(array[k],array[k+1]); ``` When `k == 3` you're attempting to access an element outside the bounds of `array` for the second argument of `strcpy`: ``` array[k+1] ```
Your approach is not good. When you find a matched string you copy all tail of the array in the new position. Here is a more simple and clear approach ``` #include <stdio.h> #include <string.h> #define N 4 int main(void) { char s[N][N] = { "cat", "mat", "sat", "mat" }; int i, j; j = 0; /* current o...
19,421,238
I want to check programatically if my device is locked by a third party Lockscreen...With the normal Lockscreen by android you can do that by ``` KeyguardManager kgMgr = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); boolean locked = kgMgr.inKeyguardRestrictedInputMode(); ``` But what if a third party...
2013/10/17
[ "https://Stackoverflow.com/questions/19421238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1370245/" ]
Since candidates is an array, `$#candidates` is the largest index (number of elements - 1) For example: ``` my @x = (4,5,6); print $#x; ``` will print `2` since that is the largest index. Note that if the array is empty, `$#candidates` will be -1 EDIT: from `perldoc perlvar`: ```none $# is also used ...
It is a value of last index on array (in your case it is last index on candidates).
3,318,427
I recently posted a article in my blog site which uses Wordpress for CMS and after posting the article i noticed a set of dots appearing after the post . I'm not able to remove it .. Can anyone help me ? and explain me what's wrong with it ?!
2010/07/23
[ "https://Stackoverflow.com/questions/3318427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391186/" ]
It tells the compiler the boundary to align objects in a structure to. For example, if I have something like: ``` struct foo { char a; int b; }; ``` With a typical 32-bit machine, you'd normally "want" to have 3 bytes of padding between `a` and `b` so that `b` will land at a 4-byte boundary to maximize its ...
I have seen people use it to make sure that a structure takes a whole cache line to prevent false sharing in a multithreaded context. If you are going to have a large number of objects that are going to be loosely packed by default it could save memory and improve cache performance to pack them tighter, though unaligne...
34,444
> > **Possible Duplicate:** > > [How does the automatic subjective filter work?](https://meta.stackexchange.com/questions/4371/how-does-the-automatic-subjective-filter-work) > > > How does SOFU determine that "The question you're asking appears subjective and is likely to be closed."?
2010/01/04
[ "https://meta.stackexchange.com/questions/34444", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/5849/" ]
I'm of the understanding that it looks for a few specific keywords (like "best") in the title. Try writing a nonsense title with "best" in it and hit Tab, then go back and change "best" to "biggest". **Update**: Here's the definitive answer, from Jeff: [How does the automatic subjective filter work?](https://meta.stac...
Not just that. It also looks for keywords like "you" For example, ``` How would you do something in somelanguage in the best possible manner ``` returns the alert ``` How would you do something in somelanguage ``` returns the alert; while ``` How to do something in somelanguage ``` does not return the alert
88,266
I saw the following in a journal homepage at <http://www.pphmj.com/journals/jpanta_author_information.htm> > > **Print Charges:** > To defray the publication cost, authors are requested to arrange print charges of their accepted papers at the rate of US$ 40 per page from their institutions/research grants, if any. >...
2017/04/19
[ "https://academia.stackexchange.com/questions/88266", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/72391/" ]
**If** you are at **any** institution or **if** you have **any** grants, these should be used to pay the print charges. If you don't have these, it implies you pay the charges out of your own pocket-- if you want a printed version of your paper, that is.
Actually there is another interpretation that sometimes applies, though I can't say that it does here. For some journals, in some situations, if you don't have institutional or grant funds to pay page charges they are just forgiven and won't accrue to the author(s). I can't say how prevalent this is, but it has occurre...
36,621
I'm taking the leap: my PHP scripts will ALL fail gracefully! At least, that's what I'm hoping for...` I don't want to wrap (practically) every single line in `try...catch` statements, so I think my best bet is to make a custom error handler for the beginning of my files. I'm testing it out on a practice page: ``` ...
2008/08/31
[ "https://Stackoverflow.com/questions/36621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1615/" ]
`set_error_handler` is designed to handle errors with codes of: `E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE`. This is because `set_error_handler` is meant to be a method of reporting errors thrown by the *user* error function `trigger_error`. However, I did find this comment in the manual that may help you: > > "...
I've been playing around with error handling for some time and it seems like it works for the most part. ``` function fatalHandler() { global $fatalHandlerError, $fatalHandlerTitle; $fatalHandlerError = error_get_last(); if( $fatalHandlerError !== null ) { print($fatalHandlerTitle="{$fatalHandle...
30,048,722
I have tried to hide toolbar from the text change listener ``` public void onTextChanged(CharSequence s, int start, int before, int count) { toolbar.animate() .translationY(-toolbar.getBottom()) .setInterpolator(new AccelerateInterpolator()) .start(); } ``` this solution works perfectly o...
2015/05/05
[ "https://Stackoverflow.com/questions/30048722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1944894/" ]
All what Julian said, but presumably the real question is about the difference between plain iCalendar-over-HTTP (commonly called webcal, 'iCalendar subscription' or 'subscribed calendar') and CalDAV. Or in other words: what does CalDAV add. Simply put: in iCoHTTP you usually store a whole calendar under one URL, like...
CalDAV is a protocol, extending WebDAV, thus HTTP. Webcal is a URI scheme that AFAIK was invented by Apple and has exactly the same semantics as "http", except that Safari (and maybe some other browsers) know that the URI refers to a calendar, and thus invoke the "right" application without having to fetch the resourc...
35,489,409
I try to extract from "EditText" in "string" in the same activity but fail. cod: ``` String mStreamUrl = ((EditText) findViewById(R.id.bTorrentUrl)).getText().toString(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(...
2016/02/18
[ "https://Stackoverflow.com/questions/35489409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4718734/" ]
Change this: > > > ``` > String mStreamUrl = ((EditText) findViewById(R.id.bTorrentUrl)).getText().toString(); > > ``` > > to this: ``` String mStreamUrl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_t); mStreamU...
When you use findViewById you always risk a NullPointerException because of the way Android loads it's views. What I would suggest if to see if your view is non-null then cast it to a string (getText().toString()) in a separate statement. **Update : remember to call this after setContentView()** Also remember that fin...
36,103
I know that *apparently* there is no information about this in the Dragon Ball Super series. But since new information is constantly popping up in manga, magazines, etc. Before the series sometimes, that's why I'm asking. More data on this, according to [Dragon Ball Wikia on Super Saiyan Rosé](http://dragonball.wiki...
2016/08/29
[ "https://anime.stackexchange.com/questions/36103", "https://anime.stackexchange.com", "https://anime.stackexchange.com/users/3028/" ]
I dont think they would be able to achieve it because I think it is partly linked to him being the same kind of race as Gowasu (as in mind)
Don't listen to anyone else except Zamasu it has to do with the fact that Super Saiyan Rose is Goku Black's version of the regular Super Saiyan that surpassed the power of Super Saiyan God and evolved naturally into SSGSS/A differently colored Super Saiyan Blue due to his status as an actual god with natural god ki. SS...
63,417,385
I am trying to make an if/elseif statement work in php and everything seems to work just fine, besides if the "locid" is empty, or not present, i want to display a different query. Could someone help me figure out whats wrong with the code? Basically, the if(empty($locid)) statement does not work. The page appears as ...
2020/08/14
[ "https://Stackoverflow.com/questions/63417385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13806446/" ]
You have a logical flaw in your *if* *else* construction. First you check if the `GET` variabe is set and enter an *if* statement if that's the case. However, checking for an empty variable inside that makes no sense as you know when you have entered the statement, the variable won't be empty. Therefore, you should m...
If the ids differ only by the case, you can greatly simplify the code: ``` $locids = [ 'veterinary', 'store', 'shelter', 'other' ]; $whereClause = ''; $locid = $_GET['locid'] ?? null; if (in_array($locid, $locids)) { $locationCate = ucfirst($locid); $whereClause = "WHERE location_cate='$locationCate'"; } $se...
25,941,744
Given the following classes: ``` public abstract class Super { protected static Object staticVar; protected static void staticMethod() { System.out.println( staticVar ); } } public class Sub extends Super { static { staticVar = new Object(); } // Declaring a method with the s...
2014/09/19
[ "https://Stackoverflow.com/questions/25941744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1744774/" ]
The reason is quite simple: for JVM not to do extra work prematurely (Java is lazy in its nature). Whether you write `Super.staticMethod()` or `Sub.staticMethod()`, the same implementation is called. And this parent's implementation typically does not depend on subclasses. Static methods of `Super` are not supposed to...
When static block is executed [Static Initializers](http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.7) > > A static initializer declared in a class is executed when the class is initialized > > > when you call `Sub.staticMethod();` that means class in not initialized.Your are just refernce Whe...
20,556,102
So I am trying to get angular working on IE8. I have followed all the steps on <http://docs.angularjs.org/guide/ie> and it seems to be working -- I see the content of `ng-view` rendered on IE8 when I switch between views. The problem is that I don't actually see any content in the inspector: ![enter image descriptio...
2013/12/12
[ "https://Stackoverflow.com/questions/20556102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2026098/" ]
Let's take a tour of [String#repalceAll(String regex, String replacement)](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll%28java.lang.String,%20java.lang.String%29) You will see that: > > An invocation of this method of the form str.replaceAll(regex, repl) yields exactly the same result a...
This doesn't say how to "fix" the problem - that's already been done in other answers; it exists to draw out the details and applicable documentation references. --- When using [`String.replaceAll`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll%28java.lang.String,%20java.lang.String%29) or...
11,279,835
I have a ``` < div id="thisdiv" class="class1 class2 class3 class4 class5"> text < /div> ``` I need to be able to delete all classes after class3 with jQuery. something like ``` $('#thisdiv').removeClass(all after class3); ``` OR ``` $('#thisdiv').attr('class', all from class1 to class3); ``` Please how can I ...
2012/07/01
[ "https://Stackoverflow.com/questions/11279835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/803358/" ]
``` function removeAllClass(selector, after, before) { $(selector).attr('class', function(i, oldClass) { var arr = oldClass.split(' '); if (!before) { arr.splice(arr.indexOf(after)+1).join(' '); return arr.join(' '); } else { return arr.slice(arr.indexOf(a...
To do something like this correctly might be a little bit expensive. You need to replace the `class` attr by iterating over existing classes and removing those that don't fit your criteria. The order of classes from the `class` attribute are not guaranteed to be in any order, in general: ``` function removeAbove(prefi...
4,971,981
I have a subview that acts as a container view in a table header. In that, I have a UIButton. The button is not receiving any touch events. (Yes everything is wired up properly in IB...) So my question is, is it a common problem to have buttons not receiving any events in the header? Do I need to forward any events? ...
2011/02/11
[ "https://Stackoverflow.com/questions/4971981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/410856/" ]
Wow, I feel like a moron. I didn't have user interaction enabled. Sorry for wasting all your time guys...
I've included UIButtons and even UITableViews in my table header before, so I don't think it should be an issue. Something is just not setup correctly. I didn't have to do anything special to get touch events to fire.
4,253,328
I've found the `R.string` pretty awesome for keeping hardcoded strings out of my code, and I'd like to keep using it in a utility class that works with models in my application to generate output. For instance, in this case I am generating an email from a model outside of the activity. **Is it possible to use `getStr...
2010/11/23
[ "https://Stackoverflow.com/questions/4253328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/210920/" ]
In `MyApplication`, which extends `Application`: ``` public static Resources resources; ``` In `MyApplication`'s `onCreate`: ``` resources = getResources(); ``` Now you can use this field from anywhere in your application.
If you want to use getString Outside of a Context or Activity you should have context in constructor or method parameter so that you can access getstring() method. Specially in Fragment You shoud ensure that getActivity() or getContext() are not providing null value. To avoid null from getActivity() or getContext() in ...
67,170,310
I'm running some code using Junit4 and an external jar of JunitParams. As far as I could tell, my code was all set right, and imports are all correct...but my method under test keeps throwing runtime exceptions since it seems to ignore the @Parameters annotation hanging out in it. When it reaches my method under test...
2021/04/19
[ "https://Stackoverflow.com/questions/67170310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15081463/" ]
I found something that ended up working out- I changed the inside of the @RunWith annotation to ``` Parameterized.class ``` It turned out I was trying to pass parameters into the method under the @Test annotation, and not just the constructor of my StringProcessorTest class; I removed them from the method under test...
I think you have two choices to resolve your issue: 1. Remove the `@Parameters` annotation from `stringValues()` method and add it to your test method like this: ```java private List stringValues(){ return Arrays.asList(new Object[][] { {"HELLO","OLLEH"}, {"TESTING", "GNITSET"} }); } @Test @Parameters(method = "...
16,293
How can we maintain Selenium scripts when the application changes? Specifically, how do we define and manage automation to keep it up to date with changes in the application being tested?
2015/12/29
[ "https://sqa.stackexchange.com/questions/16293", "https://sqa.stackexchange.com", "https://sqa.stackexchange.com/users/15824/" ]
Do you mean something like version control? Your developers use probably SVN or GIT, so all your tests should be stored there as well. This way you can checkout any old version of the code and the right tests for it will be checked out too.
The same question has been asked multiple times : [Building "slow to break" regression tests](https://sqa.stackexchange.com/questions/4/building-slow-to-break-regression-tests) [How can I structure Selenium tests in a way that minimizes the maintenance work?](https://sqa.stackexchange.com/questions/8470/how-can-i-str...
39,073,346
I have 2 tables: **checkinout** ``` Userid | Checktime | Checktype | VERIFYCODE | SENSORID | Memoinfo | WorkCode | sn | ``` **userinfo** ``` Userid | Name | Gender ``` I want to get the column Name only from userinfo table and insert it to checkinout table corresponds to their Userid, `checkinout.userid=userinf...
2016/08/22
[ "https://Stackoverflow.com/questions/39073346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6329280/" ]
You can not mix explizit and implizit join: ``` SELECT checkinout.USERID, checkinout.CHECKTIME, checkinout.CHECKTYPE,checkinout.VERIFYCODE, checkinout.SENSORID, checkinout.Memoinfo, checkinout.WorkCode, checkinout.sn, userinfo.name from bio_raw.checkinout join bio_raw.userinfo on checkinout.userid = userinfo...
When you want to join 2 tables there is no need to put all of them in `FROM` param. ``` SELECT checkinout.USERID, checkinout.CHECKTIME, checkinout.CHECKTYPE,checkinout.VERIFYCODE, checkinout.SENSORID, checkinout.Memoinfo, checkinout.WorkCode, checkinout.sn, userinfo.name from bio_raw.checkinout join bio_raw.use...
13,351,314
So I'm a pretty spoiled rubyist and basically never have to install anything using sudo anymore. I've installed node.js and npm (granted, using the Mac 64-bit .pkg, which could have done gosh knows what on my system) and they work fine. Now, executing the following: `npm install jasmine-node -g` Doesn't work and says...
2012/11/12
[ "https://Stackoverflow.com/questions/13351314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/492404/" ]
I just changed the ownership of all the folders node was concerned with. ``` sudo chown -R my_account_name /usr/local/lib/node_modules/ sudo chown -R my_account_name /usr/local/lib/node/ sudo chown -R my_account_name /usr/local/include/node/ ``` I don't really know if that's bad practice, but I don't really give a d...
When you run npm install -g somepackage, you may get an EACCES error asking you to run the command again as root/Administrator. It's a permissions issue. It's **easy to fix**, open your terminal (Applications > Utilities > Terminal) ``` sudo chown -R $USER /usr/local ``` \*\* I strongly recommend you to not use the...
16,975,601
My html/css code interferes with my **HTML/CSS** drop down menu I have one textbox positioned above my navigation bar but the css code inter fears with my css dropdown. **[JSFIDDLE](http://jsfiddle.net/K6fey/1/)** **HTML** ``` <title>Mingamez.com</title> <link rel="shortcut icon" href="images/favicon.png"> <link ...
2013/06/07
[ "https://Stackoverflow.com/questions/16975601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1978141/" ]
It looks like you're having a layering issue - the box around the input field actually extends the whole screen width and is in front of the menu so you can't "get to" the menu. Easy fix, just set a width on `#advsearch` and give it a higher `z-index`. Like this: ``` #advsearch { text-align: center; margin: 2...
first of all close your html tags properly. you have missed the li and ul closing tags. ``` </li> </ul> ``` close this before tags change the below css: (add padding-top:20px; ) ``` #cssmenu { position:fixed; left: 0; padding-top:25px; top: 0; width: 100%; z-index:-1; } ```
14,403
I'll give you an example of a divine person: God the Father. I'll give you an example of a human person: the apostle Paul. **According to Roman Catholic orthodoxy** (note: cite it), is Jesus Christ a human person, a divine person, both, or none?
2013/02/22
[ "https://christianity.stackexchange.com/questions/14403", "https://christianity.stackexchange.com", "https://christianity.stackexchange.com/users/-1/" ]
There are two issues here, which can unfortunately interact in a confusing way. Part 1: Christ is one Person. He is fully human. He is also fully divine. That's what it means to have those two natures. So both "divine" and "human" can be correctly used as predicate adjectives describing Christ. Part 2: Theologians h...
Jesus Christ is one Person, a divine Person, with two natures, His divine nature, and His human nature. He cannot be, and is not, two persons. He is already the second Divine Person of the Most Holy Trinity, so He cannot logically be also a human person.
72,689,384
I'm trying to create a C program that creates a txt file with random integers, and then `mmap` the said file and `qsort` it. Creating the txt and mapping goes smoothly, but I can't figure out why `qsort` just destroys it. My guess, it's something to do with data types, but even after playing around with them, I get mor...
2022/06/20
[ "https://Stackoverflow.com/questions/72689384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19200014/" ]
Here is the solution I might think is the right one ``` class CarRecord(models.Model): date_created = models.DateTimeField(auto_now_add=True) type = models.CharField(max_length=50) license = models.CharField(max_length=50) owners = models.ManyToManyField(User, related_name='car_owners') creator = m...
You can write permission class car owner user. Your model. ``` class CarRecord(models.Model): date_created = models.DateTimeField() type = models.CharField(max_length=50) license = models.CharField(max_length=50) owners = models.ManyToManyField(User, related_name='car_owners', verbose_name=('owners'),...
14,439,993
I would like to use push notification message without badge, message or sound, only with application related JSON in order to update app's content in realtime. These notifications useless when app is not running so I won't send them when app enters background or user idle (sending unsubsrcibe to my server ) and subscri...
2013/01/21
[ "https://Stackoverflow.com/questions/14439993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/413505/" ]
Im sure there are more reasons to not use APNS for realtime communication with your server, but here are two 'blocker' 1. you will not be able to unsubscribe from your server if the user lost connection. 2. push notifications are not reliable in terms of delivery time. You will only get notice by the push-server that ...
Apple specifically instructs against using it to send data. Only to notify that new data is available. And notifications are explicitly not real time.
29,944,647
This question has been asked before but not solved. I'm using jquery Tabs and Accordion, both on the same page and they simple won't work together. They work seperate on individual pages, but as soon as theyre on the same page the tabs won't work. In fact, it flips randomly between which one works and which one doesnt...
2015/04/29
[ "https://Stackoverflow.com/questions/29944647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4403887/" ]
I tried your code, created a [JSFiddle](http://jsfiddle.net/Lg30296h/) and all I had to change was this line: ``` $("div.styleguide_demo_accordion1").accordion({header: "h2", collapsible: true, heightStyle: "content", active: false}) ``` to ``` $("div.styleguide_demo_accordion1").accordion({header: "h3", collapsib...
Nothing strange. There are `<h3>` in HTML while `header: "h2"` in JS Change all `<h3>` to `<h2>` or `header: "h2"` to `header: "h3"` and it will be OK
38,185,206
I have a date in String format, in the following manner "2016-07-08" (8th July 2016). I need to check if this is a Friday, the reason is that the date will change and I will always need to check if the provided date is Friday. I am using the following code (assume startDate is a String which holds my date): ``` DateFo...
2016/07/04
[ "https://Stackoverflow.com/questions/38185206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6547502/" ]
Capital `Y` is for week-year. You probably meant `yyyy-MM-dd` (with lower case `y` for the year). The [javadoc](https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html) lists all the valid patterns.
Your problem lies in pattern used for parsing years. Instead of creating SimpleDateFormat with `YYYY-MM-dd` please use this instead ``` new SimpleDateFormat("yyyy-MM-dd") ```
22,244,536
Clojure beginner here. Here's some code I'm trying to understand, from <http://iloveponies.github.io/120-hour-epic-sax-marathon/sudoku.html> (one page of a rather nice beginning Clojure course): --- ``` Subset sum is a classic problem. Here’s how it goes. You are given: a set of numbers, like #{1 2 10 5 7} a...
2014/03/07
[ "https://Stackoverflow.com/questions/22244536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/627723/" ]
The `subset-sum-helper` function always returns a *sequence* of solutions. When the `target` is not met, the `solution` body at the end of the `for` expression enumerates such a sequence. When `target` is met, there is only one solution to return: the `current-set` argument. It must be returned as a sequence of one ele...
Maybe this explanation helps you: Firstly we can experiment in a minimal code the expected behaviour (with and without brackets) of the [for](http://clojuredocs.org/clojure_core/clojure.core/for) function but removing the recursion related code **With brackets:** ``` (for [x #{1 2 3} y [#{x}]] y) => (#{1} #...
8,989,302
``` import java.util.*; public class Test { public static void main(String[] args) { List db = new ArrayList(); ShopDatabase sb = new ShopDatabase(db); sb.addEntry(new ProductEntry("film", 30, 400)); sb.addEntry(new CashierEntry("Kate", "Smith", 23, 600)); sb.addEntry(new ...
2012/01/24
[ "https://Stackoverflow.com/questions/8989302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1110626/" ]
The problem is that you have multiple fields called `name`. The one in `People` **shadows** the one in `Entry`, and so on. What happens is that the constructor sets the base class's `name`, and `toString()` prints out the derived class's `name` (which has never been initialized and is therefore `null`). Same for `id`...
You're shadowing the variables `name` and `id` with other fields named `name`, and `id`, and so the compiler is getting confused as to what to refer to (the superclass versions, or the versions from `Person`, which are never defined). Follow @aix's and @Dave Newton's advice and you'll be good to go.
1,031,403
I am having a bizare problem where I have a script that works elsewhere on the site but refuses to work for me now. The problem is exclusive to IE, it works fine in Mozilla. Below is the form: ``` <form class="element_form" action="general_image.php" method="post"> <?php generate_input('hidden', '', 'id', $id);?>...
2009/06/23
[ "https://Stackoverflow.com/questions/1031403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31677/" ]
i have found that sometimes it is better to have a hidden field for action then a submit button or image. if someone press RETURN or ENTER to submit the form which action will be returned ?
Are you remembering to `session_start();` ?
12,926,900
Let see code first ``` var name = "The Window"; var object = { name : "My Object", getNameFunc : function(){ return function(){ return this.name; }; } }; alert(object.getNameFunc()()); ``` the result is `"The Window"`; I want to know what happend in every step. I think `this` is point ...
2012/10/17
[ "https://Stackoverflow.com/questions/12926900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1041001/" ]
I tried other solutions and the exception didn't go away. So I decompiled the entire `jose4j 0.6.5 jar` with a Java Decomplier and look at its pom.xml. I realised it has a specific dependency on **slf4j-api, version 1.7.21**: [![enter image description here](https://i.stack.imgur.com/73LS8.png)](https://i.stack.imgur....
Add the following jars to the class path or lib folder 1. [slf4j-api-1.7.2.jar](https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.2) 2. [slf4j-jdk14-1.7.2.jar](https://mvnrepository.com/artifact/org.slf4j/slf4j-jdk14/1.7.2)
24,278,731
Landscape mode handle when auto screen orientation is ON and easily turn to portrait. But Auto Screen Orientation is Off then forcefully change supported orientation which effect on if Auto Screen Orientation is ON. Pls tell me these things in WP How check auto screen orientation of setting ON or Off? Another way to...
2014/06/18
[ "https://Stackoverflow.com/questions/24278731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3244180/" ]
One place that I have seen a `while(1);` is in embedded programming. The architecture used a main thread to monitor events and worker threads to handle them. There was a hardware watchdog timer (explanation [here](http://en.wikipedia.org/wiki/Watchdog_timer)) that would perform a soft reset of the module after a peri...
``` while(1); ``` is actually very useful. Especially when it's a program that has some sort of passcode or so and you want to disable the use of the program for the user because, for an example, he entered the wrong passcode for 3 times. Using a `while(1);` would stop the program's progress and nothing would happen ...
46,437,808
I'm developing an android app, it has a Splash Screen that runs for 2500ms. I want to add the functionality for a User touch screen and skip this Activity. I could made it with a button, but for pretty objective I just want to add a screen touch listener (Don't know how.) My SplashScreen: ``` public class Splash ext...
2017/09/27
[ "https://Stackoverflow.com/questions/46437808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4681874/" ]
**Try this it will resolve your problem** ``` <div *ngFor="let letter of letters" (click)="myMethod(letter)">{{letter}} </div> myMethod(selectedLetter){ let postLen = 3; // configurable let i=0, len =str1.length; let foundFlag = false; let arr1 = [], arr2 = [], arr3 = []; for(;i<len;i++){ ...
Just use two lists with `ngIf`: the first list renders the letters before `currentLetter` or `currentLetter` itself, while the second list renders the letters after `currentLetter`. ``` <ng-container *ngFor="let letter of letters; index as i"> <button *ngIf="i>=letters.indexOf(currentLetter)" (click)="currentLetter ...
57,695,362
Maven dependencies are downloaded every time my build workflow is triggered. Travis CI provides a way to cache maven repository. Does Github actions provider similar functionality that allows to cache maven repository?
2019/08/28
[ "https://Stackoverflow.com/questions/57695362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1101512/" ]
For completeness, this is an example of how to cache the local Maven repository on subsequent builds: ``` steps: # Typical Java workflow steps - uses: actions/checkout@v1 - name: Set up JDK 11 uses: actions/setup-java@v1 with: java-version: 11 # Step that does that actual cache save and restore ...
As of 2021, the most up to date official answer would be ```yaml - name: Cache local Maven repository uses: actions/cache@v2 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- ``` taken from an official github example ...
3,687,904
What's the least (negative) integer value that can be exactly represented by Double type in all major x86 systems? Especially in (simultaneously) JVM, MySQL, MS SQL Server, .Net, PHP, Python and JavaScript (whatever corresponding type it uses). The reason why I ask about this is because I'd like to choose a value to u...
2010/09/10
[ "https://Stackoverflow.com/questions/3687904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274627/" ]
The answer: 1. Get a gun. 2. Track down those responsible and ... 3. Just kidding. But *someone* needs to stand up and take responsibility for their garbage, don't you think? We wouldn't really shoot them, but don't we wish sometimes that we could get face-to-face with the person or team and demand they answer why the...
I had several such issues. That wizard is absolutely not reliable. If this is a one time task, I would export into csv, and then import from csv. If you need to run it regularly, write your own code.[We recently had a similar discussion: Should programmers use SSIS, and if so, why?](https://stackoverflow.com/questions/...
46,394,306
Let's assume that I have 5 tables ``` CREATE TABLE Student ( id int not null primary key auto_increment, firtsname varchar(30) ); CREATE TABLE Lecture ( id int not null primary_key auto_increment, lecturename varchar(30) ); CREATE TABLE Teacher ( id i...
2017/09/24
[ "https://Stackoverflow.com/questions/46394306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7945407/" ]
``` import re def askName(): name = input("Please enter your name: ") if re.match("[A-z]",name): with open("filename", "w") as f: f.write(name) else: askName() askName() ```
My solution upon many others: ``` while True: name=(input("Please enter your name: ")) if name and name.isalpha(): filename = ("name.txt") with open (filename, "a") as f: f.write (name + "\n") break else: print ("Invalid name. Try again") continue ```