INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
how many logical operator can we use in a statement in python? vari1='a' # choices are all ready printed above. while vari1 != 'o' and vari1 != 'O' and vari1 != 'p' and vari1 != 'P': vari1=input("please enter your choice.") if vari1 != 'o' and vari1 != 'O' and vari1 != 'p' and vari1 != 'P': print("please enter a appropriate choice") I tried this code but its not working. I wanna know how many logical operator I can use in one statement. I think there is some problem with my condition.
better to use in this way: while True: vari1=input("please enter your choice.") if vari1.lower() not in ['o','p']: print("please enter a appropriate choice") else: # do your stuff break `str.lower` convert string to lowercase. demo: >>> 1 in [1,2,3,4,5] True >>> 1 not in [1,2,3,4,5] False >>> 1 in [2,3,4,5] False >>> 1 not in [2,3,4,5] True
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -3, "tags": "python" }
ipython: showing CWD in prompt In `ipython`, I have changed the prompt to show hostname and current working directory, to emulate system shell (bash): c.PromptManager.in_template = '\\h:\\w ' this works well, except for a small detail. When I am in my home (`/home/martin`) it shows the full path, instead of the customary `~`: alpha:/home/martin instead of alpha:~ is it possible to change to `~` ?
you can use c.PromptManager.in_template = '\\h:\\Xn ' where $n=0 .. 5.$ The current working directory, with $HOME replaced by ~, and filtered out to contain only $n$ path elements so for example, you can use: c.PromptManager.in_template = '\\h:\\X5 '
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ipython" }
Showing the last entered message I want to print the last message that was added to the db. I wanted to do this by print the last greatest id but it does not work. It doenst give me any errors and I cant figure out why it is not working. Maybe there is a logical error as I am pretty new to coding. <?php $mysqli = new mysqli("localhost", "test", "test", "test"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: " . $mysqli->connect_error; } $res = $mysqli->query("SELECT message FROM guestbook WHERE MAX('id')"); print '<div>' . '<p>' . 'Inhalt ihrer Nachricht:' .'</p>' . '</div>'; print '<div id="textbox">' . '<div class="guestcontent">' . '<p>' . $res['message'] . '</p>' . '</div>' . '</div>' . '<br>'; ?>
You should try `order by desc`. The `ORDER BY` keyword is used to sort the result-set by one or more columns. and `DESC` keyword is use for sorting column in DESCENDING order. which means the last entry print first and `LIMIT 1` is use for fetching only one row i.e the last inserted one. `SELECT message FROM guestbook ORDER BY id DESC LIMIT 1`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php" }
SQL query to find out experience of employee in the format 'yy years mm months dd days' I want a query to find out experience of employee in the format 'yy years mm months dd days'. SELECT EMPID, EMPNAME, DEPARTMENT, DESIGNATION, DATEDIFF(YEAR, DOJ, GETDATE()) AS EXPERIENCE, EMPSTATUS AS JOB_STATUS FROM EMPLOYEE DOJ - field in db for saving 'date of joining' of employee. This is the query which returns experience in years only. How to modify it?
SELECT EMPID, EMPNAME, DEPARTMENT, DESIGNATION, convert(varchar(3),DATEDIFF(MONTH, DOJ, GETDATE())/12) +' years '+ convert(varchar(2),DATEDIFF(MONTH, DOJ, GETDATE()) % 12)+ ' months' AS EXPERIENCE, EMPSTATUS AS JOB_STATUS FROM EMPLOYEE
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "sql, sql server" }
How to use implode a column from an array of stdClass objects? I have an array of `stdClass` objects and I want to build a comma separated list using one specific field of all those `stdClass` objects. My array looks like this: $obj1 = stdClass Object ( [foo] => 4 [bar] => 8 [foo-bar] => 15 ); $obj2 = stdClass Object ( [foo] => 16 [bar] => 23 [foo-bar] => 42 ); $obj3 = stdClass Object ( [foo] => 76 [bar] => 79 [foo-bar] => 83 ); $a = array(1=>$obj1 , 2=>$obj2 , 3=>$obj3); And I want to implode on `foo` of all the `stdClass` objects in that array to create a comma separated list. So the desired result is: 4,16,76 Is there any way to do this with implode (or some other mystery function) without having to put this array of objects through a loop?
You could use `array_map()` and `implode()`... $a = array_map(function($obj) { return $obj->foo; }, array(1=>$obj1 , 2=>$obj2 , 3=>$obj3)); $a = implode(", ", $a);
stackexchange-stackoverflow
{ "answer_score": 37, "question_score": 26, "tags": "php, arrays, implode, csv, stdclass" }
separate callback function java script I'm using from kcfinder in my web page it is ok but only one problem; i need to separate callback function and use it further ...but i can't function openKCFinder(div) { window.KCFinder = { callBack: function(url) { ///all action } //i need something similar this ///it is not work; function set_pic(url,div){ ///all action } function openKCFinder(div) { window.KCFinder = { callBack: set_pic(url,div) ; } thanks for help me. and excuse me for poor English.
Your current code runs `set_pic(url,div)` right away; its return value is assigned to `callback`. Try: `callback: function(){ set_pic(url, div); }`
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript" }
get mongodb fields in particular order in php I get data from mongodb in php and display fields in table. Can I get fields in php from mongodb in the order I set, for example, when the order of fields I send in fields doesn't effect othe order of fields I display them: $cursor = static::getMongoCollection(false)->find($query)->fields($fields); For example it displays in the same order now matter if I use: $fields = array("field1" => 1, "field2" => 1, "field3" => 1) or $fields = array("field3" => 1, "field2" => 1, "field1" => 1) I need in my application to display fields in different order. Is there a way to make it?
The PHP driver just returns the fields from MongoDB in whatever order MongoDB sends them. So, regardless of how you select the fields you wish to return, the data sent back won't change (unless you alter the fields list of course). Why don't you just order the results yourself after they are returned?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "php, mongodb, mongodb php" }
DBD::Oracle fails to connect with OCIEnvInit when called when accessed through webserver only I have a simple perl script that uses DBD::Oracle to run a query and print the results. It works fine from the command line, but I also have a PHP script that runs it and reads the output. When the PHP script is accessed through apache it fails to connect, with the error "OCIEnvInit". I've tried creating a shell script that re-sets all the environment variables available in the shell but that didn't help, and I also tried setting the debugging output for DBI but got nothing. What could cause this error when the script does work?
Are you sure that `ORACLE_HOME` and other relevant environment variables (e.g., `LD_LIBRARY_PATH`) that are set in your shell when you run the script from the command line are also set to the same values in the apache/PHP process?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "perl, oracle, dbi" }
Generate certificate for signing AIR app How do I generate a self-signed certificate to sign an adobe AIR app? I'm using the maven flexmojos plugin. I've followed an openssl tutorial to generate a .p12, but now the mvn plugin /adt compiler is telling me that the certificate is not a X509 certificate. Thanks
Take a look at Creating a self-signed certificate with ADT
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "apache flex, air, certificate, code signing" }
В заданном предложении найти наибольшее количество идущих подряд пробелов В заданном предложении найти наибольшее количество пробелов, что расположены подряд. Исключить из данного предложения длинные последовательности пробелов. 1 часть я уже решил , я просто не понял как решить 2-ю я знаю что мне надо использовать функцию erase . #include <iostream> #include <string> using namespace std; int main(){ string s; cout<<"Enter text: "; getline(cin,s); int k = 0; int max = 0; int str = s.length(); for(int i = 0; i< str; i++){ if(s[i] == ' '){ k++; }else{ k = 0; }if(k>max){ max = k; } } cout<<s.erase(max); return 0; }
Ну если я вас правильно понял, то у вас не получается удалить последовательность пробелов длинной `max`. Строчкой: s.erase(max); Вы удаляете все символы начиная с индекса `max`. А вам нужно удалить `max` символов начиная с начала последовательности. Например при проверке: if(k > max){ max = k; index = i; } `index` \- индекс последнего символа в самой длинной последовательности. И далее пишите так: cout << s.erase(index - max, max); То есть `index - max` это индекс начала последовательности, `max` это кол-во сколько нужно удалить символов. Поподробней про `erase` можно почитать тут Пример выхода программы: Enter text: Privet mir kak dela ? Privet mi kak dela ?
stackexchange-ru_stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c++, c++11" }
bach update on dbeaver I need to update a database with like this: UPDATE my_table SET columnb='01001' WHERE columnb IN ('lraXh7QFkB2','fhh1ZmczNeXA', 'H1M1aL1kL','5-RNsXxrE8DeQ2' ) when I run it on the query editor it works fine, the same is I save the query on a .sql file and import it to execute. But if the file has several statemes like: UPDATE my_table SET columnb='01001' WHERE columnb IN ('lraXh7QFkB2','fhh1ZmczNeXA', 'H1M1aL1kL','5-RNsXxrE8DeQ2' ) UPDATE my_table SET columnb='021001' WHERE columnb IN ('lraXh7QFkB2','fhh1ZmczNeXA', 'H1M1aL1kL','5-RNsXxrE8DeQ2' ) UPDATE my_table SET columnb='010031' WHERE columnb IN ('lraXh7QFkB2','fhh1ZmczNeXA', 'H1M1aL1kL','5-RNsXxrE8DeQ2' ) I get this error: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; that occurs at line four just after updating for the first case
You do not have semicolons at the end of each update statement UPDATE my_table SET columnb='01001' WHERE columnb IN ('lraXh7QFkB2','fhh1ZmczNeXA', 'H1M1aL1kL','5-RNsXxrE8DeQ2' ); UPDATE my_table SET columnb='021001' WHERE columnb IN ('lraXh7QFkB2','fhh1ZmczNeXA', 'H1M1aL1kL','5-RNsXxrE8DeQ2' ); UPDATE my_table SET columnb='010031' WHERE columnb IN ('lraXh7QFkB2','fhh1ZmczNeXA', 'H1M1aL1kL','5-RNsXxrE8DeQ2' );
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, dbeaver" }
Finding the equation of line given the two intersecting lines of planes I have an idea that in order to get the equation given only the lines, it requires to do cross product and solving for the coordinates that satisfies the given two lines. The problem is that only intersecting lines of planes are given. I have no problem for the cross product but I am confused for finding the coordinates since the answer would be infinite solution. What could be another way to find the points? The original problem goes this way. > Determine an equation for each of the lines described below. > >> line of intersection of the planes 2x - y + z = -1 and x + 4y - z = 2.
Crossing the normal vectors to the plane, you’ll get the direction vector of the line, i.e. $$(2,-1,1) \times (1,4,-1) =(-3,3,9) $$ Now, you need any one point that lies on the line. This will be any point that lies on both the planes. One variable is arbitrary. Let’s take $z=0$. Then you get $$2x-y=-1 \\\ x+4y =2 \\\ \implies x =-\frac 29, y= \frac 59$$ and thus, the equation of the line is $$\vec r = \left( -\frac 29, \frac 59, 0 \right) +\lambda(-3,3,9)$$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "vectors, 3d" }
Javascript Unicode White Space I need the replace() to recognize space around the 'I' so it only makes the pronoun 'I' in an inputted string lower case, not every 'I' in a sentence. var1 = var1.replace(/\u0020 I \u0020/g, "i"); What am I doing wrong?? EDIT: both var1 = var1.replace(/ I /g, " i "); and var1 = var1.replace(/\bI\b/g, "i"); work. Thank you :)
Looks like you are replacing the spaces as well. You probably want to keep those. var1 = var1.replace(/ I /g, " i ");
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, unicode, replace" }
JSON decode api from db-ip.com using PHP I have some problem with db-ip.com api that display info about visitor ip's. My script only print < pre > tags but nothing between. I need that all parameters from api are decoded and print, like from this link: < Please help me. <?php // get ip if (!empty($_SERVER["HTTP_CLIENT_IP"])){ $ip = $_SERVER["HTTP_CLIENT_IP"]; } elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){ $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else { $ip = $_SERVER["REMOTE_ADDR"]; } $json_url = " $json = file_get_contents($json_url); $json=str_replace('}, ]',"} ]",$json); $data = json_decode($json); echo "<pre>"; print_r($data); echo "</pre>"; ?>
Try this code <?php header('Content-Type: application/json'); // get ip $ip = $_SERVER['HTTP_CLIENT_IP'] ? $_SERVER['HTTP_CLIENT_IP'] : ($_SERVER['HTTP_X_FORWARDED_FOR'] ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']); //$ip = '178.133.109.106'; $json_url = " $data = file_get_contents($json_url); print_r($data); ?> check out this link <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, json, api, curl, file get contents" }
Spring - inject value for request header name There is a problem with Spring and injecting request header name value into controller. Here is the code: @Controller public class ApiController { @Value("${param.header_name}") private String param; @RequestMapping(value = "/**") public void handleApiRequest(final HttpServletRequest request, final HttpServletResponse response, @RequestHeader(value = param) final String param) Properties are defined using **`@PropertySource`** and **`PropertySourcesPlaceholderConfigurer`**. The problem is: > "The value for annotation attribute RequestHeader.value must be a constant expression." But it is not possible to inject a value to a constant (final static) field. Is there a workaround for this? I would like to use `RequestHeader` annotation / mapping and property file to define the header name.
Values used in annotations must be resolvable at compile-time, but `param`'s value can only be determined at runtime The only solution I see is to use `HttpServletRequest.getHeader(String)`): String headerValue = request.getHeader(param);
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "java, spring, spring mvc" }
PHP Detect if non-english I am using these code to check if a string is in English or not. <?php $string=" ("; if(!preg_match('/[^\W_ ] /',$string)) { echo "Please enter English words only:("; } else { echo "OK, English Detected!"; } ?> It cant provide perfect result because string like `"some english text ("` this also detects as English language, any idea?
Try this (please note you need mbstring php module installed): <?php $string=" ("; if(strlen($string) != mb_strlen($string, 'utf-8')) { echo "Please enter English words only:("; } else { echo "OK, English Detected!"; } ?>
stackexchange-stackoverflow
{ "answer_score": 36, "question_score": 9, "tags": "php" }
How to match multiple words in regex Just a simple regex I don't know how to write. The regex has to make sure a string matches all 3 words. I see how to make it match _any_ of the 3: /advancedbrain|com_ixxocart|p\=completed/ but I need to make sure that _all_ 3 words are present in the string. Here are the words 1. advancebrain 2. com_ixxocart 3. p=completed
Use lookahead assertions: ^(?=.*advancebrain)(?=.*com_ixxochart)(?=.*p=completed) will match if all three terms are present. You might want to add `\b` work boundaries around your search terms to ensure that they are matched as complete words and not substrings of other words (like `advancebraindeath`) if you need to avoid this: ^(?=.*\badvancebrain\b)(?=.*\bcom_ixxochart\b)(?=.*\bp=completed\b)
stackexchange-stackoverflow
{ "answer_score": 21, "question_score": 20, "tags": "php, javascript, regex, programming languages, lookahead" }
Should truly fresh steak (i. e. still purple) have a smell? I recently purchased a strip steak from my local grocery. Got home and noticed that the other side (the side that was face down at the deli) had a section that was noticeably purple. If I get really close, there is definitely a smell, but it's not a great smell. I've smelled oxidized (brown) beef before and find it has kind of a "sweet" smell, but this is not that. My first thought was that I was sold spoiled steak. Then I cut the steak in half and noticed that the inside of the steak was the same color and had the same smell. I don't think steak spoils from the inside out, so now I don't know. For what it's worth, it's the smell that's got me concerned. There's no other signs of spoilage that I can find--the steak isn't sticky or slimy. Can anyone provide some expert advice on this? I'm inclined to think it's fine and is just really, REALLY fresh, but I'm hoping someone else knows what's going on.
I ate the steak and was fine. I think it was just an non-oxidized portion of steak. I let it sit in the refrigerator for an hour or so before it I ate it and it's color changed from purple to red, so I'm inclined to think oxidation.
stackexchange-cooking
{ "answer_score": 0, "question_score": 4, "tags": "food safety, beef, steak, fresh" }
The second column on my report is not formatting the same as the first column I need it to look like a table so it looks similar to what the old program's report did. I finally figured out how to do columns, then I added lines between each field both horizontal and vertical. The first column formats with this correctly, but the second column only adds the line horizontally. See the screenshot: !Columns Any help?
Personally, I prefer the new version. Less clutter. But if you want to add them, you can: 1. Put borders around your cells. This may cause some problems with overlap, but you can work around that by only putting borders around the Item and Price fields. 2. Use your line tool to draw 4 vertical lines in both the Detail and Report Header sections.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "crystal reports, formatting" }
Under which circumstances can »werden« stand at the end of a sentence? My listening understanding is poor, but I frequently and clearly hear the word _werden_ used at the end of sentences. What grammatical structure allows this and what is its function in this position?
As peterh pointed out in his comment, _werden_ is frequently used in passive constructions: > Das Problem kann gelöst werden. (peterh) > [ _X_ ] + [kann / könnte / sollte...] + [Verb im Perfekt] + [ _werden_ ]. Another option are subordinate clauses (Nebensätze), where the word order is changed compared to main clauses: > Ich frage mich, ob die Briefe heute noch ankommen werden. In this case, _werden_ is not actually an infinitive, but is the inflected form (third person plural; but the same applies for the the first person plural) of the same verb _werden_. Its function here is to set the sentence in future tense. _Werden_ has many uses in the German language, as you can see in this overview with explanations at canoo.net.
stackexchange-german
{ "answer_score": 9, "question_score": 4, "tags": "verb, sentence structure, passive, future" }
sbt librarymanagement ResolveException Error downloading com.atlassian.jwt:jwt-core Get dependency error (play application with silhouette) after switching to a new development system. sbt.version=1.3.3 in build.sbt: resolvers += Resolver.jcenterRepo resolvers += "Sonatype snapshots" at " [error] Error downloading com.atlassian.jwt:jwt-api:2.0.5 [error] Not found [error] Not found [error] not found: /Users/robert/.ivy2/local/com.atlassian.jwt/jwt-api/2.0.5/ivys/ivy.xml [error] not found:
The artifact `com.atlassian.jwt:jwt-api:2.0.5` seems to be available only from Atlassian's repositories (see < Add the following resolver: resolvers += "Atlassian's Maven Public Repository" at "
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "sbt, jwt, silhouette" }
Change Bound Property in OnPost in model is invalid I am using ASP.NET Core Razor Pages and I want to add a counter for a number of attempts it takes a user complete a task. I am using: [BindProperty] public int Attempts { get; set; } And inside the `OnPost` I am doing this: public IActionResult OnPost() { if(!IsCorrect()) { Attempts++; return Page(); } return RedirectToPage($"./Index") } I expected this to update the data on the client side, since without `[BindProperty]` & `return Page()`, data would be lost if the model was invalid. However, `Attempts` never increases on the client. I think I may have misunderstood how this works? Any suggestions?
Once your `OnPost` method completes and the corresponding View is rendered, the values that are displayed in controls that use the `asp-for` Tag Helper (or the older `HtmlHelper` methods) are repopulated from `ModelState`. This means that even though you are setting a new value for `Attempts`, it is simply not being used because a value exists in `ModelState` with the `Attempts` key. One way to fix this is to clear the value that's stored in `ModelState`, using something like this: public IActionResult OnPost() { if (!IsCorrect()) { ModelState.Remove(nameof(Attempts)); Attempts++; return Page(); } return RedirectToPage("./Index"); } When a `ModelState` value doesn't exist, the value is read from the `Attempts` property on your `PageModel` implementation, as expected.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "c#, asp.net core, asp.net core 2.1, razor pages" }
Zero-knowledge proof of committed value I am considering the following questions and would appreciate any help. **Problem formulation** : Suppose Alice holds a secret value $x$ and there is a public Boolean predicate function $\texttt{Pred}$ that applies to $x$, $\texttt{Pred}: x \rightarrow \\{0,1\\}$. A sample predicate function can be whether the input $x$ is in a certain range or not. Now Alice computes $y\gets\texttt{Pred}(x)$, but instead of publishing $y$, it publishes the encryption of $y$, $\texttt{Enc(y)}$ or commit to this value $\texttt{comm}_y$. Is it possible for Alice to prove that the encrypted value or the committed value is correctly computed by evaluating $\texttt{Pred}$ over $x$ without revealing $x$ and $y$? (Please make additional assumptions if needed to solve this problem).
Yes it's possible, but you need to find equations $E_1, E_2$ which allow you to check: $$\texttt{Enc}(y)=c \iff E_1(y, c) $$ $$\texttt{Pred}(x) = y \iff E_2 (x,y) $$ Then you have to find a zero-knowledge proof-system which authorize you to prove equations such as $E_1, E_2$. For example, if these equations are in a bilinear group context, then Groth-Sahai perfectly fits : < Or if $E_1$ and $E_2$ are circuits, you can look this : < ps : In your case, because, there is no public information at all about x; It seems easy to cheat with a false $x$, but I'm assuming you have already thought about this.
stackexchange-crypto
{ "answer_score": 0, "question_score": 1, "tags": "zero knowledge proofs, commitments" }
Subtract two cells based on multiple criteria I'm trying to calculate a daily count, given that I have current date, city, and total count. For each row, I imagine [city's current total] - [the previous total for that city] = the daily count. Not all cities exist in every date. The number of rows may vary between dates for each city. I've tried INDEX and MATCH with VLOOKUP, but don't Excel functions well enough. I'm familiar with arrays, but can't figure how to pluck the UBOUND and UBOUND-1 counts based on the date + city criteria. Ideas? ![Spreadsheet illustrating the data](
In E2204 put: =D2204-INDEX(D:D,AGGREGATE(14,7,ROW($D$1:$D2203)/($C$1:$C2203=C2204),1)) OR if one has the formula XLOOKUP: =D2204 - XLOOKUP(C2204,$C$1:$C2203,$D$1:$D2203,0,0,-1) ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "excel, calculated field" }
Creating a list of matrices I am new to programming and I was wondering if my question has a simple implementation. I have a bunch of matrices and I want a way to be able to store them, or be able to easily call them and do operations on them. For example, if I have 100 matrices, called, M1,M2,...M100; is there a way I can rename them so that if I want to call the nth matrix, I can just write M(nth)? EDIT: For example, if I want to add M1+M1, M1+M2, ...,M1+M100; I want to be able to write a loop something kind of like, for i=1:100 AM(i)=M(1)+M(i) end Is this possible?
Use cell array AM = cell(1,100); and set it as AM{i} = Mi; then you can access it as AM{i}; note the use of {} to access each element of the cell array AM, that is in turn a matrix
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 4, "tags": "matlab" }
Trying to hide a button on another view, depending on segue chosen in swift xcode Trying to hide a button on another view depending on the segue path chosen. So for example, if the "AddNewPokemon" segue is selected, then UIButton.hidden = true on the next view page. if segue.identifier == "AddNewPokemon" { let navigationController = segue.destinationViewController as! UINavigationController let controller = navigationController.topViewController as! PokedexDetailsViewController controller.cancelButtonDelegate = self controller.delegate = self I have tried browsing stackoverflow for the past hour, but to no avail, fairly new to swift. <
if segue.identifier == "AddNewPokemon" { let navigationController = segue.destinationViewController as! UINavigationController let controller = navigationController.topViewController as! PokedexDetailsViewController //add line set the value created in PokedexDetailsViewController ie hideButton = true controller.hideButton = true controller.cancelButtonDelegate = self controller.delegate = self } Create a var hideButton in PokedexDetailsViewController controller and set it true in prepare for segue and check in PokedexDetailsViewController viewdidload() method if true then hide it. Hope this may help you. Thanks
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "ios, swift, xcode" }
exception translation with jpa template spring I have my application in Spring / JPA. Spring translate database exception into Runtime exception called DataAccessException. I have unique constraint on one of my column and I want to display user defined message that Value for this column already exists. But when I retrieve message using `e.getMessage();` it just give me Could not execute JDBC batch update. Which is insufficient. Can I get any database specific error code the way database vendor returns so that I can do some mappping based on that. spring does provide sql-error-code.xml using which we can translate. But I am using jpatemplate and not jdbcTemplate. Please help me as I am new to exception handling in spring. Thanks in advance.
Quoting the spring manual: > Spring provides a convenient translation from technology-specific exceptions like SQLException to its own exception class hierarchy with the DataAccessException as the root exception. These exceptions wrap the original exception so there is never any risk that one might lose any information as to what might have gone wrong. You should catch the Spring DataIntegrityViolationException and then set whatever use message makes sense for your user. Full list of exceptions here <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "spring, jpa, exception" }
How do I create repeating patterns with cycles' procedural textures Most people's question in this area is how to reduce repeating patterns, however I want to create them. I'm creating 2d rendered tiles for my game, and I want to create procedural materials for my tiles that will seamlessly match. For that I need the cycles procedural textures to repeat on a predictable interval. I've looked at similar threads, and they only deal with simple gradients, or images, not things like voronoi, musgrave, noise. I haven't been able to figure out how to scale/manupilate with math, the procedural nodes to any degree of repetition.
SleepyMolecule’s answer shows a way to get a seamlessly repeating pattern without mirroring, but unfortunately it uses OSL, and therefore can’t be used for Cycles GPU rendering. But Blender 2.81 added a 4D option to the Noise Texture node, so the same idea can now be used without recourse to OSL, and the resulting node setup can be used for both CPU and GPU Cycles rendering (and also for Eevee). Here’s an example of a shader node setup for this, applied to a horizontal plane. ![]( (The number in the Scale node is 2π, which can be entered as 2*pi. This scaling changes the repeat distance from 2π to 1. The Hue Saturation Value is inserted just to give better coloration, so that the pattern is clearer.) The above uses a Noise Texture node, but a Musgrave Texture or Voronoi Texture node can be used instead, as they also now have 4D options. (But the Voronoi Texture exhibits mirroring in some modes. I don’t know why.)
stackexchange-blender
{ "answer_score": 14, "question_score": 59, "tags": "cycles render engine, texturing, materials, node editor" }
How do I uninstall a programm I have it mounted by I can't find where I uninstall programmes. In windows you just go to Control Panel in osx I am lost!
Uninstalling applications in Mac OS X is very different than uninstalling in a Microsoft Windows environment because Mac OS X has nothing like the Windows Registry. While most Windows programs include an uninstaller that can be run through using the Add/Remove Programs control panel, no such feature exists in Mac OS X and so most users **simply move application bundles (see below) to the Trash**. However, often times there is more to uninstalling than a simple drag-and-drop to the trash. This article will guide you on how to fully uninstall applications. wiki
stackexchange-superuser
{ "answer_score": 5, "question_score": 1, "tags": "macos, osx snow leopard" }
Why is such a vector guaranteed to exist? > Theorem:: > > Let $M$ be a symmetric matrix and let $x$ be a non-zero vector that maximizes the **Rayleigh quotient** with respect to $M$. Then, $x$ is an eigenvector of $M$ with eigenvalue equal to the Rayleigh quotient. Moreover, this eigenvalue is the largest eigenvalue of M. On seeing the theorem the first question is why will such an eigen vector exist? Question:Why is such a vector guaranteed to exist? Can someone please help me here?
If you allow a littll analysis to enter into the reasoning, restrict the Raleigh quotient to the unit sphere (this is actually not leading to loss of generality, since it is homogenous of degree 0) which is compact and where the Raleigh quotient is continuous, and therefore attains a maximum value.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "linear algebra, matrices, eigenvalues eigenvectors" }
Is ( ¬p AND (p OR q) ) AND ¬q a contradiction? As We Know That p AND (q OR r) = (p AND q)OR(p AND r) we have = ((¬p AND p) OR (¬p AND q)) AND ¬q = (F OR (¬p AND q)) AND ¬q = (¬p AND q) AND (q AND ¬q) =F hence a contradiction i do not understand these two steps (F OR (¬p AND q)) AND ¬q (¬p AND q) AND (q AND ¬q) can someone please explain these two steps .. what rule is applied and what is going on here ? thanks
I am going to use the following notation for AND, OR, and F respectively: $\land, \lor, \bot$. $$(\bot\;\lor\;(\neg P\;\land\;q))\land\neg q\iff(\neg P\;\land\;q)\land\neg q$$ A formal elimination rule isn't being used here, but rather, the theorem: $$\bot\lor P\iff P$$ Think about it with truth tables (semantically). Since $Q\lor P$ is true only when either $Q$ or $P$ (or both) are true, if $Q=\bot$, then $Q\lor P$ is only true if $P$ is true, and hence false if $P$ is false. So $\bot\lor P\iff P$. The last step follows from $q\land\neg q$ always being false (law of excluded middle) and $P\land \bot\implies\bot$. In summary, formally prove these three lemmas: 1. $\bot\lor P\iff P$ 2. $P\land\neg P\implies\bot$ 3. $P\land \bot\implies\bot$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "logic, propositional calculus" }
Fragment managment android I want to pass from a fragment of the navigation drawer menu to a fragment outside of the menu. I manage to display the new fragment but overriden to the previous. Can you suggest me some link? FragmentManager manager = getSupportFragmentManager(); FragmentTransaction t1 = manager.beginTransaction(); DetailFragment instance = new DetailFragment(); Bundle b2 = new Bundle(); b2.putString("Title", Title); b2.putString("author", author); instance.setArguments(b2); t1.replace(R.id.nav_host_fragment, instance); t1.commit(); The problem is the R.id.nav_host_fragment
public void routine(String Title, String author,Fragment fragment,FragmentManager f1) { FragmentTransaction t1 = f1.beginTransaction(); DetailFragment instance = new DetailFragment(); Bundle b2 = new Bundle(); b2.putString("Title", Title); b2.putString("author", author); instance.setArguments(b2); t1.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); t1.replace(fragment.getId(), instance,"Change layout"); t1.commit(); } The above function is recall by my first fragment in the code below to pass to the next fragment where the first fragment is come from nav bar fragment and the next fragment is an empty fragment androidx.fragment.app.Fragment fragment =getParentFragment(); instance.routine(Title[position],Author[position],fragment, instance.getSupportFragmentManager());
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, fragment, navigation drawer" }
jquery hyperlink characteristics In the following code why is that on click of details the page zoom shifts to top of the page and how can this be prevented <a href='#' onclick='javascript:toggle(%s);'>Details</a>&nbsp;&nbsp;%s %s <b>Total Sal: </b>%s<br><div id='%s' style='display:none;'>%s</div><br>"%(divname,first_name,lastname,usage,divname,html_table) Note: the above code is generated on the server side..
Change you href to href="javascript:void(0);"
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "javascript, jquery, jquery ui, jquery selectors" }
Android Push notifications component I need to implement a server that can send Push Notifications to Android mobile phones. I am looking for a component that provide push notifications services, I dont mind paying for a good one. Where do I start if I want to implement my own? Thanks Amit
Android C2DM is not what you are looking for?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, push notification" }
Aptana 3 git commit I am trying to use git to keep track of any work I do on my current project. So what I want to be able to do is no matter what machine I am on, my laptop or desktop, is pull down the current snapshot of the project, make any changes and add new files then commit it back to the repository. I am using Aptana 3 and I was able to clone my repository but when I selected all of the files and selected commit, no changes were made to the repository on github. Any ideas why this would be happening?
Git has 3 distinct operations that happen in order to put new changes into a remote repository: 1. Changes are `add`ed to the local staging area. 2. The local staging area is `commit`ted. 3. The resulting new local commit is `push`ed to the remote repository. What you tried to do may have only accomplished #2, which means that nothing was actually committed (due to #1 not having been done). Furthermore, nothing would show up on GitHub until #3 was done as well.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "git, github, aptana3" }
Existence of a chain Covering on a connected compact set? Assume that $K $ is a compact connected set in a metric space $(M, d)$. we want to cover $K$ by a finite family of open balls $(B_i)_{1\leq i\leq n}$ with an equal radius namely, $B_i=B(x_i,r)$; having the property that $$B_{i-1}\cap B_i \neq \emptyset.$$ > **Notice that we do not require $B_{j}\neq B_i$ whenever $i \neq j$.**
Start with any finite open cover of balls of radius $r$, call that cover $\mathcal B$. Pick $B_1 \in \mathcal B$. Pick $B_2 \in \mathcal B - \\{B_1\\}$ such that $B_1 \cap B_2 \ne \emptyset$; this is possible since $M$ is connected. Pick $B' \in \mathcal B - \\{B_1,B_2\\}$ such that $(B_1 \cup B_2) \cap B' \ne \emptyset$; this is possible since $M$ is connected. If $B' \cap B_2 \ne \emptyset$ then set $B_3 = B'$. On the other hand, if $B' \cap B_1 \ne \emptyset$ then set $B_3 = B_1$ and $B_4 = B'$; notice, you had to back up over $B_1$ again in order to extend the chain. Continue in this manner inductively, and you'll get all the sets in $\mathcal B$ to be in your chain, perhaps backing up in your chain in order to tack on the next one.
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "combinatorics, general topology, metric spaces, connectedness" }
Missing Full Text Index System View In Sql Server 2008 I've been reading about the system view: `sys.dm_fts_index_keywords_by_document` on msdn.aspx) but can't find the view in my 2008 database. Anyone know if it should be there by default?
It's a TVF not a View. If you mean you can't see it in Object Explorer look in the master database under `Programmability -> Functions -> System Functions -> Table Valued Functions`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql server 2008, full text indexing, system views" }
What is this graphical effect called? I was watching this trailer: < and at 1:22, the player used a magic trick that created a sphere that warped the projection of the scene. ![]( Does anyone know what is this effect?
I don’t think there’s a formally established name for it, but it’s generally known as distortion, warping, or refraction. It works by taking an already rendered version of the current frame, sampling it with warped/stretched texture coordinates, and, usually, compositing the result back in with the rest of the scene. One of the first games I know of that used it was Half-Life 2, for an effect when the Strider enemies fired their cannon: !enter image description here For an example of what this looks like in a modern game engine, check out Unreal’s documentation.
stackexchange-computergraphics
{ "answer_score": 5, "question_score": 1, "tags": "transformations, projections" }
"ça ne lui fera pas de mal" vs "ça lui fera du bien": Which is stronger in meaning? > Je me persuade que **ça ne lui fera pas de mal** de manger moins et diététique !! I assume this expression is considered litotes, ... > Je me persuade que **ça lui fera du bien** de de manger moins et diététique ! ... so how does it compare to the straightforward affirmative construction? I wonder which is stronger in meaning.
> _"ça lui fera du bien"_ is just an objective way to speak. That will be good for him. _"ça ne lui fera pas de mal"_ has two meanings: > Nothing to worry about. He can try it and that can eventually be good to him. or > _"Seriously, he needs to do something"_ and for instance eating less and dietetic things (because he's too fat or other...)
stackexchange-french
{ "answer_score": 2, "question_score": 1, "tags": "litote" }
How to prevent access to script except for one IP in PHP? I have a static form on a server that does not support php: <form action=" I need the script on the file process_form.php to only be processed if the request is being sent by the static IP of the server on which the static form is hosted. How to do this? If anyone other then that ip is attempting to request the script the script should be killed immediately.
This will not work the way you want because the IP will be that of the _client_ , never the server on which the form is hosted. You are looking to test the $_SERVER["HTTP_REFERER"] header variable. That will tell you which page the originating form was hosted on - **however, it is not safe.** This header is set by the client, and can be freely manipulated.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "php, security" }
Any point in waiting for Samsung 850 EVO? I'm about to upgrade my MacBook Pro (13" mid 2012) with 16GB of RAM and an SSD. According to this news article Samsung's new 850 SSD series might be around the corner, and I'd much appreciate your opinion on whether I should wait for it or go with the current 840 EVO? Is there really any more speed to be had over the MBP's SATA III interface than what the 840 EVO already delivers? The fact that the 850 series will still use SATA III would suggest so, but on the other hand this post doesn't think so.
Ask yourself this, do you need a performance boost now or can you wait an unknown amount of time for a possibly unnoticeable difference between the 840 and 850 EVO? I personally have an 840 EVO, install them all day long and before my EVO I had an Intel SSD. EVOs are great but the decision should be as simple as do you want it now or do it you want it later. No matter what you won't regret your decision.
stackexchange-apple
{ "answer_score": 3, "question_score": 1, "tags": "macbook pro, hard drive, ssd, sata" }
When should you use a constructor in JavaScript? For example I have this function that builds a `Car` object. function Car() { var honkCount = 0; var honkHorn = function () { honkCount++; $results.html('HONK!<br />'); }; return { get honkCount() { return honkCount; }, honk: honkHorn } } Both `var car = new Car();` and `var car = Car();` don't seem to make much difference and I'm confusing myself a bit.
> Both `var car = new Car();` and `var car = Car();` don't seem to make much difference and I'm confusing myself a bit. You are right, they are both the same, simply because you are returning an object from the function. From the MDN documentation: > 3\. The object returned by the constructor function becomes the result of the whole new expression. If the constructor function doesn't explicitly return an object, the object created in step 1 is used instead. (Normally constructors don't return a value, but they can choose to do so if they want to override the normal object creation process.) And as the documentation also says, _usually_ constructor functions don't return a value explicitly.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "javascript, function, oop, object, constructor" }
When APNS tokens fail, is it a must to repeat the remaining push notifications? I'm sending 1-10 notifications at a time, sometimes one of the tokens fail, I'm guessing they fail when a user deletes the app (or other similar reasons), do I need to retry the remaining tokens/notifications for that batch? (I receive a "failed token" warning later on from PyAPNS) The tokens are all valid tokens, it's stated that malformed tokens require a retry of the remaining push notifications, however I'm wondering whether I need to retry too with non-malformed tokens, it would be pretty stupid If I need to retry in the above scenario, people delete apps all the time, I'm guessing a high percentage of batches would require a retry (There are many questions related to this issue, however I wasn't able to find a definite answer, from my trials I'm guessing I already have my answer, It seems the notifications aren't delivered in the above scenario)
I don't know what causes PyAPNS to return a "failed token" warning. If it refers to a token belonging to a device that uninstalled the app (which I doubt, since such device tokens are only returned by the Feedback Service), you don't have to re-send the remaining notifications. However, if this failure is caused by an error response of InvalidToken, this means the connection to APNS was closed after the invalid token was processed, and any notifications that were sent after it must be re-sent.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "ios, push notification, apple push notifications, pyapns" }
How to add C daemon to android project and run it? I have a daemon written in C language. I also have an android application that uses this daemon via socket. Daemon run with system. Is it possible to add compilled C daemon to android application and run it from application?
I guess it is possible, but just in case your device is rooted.You should include the daemon as part of your application, see NDK if you don't know how to do it, and somwhere in your application code call it like Runtime.getRuntime().exec("su root " + "path to daemon"); where 'su' is super user utility, which forks your application and executes daemon in sepparate proccess with elevated permissions.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "android, c, daemon" }
Where in the world can I fly on a reduced-gravity aircraft as a tourist? According to Wiki: > A reduced-gravity aircraft is a type of fixed-wing aircraft that provides brief near-weightless environments for training astronauts, conducting research and making gravity-free movie shots. !enter image description here Image courtesy of NASA Where in the world can I take such a flight and what is the _approximate_ cost of each operator?
As of 2017, the following companies operate reduced-gravity (aka zero-gravity) flights: EU: * Air Zero G, flies from Zurich and Bordeaux. Approximate price: 6000 EUR. Russia: * Gagarin Cosmonaut Training Centre, near Moscow. Approximate price: 4000 EUR. United States: * Zero Gravity Corporation, scheduled flights from various airports around the US. Approximate price: 4250 EUR.
stackexchange-travel
{ "answer_score": 36, "question_score": 36, "tags": "air travel, where on earth, space" }
Using secondary index and key filter together in RIAK mapred Is possible to use sec index and key filters together in a map reduce query. Something like this *{"inputs":{ "bucket" :"ignore_bucket1", "index" :"secindex_bin", "key" :"secIndexVal", "key_filters":[["and", [["tokenize", "-", 5], ["greater_than_eq", "20120101"]], [["tokenize", "-", 5], ["less_than_eq", "20120112"]] ]] }} Also is it efficient to get list of keys using sec index and then run keyfilter on returned keys ?
As far as I know it is not possible to combine these in the input statement as they represent very different ways of retrieving keys. It would be possible to implement this is as you suggested, by using the secondary index to retrieve the initial set (avoids scan of all keys) and then implement the key filtering logic as a map phase function. Another, probably faster, way to get around it could perhaps be to create an additional compound binary secondary index, e.g. [secIndexVal]_[date]. If this is ensured to sort correctly, you could run a single secondary index range query on this and get the values you specified above.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "riak" }
how to copy many files inside of a directory to many other directories using shell or python i have many files inside a directory1(libX11.so.6, tm.txt, ff.txt..and so on), i need to copy these files of directory1 to many other directories named as directory2,3.......100000. I tried find command but its not working.My sample online code is given below.can anybody suggest some better solutions using shell or python...Thanks in advance. find . -type f -name "libX11.so.6, tm.txt, ff.txt" -exec cp -rv {} /home/geo/data/directory{2...100000} \; while doing this it shows errors
The following code will copy **all** your original_dir files to the destination_dir. I believe you can do some customized changes to get what you want. import os from shutil import copyfile original_dir = "/path/to/the/original/dir" original_files = os.listdir(original_dir) destination_dir = "/path/to/your/destination/dir" for each in original_files: current_file = os.path.join(original_dir, each) # check if it is a file if not os.path.isdir(current_file): # print(each + " is being processing") copyfile(current_file, destination_folder + each)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, linux, shell, unix" }
Font size doesn't decrease size of my program I'm creating an android application for someone that gathers information about his clients and their transactions. His device is quite old so he asked if I could decrease the size of the program. I tried to do this using the simplest possible algorithm which is to make the font size smaller. I tried this and compiled my program but it didn't change in size, not even a single byte. This is my output total 18228 -rw-rw-r-- 1 mark mark 18665472 May 2 15:27 ClientTransactions.jar I changed the font of my program from **12pt** to **8pt** The new output is: total 18228 -rw-rw-r-- 1 mark mark 18665472 May 2 15:29 ClientTransactions.jar Can anyone help me further with this, i'm really confused
Changing the font size of your source code has no effect on it's size. Compiling it will result in the same size every time. Try to refactor your code and get rid of any unused methods,...
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "fonts" }
What does "getattr(self, 'something') is true" mean in Python? I am new to Python. I could not figure out what "is True" means in this case: class Answers(): def get_reference(self): return None def is_private(self): return getattr(self, 'private', False) is True I understand that getattr() will return the value of "private" or it will return False as the default value. So what does the "is True" mean?
It's checking whether the getattr call returns True.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python" }
media_handle_upload for local files? I am creating an image on the server and storing it in a tmp folder. I would like to run a php file that takes this image, stores it in the default media directory structure and attaches it to a post while creating appropriate thumbnails. media_handle_upload seems to require an upload POST request to work with. Is it possible to make it work on a local image in a non-POST context? Thanks.
You want `media_handle_sideload()` > Handles a side-loaded file in the same way as an uploaded file is handled by media_handle_upload(). // Array similar to a $_FILES upload array. $file_array = array( 'name' => 'filename.jpg', 'tmp_name' => 'path/to/filename.jpg', ); // Post ID to attach upload to, 0 for none. $post_id = 0; $attachment_id = media_handle_sideload( $file_array, $post_id );
stackexchange-wordpress
{ "answer_score": 4, "question_score": 5, "tags": "posts, post thumbnails, attachments, media" }
How do I monitor iAd performance in my app? Sorry, I'm not entirely sure if this question is appropriate so delete if necessary, I just haven't had any success with Apple or Google! I've successfully implemented iAd into my app and live ads are being pushed to the app which can be seen. However, I can't seem to find how I find how the ads are doing. How many impressions they get and how much they are earning. Is there such a feature within iTunes Connect which I can't see? Or do I need to wait until Apple sends out the payment to find out how much they've earned? Thanks,
Got the URL here, apparently Apple hide the URL: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "ios, objective c, iad" }
With blueimp file upload, how can I detect when all files in the upload queue have completed? It appears as though the done and fail callbacks are called for each individual file. After reading the docs, I couldn't find a callback that is only fired when the request queue empties. Has anyone managed to work around this? Or perhaps I'm just missing something obvious.
It turns out the start and stop callbacks are what I was looking for. The documentation describes them as simply being equivalent to ajaxStart and ajaxStop but it appears they are called when the first upload starts or the last upload ends.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "file upload, blueimp" }
Sorting List based on another list python I've got a list of objects of the following format: obj = [{"id": 39, "name":"bla"},{"id": 23, "name":"blabla"},{"id": 45, "name":"blabla"},{"id": 12, "name":"blabla"},{"id": 100, "name":"blabla"},...] I also have a list of IDs (`A`) defined as follows: A = [23,39,45,...] I need to sort `obj` such that all the sorting reflects the order of `A` \- the first object is the one with key `23`, the second one with key `39` and so on. I'm thinking of using `zip` for this but not sure exactly how to do so - would I need to zip the two lists together and then sort the zipped list of tuples?
First construct a mapping that allows you to look up an item by its id: In [6]: index = {item["id"]: item for item in obj} In [7]: index Out[7]: {39: {'id': 39, 'name': 'bla'}, 23: {'id': 23, 'name': 'blabla'}, 45: {'id': 45, 'name': 'blabla'}, 12: {'id': 12, 'name': 'blabla'}, 100: {'id': 100, 'name': 'blabla'}} then pick them one by one from this mapping: In [8]: [index[id] for id in A] Out[8]: [{'id': 23, 'name': 'blabla'}, {'id': 39, 'name': 'bla'}, {'id': 45, 'name': 'blabla'}]
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, list, sorting" }
How to remove - when reading string values right to left I am creating new column based on right most values from existing values ABP-1-3-3 CBP-1-10-12-14 Expoected values for new column i am able to read from left, Values i am getting -3 14 enter image description here How can i modify my below code with regexp replace to remove any - ? SUBSTR(TEST, -2, INSTR(TEST, '-')-1) AS TEST2,
Try this: with test as ( select 'CBP-1-10-12-14' v1 from dual union select 'ABP-1-3-3' v1 from dual ) select regexp_substr( v1 , '[0-9]*$' ) from test Also take a look at < . It is a neat site. Put in your regex string, and it will "translate" it to human-readable description.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "oracle11g, regexp replace" }
Запятая перед "плюс" Когда в предложении "плюс" употребляется в значении "и", нужна ли перед ним запятая? Например: "Я купил лекарства(,) плюс к этому мне нужно купить продукты".
Это сложносочиненное предложение. Даже если было бы "и", ставилась бы запятая. В вашем случае "плюс к этому" - это, должно быть, союз, употребленный, как вы правильно сказали, в значении "и", следовательно запятая нужна. Если бы было предложение типа: "Мне дано купить лекарства плюс продукты", то запятая не ставилась бы.
stackexchange-rus
{ "answer_score": 1, "question_score": 0, "tags": "пунктуация" }
How to upload large github repository more than 2GB file with vs code I need to upload my file on github repository, The file is more than 2GB and I am unable to upload my file on github repository using vscode terminal. When I try to commit the file it says, **Git: warning: LF will be replaced by CRLF in "pathname" Learning/debug.log** The file contain html, css, js, audio, video , img etc with full year code of 2019. need to upload those file on github repository, I was tried but not able need help.
> **What is my disk quota?** > > File and repository size limitations > > We recommend repositories be kept under 1GB each. Repositories have a hard limit of 100GB. If you reach 75GB you'll receive a warning from Git in your terminal when you push. This limit is easy to stay within if large files are kept out of the repository. If your repository exceeds 1GB, you might receive a polite email from GitHub Support requesting that you reduce the size of the repository to bring it back down. > > In addition, **we place a strict limit of files exceeding 100 MB in size**. For more information, see "Working with large files."
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "github, github pages" }
How to tweet multiple lines with Tweepy? How can I tweet this... List of fruits: 1. Apple 2. Banana 3. Orange Instead of this? List of fruits: 1. Apple 2. Banana 3. Orange My code so far: import tweepy # Authenticate connection auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(token_key, token_secret) # Start API api = tweepy.API(auth) # Update status api.update_status('List of fruits: \n1. Apple \n2. Banana \n3. Orange') As you can see, using '\n' didn't work. Tweepy just ignored it. Thanks in advance.
When you call an external API, it need not be written in Python on the server end. So maybe the '\n' is simply being caught as an exception. Or probably, the encoding is changed to ignore the escape characters. What you can do is: with open('temp.txt', 'w') as f: f.write('List of fruits: \n1. Apple \n2. Banana \n3. Orange') import tweepy # Authenticate connection auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(token_key, token_secret) # Start API api = tweepy.API(auth) # Update status with open('temp.txt','r') as f: api.update_status(f.read())
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, string, twitter, tweepy" }
C++ GUI Window position I have a GUi, written in C++/CLI . I want one specific window of it to open on a specific position (right top corner) of my display. How can I implement this?
BOOL WINAPI SetWindowPos( __in HWND hWnd, __in_opt HWND hWndInsertAfter, __in int X, __in int Y, __in int cx, __in int cy, __in UINT uFlags ); More info on msdn.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "c++, user interface, window, position, command line interface" }
Sending Restsharp reponse to a class I'm trying to send the content of this API response into a custom response class. This produces a parsing error. Is there an additional conversion needed before the RestSharp response works with Newtonsoft? The class has three strings which are meant to grab the three members of the JSON with the same name. IRestResponse response = client.Execute(request); <CLASSNAME> content = JsonConvert.DeserializeObject<CLASSNAME>(response.ToString()); The parsing error is "'Unexpected character encountered while parsing value: R. Path '', line 0, position 0.'" My class is as follows: public class Response { public string name { get; set; } public string msg { get; set; } public string code { get; set; } } The JSON is as follows: { name: msg: code: ...bunch of other stuff... }
Oh I found it! It has to be Response.Content that is deserialized. That's where the JSON is.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, restsharp" }
Functions and transformations > A function, $y = f(x)$, originally has a domain of $x ≥ 4$ and a range of $y ≤ 1$. > > Determine the new domain and range of $y=-2f(-x+5)+1$ after applying all transformations. > > (Try sketching the graph and applying the transformations,) I am stuck with even starting this question without having the original function. But based on the domain and range of the original I think this is a square root parent function. I am at loss; please help. This question has been bugging me and I am sure I am overthinking.
In keeping with your idea about using a square root parent function, I put into the graphing site Desmos a function $f$ with the desired domain and range: **link**. You will see there not only the original graph, but also a sequence of transformations that get to the final function that you are supposed to be considering. These are color coded, and you can click the color next to each function input to hide it. Can you see how each of them affects the parent graph? Here is an image for completeness: ![enter image description here](
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "algebra precalculus, graphing functions, transformation" }
Can C# files contain file-level summary comments? E.g. Foo.cs: using System; /// <summary> /// This file contains Foo and Bar-related things. /// </summary> namespace Xyz { class FooThing { } } Does C# support such XMLDoc comments?
No, XML document comments can only appear on specific types of elements, as described in this article: > In source code files, documentation comments that precede the following can be processed and added to the XML file: > > Such user-defined types as a class, delegate, or interface > > Such members as a field, event, property, or method If you place a file-level XMLDoc-style comment in your file, it will be appended to the next class or other element that happens to appear. Certain documentation tools, like Sandcastle, provide a way to add namespace-level XMLDoc comments but they generally appear in a separate file. Of course, you can use _non_ XMLDoc-style comments in each file, e.g. a copyright header or similar, by just using standard /* */ style comment blocks.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 4, "tags": "c#" }
How does a single SRB control attitude? The Ares I-X was a test flight from the Constellation program for crewed Ares I-launched Orion capsules.) ![Ares I-X max q]( If liquid fueled rocket motors can gimbal, how do solid rocket motor-propelled spacecraft control their attitude, especially when performing a "pad avoidance maneuver" directly after ignition?
The Ares 1-X used stock Shuttle program SRB thrust vector control (TVC) - hydrazine fueled power units drove hydraulic pumps which powered actuators that could tilt and rock the nozzle, which incorporated a flexible bearing in its design. ![enter image description here]( ![enter image description here]( (Pictures from "Space Shuttle", Jenkins, 1992 edition p.263 and here \- p 2.13-48 of linked PDF) However, unlike the Shuttle system with its 2 SRBs, a single SRB with articulating nozzle cannot provide roll control, only pitch and yaw. So Ares 1-X had 2 unique modules containing hypergolic thrusters (derived from the Peacekeeper missile) mounted on it to provide control in the roll axis. ![enter image description here]( (Picture from here) Reference: <
stackexchange-space
{ "answer_score": 21, "question_score": 16, "tags": "attitude, srb" }
React Router - Build State from Query String New to React, building a search app where the URL is built up based on search term entered and subsequent filters that are selected. I am updating the query string, not the path, based on search term and selections made. (e.g /?term=movies&selections=action,adventure) I am manually pushing these changes to the query string via browserHistory.push() in Action Creators. I'm not sure of the right pattern to follow to hydrate application state in response to these updates. I can check query string params in componentWillMount(), on first render to render initial state, and that works fine, but when the browsers back/forward buttons are used I am not sure of the best pattern to follow to rebuild the state. I am using the following modules on top of React: react-redux react-router react-router-redux Advice appreciated thanks.
You need to check query in `componentWillReceiveProps` callback. Something like this: componentWillReceiveProps(nextProps) { if (!_.isEqual(this.props.location.query, nextProps.location.query) { this.fetchDataFromServer(nextProps.location.query); } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "reactjs, react router, browser history, react redux, react router redux" }
Is it possible to select and insert its result in MySQL? I have a table that needs to be updated with another table. Can I make a Select command to insert the data found on another table? If so, how? I use MySQL
insert into table1 (Column1, Column2) select Column1, Column2 from table2
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "mysql, database, select, insert" }
The array is only read from, never written to Good morning, I create this class in java : public class MapPoint { public MapPoint() { this.tag = new String() ; this.Id = 0 ; } public long Id; public double lon; public double lat; public String tag; } but when I want to create an array of `MapPoint` in my main function like this : public class mainTestClass { public static void main(String[] args){ MapPoint[] mapPoints = new MapPoint[100]; mapPoints[0].setId(2); System.out.println(mapPoints[0].Id); } } I have this hint > "The array is only read from, never written to" and when I run my program I have this error : > Exception in thread "main" java.lang.NullPointerException at mainTestClass.main(mainTestClass.java:34). please help thanks.
You have just declared an array that can contains at most 100 MapPoint objects. Now, you need to create an object in the array. mapPoints[0] = new MapPoint(); mapPoints[0].setId(2); When you're doing `MapPoint[] mapPoints = new MapPoint[10];` it's like in this situation : !enter image description here That's why you got a `NullPointerException`.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 4, "tags": "java, arrays" }
How to delete an image I uploaded? When I delete an image I previously uploaded into an Image field, the file stays on my server. It takes up space and remains publicly viewable. Is there an easy way to get Drupal to clean up after itself by deleting uploaded files that are no longer in use?
Images should be deleted automatically during cron runs, if they are not used anymore. Meaning, their file_usage count is 0.
stackexchange-drupal
{ "answer_score": 5, "question_score": 3, "tags": "7, media" }
Rated with a boolean instead of a "5 star" rating system? When I ask someone their opinion about food, they either say "I recommend it" or "I don't." This "boolean answer" (yes/no, I agree/I don't, recommend/don't recommend) is normally given if I ask questions about food, movies, or any other consumable (media or otherwise). If that seems to be the trend, why does Yelp have a star rating? Why not a "200 recommend this" and "5 do not recommend this?" Is it that a star rating allows people to go into detail? The issue I have with this, is that you're ultimately trying to get a recommendation (or not) from a peer so a star rating seems detached from that. I guess my question is: Why is it that there are still star ratings on consumables when ultimately the user is looking for a boolean answer, and why isn't that being reflected in a more boolean like rating system?
I am going to give an indirect answer, but hopefully it will be explanatory. Imagine if Amazon used the Boolean system and you searched for the item you want to buy. Which should you get?: 1. Item #1 - 89x, 33x 2. Item #2 - 113x, 73x 3. Item #3 - 66x, 73x 4. Item #4 - 7x, 1x Vs. 1. Item #1 - 4.9⭐️ 2. tem #2 - 4.5⭐️ 3. Item #3 - 3.0⭐️ 4. Item #4 - Not enough reviews One is easier to determine when given 4 options, much less 400 options. I'll leave it up to personal opinions to judge which one is better for a lot of side by side reviews.
stackexchange-ux
{ "answer_score": 0, "question_score": 0, "tags": "ratings" }
ptrace(PTRACE_SINGLESTEP) + waitpid = SIGCHLD I'm ptracing a multithreaded application and 9 out of 10 times, the breakpointhandling works just fine, but sometimes i get a SIGCHLD event instead of SIGTRAP. This is the sequence: * application is running, main thread hits INT3 * debugger's waitpid returns SIGTRAP * debugger SIGSTOPs all threads that are not already "t (tracing stop)", using tgkill * debugger runs ptrace(PTRACE_SINGLESTEP) on INT3'ed thread (after fixing RIP and 0xCC byte) * debugger waitpid's and expects SIGTRAP, but gets SIGCHLD instead What am I supposed to do with this SIGCHILD? Ignoring it makes the debugger stuck forever in following waitpids. Injecting it back into the debugee with PTRACE_CONT screws with the initial PTRACE_SINGLESTEP. It seems that it is happening only for main threads (PID==TID), not for childthreads (aka LWP). I'm using UBUNTU 12.04 64bit in virtual box.
Injecting SIGCHLD with PTRACE_SINGLESTEP (data param) back into debugee seems todo the trick.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ptrace, waitpid" }
SharePoint PnP - Get-PnPField - Only Columns visible to Super User When using `Get-PnPField`, is there a way to only pull fields that are available for editing the settings GUI? `Get-PnPField` pulls all the fields including some system-related.
You are right by default `Get-PnPField` returns all fields from a list or site. You can filter the results you are getting from this comment like below: **Exclude Hidden Fields** : Get-PnPField | ? { $_.Hidden -eq $false} **Exclude Read Only Fields** : Get-PnPField | ? { $_.ReadOnlyField -eq $false} **Exclude Hidden AND Read Only Fields** : Get-PnPField | ? { $_.Hidden -eq $false -AND $_.ReadOnlyField -eq $false} **References** : 1. Get-PnPField 2. Logical Operators in PowerShell
stackexchange-sharepoint
{ "answer_score": 0, "question_score": 0, "tags": "sharepoint online, powershell, pnp powershell, pnp" }
ArcMap legend column formatting I'm trying to spread my ArcMap legend across 3 columns. Ideally column #2 and #3 should have their symbology header / layer name above them (see picture). ArcMap however is of the opinion that either one or both headers should be placed at the bottom of the column before. In **Legend Properties** I tried assigning each layer to it's own column. I tried using them as symbology headers or layer names. What am I overlooking? !legend column header
If you have ArcGIS version 10.2, to get the headings to sit properly as in the legend on the right you need to make sure that fixed frame strategy is switched off. !Example Legends So in the legend properties make sure fixed frame is switched off on the layout panel (see below). !Legend Properties Layout Panel Then to define items to be in new columns select the item you wish to be in a new column on the legend properties panel and check the "place item in a new column" box see image below:!enter image description here
stackexchange-gis
{ "answer_score": 3, "question_score": 1, "tags": "arcgis desktop, arcmap, legend" }
what is the VB6.FontChangeName alternative in vb.net I have migrated VB6 to VB.Net using wizard tool and below is the one of the property that being migrated. the sprSpread is the far pint spread control reference. Public Property FontName() As String Get FontName = sprSpread.Font.Name End Get Set(ByVal Value As String) sprSpread.Font = VB6.FontChangeName(sprSpread.Font, Value) RaiseEvent FontNameChange() End Set End Property What is the Vb.Net alternative for VB6.FontChangeName
Since the properties of the `Font` class are read-only, when you need to change the property of a font in .NET, you need to create a whole new `Font` object. For instance: ' Create a new font with the same size and style as before, but with a different name sprSpread.Font = New Font(Value, sprSpread.Font.Size, sprSpread.Font.Style)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "vb.net, vb6 migration" }
checking whether mutable list has cycle in ocaml? I'm trying to write a function to test whether a mutable list in Ocaml contains a cycle or not (that is, has a reference to itself and repeats continuously. My list is defined as `type 'a m_list = Nil | Cons of 'a * (('a m_list) ref)`. So far, I have: let is_cyclic list = let rec check xs = match (!xs) with |Nil -> false |Cons(_,v) -> ((!v)==list)||check v in match list with |Nil -> false |Cons(_, x) -> check x ;; but it's not quite right and I'm unsure how to proceed from here...thanks for any help!
There is a cycle in the list as soon as two Cons cells (found at different depths in the list) are the same. Your example code only checks if the first Cons cell appears again down in the list. One way to check for cycles is to remember all the Cons cells you have visited going down the list, and to compare each new cell to all the previous ones. I'm not going to write the entire function, but it may look like this: let rec is_cyclic list already_visited = match list with Nil -> false | Cons(h, { contents = t }) -> if List.memq list already_visited then (* list was traversed before *) ... else ...
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 7, "tags": "ocaml, cyclic" }
AngularJS - Getting the Value from the first column of a row in a table on change event Please see plunker here that demonstrates the issue: I want to display the corresponding English value (first column) for any given row when any of the values are changed. So for example 'Uploaded' should always be displayed in the pop-up when any of the values on the second **row** are changed. I have gotten this far in example, but not quite there: <textarea ng-model="res.Value" ng-change="vm.changed(vm.resourceGridResources.Resources[$index].Resources[0].Value)" style="min-width: 300px"></textarea>
For your exemple. Do not use `$index` but `$parent.$index`. It will refers to the `$index` of the previous `ng-repeat`. <textarea ng-model="res.Value" ng-change="vm.changed(vm.resourceGridResources.Resources[$parent.$index].Resources[0].Value)" style="min-width: 300px"> </textarea> Corrected plunkr
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "angularjs, angularjs ng repeat, angularjs ng change" }
How to make custom TableViewCell with initWithStyle after 3.0 I am trying to have custom TableViewCell with initWithStyle, since it says initWithFrame is deprecated after 3.0. Everything worked fine with initWithFrame before. Is there any tutorials or sample code available for this? Thanks.
I have subclassed UITableViewCell then override the initWithStyle method. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; // Initialization code msgText = [[UILabel alloc] init]; [self.contentView addSubview:msgText]; } return self; } msgText is a UILabel property of the class and I set the text property of the label elsewhere. You can add any views to self.contentView you like. I also set the frame of each of the subviews when I add the content like text and/or images.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 4, "tags": "iphone, iphone sdk 3.0, uitableview, initwithstyle" }
Webkit shadows textarea when tapping on element I'm building an iOS app that uses a webview in one place. When the user taps on an textarea and the keyboard appears the textarea get a shadowing highlight effect and then goes back to normal. Please note that I'm not talking about webkit-appearance och outline, but the shadow that covers the whole textarea being tapped. I'm guessing this is some kind of accessibility feature. Still, it mess up my animation and makes the whole view look like crap. Does anyone know if it's possible to remove this highlight shadow?
You can disable it by setting the css attribute -webkit-tap-highlight-color to rgba(0,0,0,0); But as you mentioned it is a usability feature, so you should not turn it off. ;) See: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ios, css, uiwebview, textarea" }
SQL split only the numeric values from a varchar I have a column with the following values: Column A ------------ 001 TestA 002 TestB 003 TestC Now I want only the numeric values from the Column A like: 001 002 003 Please suggest a solution in SQL
If you can guarantee that there will always be a space character between the numbers and the text then use `CHARINDEX` with `SUBSTRING`: SELECT SUBSTRING( [Column A], 1, CHARINDEX( ' ', [Column A] ) ) AS Digits FROM myTable
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, sql server, tsql" }
Is there way to invoke a lambda function if an amazon s3 object is accessed? I am hosting a javascript file in an amazon s3 bucket . Whenever the .js file is accessed, an event must be invoked and the lambda function must execute? Is there some way to know if an object in the s3 bucket is accessed? Not created but just accessed.
No, this is not one of the available events for Lambda to hook into. You might be able to hook up something using S3 access logging - log the accesses to another bucket, and have a Lambda function process the resulting log files - but it will not be real-time by any stretch of the imagination.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, amazon web services, amazon s3, aws lambda" }
Pagination with Wordpress I just can't seem to get pagination in Wordpress to work... I have tried for weeks to get it going but it seems to be impossible :(. Is it doable, in that case how? this is my Wp_Query: $all_posts = new WP_Query(array( 'posts_per_page' => 3, )); And this is how I output it: if ($all_posts->have_posts()): while ($all_posts->have_posts()) : $all_posts->the_post(); // content rendered here <?php endwhile; ?> <?php endif; ?>
This fantastic article showed the way! <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, wordpress, pagination" }
Javadocs specifying issue number I got a issue, that wants to change functionaly in my java code, issue number for example #41241. **What would be the correct Javadoc comment be to specify issue number, that requests this change?** Just that in future I know, why a certain function or line was changed/created?
I don't write issue numbers into source code. This can get complicated when a method gets changed because of multiple issues... I used to add the issue number to the SVN commit like: _ISSUE-1234: added NPE check_. Eclipse provides the useful feature `Team -> Show Annotations` which shows for each line in which SVN commit it was changed and the commit comment. This adds more benefit as a comment in JavaDoc in my opinion.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "java, comments, javadoc, issue tracking" }
Color typo in underline text Using `soul` package, I try to underline in black a text containing some words. One of the words is colored in grey. \documentclass{article} \usepackage{color} \usepackage{soul} \definecolor{Gray}{gray}{.5} \begin{document} \ul{Hello \textcolor{Gray}{this} is an example} \end{document} Produces the error: "Package soul Error: Reconstruction failed." I tried a dirty solution: \ul{Hello }\textcolor{Gray}{\ul{this}}\ul{ is an example} which doesn't produce error, but underlines my text with a Gray line. I'd like to underline in black. > ![underlineInGray](
Package `soul` can support commands without and with one argument. `\textcolor` uses two arguments, therefore a new command is defined in the following example for `\soulregister`. The different line color can be fixed by setting the color for the line explicitly using `\setulcolor`. \documentclass{article} \usepackage{color} \usepackage{soul} \definecolor{Gray}{gray}{.5} \newcommand*{\ColorGray}{\textcolor{Gray}} \soulregister{\ColorGray}{1} \setulcolor{black} \begin{document} \ul{Hello \ColorGray{this} is an example} \end{document} > ![Result](
stackexchange-tex
{ "answer_score": 5, "question_score": 1, "tags": "color, soul, underline" }
How can I find coefficients a, b, c given two points? Suppose I have two points $A(x_A,y_A)$ and $B(x_B,y_B)$. How can I find coefficients $a, b, c$ of the straight line general equation ? $a x + b y + c = 0$
The answer is $$(y_A-y_B)x-(x_A-x_B)y+x_Ay_B-x_By_A=0.$$
stackexchange-math
{ "answer_score": 3, "question_score": 3, "tags": "geometry, trigonometry" }
How to write a plugin that "listens" every time, an edit occurs? Let's say I want to write a plugin that replaces (i.e.: overwrites) every `src`-tag of every iframe-element on a WP-Website with a custom string AND the plugin shall watch every new post or page-edit whenever a new iframe is inserted, how would I go about it? Is there something like an event-api for WP every time an edit visible on the frontend occurs?
1. Use the "save_post" action hook, which is triggered every time a post or page is created or updated. In the function called by the hook, you can check the post content for new iframes, and if found, replace the src attributes of iframe elements before they are saved to the database. 2. Use the "the_content" filter hook, which allows you to modify the post content before it is displayed on the frontend. In the function called by the filter, you can replace the src attributes of all iframe elements on the website with a custom string. 3. To limit the plugin functionality to certain post types, you can check the post type before making the replacement in both the "save_post" and "the_content" functions. 4. Once the plugin is ready, activate it in the WordPress backend and it will start listening for post and pages changes and replacing the iframe src attributes as per your custom string.
stackexchange-wordpress
{ "answer_score": 2, "question_score": 0, "tags": "plugins, api, events" }
to + present tense use Is it correct to write: "Our family is dedicated to perfecting the art of pizza cooking" Instead of the canonical: "Our family is dedicated to perfect the art of pizza cooking" I think I read the former more often although grammatically the obvious pick is the second one.
Actually, the "to" in "dedicate to" is a verb particle. As such " _Our family is dedicated to ..._ " has nothing to do with the use of the infinitive (to + verb) following the verb dedicate. Instead it has to do with the fact that dedicate is a phrasal verb. So yes, it is correct to use the gerund form (verb + ing) of a verb, as you did with "perfecting," after dedicate to. From my ear, I hear a slightly different meaning though in what they express each of these. > Our family is dedicated to perfecting the art of pizza cooking This sounds like perfecting is a continual process and they will continue doing this until the end of time. > Our family is dedicated to perfect the art of pizza cooking. This sounds to me like you will eventually perfect it and then there will be no more work to do.
stackexchange-english
{ "answer_score": 1, "question_score": 0, "tags": "tenses" }
My query works (100+ results.) How do I insert them into a new table? my attempt: `SELECT * into table_joe FROM table_names WHERE username LIKE '%Joe%'` But this fails saying the new table (table_joe) is an undeclared variable. Thank you!
You need to use `INSERT` here, not `SELECT`: INSERT INTO table_joe SELECT * FROM table_names WHERE username LIKE '%Joe%'; But note that in general it very advisable to _always_ explicitly list out which columns are the target/source in an insert. So, something like the following is better practice: INSERT INTO table_joe (col1, col2, col3) SELECT col1, col2, col3 FROM table_names WHERE username LIKE '%Joe%';
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql" }
add class to @Html.ActionLink How do I add a class to this @Html.ActionLink? I've tried many suggestion and none have worked so far. @Html.ActionLink("Physician Profile", "Print", "Roster", new { profilePrintType = ProfilePrintType.PhysicianProfile}, new { style="padding:2px 10px;" })
for reserved words you have to add @ new { @style="padding:2px 10px;", @class = "className" })
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 3, "tags": "c#, asp.net, asp.net mvc 4" }
Is there a Chrome(ium) alternative for the Firefox "Self-Destructing Cookies" extension? I am huge fan of the Firefox extension < and am looking for something like this for chrome. Note: I am **not** looking for some random cookie deleting/managing extension. I am looking for an extension that allows cookies but immediately deletes them after leaving sites. As close to the mentioned extension as it can be.
Tab Cookies looks like it would fit the bill. From the description: > This extensions deletes all the cookies created in a tab (which are not used by other tabs) when you close the tab. In this way your privacy is guaranteed. > > For example, as long as you stay on gMail, you are logged in, but once you close that tab (and all the others which are or have been on a Google site) the tracking cookies of Google disappear. Same for Facebook, once you close all the tabs which opened Facebook, its cookies disappear, so other sites cannot track you around the web.
stackexchange-superuser
{ "answer_score": 14, "question_score": 19, "tags": "firefox, google chrome, browser addons, google chrome extensions, firefox extensions" }
Using awk to find data matching date range in text file I have a text file with date stamp and temperature values from five sensors and every ten minutes the file is updated with a new row of data. Here is a sample of the data file - cols 1 and 2 are date and time, cols 3 to 7 are temperature values: 31-12 04:40 19.6 20.5 18.3 21.3 12.5 31-12 04:50 19.6 20.4 18.3 21.3 12.7 31-12 05:00 19.5 20.4 18.2 21.2 12.6 31-12 05:10 19.5 20.4 18.2 21.2 12.5 31-12 05:20 19.5 20.4 18.5 21.2 12.1 How can I use awk to extract from the data file those records that pertain to the last 24 hours, last 7 days, last 28 days and last 365 days?
Bad news: Standard `awk` doesn't have date handling capabilities, and date handling is a hit or miss affair for shell scripts. Both GNU and BSD versions of the `date` command can use the date command to check a date, but both use completely different syntax for doing so. If you're using `gawk` or Linux with `awk`, you can try the `mktime` function: date="20141225011522" # December 25, 2014 at 1:15:22 date_in_seconds = mktime( date ) You'll need to do a bit of reformatting with your dates, but once done, you'll get back the date in the number of seconds since _the epoch_ which is usually January 1, 1970. By the way, you need to include examples of what you tried, and the problems you ran into in the code itself, or else your question will be closed.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "linux, bash, date" }
Deleting without copying to clipboard in Windows? Here is a typical workflow I would like to follow: 1. copy some data from Excel spreadsheet into the clipboard 2. in vim , delete the data in the file using `ggdG` 3. then paste the data into the file from the clipboard (I use `CTRL-V` as I am under Windows) This does not work because step 2 copies the deleted data into the clipboard. Is it possible to delete without affecting the clipboard ?
When deleting the buffer contents in Vim, you can send it to the _black hole_ register `"_`. From `:help quote_`: > When writing to this register, nothing happens. This can be used to delete text without affecting the normal registers. So simply use this command in your step 2: gg"_dG Or you can also use the `:delete` command with a range: :%d _ This Ex command deletes every line into the black hole register.
stackexchange-vi
{ "answer_score": 4, "question_score": 2, "tags": "cut copy paste" }
Wordpress: How to remove pages from search results I've got a Wordpress based website and I'd just like to remove pages from search results. Of course I can't just do something like `if( is_page() ) { // don't do anything; }` because it would still count as a result and so it would affect pagination etc... So, maybe some parameter in the search query? But the thing is, the search query is written in the wordpress core so I can just edit it?
If you mean from the internal wordpress search, there are some plugins that allow you to set a page or article as excluded from search result. You could try this one: < If you also wan't to exclude the page from the Search engines, you should also add the url of the page to the robots.txt file in your wordpress folder.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, wordpress, search" }
Programmatically delete Remote Notifications from Notification Centre How can we pragmatically remove any pending remote notifications sent for my app from notification centre. I want to clear them up on app launch. I have tried with `[[UIApplication sharedApplication] cancelAllLocalNotifications];` API but its not helping. PS: This question is specific to iOS 10 and old threads are not duplicates for this one.
Finally... This one works like charm! [[UNUserNotificationCenter currentNotificationCenter] removeAllDeliveredNotifications];
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 4, "tags": "ios, objective c, cocoa touch, apple push notifications, ios10" }
Why is the minimum value of ints, doubles, etc 1 farther from zero than the positive value? I know it has something to do with 2's complement and adding 1, but I don't really get how you can encode one more number with the same amount of bits when it comes to negative numbers.
Think about it in these terms. Take a 2-bit number with a preceding sign: 000 = 0 001 = 1 010 = 2 011 = 3 Now let's have some negatives: 111 = -1 110 = -2 101 = -3 Wait, we also have 100 ... It has to be negative, because the sign-bit is 1. So, logically, it must be -4. (Edit: As WorldEngineer rightly points out, not all numbering systems work this way -- but the ones you're asking about do.)
stackexchange-softwareengineering
{ "answer_score": 16, "question_score": 10, "tags": "java, numbers" }
Is it possible to generate input for parametrize? I have a rather large set of parameters to run through several test cases. I'd prefer to have the set live somewhere else rather than in the parametrize statement, poplulating the parametrize, if possible. This way parametrizing several test case doesn't have duplicate large blocks of test case parameters. If that is not possible is there another way to "share" this parametrization? To avoid having duplicates decorate the affected test cases? import pytest # this data structure has about 20 of these @pytest.mark.parametrize("a, b, c" [('hello' [(1,1), ('abc','abc')],[(1, 2)]....) def test_case_a(a, b, c): # the same data and arguments as test_case_a @pytest.mark.parametrize("a, b, c" [('hello' [(1,1), ('abc','abc')],[(1, 2)]....) def test_case_b(a, b, c):
Just put your shared params in a global variable: **test.py** import pytest SHARED_PARAMS = "a, b, c", [['hello', [(1, 1), ('abc', 'abc')], [(1, 2)]]] @pytest.mark.parametrize(*SHARED_PARAMS) def test_case_a(a, b, c): pass @pytest.mark.parametrize(*SHARED_PARAMS) def test_case_b(a, b, c): pass **Execution results:** $ pytest -v =========================== test session starts ========================= platform linux -- Python 3.7.0, pytest-3.6.2, py-1.5.4, pluggy-0.6.0 -- /home/user/.virtualenvs/test3.7/bin/python3.7 cachedir: .pytest_cache rootdir: /home/user/projects/so, inifile: collected 2 items so/test_api.py::test_case_a[hello-b0-c0] PASSED so/test_api.py::test_case_b[hello-b0-c0] PASSED ======================== 2 passed in 0.01 seconds =======================
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "python, pytest" }
"x Days ago' template filter in Django? I'm looking for a filter that turns a datetime instance into 'x Days' or 'x years y months' format (as on SO). Suggestions? Am I overlooking something very obvious?
Have a look at the timesince template filter. It's builtin. The following returns a humanized diff between now and `comment_date` (e.g. `'8 hours'`): {{ comment_date|timesince }} The following returns a humanized diff between `question_date` and `comment_date`: {{ comment_date|timesince:question_date }}
stackexchange-stackoverflow
{ "answer_score": 36, "question_score": 13, "tags": "python, django" }
Argument to \input or \include statement? I produce a lot of plots in Matlab which I export to TikZ with `matlab2tikz`. In `matlab2tikz` I can specify the plot `width` and `height`, for instance. This works out quite nicely, but as I write my document I see that I should have changed the `width` and `height` to different values for several plots. Now, this is of course something I either could do in the `matlab2tikz` call or directly in the `.tex` file output from `matlab2tikz`. I have quite significant amounts of plots and most of them are created in "automated" procedures, so it would be nice if I could pass an argument to `\input` (or similar) which could manipulate the `width` and/or `height` of the plot. Something like: \input[w=0.4,h=0.2]{plotfile} and have something like this in `plotfile`: \begin{axis}[% width=w\textwidth, height=h\textwidth, ] Is there a solution to this?
How about defining it this way? \newlength{\figurewidth} \newlength{\figureheight} \newcommand{\myinputaux}[2][1]{% \def\myheight{#1} \setlength\figureheight{\myheight\textwidth} \setlength\figurewidth{\mywidth\textwidth} \input{#2}} \newcommand{\myinput}[1][1]{% \def\mywidth{#1} \myinputaux} You would then call this function like this: \myinput[0.4][0.2]{plotfile} % the first optional is the width, the second is the height and execute `matlab2tikz` with matlab2tikz( 'plotfile', 'height', '\figureheight', 'width', '\figurewidth' ); Note that this answer is purely theoretical, based on the readme for `matlab2tikz`. I couldn't test it "for real".
stackexchange-tex
{ "answer_score": 5, "question_score": 6, "tags": "tikz pgf, input, scaling, matlab2tikz" }
Fgets progress - easier way? I read a big text file ~500MB and want to get the progress during my read operations. To do so I now count the lines the files has and then compare it to the ones I already read. This needs two complete iterations over the file. Is there an easier way using the filesize and fgets buffer size? My current code looks like: $lineTotal = 0; while ((fgets($handle)) !== false) { $lineTotal++; } rewind($handle); $linesDone = 0; while (($line = fgets($handle)) !== false) { progressBar($linesDone += 1, $lineTotal); }
Based on bytes rather than lines, but you can quickly get the total size of the file upfront with `filesize`: $bytesTotal = filesize("input.txt") Then, after you've opened the file, you can read each line and then get your current position within the file, something like: progressBar(0, $bytesTotal); while (($line = fgets($handle)) !== false) { doSomethingWith($line, 'presumably'); progressBar(ftell($handle), $bytesTotal); } There are caveats about the fact that PHP integers may not handle files over 2G but, since you specified your files are about 500M, that shouldn't be an immediate problem.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 4, "tags": "php" }
Sending bitcoins with armoryd fails What is the correct process to send bitcoins using only armoryd? I'm using Armory 0.93.3 on MacOs Sierra. I have Bitcoin Core 0.14.1 and another instance of armoryd running and up to date. Here's what I figured out so far: $ ./armoryd getarmorydinfo { ... "versionstr": "0.93.3", ... } $ ./armoryd createustxtoaddress <address> 0.001 0.0001 > test.txt $ cat test.txt =====TXSIGCOLLECT-XxXxXxXx====================================== ... $ ./armoryd walletpassphrase <passphrase> 100 Wallet XXXXXXX has been unlocked. $ ./armoryd signasciitransaction test.txt > test.txt.sig $ cat test.txt.sig =====TXSIGCOLLECT-XxXxXxXx====================================== ... $ ./armoryd sendasciitransaction test.txt.sig xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx However, the transaction doesn't show up on blockexplorers. What am I missing?
In order to use Bitcoin Core 0.14.0+ with Armory, you need to have Armory 0.96. Since you are using Armory 0.93.3, you will need to use Bitcoin Core 0.13.2 or earlier. Also keep in mind the armoryd has not been maintained for the past couple of versions so it may not work if you use Armory 0.94+.
stackexchange-bitcoin
{ "answer_score": 1, "question_score": 1, "tags": "armory" }
How to change Opera's source search highlighting color? Opera offers brilliant incremental search while searching ona website but when it comes to source searching ( `Right button click -> Source -> Search` ) it is not so beautiful. By default : when you search for a word in Source it highlights with nearly transparent grey color which is really hard to distinguish from normal text. Does anyone know how to change this - the highlight color ? P.S. I am using 11.61, build 1250
1. Unpack and open file "skin.ini" from your current skin pack: **opera:config#UserPrefs|ButtonSet** Standard path is C:\Program Files (x86)\Opera\skin\standard_skin.zip\skin.ini 2. Close Opera. 3. In `[Generic]` add `Selected Text bgcolor nofocus = #your hex color` for example #F0FF00 !Example of skin.ini Save and pack it back to standard_skin.zip and launch Opera
stackexchange-superuser
{ "answer_score": 4, "question_score": 4, "tags": "search, opera, source code, highlighting" }
Making operations with a class as an operand possible in C++ I'm fairly familiar with operator overloading, however I am wondering how do we implement something like this: myClass myclassobj; int x; x = 5; x = x + myclassobj There is no way to overload the + operator for the int class, so something should be done from myClass, but how would we do that? I am probably using the wrong keywords, but searching through SO didn't lead to anithing. Apologies if I did something wrong, this is my first post here. Edit - My class is a custom vector class, so simply converting it to given type won't work.
Define an overloaded operator with the signature `int operator+(int, myClass)`.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "c++, class, operator overloading" }
Can't allocate memory, although there's free memory? I have a web server that is behaving strangely lately. To keep things brief, look at the following: [root@xxxxx test]# ls -lah -bash: fork: Cannot allocate memory [root@xxxxx test]# free -m total used free shared buffers cached Mem: 1285 899 386 0 0 0 -/+ buffers/cache: 899 386 Swap: 0 0 0 Now, why would this happen? Any other information I should provide to get help?
You're on a Virtuozzo or OpenVZ PVS (Pseudo-Virtual Server), I see, which makes the concept of "memory" a fairly specious one, at best. Your provider has limited the amount of "overcommitted" memory you can use, which you've bumped up against. That "total memory" number you see in free, by the way, has no relation to reality in a VZ PVS -- the provider can configure VZ to show whatever number they want in there, regardless of what resources have actually been allocated to you. You need to lodge this support request with your provider, as they're the only ones who can help you (we can't see what the configuration for your PVS is, let alone change it), and if you don't get the support you need from them, I'd highly recommend switching to a provider that can give you (a) a proper VPS that actually _has_ the memory available that it says it does (ie. _NOT_ a VZ-based PVS), and (b) proper support for what you've paid for.
stackexchange-serverfault
{ "answer_score": 3, "question_score": 0, "tags": "linux, centos, memory" }
Why does qt-creator need to connect to google-analytics? I just installed `qt-creator` to work on non-qt C++ projects. The installed version is **2.5.0** (Based on Qt 4.8.2 32-bit) If I click on any of these pages: !image showing qt-creator home page links I get this error: !image showing the error I realized that `/etc/hosts` file has the following entry: 127.0.0.1 www.google-analytics.com I don't want to remove the entry from the hosts file because it's always been there along with thousands of other similar adservices/porn/malware addresses. I do not intend to say that `qt-creator` is looking to create problems in my computer, but I am genuinely interested to know why `qt-creator` needs to connect to google-analytics? Can this be disabled and `qt-creator` can still be functional?
It is said by Qt employees that Google Analytics code used to be included in Qt documentation (and pages you are viewing as part of it), but was removed afterwards (source). Try upgrading Qt creator to the most recent version (2.5.2 in repos / 2.6.0 < and see if this solves your problem. Apart from that, I'd say pretty much any IDE tries to collect usage statistics if you allow it to. Check out if this can be configured in Qt Creator.
stackexchange-askubuntu
{ "answer_score": 5, "question_score": 1, "tags": "c++, qt creator" }