INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Creating JRadioButton Matrix I am creating a matrix of JRadioButtons (see image below). What I want to do is allow only one selection per row and column. Is there any way I can possibly assigned two button groups to a single button? Or is there any other suggestions how I may do this? Description: I want the user to select one value from Highest, Normal, Least and Not Available option for Morning, Afternoon and Evening. However, I also want them to limit them to picking only one option from Morning, Afternoon and Evening for Highest, Normal, Least and Not available. So, basically, only one option needs to be selected for each row and only one option for each column, and yes, they can be the same option for the row and column. ![]( Ideas? Suggestions?
You cannot use more than one ButtonGroup for a single JRadioButton. To solve the problem, just check for errors at click button, then display the proper error message if any error encountered. Another smart idea is hiding per click. Handle click event for each one, so that when a radio button is selected its row and column are hidden `setVisible(false)` (or at least disabled `setEnabled(false)`).
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, matrix, jradiobutton" }
Conjugate Gradient guesses on a sequence of linear equation systems? Let us say that we have a sequence of linear problems $${\bf L}_i{\bf x} = {\bf r}_i \,\,\, i \in \\{0,1,\cdots, N\\}$$ Where $\bf L_i \approx L_{i+1}, \bf r_i \approx r_{i+1}$, but $\|{\bf L}_N-{\bf L}_0\|>>0$ and $\|{\bf r}_N-{\bf r}_0\|>>0$ Furthermore assume we have solved $${\bf x}_0 = {{\bf L}_0} ^{-1}{\bf r}_0$$ to some satisfactory accuracy. How can we utilize this knowledge in solving ${\bf x}_i, \forall i >0$ Is there some way to estimate how many iterations of C-G we will need to run to solve these if we start the algorithm guessing that ${\bf x}_{k+1} = {\bf x}_{k}$?
The recycling Krylov subspace approach is one option to handle these situations. See SISC paper or webpage
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "linear algebra, matrices, optimization, numerical methods, numerical linear algebra" }
Arial for commercial use I'm creating a streetwear brand and I was wondering if I can use the font Arial on my t-shirts. I can't find much about its commercial use. Can somebody help me here?
See this: < This Microsoft's publication covers your case if you asked about that Arial which is shipped with Windows. It says that you can well create commercial products which are printed or otherwise outputted as long as you do not try to include font files itself. There is a special clause for embedding font files to a document file, but wearable clothes are not such documents (It says that those document files must be made with certain allowed programs such as Word, which render the embedded fonts unusable for other purposes) There's some things which are explicitly forbidden * distributing font files * designing or generating commercial products with home- or student versions of software * uploading font files to websites or converting them to web-font formats The last limitation prevents for example use in online designing applications. For them one must purchase Arial version which is licensed for web usage.
stackexchange-graphicdesign
{ "answer_score": 2, "question_score": 1, "tags": "font licensing" }
Load own script on client's site Im trying to build some kind of an API in javascript. Basically, I want the client to include a script on his page and that script will load jquery, colorbox and execute a custom function which, for now, will just display a colorbox popup with a message. Of course, the script that the client includes on his page will be hosted by me. How should this script look like in order to achieve all of the above?
something like this var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'link to your script here'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); from How to Append <script></script> in javascript?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "javascript, jquery, xss" }
Advice on Patch Panels We are thinking of getting a switch for our data center that blows air from the ports to the power plugs. However, we use a hot-aisle and cold-aisle layout. Our other switches blow in the opposite direction. In order to avoid fishing cables through the rack, I was thinking of purchasing two patch panels. One patch panel would face the hot aisle and the other would face the cold aisle. The switch's ports would face the cold aisle. Port 1 on one patch panel would connect to Port 1 on the other; Port 2 would connect to Port 2, and so on. Then, we would use short jumper cables from the patch panel to the switch in the cold aisle. In the hot aisle, we would run cables from the back of the servers to the patch panel in the hot aisle. What do you folks think? Is this a silly or bizarre way to do things or is it probably our best bet to keep the cabling tidy and manageable? If not, is there a better way? Thanks.
With gigabit, I'd definitely suggest you stick with something purely mechanical for cable management. Good patch panels and interconnects are more expensive than you might think, and it sounds like you have quite a few racks. Even if they are highest quality, from a failure rate point of view, you're replacing 1 cable, 2 crimps, 2 RJ-45 matings with 3 cables, 4 crimps, 2 punchdowns and 4 RJ-45 matings, on every ethernet connection. You might consider custom laser-cut plastic cable guides, which are easily made by your local laser-cutter shop, and which can be arranged to exactly suit your cable layout. I've no idea your details of course, but I've made things like this for similar problems: ![enter image description here](
stackexchange-networkengineering
{ "answer_score": 3, "question_score": 2, "tags": "cabling" }
Terminal Shell Doesn't Work A few days ago my shell in the terminal just wouldn't load. I had to use Visual Studio Code's terminal to do everything. I tried shutting Linux down. I had tried this, nevertheless it didn't work. Thanks in advance. If you need any further information, please tell me.
Turns out there was a update and that was what was preventing the Shell from loading.
stackexchange-askubuntu
{ "answer_score": 0, "question_score": 0, "tags": "command line" }
How to get the product of one and every third integer that is less than a given limit starting with 3 - EXCEPT those divisible by 5 If the limit be 21. The output should be 18*12*9*6*3*1. This is what I got so far. public double sumEveryThird(int limit) { double product = 1.0; for(int n = 3;n < limit;) { if(n%5 != 0) { product = product*n; } n = n+3; } return product; }
Here’s a method that I believe does what you want. public double findProduct(int limit) { double product = 1; for(int n = 3; n < limit; n = n + 3) { if (n%5 != 0) { product = product * n; } } return product; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "java, for loop" }
Kurento Media Server events to indicate video faults I am using KMS for video security application, that has to work 24/7. Currently the behavior is unstable and video is freezing periodically. I am looking for a way to indicate this problematic behavior. I can't find find any example of using KMS events for this type of issues. Could someone please point me out to a code snippet or to any info describing a way to indicate video faults like (bad quality, freezing etc.) Any help will be appreciated!
There are no particular events for that, except in case media stops flowing. However, you can use the `getStats` method from one particular endpoint, and check for different WebRTC statistics that will inform you about the quality of the media. In any case, that behaviour is quite odd, and you should check under which circumstances it is produced, just in case you are reaching the limits of your box or your network. Also, please use the latest version of the media server (6.5.1 as of now)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "kurento" }
Is this Python code equivalent of Java code? I'm fairly new to Python so please bear with me. This is the Java code: public static int countDeafRats(final String town) { String t = town.replaceAll(" ",""); int count = 0; for (int i = 0 ; i < t.length() ; i+=2) if (t.charAt(i) == 'O') count++; return count; } This is my attempt to translate it to Python: def count_deaf_rats(town): count = 0 increment = 0 newTown = town.replace(" ", "") while increment <= len(newTown): if newTown[increment]=='O': count +=1 increment +=2 return count I didn't use for loop in Python since I don't how to increment by 2, so as the title says, would this be an acceptable translation? Edit, sample input: `~O~O~O~OP~O~OO~`
It appears that you are trying to find the number of zeroes in the string that occur at indices incremented by 2. You can use regex and list comprehensions in Python: import re new_town = re.sub("\s+", '', town) count = sum(i == "0" for i in new_town[::2])
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "java, python" }
You are taking too long "What is taking her so long?" We normally say that when we have been waiting a person for a long time. Context: My son has been waiting his mother for a long time in car. When my wife went in car. My son told my wife. "You are taking too long." Does the phrase above can be use?
> "You are taking too long." Yes, "taking too long" and variations like "taking a while" and "taking a bit" are common expressions in English. > Does the phrase above can be use? "Can the phrase above be used?" or "Can the phrase above be of use?"
stackexchange-ell
{ "answer_score": 2, "question_score": 1, "tags": "grammar" }
Как вывести в консоль каждый элемент массива раз в секунду? Добрый день подскажите пожалуйста как мне вывести каждый элемент массива раз в секунду let a = [1, 2, 3, 4, 5] a.forEach(el => { setTimeout(() => { console.log(el) }, 1000) }) данный код выводит все элементы массива разом через секунду, а мне надо чтобы он выводил по очереди каждую секунду, как это можно сделать ?
let a = [1, 2, 3, 4, 5] a.forEach((el, i) => { setTimeout(() => { console.log(el) }, (i + 1) * 1000) })
stackexchange-ru_stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "javascript, ecmascript 6" }
Union of Cosets as a Subgroup Let $H$ be a proper subgroup of finite group $G$ such that $p.|H|<|G|$. Let $x\in G\setminus H$ be an element of order $p$. Under what conditions, the set $H\langle x\rangle = H\cup Hx\cup \cdots Hx^{p-1}$ becomes a subgroup of $G$? * * * (I know that for $H,K\leq G$, $HK$ is subgroup of $G$ if and only if $HK=KH$, and also that if one of the subgroups $H$ and $\langle x\rangle$ is normalized by other, then $H\langle x\rangle$ is subgroup. Any other criteria for proving subgroup?)
This is so called Zappa-Szép product (or Zappa-Szép product) of groups. There is a lot of paper in this topic. Start with Wikipedia.
stackexchange-math
{ "answer_score": 0, "question_score": 3, "tags": "group theory, finite groups" }
If Statement for Android TextView Message Display How do I create an `if` statement for the Android `setText()` command? For example, if I have something like: Button button = (Button) findViewById(R.id.button); TextView messageBox = (TextView)findViewById(R.id.message); phrase[0] = "Hello World!"; // phrase[1] = "Toast"; // array is declared earlier in code Random r = new Random(); int n = r.nextInt(1); messageBox.setText(phrase[n]); if(/*condition when phrase[1] is displayed in messageBox*/){ // do stuff } The idea is that I want to structure an `if` statement that monitors when a certain message is displayed in my `messageBox` object.
Try this: Button button = (Button) findViewById(R.id.button); TextView messageBox = (TextView)findViewById(R.id.message); phrase[0] = "Hello World!"; // phrase[1] = "Toast"; // array is declared earlier in code Random r = new Random(); int n = r.nextInt(1); messageBox.setText(phrase[0]); if(messageBox.getText().toString().equals("Toast")){ // do stuff }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "java, android, if statement, textview, settext" }
How to import fonts with pure JS? I need to complete a site without using **CSS** at all. Every thing goes right but i don't know how to change my **font-family** with pure **JS**. Does anyone know how it is possible to import fonts using **JS** only? Thanks!
I would suggest using Google's Webfontloader, it's incredibly simple to use: WebFont.load({ google: { families: ['Droid Sans', 'Droid Serif'] } }); Which would allow you to use the massive web font library hosted by google here, without needing to explicitly specify the CSS. You can use custom fonts as well if you're willing to use a style tag or a .css file (or you can inject the @font-face via javascript.) There are other web font providers that work with the Webfontloader, just look on the github page. If you're interested in learning how to do this manually in javascript, any query on injecting CSS via javascript will sort you, but, that's still technically using CSS. Not sure if this/that is what you want.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 11, "tags": "javascript, fonts" }
ORA-01407:cannot update to null My sql query for updating column "p1_high_edu_ctry" is:- update ps_personal_data J set (J.p1_high_edu_ctry) = (SELECT P.p1_high_edu_ctry FROM PS_PERS_DATA_EFFDT P WHERE P.EFFDT=(SELECT MAX(K.EFFDT) FROM PS_PERS_DATA_EFFDT K WHERE K.EFFDT<=SYSDATE AND J.EMPLID IN(SELECT H.EMPLID FROM PS_AUDIT_PER_EFFDT H where h.AUDIT_OPRID='CHGH00000063232'))) where exists(select 1 from PS_AUDIT_PER_EFFDT q where q.emplid=j.emplid) ; but i m getting an error msg while updating:- ERROR at line 2: ORA-01407: cannot update ("SYSADM"."PS_PERSONAL_DATA"."P1_HIGH_EDU_CTRY") to NULL Any suggestions please,why its not working even if i am handling it with where exists???
Try this MERGE INTO ps_personal_data J USING ( SELECT P.p1_high_edu_ctry, p.emplid FROM PS_PERS_DATA_EFFDT P WHERE P.EFFDT= ( SELECT MAX(K.EFFDT) FROM PS_PERS_DATA_EFFDT K WHERE K.EFFDT<=SYSDATE AND P.EMPLID = K.EMPLID -- updated this condition , -- you need to check max date by emplid -- not max date from full table ) AND P.EMPLID IN (SELECT H.EMPLID FROM PS_AUDIT_PER_EFFDT H where h.AUDIT_OPRID='CHGH00000063232') ) v ON (J.emplid = v.emplid) WHEN MATCHED THEN UPDATE set J.p1_high_edu_ctry = nvl(v.p1_high_edu_ctry,' ');
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "oracle" }
Where are webaccess dll in tfs2010 ? (WebAccessUserControl) We have created a plugin for webaccess 2008. The problem is that we are trying to upgrade our version with the one use with tfs2010 but we cannot find the dll that we were using Microsoft.TeamFoundation.Webaccess. Can anybody help us on that ? I check documentation on google and on msdn but a cannot find anything useful ...
The Dll was in the gac but i did not know that we can copy it directly from the GAC when in command prompt. <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, dll, tfs" }
Is Kaivalya only way for Soul to go back to it's original nature of infinity? We have four types of Moksha - Salokya, Sarupya Samipya and finally Kaivalya. Even in Yoga tattva upanishad - Lord Vishnu talks about Kaivalya Moksha is the way to be free from influence of Maya. So my question is this: Does Kaivalya Moksha alone grant the soul to become absorbed in Parabrahman? Then what about other Mokshas? If that's the case, Is there a chance of falling to this world again in other Mokshas?
Yes among the various kinds of liberation viz- SAlokya, SArshti, SAyujya etc only Kaivalya (also known as NIrvAna Mukti) is eternal in nature. In this context the Tantrik compendium "ShAktAnanda Tarangini" quotes the following verse in the 16th Chapter of the text: > SakAmAnAm sAyujyAdi muktih sAyujyam na parA muktih sharira samvandhAt | > AkAmAnAm nirvAnameva muktih parama purushArthatvAt || "Na cha punarAvartate " --- Iti sruteh || > > > > > The Mukti that desirous persons (sakAma) get are Sayujya etc. SAyujya is not the eternal or highest form of liberation. Because, [in it] association with the body is still there. The desireless persons (NishkAma) get NirvAna Mukti. Which is the highest goal and even in Sruti it is stated - [He or the liberated being] does not return. So, the highest form of Mukti, after attaining which one does not return, is not SAyujya and other forms of liberation. It is only the Kaivalya or the NirvAna Mukti.
stackexchange-hinduism
{ "answer_score": 5, "question_score": 7, "tags": "moksha, kaivalya" }
add a second value to a key (dict) python I need to make sure I don't have more than one of the same keys, if so, leave the first one and add their value (make it a list) to the existing key this is what I tried: my_dict = {1: "A", 2: "B", 1: "C"} new_dict={} list_keys = list(my_dict.keys()) list_values = list(my_dict.values()) for i in range(len(list_values)): if list_keys[i] in new_dict.keys(): new_dict[list_keys[i]].append(list(list_values[i])) else: new_dict.update({list_keys[i]: list_values[i]}) return new_dict The result required: {1: ["A", "C"], 2: ["B"]}
The most concise way of reversing a `dict` like that uses a `defaultdict`: from collections import defaultdict d = {"A": 1, "B": 2, "C": 1} rev = defaultdict(list) for k, v in d.items(): rev[v].append(k) rev # defaultdict(<class 'list'>, {1: ['A', 'C'], 2: ['B']})
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "python, dictionary" }
Azure webapp startup script for PHP application I want to run composer update script for my PHP application hosted on Azure webapp. How can I include a startup shell script which can perform startup tasks in Azure webapp?
You could go with the available Composer Extensions for Azure Websites. As far as i know it will run composer on deployment or via the Kudu Console of your Application. Azure Composer
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, azure, azure web app service" }
Where is the source code for the UIComponent in FLEX 4.5? All the methods in UIComponent, LayoutManager (and I suppose more) are unimplemented. Why? and how to find it? I use the lastest version of flashDeveloper. The flex package is downloaded by the app itself, and I saw is version 4.5
FlashDevelop has a keyboard shortcut that will take you to the class definition. I think it's something like F4, but I don't use it on a daily basis. UIComponent has a lot of unimplemented methods because it's sort of like a smucky abstract class-ish thing.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "actionscript 3, flex4.5" }
GIT commit both to cloned repo (with new remote) and to the original repo Not sure if the subject is comprehensible - let me clarify: * I have a new project (call it "child") cloned from another project of mine (call it "master"); so now I have two repos, each with different remotes; * now I'd like to commit and push from the "child" to its remote, but also I'd like to push only certain modification to the "master" remote - and vice versa. What's the best solution to get this? (Maybe it has to do with upstream functionality?)
I would add both remotes to the child project (`git remote add upstream <url>`). When you want to add something from child to upstream, I'd branch out from upstream/master. If these changes are already in the child repo, you can cherry-pick them into the new branch. Then push this branch and merge it into upstream's master.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "git" }
Get content from unstyled xml page Hi i have an unstyled xml page that i need to get content from the un styled page has the content bellow <videourls vid1="rtsp://site.stream" vid2="rtsp://site.stream" /> this is the only content in the page how can i get the url in vid2? i have tried to use curl to get the page and html dom but all are showing me blank wen i try and echo out i have all so tried simplexml but just cant get it or get it to work could anyone help with this a friend of mines said to try to set the header to xml and use a cahed copy to get but i tried gooling for this kind of thing and couldnt find it and got a bit confused
<?php $content = '<videourls vid1="rtsp://site.stream1" vid2="rtsp://site.stream2" />'; $doc = new DOMDocument(); $doc->loadHTML($content); $tags = $doc->getElementsByTagName('videourls'); foreach ($tags as $tag) { echo $tag->getAttribute('vid2'); }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, xml, dom" }
How to refresh iCloud after some changes in iTunes I use iCloud to sync music files. On my Mac, I changed some song information such as genre or artist name. How can I sync the changes on my Mac's iTunes with iCloud so that all my iPad and iPhone iTunes have the same change?
As far as I know these changes should be applied automatically. If not, try Store -> "Update iTunes Match" to apply the changes. You can also use "Add to iCloud" for songs which haven't been matched before.
stackexchange-apple
{ "answer_score": 1, "question_score": 1, "tags": "itunes, icloud" }
How to get redirect status in puppeteer? I'm trying write Jest test using puppeteer describe('Downloads', () => { it(`should refirect to download page for ios`, async () => { await page.setUserAgent('exotic'); let response = await page.goto(` {waitUntil: "networkidle0"}); let url = page.url(); expect(response.status()).toBe(303); expect(url).toBe(` }); }); But response status is `200` because `goto` return response for ` How to get redirect status code?
You can use the `request.redirectChain()` for this. It returns an array with all requests. You can then access the first request (and response) like this: const response = await page.goto('...'); const chain = response.request().redirectChain(); const redirectRequest = chain[0]; const redirectResponse = await redirectRequest.response(); expect(redirectResponse.status()).toBe(303); expect(redirectResponse.url()).toBe('...');
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "jestjs, puppeteer" }
How to output a List of numbers in odd and even? C# I might be way off base here but this code on the MS site doesn't work for me when I modified it a little. Sorry its almost 2am. What variable should the int be? The program crashes stating "Specified cast is not valid." ArrayList OddEven = new ArrayList(); foreach (int i in lbList.Items) OddEven.Add(i); foreach (int i in OddEven) { if (i % 2 == 0) lbEven.Items.Add(i); else lbOdd.Items.Add(i); }
`lbList.Items` are probably `strings` and an implicit cast to `int` doesn't exist. Try this: ArrayList OddEven = new ArrayList(); foreach (var i in lbList.Items) OddEven.Add(int.Parse(i.ToString())); foreach (int i in OddEven) { if (i % 2 == 0) lbEven.Items.Add(i); else lbOdd.Items.Add(i); }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "c#, arrays" }
need help applying filter to php echo I created a custom post type in Wordpress. The visual editor shows paragraph breaks, but when viewing the post these breaks disappear, unlike in regular posts. This is my content code in the single-custompostype.php file: <?php echo $content = get_the_content(); ?> I read that I should add this to it: $content = apply_filters("the_content",$post->post_content); But when I add it like so, there's no effect: <?php $content = apply_filters("the_content",$post->post_content); echo $content = get_the_content(); ?> What should I be doing differently?
Does the following solve it for you? It seems like you are getting `$content` right, then overwrite it... <?php $content = apply_filters("the_content",$post->post_content); echo $content; ?>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, wordpress" }
Where to store php file on mysql server for android app I'm writing an Android app. Now i want to connect to a database, so i found some old computer which will function as server. I installed MySQL server and Workbench on it. And ofcourse created my database. I'm searching the whole web for how to write a php webservice, so that's not the problem. But i can't find any explanation of where i have to store the php file on my server computer. So can anyone help me with this and explain where i have to store/put the php webservice file? Thanks in advance, Geert
You need a webserver (e.g. Apache) that will listen to requests from browsers and will send to it a requested files. That's needed for downloading such files as HTML or JPG. When you want to write a PHP webservice, you need also a PHP module which will **interpret** the text in .php file, run it and send its output to a user (instead of sending to a user the contents of a .php file). Probably WAMP / LAMP will be the best pack including all you need.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "web services" }
Debug Assertion Failed Using Scanf I'm working on a school project and I have to use the values A and B as ints as well as use %d and %c with scanf. I have to use scanf with disable 4996 to get input however it keeps triggering a debug assertion error and I can't figure it out. #pragma warning(disable:4996) #include <stdio.h> #include <conio.h> int main() { int a = 0; int b = 0; printf("enter first value: "); scanf("%c", a); printf("\nenter second value: "); scanf("%d", b); printf("%d%d",a,b); _getch(); return 0; }
`scanf()` expects to be given the address of the variables it should write to: scanf("%d", &a); ^^ > I have to use the values A and B as ints as well as use %d and %c with scanf. You cannot use `%c` with an integer since the format string must match the output parameters in type. ## Standard advice: Don't use `scanf()` in C++.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "c++, debugging, assertion" }
Is it safe to keep all of our php functions in 1 files and then include it in all the other files? I am creating a PHP website and it contains several sections, I was wondering is it safe to keep all of my functions in 1 file and then **include it in every other file**? It would certainly make things easier for me but do you think it's a good idea? In both **security** aspects and **speed**. Because if I keep all my functions in a single page it would definitely become quite big, and I wouldn't be needing a lot of them in a lot of pages, so, wouldn't it affect my script's speed? And do you think it's wise to keep all of them together? Aren't I just making it easier for hackers to find the core of my script? What do you suggest I should do?
Big, long functions files were (and still are, to an extent) pretty common in PHP projects. Security of all files should certainly be a consideration, but a single functions file is no different from any other, really. Best practice is to keep it outside of your web root so that if PHP fails (it happens), your file still won't be accessible. If the server gets hacked, the location and format of your files is unlikely to make any difference. Modern frameworks typically include hundreds of different files on every page load. The extra time this takes is barely measurable and probably not worth thinking about. For maintainability, it's rarely a good idea to have one massive file. You should look at separating these into utility classes and autoload them as needed.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, security, include" }
Adding a 'search tips' link next to the search button in a views-based search I'm using a Drupal 7 views-based search. I have a search button in there of course. I'd like to add a link next to it called 'search tips' that goes to a 'basic page'. Anyone know how to add a link there? This is the code I have so far: <?php /* * Implementation of hook_form_alter() */ function search_tips_link_form_alter(&$form, &$form_state, $form_id) { if($form_id == "views_exposed_form") { // there's a submit button in here I'd like to add a link after that... // not sure how to place a link with this function. } }
You need to: 1. Find the specific view exposed form by using the **#id** array key. 2. Find for the search button array key. 3. Use the #suffix form key to append your link. A helpful tool to look into the array structure is by using the dsm() function from Devel module. Additional information for best practice is that use the l() function to structure your link. So it would look something like: if ($form['#id'] == 'views-exposed-form-test-page') { $form['submit']['#suffix'] = l(t('Search tips'), 'link-to-basic-page'); }
stackexchange-drupal
{ "answer_score": 1, "question_score": 0, "tags": "views" }
How to add Image icon on certain buttons? I am making a board game and I need to put the player 1 and player 2 pieces on grid of buttons. I am using a image icon to represent the piece which I want to put it on buttons. The problem is that I have a loop of buttons, and I need to put piece1 on buttons 1,3,5,7,9 and piece2 on buttons 2,4,6,8,10.
for(int i=0;i<30;i++){ buttons[i] = new JButton("label"+ i); buttons[i].setBackground(Color.white); if (i < 10) { if (i%2 == 0) { buttons[i].setIcon(piece2); } else { buttons[i].setIcon(piece1); } } panel.add(buttons[i]); }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "java, swing, jbutton, imageicon" }
Product in undercategory It is probably a trivial question. But I don't see the answer (and I didn't find anywhere). Given a (complete and cocomplete) category X and an object A of X, we can define the "undercategory" A/X. See < I have already noticed that the coproduct of a set {i_l: A to X} is the "natural injection" of A in the colimit of the obvious diagram defined by the set. I'm trying to understand how the product in A/X looks like, in terms of colimits, limits, products or coproducts of X. I appreciate any help. Thank you very much!
For a family of objects $A \to B_i$ in $A/X$, their coproduct is usually called the _pushout_ of the morphisms $A \to B_i$ in $C$. It represents the functor $X \to \mathrm{Set}$, which maps $P$ to the set of families of morphisms $B_i \to P$ which "coincide" on $A$. Pushouts in $X$ may be constructed via coproducts and coequalizers in $X$. The idea is to take $\coprod_i B_i$ and then identify $A \to B_i$ with $A \to B_j$. The products in $A/X$ are more easy: The forgetful functor $A/X \to X$ preserves (also creates) them. This means that for a family of objects $f_i : A \to B_i$ the product is given by $f : A \to \prod_i B_i$, where $f$ is defined by $\mathrm{pr}_i f = f_i$.
stackexchange-mathoverflow_net_7z
{ "answer_score": 5, "question_score": 1, "tags": "ct.category theory" }
Dynamic variables in angular2 / javascript I have multiple download buttons on a page, with a progress bar for each download: <progress-bar *ngIf="progressbar" [progress]="loadProgress_id1"></progress-bar> <progress-bar *ngIf="progressbar" [progress]="loadProgress_id2"></progress-bar> ... I have a function that sets the progress: setpercentage(perc,id) { this.loadProgress_+id = Math.round(perc); // --> how could I do this? this.ref.detectChanges(); } What I've tried (the above) doesn't work. How could I achieve this? Or should I use a different approach?
try this setpercentage(perc,id) { this['loadProgress_' + id] = .... } or setpercentage(perc,id) { const prop = 'loadProgress_' + id; this[prop] = ... }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "javascript, angular" }
Submitting one form to multiple controllers I have a form in which some fields must be submitted to one controller and other fields to another controller. There is also some overlap. I need to submit these fields via an ajax call(s). What's the best way to do this in Spring 3 MVC?
1. Gather the data with javascript (jquery). Do that by id / name, regardless of the fact they are in on form. 2. Make two separate ajax requests to two different urls, mapping two different methods
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, forms, spring mvc" }
Couldn't view individual post that were in my website I had done my first post in wordpress but i couldn't view. It is shown in posts, but when I click the post title it shows ![This is the screenshot of the error.]( What can I do to resolve it?
While installing wordpress, I had selected it as a multisite and due to this, the posted articles weren't shown in the individual post page. I tried reinstalling wordpress and now everything is working fine.
stackexchange-wordpress
{ "answer_score": 0, "question_score": 0, "tags": "posts" }
Problem with text write on inkscape and put on Microsoft-Word ### Here's the explainations of the problem... Not many words are needed because it is quite visible. Image | Location ---|--- ![Img on inkscape]( | I wrote a small text attached to the image in **INKSCAPE**. ![Img on inkscape]( | As you can see, however, the result in **WORD** is this ... I've tried `text>convert to text` but doesn't work. The file I'm trying to put in word is in SVG format. With `PDf` type ![Pdf format]( **How can i solve?** > I'm a newbie please be gentle
### Then I Solved * * * I changed my file from Svg to WMF and the format works better, just as it should. ![Finally]( Thanks for helps WMF File are...
stackexchange-graphicdesign
{ "answer_score": 3, "question_score": 2, "tags": "inkscape, text, microsoft word" }
Capistrano 3: use server custom variable in task I have multi-stage multi-server setup and in my task I need to use server name e.g. in stagin.rb I have: set :stage, :staging # Define servers server 'xxx.xx.xx.xxx', user: 'deploy', roles: %w{app}, name: 'app1' server 'xxx.xx.xx.yyy', user: 'deploy', roles: %w{app}, name: 'app2' and I want to use that "name" variable in my task: task :configure do on roles(:app), in: :parallel do # how do I get server name here? end end
If you want to return the hostname / IP, then it will be task :configure do on roles(:app), in: :parallel do |server| p server.hostname # server hostname should be in here end end If you would like to access custom properties, like `:name` in this particular case, they are stored in the `properties` hash of the `server` configuration object: just use `server.properties.name` instead of `server.hostname`.
stackexchange-stackoverflow
{ "answer_score": 16, "question_score": 10, "tags": "ruby, capistrano, capistrano3" }
Menu item icons no longer display on Android Emulator As the title says, my menu items no longer have their icons in the Android emulator. I am developing with API 16 and recently downloaded an update that became available for the SDK and the ARM image. Even after removing and reinstalling the whole Android SDK, the issue persists. I know that it isn't my own code because I reverted to a known version and it also has the same issue. The same version runs on an actual device as expected. I also previously ran the app on the emulator using API 7 and the icons appear just fine. Does anyone know if this is a known issue with the recent update? Screenshot: !enter image description here Previously, the menu items all appeared in a row at the bottom with icons above the text.
> As the title says, my menu items no longer have their icons in the Android emulator. This is the way the overflow appears on Android 4.0+, for devices and emulators with an off-screen MENU button. > Even after removing and reinstalling the whole Android SDK, the issue persists. It will persist on the tens of millions of Android 4.x devices as well, or at least those that have a MENU button. Devices sans MENU button will have a similar-looking drop-down menu, emanating from the ... affordance on the right side of their action bar. > The same version runs on an actual device as expected. That actual device is not running Android 4.x, presumably. > Does anyone know if this is a known issue with the recent update? If by "recent update" you mean the nearly-year-old release of Android 4.0, then yes.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "android, menu, icons, updates" }
Trailing slash in a raw string Just a quick silly question. How do I write a trailing slash in a raw string literal? r = r'abc\' # syntax error r = r'abc\\' # two slashes: "abc\\"
You can't. A raw string literal can't end with an odd number of backslashes (langref; last paragraph of that section). You can, howerver, write a raw string literal without the backslash, and write the final backslash as an ordinary string literal: r = r'abc' '\\' Adjacent string literals are implicitly concatenated by the parser.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 6, "tags": "python, syntax" }
php string with multiple delimiters to table Hello can you help me get this String $string ="High School#Church Divinity School of the Pacific#1989 | University of California#1992 | University#California State University, Long Beach#1999"; to table (echo): High School Church Divinity School of the Pacific 1989 * * * University of California 1992 * * * University California State University, Long Beach 1999 * * * I already used array, explode and preg_split but i need help. Thanks!
Try: <?php $string ="High School#Church Divinity School of the Pacific#1989 | University of California#1992 | University#California State University, Long Beach#1999"; $string = str_replace(array('#', '|'), array('<br />', '<hr />'), $string); echo $string; ?> **CodePad** : <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "php, string, delimiter" }
AngularJS directive calling a callback function I'm trying make a dropdownlist directive, and I want it to have an attribute like `onItemSelected="myCallbackFunction(selectedItem)"`, how can I do it? Can someone provide an example?
You can use the `&` binding (Isolate Scope Function Expression Binding) .directive("sample", [function() { return { restrict: "A", scope: { myFunc: "&" }, link: function(scope, elem, attrs) { scope.myFunc(); //whenever you wanna call it } } }]) And the HTML <div sample my-func="someScopeFunction()"></div> Id recommend reading: < for directive binding explanations.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "angularjs" }
Remove duplicate rows from pyspark dataframe which have same value but in different column I want to remove duplicate rows from two columns. Rows which contain two values has same records but are in reverse order. |--------------|-------------------| | name | alt_name | |----------------------------------| | a10.samsung | a20.samsung | | x.iphone | xr.iphone | | 3.nokia | 5.nokia | | a20.samsung | a10.samsung | | 5.nokia | 3.nokia | | xr.iphone | x.iphone | ------------------------------------ I want following output; |--------------|-------------------| | name | alt_name | |----------------------------------| | 3.nokia | 5.nokia | | a10.samsung | a20.samsung | | x.iphone | xr.iphone | ------------------------------------
You can do it using spark sql: I assume your original dataframe name as mobiles and code to remove duplicates: mobiles.createTempView('tablename') newDF= spark.sql("select * from tablename where name<=alt_name") newDF.show()
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "pyspark" }
Open file in a specific folder I want to open a file located in "C:/Abaqus_JOBS/Reliability/Job-M1/input_files". My code looks like: character :: JobName, JobDir, JobInpFol JobName="Job-M1" JobDir="/Reliability/" // JobName JobInpFol=JobDir // "/input_files/" OPEN(20, FILE="C:/Abaqus_JOBS" // JobInpFol // 1 "failureUEL.txt", action="write",status="replace") However fortran opens the file in "C:/Abaqus_JOBS".
If that is your code, then `JobName`, `JobDir`, and `JobInpFol` are all characters with length 1 (you can test this by adding `print *,len(JobName), len(JobDir), len(JobInpFol)` in your code. So your open line is really seeing the `/` in `"/Reliability/"`. You want something like `character(len=30) :: JobName, JobDir, JobInpFol` and then use `trim(adjustl(JobName))` to eliminate white spaces.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "file io, path, fortran" }
Creating websites with Node.js Hello I am wondering where to start on making websites width node.js. I did the hello world tutorial and have a working http server. But my question is if it is possible to run javascript server-side for lets say an onclick event? of how to put css in the webpage. Thanks Mkaveli
Eventhough you have javascript running on your server, events like onClick are still clientside. Just because the server-side language is javascript doesnt mean you have control over client-side events. If you want actions to happen on the server at an onclick event, consider making the element a regular anchor, or use AJAX to make a call directly to the server.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "javascript, html, css, http, node.js" }
CentOS 5.5 - services start Can I know if my service is started on system init or it started by user using service command? On my service I need to make different logic (into service starter script) if service is started automatically or by user command. Thanks
if the users use sudo or they su root i don't think is a way you can tell, but i think you can do this: add a command that looks for server uptime - if the uptime is very very low as in is just starting then you can ASSUME that is server startup and you do the logic around it. uptime | awk '{print $3}' # prints the minutes since the host is up
stackexchange-serverfault
{ "answer_score": 0, "question_score": 0, "tags": "centos, service, start" }
Meaning of "Be Mr Late Better Than Late Mr" Not long ago I found on the Internet a lot of different road signs from India. Here is one of them: !Be Mr Late Better Than Late Mr It says: "Be Mr Late Better Than Late Mr". I can't understand the meaning of this phrase. I understand that it's some word play but can't catch the idea. Can you explain this to me?
It is a road sign that is meant to implore drivers to slow down. In this case, being "Mr. Late" means that you are habitually late. In other words, you are late so often that it may as well be your name. Being "late Mr." means that you are dead. For example, someone might refer to "the late Mr. Smith" if they were talking about someone named Smith who died recently. (see definition 2a here: _living comparatively recently : now deceased_ ) So, all together, the phrase is advising you that it is better to be late, even if it means you are known as that guy who is always late, than it is to speed and risk getting killed in an accident. So that you can see it in context, here is a photo of another road sign with a similar expression: !road sign (from the flikcr of henrikj, CC by attribution)
stackexchange-english
{ "answer_score": 22, "question_score": 17, "tags": "meaning, signage" }
Question regarding Schrödinger's equation Here is my understanding of Schrödinger's equation and wave functions: (I'm considering the time independent equation.) > The equation takes in values of energy as an input and, being a differential equation, gives functions as outputs. These functions correspond to the different orbitals. > > When we input coordinate values we get an answer that we can use to plot the probability distribution of an electron around the nucleus. Can someone tell me if my understanding is correct, and correct me if I'm wrong?
To solve the Schrodinger equation for a system like a hydrogen atom we need to know: 1. the potential energy function 2. the boundary conditions The potential energy $V$ goes into the (time independant) Schrodinger equation: $$ \left(-\frac{\hbar^2}{2m}\nabla^2 + V \right) \Psi = E\Psi $$ but this alone isn't enough to tell us what the wavefunction looks like. We also need the boundary conditions that the wavefunction must go to zero at infinity and be normalised to unity. It's only when we impose the boundary conditions that we restrict the set of solutions to the $1s$, $2s$, etc atomic orbitals that we know and love. Once we have the solutions allowed by the boundary conditions then we can indeed plug our values of position into the equation for $\Psi$ and calculate the probability distribution of the electron.
stackexchange-physics
{ "answer_score": 3, "question_score": 2, "tags": "quantum mechanics, newtonian mechanics" }
ComboBox_DrawItem when ComboBox.Clear() I want to set the very first item of a ComboBox as red, and I use this code to do this task: private void cbTreeViewFolder_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); if (e.Index >= 0) { string text; Brush brush; MyClass file = ((MyClass)((ComboBox)sender).Items[e.Index]); if (e.Index == 0) { text = file.Path; brush = Brushes.Red; } else { text = file.Nome; brush = Brushes.Black; } e.Graphics.DrawString(text, ((Control)sender).Font, brush, e.Bounds.X, e.Bounds.Y); } } and it works until I clear the ComboBox, because in that case I don't know how to manage it, and all items remain in the ComboBox. Anyone knows solution for the problem?
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e) { if (((ComboBox)sender).Items.Count != 0) { e.DrawBackground(); string text = ((ComboBox)sender).Items[e.Index].ToString(); Brush brush; if (e.Index == 0) brush = Brushes.Red; else brush = Brushes.Black; e.Graphics.DrawString(text, ((Control)sender).Font, brush, e.Bounds.X, e.Bounds.Y); } }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#" }
joda time - add weekdays to date Is it possible to add weekdays to joda time? For instance, if current date is Friday 01/03, date + 1 should return Monday 04/03, rather than 02/03.
As far as I know there is no built-in method to automatically do this for you in Joda Time. However, you could write your own method, that increments the date in a loop until you get to a weekday. Note that, depending on what you need it for exactly, this could be (much) more complicated than you think. For example, should it skip holidays too? Which days are holidays depends on which country you're in. Also, in some countries (for example, Arabic countries) the weekend is on Thursday and Friday, not Saturday and Sunday.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 9, "tags": "java, jodatime" }
AIR application fails to install on BlackBerry Playbook I'm trying to install an AIR mobile (flex) application on BlackBerry Playbook. The application failed to installed with this following error message " failure 821 Application-requires-system : **unrecognized system name "BlackBerry10"** I am using AIR 3.1 SDK and I am using Adobe and Blackberry ANEs to build the app. Is the AIR SDK I am using (3.1) is correct for Playbook ? It DOES work for all other BlackBerry device.. ? Any ideas what might cause this ? Thanks !
AIR doesn't officially support BlackBerry 10, only the previous generation (BlackBerry 8, I think?). AIR 3.1 is nearly 2 years old at this point, too, so it doesn't support much of anything. Adobe stopped developing for Blackberry in 3.4 or 3.5, I believe. The only way to develop for BlackBerry 10 is to use the third-party SDKs for AIR provided by BlackBerry itself
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "apache flex, air, blackberry playbook, flex mobile" }
How to remove folded battery from phone without starting a fire? I was trying to replace the battery in my phone, but since it was very well glued to the phone, I accidentally folded it in half. This immediately caused some dark brown smoke to come out from it, so I took it outside. A few hours later, it seems to have stopped making smoke, and the bottom folded part looks very swollen. ![enter image description here]( I'd like to take it out, but I'm scared it will do something like in this video. Is there anything I can do to avoid it from catching fire? Also, are the fumes it releases dangerous?
a bloated Li-ion/Li-Po battery is very dangerous and should be handled with lot of care.Usually people would discard if the battery is in a dangerous position to be handled. I'm going to assume that your phone is expensive and you wouldn't want to discard it. Since, you have mentioned that after keeping it out for a while it has stopped making smoke you could do the following: 1.Wear full sleeve cloths, thick fire safety gloves(most important) and some kind of face protection. 2.Always use some kind of prying tool/spudger that is used in mobile repair to remove batteries. Something like in video could occur if the battery has some charge left in it. Overall, its a real risk trying to repair the phone. Proceed with caution before you attempt to. Also keep it in a safe place where it wouldn't cause fire. <
stackexchange-electronics
{ "answer_score": 3, "question_score": 0, "tags": "batteries, safety, lithium ion, cellphone" }
Using AJAX and a huge text file I have a huge text file and I am going to pick 5 aléatoir ligne to read and store the content into an array but when I'm testing the response that I get with an `alert()` it doesn't show all the content. function loadWords(){ var xhr = new XMLHttpRequest(); xhr.open('GET', "dico/francais.txt"); xhr.onreadystatechange = function(){ if(xhr.readyState == xhr.DONE && xhr.status == 200){ alert(xhr.responseText); } } xhr.send(null); } is there any other way more powerful to get the job done?
You cannot put massive data into `alert();` `alert` will always strip it after a certain length (sometimes when your screen resolution is not big enough to display it all etc.) What you could do, is to put all of it into a `textarea` in HTML in order to take a look at it.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, ajax" }
How do I link constraint data between objects? Normally if I have a material and want to put that material on say, 50 different objects, then I would select one object with that material, and then select the rest of the objects, hit Ctrl + L, and the material data would be copied to all the objects. I have the exact situation I described above, except that I want to copy an object constraint from one object to all the other objects. Unfortunately the Ctrl + L menu doesn't have a "Constraints" button. How do I copy this constraint to all the other objects?
Select object/-s without constraint/-s first, object with them last, in _Object_ > _Constraints_ menu choose _Copy Constraints To Selected Objects_. ![copy constraints menu](
stackexchange-blender
{ "answer_score": 4, "question_score": 0, "tags": "constraints, linked data" }
Как в лямбда-функции использовать больше одной команды? Как в лямбда-функции использовать больше одной команды? Предположим у меня есть функция `f`, которая принимает аргументы. Я допустим присваиваю эту функцию как команду в кнопку tkinter: b = Button(root, command = lambda: f('arg', 'arg2')) А если я хочу параллельно добавить еще одну функцию как команду (не добавляя ее в функцию `f`?
Но если я Вас правильно понял, то так: import math def sum(x, y): return x + y def mul(x, y): return x * y x = lambda a, b: [sum(a, b), mul(a, b)] result = x(1, 2) print(result)
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "python, python 3.x, функции, lambda, exec" }
Should I run tests for the entire core and contributed modules, or only for the codes I wrote? I am planning to integrate unit testing in CI/CD. I wonder what would be the good practice for running. Should I run tests for the entire core and contributed modules, or only for the codes I wrote?
The whole point of doing unit testing is verifying code functionality and preventing regression bugs on new code changes. Unless you're working on some development branch (i.e. not a release), running 3rd party vendor (core, contrib modules) unit tests is redundant; you should write unit tests for code that you're maintaining and trying to keep reliable and bug free.
stackexchange-drupal
{ "answer_score": 3, "question_score": 0, "tags": "8, testing" }
Signtool: Since Windows 10 Update 1803: No certificates were found that met all the given criteria I'm using signtool to sign my c# assemblies. Everything worked fine until Windows 10 1803 Update. Now as soon as a restart the Computer or even after suspending the Computer I get the error: No certificates were found that met all the given criteria. If I import the certificate again, everything works fine until the next restart... I tried to Import the certificate into different Folders of the Windows Certificate Store, i imported it for the current User or for Computer, I deleted it in all folders bevor the Reimport... but the Problem is always the same. Any hints would be great!
Here is a hint. Run `signtool` with the `/debug` option. When I manually run it from the command prompt, I get the same error (No certificates were found) if I am not running command prompt as administrator. With the `/debug` option, you'll see all the certificates it matches and how it filters down to select the certificate to sign. My certificate gets eliminated at the last step (Private Key filter). If this is the case with you, try running with elevated permissions and see if that works. In my case, for some reason, the VSTS build agent Windows service which runs the builds was not running after the 1803 update and I had manually started up the agent. This is why I was getting that error. Once I realized the service was down and I started it up as a service, the error went away.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "signtool" }
Elasticsearch Nest - Querying Aliases Does the Elasticsearch NEST API expose access to `/{index}/{_aliases}/*`? I am trying to get a list of indexes mapped to a given alias and I cannot seem to find an appropriate method. { "ntdev-events017-v1": { "aliases": { "ntdev-events017": {} } } } <
You can use `GetAlias` method on `ElasticClient`. Take a look on this example: var indexName = "sampleindex"; var uri = new Uri(" var settings = new ConnectionSettings(uri).SetDefaultIndex(indexName).EnableTrace(); var client = new ElasticClient(settings); client.CreateIndex(descriptor => descriptor.Index(indexName)); var putAliasResponse = client.PutAlias(descriptor => descriptor .Index(indexName).Name("alias1")); var putAliasResponse2 = client.PutAlias(descriptor => descriptor .Index(indexName).Name("alias2")); var aliasesForIndex = client.GetAlias(descriptor => descriptor .Index(indexName)) .Indices[indexName] .Select(x => x.Name).ToList(); var indexesMappedToAlias = client.GetAlias(descriptor => descriptor.Alias("alias2")) .Indices.Select(x => x.Key).ToList();
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 7, "tags": "elasticsearch, nest" }
How to remove li from ul within a div I have a div, where in i do have a ul, where the ul has some li. i just want to find some text and remove the li from the ul. suppose eg: <div id="div1"> <ul> <li>Hello</li> <!--i need to remove this.--> </ul> </div>
With jQuery, you can do this: $("#div1 ul li:contains('Hello')").remove();
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 3, "tags": "javascript" }
Generate a sequence by formula with R I want to generate a sequence: X_n= |X_{n-1} - epsilon_n|, where `epsilon_n` has an exponential distribution. For example epsilon <- rexp(100, rate = 0.3)
## n is length of the sequence, X0 is initial value, ## default exponential rate is 0.3 xSeq <- function(n,X0,rate=0.3){ vOut <- rep(0,n) vOut[1] <- X0 eSeq <- rexp(n-1,rate) for(i in 2:n){ vOut[i] <- abs(vOut[i-1]-eSeq[i-1]) vOut } return(vOut) }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "r" }
Foundation: margin between columns <div class="row"> <div id="right-content" class="large-9 columns wrapper"> <%= render "users/tabs", :user => @player_profile.user %> </div> <div class="large-3 columns wrapper"> <%= render "shared/social", :resource => @player_profile %> </div> </div> **Preview** !enter image description here And I would make something like in Fancy.com (some margin between right content and the sidebar) !enter image description here I've tried with <div id="right-content" class="large-9 columns wrapper" style=" margin-right: 20px; "> but in this case, the sidebar fly away below "right-content". How could i solve? !enter image description here
SOLVED dealing with **padding** instead of **margins**!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "css, html, zurb foundation" }
Like with Date Function I have a table that has dates stored as text and not as a date_time. I want to select rows that happened today. I can hard code the date, but obvious I want to do it dynamically. `SELECT * FROM view WHERE anniversary LIKE '%09-07'` `SELECT * FROM view WHERE anniversary LIKE '%' + DATE_FORMAT(now(), "%m-%d")`
The month and day operators can be used: SELECT * from view WHERE MONTH(anniversary) = MONTH(NOW()) AND DAY(anniversary) = DAY(NOW()) if the column is of type `varchar` the `STR_TO_DATE` function can be used to turn it into a date: SELECT * from view WHERE MONTH(STR_TO_DATE(anniversary,'%Y-%m-%d')) = MONTH(NOW()) AND DAY(STR_TO_DATE(anniversary,'%Y-%m-%d')) = DAY(NOW())
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "mysql, sql" }
How can I copy/paste multiple key-frames in After Effects from different layers? Is there a shortcut key to copy and paste After Effects keyframes? No, I don't want any kind of script to do so. I just want to move selected keyframes (they're multiple, not one, and they are in different layers) from a time to another time. But when I copy and paste them, AE pastes the whole layers! Is there a way to copy them without copying the layers? Or at least a way to show only the keyframes in the timeline, so I can copy them?
There is no way to copy-n-paste keyframes from multiple layers without using a script. You can show the keyframes in a layer by hitting the `u` key. And then you can copy those keys layer by layer. I'm not sure why you're opposed to using a script. I wrote one that can copy and paste keys from multiple layers in a single click (including copy-pasting with time reversal), and which is free and open source, you can download it here. ![enter image description here](
stackexchange-avp
{ "answer_score": 1, "question_score": 0, "tags": "after effects, keyframes" }
Равномерная сортировка по убыванию от точки Есть таблица с координатами `point`, как сделать запрос, чтобы самые ближе лежащие точки отсортировались вверх, а самые далекие вниз? Допустим я делаю что-то типо `order by NextToThisPoint(0, 0)` И мне первым выдает строки с координатами `1, 3` и `5, 12`, а какой-то `123, 553` упадет вниз списка
Для плоскости. x0,y0 - координаты точки, относительно которой сортируется. SELECT x, y, SQRT((x-x0)*(x-x0)+(y-y0)*(y-y0)) AS distance FROM table ORDER BY distance Для глобуса. lat0, lng0 - географические координаты точки. SELECT lat, lng, ACOS( SIN(PI()*lat/180.0)*SIN(PI()*lat0/180.0) +COS(PI()*lat/180.0)*COS(PI()*lat0/180.0) *COS(PI()*lng0/180.0-PI()*lng/180.0) )*6371 AS Kilometers FROM table ORDER BY kilometers
stackexchange-ru_stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "php, mysql" }
Pandas difference between columns of different categorical variable I have a dataframe with 1000 columns that looks like this Item Value1 Value2 Value3 Value4 Value..n A 12 24 14 50 43 B 14 27 13 48 47 C 10 32 17 89 49 D 17 30 15 23 40 I want to calculate the difference between the values based on the Item variable, something like this Difference Value1 Value2 Value3 Value4 Value..n A-B 2 3 1 2 4 A-C 2 ... ...... ... A-D B-C B-D C-D and exclude the rows where if an item has more entries than the others. For example of item A has 100 entries and item B has 150, then the difference would be calculated of the first 100 entries and the next 50 entries of item B would be excluded from calculations.
We can do `itertools.combinations`, then `reindex` and create the dataframe import itertools idx = pd.MultiIndex.from_tuples([*itertools.combinations(df.Item,2)]) df = df.set_index('Item') out = pd.DataFrame(df.reindex(idx.get_level_values(0)).values-df.reindex(idx.get_level_values(1)).values, index=idx, columns=df.columns) out.index=out.index.map('-'.join) out Value1 Value2 Value3 Value4 Value A-B -2 -3 1 2 -4 A-C 2 -8 -3 -39 -6 A-D -5 -6 -1 27 3 B-C 4 -5 -4 -41 -2 B-D -3 -3 -2 25 7 C-D -7 2 2 66 9
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, pandas, dataframe, logic" }
Installing pip using pypy3 in an Ubuntu Docker image After installing `pypy3` like so: apt-get -y install pypy3 The following error occurs when trying to set up `pip`: # pypy3 -m ensurepip Traceback (most recent call last): File "/usr/lib/pypy3/lib-python/3/runpy.py", line 196, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/pypy3/lib-python/3/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/pypy3/lib-python/3/ensurepip/__main__.py", line 5, in <module> sys.exit(ensurepip._main()) File "/usr/lib/pypy3/lib-python/3/ensurepip/__init__.py", line 221, in _main version="pip {}".format(version()), File "/usr/lib/pypy3/lib-python/3/ensurepip/__init__.py", line 71, in version assert len(wheel_names) == 1, wheel_names AssertionError: [] Is there a way to fix this?
curl | pypy3 Works for me. I have found using the get-pip.py file to be reliable
stackexchange-askubuntu
{ "answer_score": 0, "question_score": 0, "tags": "software installation, python, docker" }
Selecting BLOB column from Oracle database to SQL Server database over linked server How do I select a blob column from an Oracle database using OPENQUERY on a SQL Server that is using Linked Server to connect to the Oracle database? When I try using this syntax, I receive an error: SELECT * FROM OPENQUERY(LINKED_SERVER_NAME , 'Select blobColumn from TABLE') AS derivedtbl_1 Errors: > OLE DB provider "MSDAORA" for linked server "LINKED_SERVER_NAME" returned message "Oracle error occurred, but error message could not be retrieved from Oracle.". OLE DB provider "MSDAORA" for linked server "LINKED_SERVER_NAME" returned message "Data type is not supported.".
This works: SELECT * FROM OPENQUERY(LINKED_SERVER_NAME , 'Select DBMS_LOB.SUBSTR(blobColumn,4000,1) from TABLE') AS derivedtbl_1 This returns only the first 4000 characters of the blob columns, and only works for columns that have text (not binary) data. But it works for me.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "sql server, oracle, linked server, blobs" }
Script to change logonworkstation in AD when running against multiple users We are currently experiencing issues with selective user accounts switching from All Computers, to The Following Computers under Logon Workstations in Active Directory. I'd like to have a way to have a spreadsheet (CSV) that contains usernames, and then run the PowerShell script would read these values and set each user to All Computers under Logon Workstation. Now, here is a simple script that works perfectly fine - Only thing is that you would have to enter each username manually each time you run this command: "Set-AdUser -Identity User.Name -LogOnWorkstations $null" Here is what I thought would work - But ends up not being the case: $csv = Import-Csv C:\Users\administrator\Desktop\users.csv Set-AdUser -Identity $csv -LogOnWorkstations $null If anyone has an idea why my second script isn't working, that would be greatly appreciated!
In the seconds script shall I assume that `$csv` contains a list of users? If so `Set-AdUser` does not accept multiple `-Identity`'s. You would need to use a loop is the simplest answer. $csv = Import-Csv C:\Users\administrator\Desktop\users.csv $csv | ForEach-Object{ Set-AdUser -Identity $_ -LogOnWorkstations $null } This is _very_ dependent on the structure of your CSV. If it has a column for `username` then you would need to update the cmdlet call. Set-AdUser -Identity $_.UserName -LogOnWorkstations $null If the file is just a list of users then don't even bother with `Import-CSV` Get-Content C:\Users\administrator\Desktop\users.csv | ForEach-Object{ Set-AdUser -Identity $_ -LogOnWorkstations $null }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "windows, powershell, csv, active directory, windows server 2012" }
Getting value from a Masterpage in the controller Asp.Net MVC How do I get value of a textbox that's placed in the masterpage?
I agree with Pete. Sometimes it is convenient to put general items into the master page. In contrast to classic asp.net it is harder to get the value with every post. In classic asp.net there is only one formular on the html page wich will be posted and all works well. In mvc there could be more formulars on the page. You have to put the textbox into a every form to get the value in every post - no solution. A **custom user control (ascx)** might be a solution. Put the textbox in and place the custom control into the form where you need the value. If you have more forms or a complicated layout, than it is no solution. A **hidden field** might be a solution. Replicate value changes of your original textbox into hidden fields placed in the formulars where you need the value.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, asp.net mvc" }
Is there a downside to using apollo with appsync? Is there any kind of downside to using react apollo to call queries/mutations, with aws appsync?
The Apollo client should work just fine with AppSync for queries/mutations. One potential downside would be missing any future potential AppSync-specific optimizations or features that might be released the the AWS Mobile SDK team, as well as future ability to integrate subscriptions, which would require the AWS-built SDKs, or modifying the Apollo SDK, since the Apollo SDK would not work with AppSync subscriptions out-of-the-box.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "apollo, react apollo, aws appsync" }
What would make a place always misty? What would cause a place to be always misty? It is in a Fantasy setting, but I am looking for a feasible explanation.
You get mist when air with water in meets colder air and the water starts condensing out. This will occur most commonly in places with a large body of water (like the coast) which moist air can blow off onto the cooler land. Could also get it in a valley which doesn't see much sun light to warm it but moist air from the hill side can flow down into it. I don't know if any of these would make it _always_ misty but definitely make it more likely.
stackexchange-worldbuilding
{ "answer_score": 8, "question_score": 25, "tags": "climate, weather" }
What are some problems in the class P which we used to think were in the class of NP? I was recently watching a video on the classes of P and NP, in which it was claimed that there have been 'several' problems that were presumed to be in the class of NP, which have since been shown to be in the class of P. Unfortunately, no examples of such problems were given. Could anyone verify this statement by providing an example of such a problem?
Consider the following problem $A$: given $n$, is $n$ a composite integer (i.e., not a prime)? It is easy to prove that $A$ is in NP: any nontrivial divisor acts as a certificate. Proving that $A$ is also in P is much harder, and it is equivalent to proving that its complement, i.e. primality, is in P as well. Still, this has now been proved.
stackexchange-cs
{ "answer_score": 3, "question_score": 0, "tags": "complexity theory, np" }
Angular 2 ngModelChange old value Can someone please tell me what is the best practice for comparing ngModel old and new value? In angular 1: $scope.$watch('someProperty', funciton(oldVal, newVal){ // code goes here }) I am asking this because `(ngModelChange)` never brings me the `oldVal` , only the `newVal`. In my case, I am using ngModel in a `<select>` tag and compare the old selection with the new one: <select [(ngModel)]="current" (ngModelChange)="onModelChange($event)"> <option *ngFor="let item of myArray" [ngValue]="item">{{item.name}} </option> </select>
This might work (ngModelChange)="onModelChange(oldVal, $event); oldVal = $event;" or (ngModelChange)="onModelChange($event)" oldValue:string; onModelChange(event) { if(this.oldValue != event) { ... } this.oldValue = event; }
stackexchange-stackoverflow
{ "answer_score": 19, "question_score": 18, "tags": "angular, angular ngmodel, angular2 forms" }
Solve the pde $(x^2-y^2-yz)p+ (x^2-y^2-zx)q=z(x-y)$ I'm solving this by Lagrange's method. Lagrange's auxiliary equation is: $\frac{dx}{x^2-y^2-yz}=\frac {dy}{x^2-y^2-zx}= \frac{dz}{z(x-y)}$ From the first two ratio and the last ratio: $\frac{dx-dy}{z(x-y)}=\frac {dz}{z(x-y)}$ Solving which I get $z-x+y=c_1$ I'm unable to find another solution. Please help!
since $$\dfrac{dx}{x^2-y^2-yz}=\dfrac{dy}{x^2-y^2-xz}=\dfrac{dz}{z(x-y)}$$ $$\Longrightarrow \dfrac{xdx}{x^3-y^3-xyz}=\dfrac{ydy}{x^2y-y^3-xyz}=\dfrac{\dfrac{dz}{z}}{x-y}$$ $$\Longrightarrow\dfrac{xdx-ydy}{(x^3+y^3)-xy(x+y)}=\dfrac{\dfrac{dz}{z}}{x-y}$$ $$\Longrightarrow \dfrac{xdx-ydy}{(x+y)(x-y)^2}=\dfrac{\dfrac{dz}{z}}{x-y}$$ $$\Longrightarrow \dfrac{xdx-ydy}{x^2-y^2}=\dfrac{dz}{z}$$ $$\Longrightarrow\dfrac{d(x^2-y^2)}{2(x^2-y^2)}=\dfrac{dz}{z}$$ $$\Longrightarrow z^2=x^2-y^2+C_{2}$$
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "ordinary differential equations" }
context:property-placeholder comma-separated list of resources don't work with system property placeholder I can't entirely configure property-placeholder from system property because I can't give comma-separated list of resources. I'm trying to do like: <context:property-placeholder location="${config-location}" /> I use system property to configure this. It works if I give one location only, like "`classpath:main.properties`", but it does not if I'm trying this: "`classpath:main1.properties,classpath:main2.properties`". If I use this latter exact value directly in xml configuration it works fine. I guess it resolves comma-separation earlier than placeholders. It should be the other way around. P.S : version **4.3.4**
Another possible worth tryout would be, <context:property-placeholder location="#{systemProperties['config-location']}" /> how to read System environment variable in Spring applicationContext
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "spring" }
Javascript set href for all elements in class I have a list of (at least 4) < a > tags with the class 'remove-typefilter' They do not have a 'href' ., but I want to give them all one when the users clicks a button. This is the JS function I've written to achieve this: function BuildButtons(urlparams) { elements = document.getElementsByClassName('remove-typefilter') for (let element in elements) { element.href = 'www.newlink.com' + urlparams element.style = 'color: red;' } } Yet when I run this function it does not change the attributs. The A tags get no link and the styling goes not change. Does anyone know what I am doing wrong?
Two issues: * Syntax error in the function definition: `url-params` is invalid. Use `urlParams`. * `for ... in` loops iterate the keys of the iterated object, not the values. Use `for ... of` instead Also: * Do not define `elements` as a global variable. Use `const`. * Better add a protocol in your URL, like ` * Although assigning a string to `style` works, it is more efficient to assign directly to the relevant style property Corrected code: function BuildButtons(urlParams) { const elements = document.getElementsByClassName('remove-typefilter'); for (const element of elements) { element.href = ' + urlParams; element.style.color = 'red'; } }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -2, "tags": "javascript" }
missing variables have point, need to make it blank I have a table and tables shows the missing variable with point as below. Point means it is empty(missing) variable but I don't need to see it table var . 23 . and so on. I don't want to see that point. I need completely blank . When I do if then statement gives me error. data tos; set tos; if TOS.AUTH='.' THEN TOS.AUTH =.; ________ 557 ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase. ERROR 557-185: Variable TOS is not an object. How can I delete these points.
If you are concerned with how it comes in printed output outside of SAS, you have a few different options depending on how you print it out. Most common is `options missing=' '` which sets the missing character to space. Internal to SAS, it really doesn't matter what it looks like, just accept the period is my suggestion.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "sas" }
Gulp Install via the Command Line (Mac) I've seen that in some tutorials when you install Gulp it suggests: npm install -g gulp In other tutorials it suggests: npm install -g gulp-cli What is the difference, and what relevance does the suffix cli have? I appreciate it means command line interface, but does this have any added benefits, or are they both the same thing. Also, all tutorials suggest installing packages like gulp globally, but then you have to install them as a dev dependency in the project anyway - why do you essentially end up having to install it twice? Many thanks
`gulp-cli` is just the `cli` part of this tool, whereas `gulp` is both the cli + the library bundled together. This package was initially bundled together as `gulp` but to better support multiple major versions (with API changes) the CLI / Library were split. This way, the CLI could leverage the library version that was installed as part of your project dependency -- as global NPM packages should. Installing the package globally, just allows you to reference the CLI tool by name, without including the path to your `node_modules` directory, e.g. `gulp` vs. `./node_modules/bin/gulp` The team also wrote a very brief update to summarise some of this, see: <
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "npm, command line, gulp" }
Sliding Points on a curve in GeoNodes Is there a way to animate instance points on a curve in geometry nodes? I am thinking of something similar to the follow path constraint, with an easy offset value to manipulate. I have a curve object on which I want the instanced objects to slide along. The offset between the instanced objects should stay constant.![nodetree-screenshot]( Edit: Also it would be cool if the sliding would loop on the curve.
![enter image description here]( can use this node setup: ![enter image description here]( if you animate e.g. the start value you will get:
stackexchange-blender
{ "answer_score": 2, "question_score": 1, "tags": "animation, node editor, constraints, geometry nodes, curve modifier" }
NEST - Using GET instead of POST/PUT for searching Is there a way to tell NEST to use GET instead of POST when performing searches? Similar to how the ElasticSearch documentation shows CURL using GET I'd like to use GET when using NEST instead of using POST as it currently does.
Yes < line number 135 public static void Update(IConnectionSettingsValues settings, ElasticsearchPathInfo<SearchRequestParameters> pathInfo, ISearchRequest request) { pathInfo.HttpMethod = request.RequestParameters.ContainsKey("source") ? PathInfoHttpMethod.GET : PathInfoHttpMethod.POST; } Obviously you need to have `SearchRequest.RequestParameters.ContainsKey("source")` return `true` for it to do a `Get`. In future. Just RTFM.
stackexchange-stackoverflow
{ "answer_score": -2, "question_score": 3, "tags": "c#, elasticsearch, nest" }
Vertical scrolling in Windows 8 FlipView Is it possible to do a vertical scroll in a WinJS FlipView? It seems like the FlipView is blocking the scroll event? Thanks in advance
I have confirmed that the win-interactive css class will allow for vertical scrolling in a FlipView. To test, you can set up a FlipView and use the following as it's itemTemplate: <div id="simple_ItemTemplate" data-win-control="WinJS.Binding.Template" style="display: none"> <div class="overlaidItemTemplate"> <div style="height: 100%; overflow-y: scroll"> <div class="win-interactive" style="height: 1000px; background: -ms-linear-gradient(top, #1e5799 0%,#ffffff 100%)"> </div> </div> </div> </div>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, html, windows, windows store apps, winjs" }
Making archive from files with same names in different directories I have some files with same names but under different directories. For example, path1/filea, path1/fileb, path2/filea, path2/fileb,.... What is the best way to make the files into an archive? Under these directories, there are many other files under these directories that I don't want to make into the archive. Off the top of my head, I think of using Bash, probably ar, tar and other commands, but am not sure how exactly to do it. Renaming the files seems to make the file names a little complicated. I tend to keep the directory structure inside the archive. Or I might be wrong. Other ideas are welcome! Thanks and regards! * * * EDIT: Examples would be really nice!
What I have used to make a tar ball for the files with same name in different directories is $find <path> -name <filename> -exec tar -rvf data.tar '{}' \; i.e. tar [-]r --append Hope this helps.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "bash, archive" }
I made a typo in a new tag name, how can I correct that? I would like to introduce .net-attributes, but I incorrectly typed .net-attibutes (without the `r`). How do I resolve that?
It's done: I just edited those two questions you added the tag to, removing the bad tag and adding the one you wanted. This night (3 UTC), the bad tag will be pruned unless it gains new questions. BTW: The new tag might still benefit from a tag-wiki and excerpt. As a follow-up, if the wrong tag is similar enough, it can block creation of the proper tag. Either get a mod to do the rename then, or untag, let the orphaned tag be pruned, and _then_ retag properly.
stackexchange-meta_stackoverflow
{ "answer_score": 7, "question_score": 6, "tags": "support, tags, retag request" }
Evaluating differences between EJB Enterprise application and Spring MVC framework? Suppose I have to create a shopping cart website, it should accept lot of requests and process their request without any performance issue. Which method I can use EJB Enterprise application or Spring MVC framework..?
I don't think the two are mutually exclusive. Here is a good discussion on coderanch that really helped me. < Hope this helps.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "java, spring mvc, jakarta ee, ejb 3.0" }
How to use websocket in spring boot and react js? I referred to this spring boot doc to create web socket in spring boot. I used stompjs and sockjs-client var socket = new SockJS('/gs-guide-websocket'); //gives an error in below line stompClient = Stomp.over(socket); stompClient.connect({}, function (frame) { setConnected(true); console.log('Connected: ' + frame); stompClient.subscribe('/topic/greetings', function (greeting) { showGreeting(JSON.parse(greeting.body).content); }); });
use this stompjs and socket-client then import them import SockJS from 'sockjs-client'; import Stomp from 'stompjs'; to connect websocket //use your link here var sock = new SockJS(' let stompClient = Stomp.over(sock); sock.onopen = function() { console.log('open'); } stompClient.connect({}, function (frame) { console.log('Connected: ' + frame); stompClient.subscribe('/topic/public', function (greeting) { console.log(greeting); //you can execute any function here }); });
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "spring boot, react native, websocket" }
subscribe not a function error, when a field of observable object is subscribed to function Action() { var self = this; self.name = ko.observable(); self.action = ko.observable({}); self.action.name = ko.observable(); //This works fine self.name.subscribe(function(value) { // some logic }); // This gives subscribe not function error self.action.name.subscribe(function(value) { // some logic }); } I can't understand this kind of behaviour. Can somebody help me with some explanation ?
Change `Action` to this: function Action() { var self = this; self.name = ko.observable(); self.action = ko.observable({ name: ko.observable() }); self.action().name.subscribe(function(value) { alert("changed"); }); self.name.subscribe(function(value) { // some logic }); } `observable`s are functions. `self.action.name` is just name of the `observable` function. Not the inner `name` property you want to access. So, instead of accessing `action`'s name. Use `self.action().name`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, knockout.js" }
printing php variables in echo '' i have a big table where should print 5 php variables. I am printing this way echo ' <td valign="center" align="center" colspan="2">Number : <br/>$num</td> '; but it prints $num not the value of $num EDIT : I realized that. echo ' ' <td valign="center" align="center" colspan="2">Number : <br/>'.$num.'</td> '; Thank you for help :)
Single quoted PHP strings do not interpolate variables. Double quoted strings do. Use a double quoted string. Better yet, don't build up HTML in strings in the first place. Drop into PHP mode only when you need access to PHP. <td valign="center" align="center" colspan="2">Number : <br/><?php echo $num;?></td>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -2, "tags": "php" }
C# Xaml (Windows Universal App) open new Page I'm trying to re-do my old windows form project in Windows Universal app. I need to open another windows, in my old project: `WindowsForm2 frm = new WindowsForm2(); frm.ShowDialog(); // or .Show()` in my new project I can't use the "Show()" method. How can I do it?
< In UWP you should use Frame class to navigate between pages: Frame.Navigate(typeof(Page2)); Also moving to new page and opening a new window are two different things. Second one is a little harder: <
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 4, "tags": "c#, xaml, uwp" }
Convert FeatureLike type into GeoJSON feature? How to convert Feature type into GeoJSON feature? I have tried this: var feature: FeatureLike; var writer = new GeoJSON(); const res = writer.writeFeatureObject(feature); console.log(res);
The GeoJSON `writeFeatureObject` method only takes a Feature. If you had a RenderFeature you would need to convert it to a Feature const res = writer.writeFeatureObject(feature instanceof RenderFeature ? toFeature(feature) : feature); <
stackexchange-gis
{ "answer_score": 3, "question_score": 2, "tags": "openlayers, geojson" }
Disallow VNC if not via a SSH tunnel? How can I disallow VNC if the connection isn't via a SSH tunnel?
Although it's not explicitly listed as an option to `vnc4server`, you should be able to pass the `-localhost` option to the underlying `Xvnc` process. From `man vncserver`: You can add Xvnc options at the command line. They will be added to the invocation of Xvnc without changes. From `man Xvnc`: -localhost Only allow connections from the same machine. Useful if you use SSH and want to stop non-SSH connections from any other hosts. See the guide to using VNC with SSH on the web site. Alternatively, you could use `ufw` or `iptables` to default deny external connections, only opening the chosen SSH port.
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 1, "tags": "ssh, vnc" }
Синхронизация доступа к ArrayList Здравствуйте. Такой вопрос: 1. В javadoc написано, что для `thread-safe` доступа к `ArrayListу` его нужно декорировать через `Collections.synchronizeList`. Я так понял, что этот метод просто возвращает `list` методы которого `synchronized`, это так? 2. Из того же javadoc: List list = Collections.synchronizedList(new ArrayList()); synchronized(list) { Iterator i = list.iterator(); // Must be in synchronized block while (i.hasNext()) foo(i.next()); } > It is imperative that the user manually synchronize on the returned list when iterating over it: ... Зачем в этом случае вручную синхронизировать через `synchronized(list)`? Или это нужно делать, только когда работаешь с итераторами, и не обязательно, если обращаешься к листу через `get()`, `add()`, `set()`? Спасибо.
1. Ну так посмотрите, что делает Collections.synchronizedList.. в IDE контрол-клик и читайте, что написано. Но вообще, вы обнаружите, что да, там каждый метод synchronized. 2. Соответственно, этот факт и является причиной того, что есть необходимость синхронизоваться отдельно. Всё дело в том, что итератор сломается, если кто-то выполнит модификауцию списка **между** вызовами next(). Чтобы этого избежать и приходится делать более крупный блок synchronized. 3. И да, нарушение внутреннего состояния списка внутри методов set никто не отменял: одновременный вызов метода set из разных поток с высокой вероятностью разрушит список. Поэтому, надо делать synchronizedList. Ну или можно просто руками везде синхронизовать, а не оборачивать. Лично я обычно так и делаю и редко пользуюсь этим декоратором. Он обычно полезен, если вы отдаёте список куда-то наружу, чего я стараюсь всеми правдами и неправдами избежать.
stackexchange-ru_stackoverflow
{ "answer_score": 6, "question_score": 1, "tags": "многопоточность, java, коллекции" }
php reservation system i m creating a project with php and html use.i would like to create a ticket reservation system for my university.Firstly,the user will choose a date and the number of persons that he wants to reserve tickets.Then,by pressing the next button,he could see the list of the events that are available in the date he checked in the previous step.this list will be static,so i think that i have to create a data base which will have this data and if the users selects ex monday,he could see the data events for monday.Could you please help me do this because i have no big experience with php?i have created the two screens with html and css but now i would like 1st to let me know how to create a data base with my data and secondly how to connect them with my day oprtions! Thanks a lot!
Take a look at: PHP 101: A Simple Seat Reservation System
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php, html, database" }
What is the option '-r' in nodemon? Nodemon options docs don't mention anything with this. Nowhere I can find anything about the option `-r`. To give you some context, here is where it is being used. **Update** After answered this question, subsequently, another question popped up: Why use this? There is already an **unanswered** SO question here
-r is not a nodemon but a node option. node --help says: -r, --require=... module to preload (option can be repeated) In your example, it was "preloading" `dotenv-safe/config`
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "node.js, nodemon" }
Alter messages in Drupal 7 There is a couple of messages in drupal. When there is a php warning, an error message is raised, but a module can also raise messages with drupal_set_message(). The question is: Is there a way to alter these messages? For example to replace every 'a' with 'b' in every message. Thanks!
While there is no message alter on set, you can change them on display via `hook_preprocess_status_messages`, see < on preprocess and < . Edit: also you can try string overrides check < , in short `$conf['locale_custom_strings_en']['some message'] = 'some messbge';` for English, change `_en` for something else if it's not English.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 5, "tags": "php, drupal, drupal 7" }
$\lim_{n\rightarrow\infty} n^2C_n$ for $C_n=\int_{\frac{1}{n+1}}^{\frac{1}{n}}\frac{\tan^{-1}nx}{\sin^{-1}nx}dx$ equals? Let $$C_n=\int_{\frac{1}{n+1}}^{\frac{1}{n}}\frac{\tan^{-1}nx}{\sin^{-1}nx}dx$$ then $\lim_{n\rightarrow\infty} n^2C_n$ equals? I am having trouble in finding the integral.Wolfram alpha too doesnt give any answer < Any idea?
try a substitution $x n= q$, then $$ C_n=\frac{1}{n}\int_{\frac{n}{n+1}}^1\frac{\arctan(q)}{\arcsin(q)}dq $$ since $\frac{n}{n+1}\sim1 $ for $n \rightarrow \infty$ we might expand the integrand in a taylorseries around $q=1$ which means $\arctan(x)\sim \frac{\pi}{4}$ and $\arcsin(x)\sim \frac{\pi}{2}$ $$ C_n\sim\frac{1}{2n}\int_\frac{n}{n+1}^1dq\ \sim\frac{1}{2 n^2} $$ therefor > $$ \lim_{n\rightarrow \infty}n^2 C_n=\frac{1}{2} $$
stackexchange-math
{ "answer_score": 5, "question_score": 5, "tags": "calculus, integration, limits, definite integrals" }
Getting JVM error after SOAP UI installation I am trying to install `SOAPUI` tool. After the installation, when executed, I amm getting this error: > The JVM could not be started. The maximum heap size (-XMx) might be too large or anti virus or firewall tool could block the execution When installed to a different machine, it works fine. Any suggestions?
This error often occurs if you try to set too much memory on a 32-bit OS such as Windows. E.g. if you use `-Xmx1600m` or more on Windows 32-bit you will get this error. Which OS and version of Java do you have on the machine which fails.
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 8, "tags": "java, jvm, soapui" }
Mp4 on aws s3 is causing excessive gets We are getting excessive gets after we started hosting our mp4 out of a s3 bucket. It looks like the streaming process is causing 100s of gets for every view of video. Is there something we can change either on s3 or the mp4 to reduce the # of gets
The final solution was that the mp4 was badly transcoded. Im not 100% sure why but after retranscoding the mp4 it worked a lot better. I found this link that implied excessive gets could be cause by sound and video being far apart on the mp4.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "amazon s3, mp4" }
Webkit css box issue I have a css3 boxflex layout in webkit, but for some reason, `#main` (the purple one) isn't filling 100% of the screen like the css is telling it to: < How do I get it to fill the whole height available? This is just a basic layout with header, middle area with sidebar/content, and a footer.
Hey, you need your html and body tag to have a height of 100%: html,body {margin:0;padding:0; height: 100%;} jsFiddle example here: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, css, webkit" }
res.status.json() is not a function in Nextjs I am creating this api endpoint called pincode.js in Nextjs: export default function handler(req, res) { res.status.json([234400, 721302, 110003, 560017]); } but it is giving the error : res.status.json() is not a function How to handle this?
status is a function that expects a status code, you should call or omit it. passing status 200 to it: export default function handler(req, res) { res.status(200).json([234400, 721302, 110003, 560017]); } omit status code, and send default one (200, if I'm not mistaken): export default function handler(req, res) { res.json([234400, 721302, 110003, 560017]); }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "reactjs, api, next.js, next api" }
Numpy.where on an array of strings using regex I have an array like: array = ['A0','A1','A2','A3','A4','B0','B1','C0'] and want to obtain an array which is true for values with an A followed by a number ranging from 0 to 2. So far, this is the way I do it: selection = np.where ((array == 'A0') | (array == 'A1') | (array == 'A2'), 1, 0) But is there a more elegant way to do this by using e.g., a regular expresion like: selection = np.where (array == 'A[0-1]', 1, 0)
I don't think numpy if your best solution here. You can accomplish this using built-in python tools such as `map`. import re array = ['A0','A1','A2','A3','A4','B0','B1','C0'] p = r'A[0-2]' list(map(lambda x: bool(re.match(p, x)), array)) # returns [True, True, True, False, False, False, False, False] # to get an array: np.array(list(map(lambda x: bool(re.match(p, x)), array))) # returns: array([ True, True, True, False, False, False, False, False])
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "python, numpy" }
Prove that $\sqrt {n − 1} +\sqrt {n + 1}$ is irrational for every integer $n ≥ 1$ This question is from Apostol's Mathematical Analysis. I have a solution for it at SOLUTION! The question is: Prove that $\sqrt {n − 1} +\sqrt {n + 1}$ is irrational for every integer n ≥ 1. And the proof I have is!enter image description here Now, I can't understand how to get h=$3/2$ and k=$1/2$ ? Please help.
We know that $k^2$ and $h^2$ are two positive integer squares that differ by $2$. We could just stop here, since there are no such positive integers. If this weren't immediately apparent, let $k \geq 1$ and $i \geq 1$, then $$(k+i)^2 = k^2+2ki+i^2 \geq k^2+3.$$ So two square integers differ by $3$ or more.
stackexchange-math
{ "answer_score": 11, "question_score": 2, "tags": "real analysis" }