INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
IndexOutOfBounds with array Each time I try to run this method private void resetOdds() { mOdds[1] = 0.10; mOdds[2] = 0.25; mOdds[3] = 0.35; mOdds[4] = 0.30; } I get an IndexOutOfBounds error. I don't know why, as I supply enough items in the array to change: private final double[] mOdds = { 0.10, 0.25, 0.30, 0.35 }; Does anyone know why I'm getting this error?
Your indexing is off by one; it should start at 0: mOdds[0] = 0.10; mOdds[1] = 0.25; mOdds[2] = 0.35; mOdds[3] = 0.30;
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "java, android" }
Regex for validating an email string, using Jquery I am taking the **; (semicolon) separated email addresses from a textbox** & need to validate each individual email address, using Jquery. Could anyone plz let me know **_if we can use inbuilt Jquery validation plugin for Email validation?_** Else what would be the Regex for the same? Sample Code: function IsValidEmail() { var inputEmailAddress = $("#TextBox1").val(); var array = inputEmailAddress.split(";"); var validEmailPattern = new RegExp('[A-Za-z]'); //Please suggest correct Regex var individualEmailstring; for (var i = 0; i < array.length; i++) { individualEmailstring= array[i]; if (!(individualEmailstring.match(validEmailPattern))) return false; } return true; }
I don't know about being able to use the Email Validation Plugin like you'd like. About the Regex, found this Email Regex on Regular Expressions : `^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$`
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "regex, jquery plugins" }
Package name of stock SMS-app on Galaxy S2/S3/S4? What is the package name of the factory-default SMS/MMS ("Messaging") app on the Galaxy S2/S3/S4? It's not using the stock Android app, correct?
if you are rooted you may want to try using Root Explorer you may want to go /system/app/SecMms.apk open it up and check the `manifest.xml` and you'll find the package name is : `com.android.mms` P.S this is the actual package name from the stock message app in S4.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "android, sms, galaxy" }
Rotate master branch into feature branch Currently I have the following branch * master remotes/origin/HEAD -> origin/master remotes/origin/master What I want to do is * Move my master branch into branch feature-1 * Copy a new master branch from existing master, and make change So at the end, both my local and remote will have 2 branches - master & feature-1, and when I push from the local master branch, remote master branch will be updated. While when I do push in feature-1 branch, the remote feature-1 will also be updated.
You don't need to "copy" your current `master` branch, you simply create a `feature-1` branch on top of the current master and push it to origin. git checkout master git checkout -b feature-1 git push -u origin feature-1 # only needed once Note the `-u` option for the first push of feature-1 branch. You won't need a `git set-upstream` to link your local branch to a remote branch of the same name on origin. See "Git: Why do I need to do `--set-upstream` all the time?" for more.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "git" }
equivalent of "ssh -c blowfish" for rsync? What is the equivalent of doing ssh -c blowfish with `rsync` for fast block cipher if one wants to have faster transfer rates?
rsync ... -e "ssh -c blowfish" ...
stackexchange-superuser
{ "answer_score": 8, "question_score": 6, "tags": "ssh, rsync" }
Incomplete Delayed Chained Payment Fees Payer I'm setting up a delayed chained payment in PHP I'm setting the feesPayer to `SECONDARYONLY` $payRequest->feesPayer = 'SECONDARYONLY'; the transaction is made to the primary receiver but the second leg of the chained payment (from primary to secondary receiver) is still pending. then 90 days passed (payKey expired) and I did not complete the payment. who pays the fees when the payKey expires?
Based on my messages with PayPal's support, I tell you that no one will pay the fees because the payment will be reverted back to the buyer ! So if you didn't complete the payment, it will go back and you will not be able to change the receivers during 90 days.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "paypal, paypal adaptive payments, chained payments" }
WHM Module Installer - Why is SOAP not showing in phpinfo? I'm trying to install SOAP on server. This is what I did: 1. Got into WHM Module Installers 2. Installed SOAP 0.13.0 3. Confirmed it was there; looked in FTP and I see the SOAP directory created 4. Restarted server Added phpinfo on server and went to it on browser 5. Also added extension = php_soap.so on php settings Didn't see SOAP on phpinfo Am I missing something? Thanks,
Problem solved. After installing the application on module installers in WHM, need to go to EasyApache and add SOAP in the exhaustive list and build it.
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 3, "tags": "soap, whm" }
open failed: No such file or directory I have built a standalone executable which references my .so object. both are in the same directory. when I try to run executable it gives me the following error: > ld.so.1: myExec: fatal: libMine.so: open failed: No such file or directory what am I doing wrong?
Unix systems don't look in the current directory for .so files automatically. You can get around this for development by setting `LD_LIBRARY_PATH`, but during the normal installation they should be installed in the appropriate place on the system. See also why you shouldn't make your users use `LD_LIBRARY_PATH`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c++, linux, shell, linker, solaris" }
jQuery fade in fade out image opacity animation I am currently trying to find a way to have a simple image being displayed that automatically fades in fades out (opacity 0 > 100) in a constant loop. Are there any way to achieve this in jQuery without necessarily having to rely on a flash solution? Some info would be greatly appreciated.
Try this $(function () { $('img').on("hasFadedOut", fadeInImg); $('img').on("hasFadedIn", fadeOutImg); fadeOutImg(); }) fadeInImg = function () { $('img').fadeIn(500, function () { $('img').trigger("hasFadedIn"); }); }; fadeOutImg = function () { $('img').fadeOut(2000, function () { $('img').trigger("hasFadedOut"); }); };
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "jquery" }
Distinguish between Model and Controller in JSF I want to clearly understand the proper way of developing a JSF application. In our project, the model and controller is the same class, represented by CDI bean. I'm sort of confused whether it's a good practice. As far as I understand MVC pattern, the controller should handle user actions (such as submitting form) and the model should contain business logic and data. Or is it OK, that they are in the same class? Also, should every page have its own separate Controller/Model (i.e is it considered a good practice)?
JSF controllers are just UI handlers, they shouldn't carry any business logic. Usually there are even more layers (I include here only layers that relate to logic): 1. UI Controller - that is tightly tied to the UI and thus to the technology you use for MVC 2. Service Layer - is a facade-entry point to the business logic, usually also manages transactions and in some cases - DTO/Entity transformation if this is required. It doesn't know anything about Web MVC technology you use. 3. Business logic that obeys Domain Model pattern (sometimes called Domain Service).
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "java, model view controller, design patterns, jsf, cdi" }
Tools for weak relationships What are the possible data analysis tools that may be sensitive to weak relationships? I intent to explore relationship (if any) between weather and employee absenteeism. However the "traditional" models such as lm and tree are fairly inconsequential. I don't intend to overfit my model but still would like to try more tools. Many thanks for suggestions.
Practically speaking, if you apply any method with high level of significance, say 10%, it will become more sensitive to smaller effects. This is the way how exploratory statistics is used in marketing or social sciences, where type I. error is not so much disastrous thing to happen. Applying a regression tree in your case should be the one to start with, as it has few assumptions. However, some tree methods fail in case where the prior distribution is too unbalanced (such as bin sizes with classification trees).
stackexchange-stats
{ "answer_score": 0, "question_score": 0, "tags": "predictive models" }
MySQL won't properly GROUP BY on emojis I'm storing single emojis in a `CHAR` column in a MySQL database. The column's encoding is `utf8mb4`. When I run this aggregate query, MySQL won't group by the emoji characters. It instead returns a single row with a single emoji and the count of all the rows in the database. `SELECT emoji, count(emoji) FROM emoji_counts GROUP BY emoji` Here's my table definition: CREATE TABLE `emoji_counts` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `emoji` char(1) DEFAULT '', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; Is there some special Unicode behavior I'll have to account for?
Turns out I needed to specify an expanded collation in the query, namely `utf8mb4_unicode_520_ci`. This worked: SELECT emoji, count(emoji) FROM emoji_counts group by emoji collate utf8mb4_unicode_520_ci; EDIT: That collation isn't available on some server configs (including ClearDB's)... `utf8mb4_bin` also appears to work.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "mysql, unicode, emoji" }
VMware Linux Server -- how can you tell if you are a vm or real hardware? An interesting question. I have logged into a Linux (most likely SuSE) host. Is there some way that I can tell programmatically that I am a VM host or not? Also assume that the vmtools are not installed.
Use standard Linux tools to inspect the hardware on the system. cat /proc/scsi/scsi or ethtool -i eth0 or dmidecode | grep -i vmware If the output of these commands shows hardware with a manufacturer name of "VMWare", you're on a VMWare VM. Multiple commands are provided here because system configurations and tools differ.
stackexchange-serverfault
{ "answer_score": 29, "question_score": 47, "tags": "linux, virtualization" }
Sql export for select result I try to export data from database but in phpmyadmin i have no option to dump it to sql format. SELECT email FROM users, profiles WHERE users.id = profiles.user_id AND profiles.country_id = 1 I'm not good in sql - why i cant dump this to sql format form phpmyadmin
There is export option below the results. !enter image description here EDIT: You need to select single table e.g. SELECT email FROM users WHERE userid IN (SELECT userid FROM users, profiles WHERE users.id = profiles.user_id AND profiles.country_id = 1)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql, sql" }
Let $a<b$ and $a,b\in\Bbb R$. Then there is $c$ such that $a<c<b$ and that $c$ is irrational > Let $a<b$ and $a,b\in\Bbb R$. Then there is $c\in\Bbb R\setminus\Bbb Q$ such that $a<c<b$. * * * **My attempt:** 1. $a+b$ is irrational Let $c:=\dfrac{a+b}{2}$ 2. $a+b$ is rational Let $x:=\dfrac{a+b}{\sqrt 2}$. Then $x$ is irrational. * $a<x<b$ Let $c:=x$ * $b\le x$ Then $x-b<x-a$. Take $x'\in (x-b,x-a)$ such that $x'$ is rational. Then $a<x-x'<b$ where $x-x'$ is irrational. Let $c:=x-x'$. * $x\le a$ Then $a-x<b-x$. Take $x'\in (a-x,b-x)$ such that $x'$ is rational. Then $a<x+x'<b$ where $x+x'$ is irrational. Let $c:=x+x'$. * * * My proof is quite short. I'm worried if it's sloppy and contains mistakes. Please help me verify it!
Consider the following two sequences. $$ \\{1/n\\}_{n=1}^{\infty}$$ and $$ \\{\sqrt 2/n\\}_{n=1}^{\infty}$$ The first one, approaches $0$ with rational terms and the second one approaches $0$ with irrational terms. Pick a natural number n, such that $1/n$ and ${\sqrt 2}/n$ are both less than $b-a$ If $a$ is rational then $a+{\sqrt 2}/n$ is irrational and it is in the interval $(a,b)$ If $a$ is irrational then $a+{1}/n$ is irrational and it is in the interval $(a,b)$
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "real analysis, proof verification" }
Mongocxx accessing Error from different cpp file I have created a header `mongo.h` it contain mongocxx::instance inst{}; mongocxx::uri uri{ "link*****" }; mongocxx::client client{ uri }; i accessed the mongodb from `main.cpp` by including this `mongo.h` but when including this header to other cpp file it return error. Documents saying that the instance must create once . i have read < not understand fully, i dont familiar with constructor and destructor ,, Any body please help to access mongodb from every cpp file .
This is a good example of where a singleton could help. In `mongo.h`, put a single function declaration: mongocxx::client& get_client(); In a _single_ cpp file, define the function as follows: mongocxx::instance inst{}; mongocxx::client& get_client() { static mongocxx::client client{mongocxx::uri{ "link*****" };}; return client; } By putting this in a separate .cpp file, you ensure that `inst` is created some time before the `main` function starts. The `static` keyword in `get_client` ensures that the client is only ever created once, namely the first time `get_client` is called.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++, mongodb, instance, mongo cxx driver, mongodb c" }
ふたりで一人前で meaning > **** ? What is the thing that can cut in half various things when the to parts become one? This is my interpretation, but I think is wrong. Can someone explain? Especialli the bold . Is it the continuative of or the of means?
* That in bold is the continuative form of the copula , as in " **** ". So it's basically "and". * in this sentence means _full-fledged_ , _mature_ , etc. What is the etymology of ? * literally means "(becomes) full-fledged by two people" or "full-fledged when there are two people". Riddles often use personification like this, and it just means "works fine only in pairs". The whole sentence roughly means "What is the thing that works fine only in pairs **and** cuts various things in two?" The answer of the riddle is probably "scissors".
stackexchange-japanese
{ "answer_score": 4, "question_score": 6, "tags": "grammar, words" }
php-how to move files to the folder created using userid (upload files) Once the is uploaded i am creating folder based on Application id which is unique. The problem i am facing here is, once i upload ,files are uploade out side respected folders. even folder is getting created. Can any any one help on this!!! $path = $file['name']; $path_user = '/home/devestctrl/public_html/wp-content/plugins/est_collaboration/Files/'.'/'.$send_id; if (!file_exists($path_user)) { if (mkdir( $path_user,0766,false )) { if (move_uploaded_file($file['tmp_name'],$path_user.$path)) { echo"inside 2"."<br>"; echo"Your File Successfully Uploaded"; } } }
Remove extra `/` between `est_collaboration/Files/'` And `.$send_id`. Append `/` in last. Like `$path_user = '/home/devestctrl/public_html/wp-content/plugins/est_collaboration/Files/'.$send_id.'/';`
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "php, upload" }
How do I find a string (and some lines before and after) in a huge file by terminal? I want to display three or four lines before and after a certain string in a really huge file, which I can' topen with vi. How is this done? I tryed grep -i -n -r 'mysearchstring' but this only gives me one line. I need some lines before and after to get the context! Thanks! I once have seen a terminal command, that does that, but I forgot and I can't find it again. :/
Use grep with the `-A` (how many lines to display after the match) and `-B` (how man lines to display before the match) parameters: grep -i -n -r -A 4 -B 4 'mysearchstring' file.xml
stackexchange-askubuntu
{ "answer_score": 5, "question_score": 2, "tags": "command line, files, find" }
Active Directory Password Overlap Is there a way to configure active directory so that when a user changes their password their previous password will work for a few hours? Basically want to have a grace period during a password change where both the old and new password will work.
this registry change worked for me <
stackexchange-serverfault
{ "answer_score": 1, "question_score": 2, "tags": "active directory, ldap" }
What is the Russian diminutive of mouse? Just a simple question as I am not sure of the right form. What is the Russian diminutive of mouse? _мышонок_ ?
Well, "мышонок" is a baby mouse so you were close, but strictly speaking diminutive is `мышка` which is a small mouse.
stackexchange-russian
{ "answer_score": 6, "question_score": 2, "tags": "выбор имени" }
PHP QR Code script - No GD2 Library I have been googling with no luck. I am searching for a php script to create and display QR Codes that doesn't require the GD2 Library. Can anyone point me in the right direction? Thanks
You can use the Google Charts API: < Use an `img` element, with its `src` attribute in a particular format: <img src=" /> which produces: ![]( The `chs` is the chart size, in this example 150px by 150px; the `cht` is the chart type, in this case `qr` and the `chl` is the chart's text to be encoded in url-encoded format.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php" }
P4V not showing edited stream mappings in workspace view This has been a constant frustration when transitioning from git. Sometimes when scoping my stream I import a folder then find that I will need to edit it. So after removing the folder path from my mapping it disappears but when I try to re-add it as a share, the mappings are correct but the folder will not populate in my workspace. I have combed through Perforce terrible documentation to come up with no solution. After I add a mapping what am I missing to get that to populate? I suspect it is not branching the files I have added but don't really know. How can I get the added folders to show up? **Summary:** changing `import //dev/root_fld/fld_A` to `share //dev/root_fld/fld_A` in stream mapping updates the workspace but no folder appears.
Do a merge from the parent stream. This will pick up all changes from the parent that aren't yet reflected in the current stream, including the files that exist in the parent but haven't yet been branched. (Do an "automatic resolve" to automatically accept all the branched files -- when you do a merge you have the option to "ignore" them also but you probably don't want to do that!)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "perforce, p4v, perforce stream" }
How do you get the node which contains a certain attribute in Firebase? For example - How to get the node `-L1BchvA8NaQ9Yh7CjS_` which matches email = `tomcruise@firebasemyapp.com`? when the database looks like { "-L1BchvA8NaQ9Yh7CjS_" : { "createdAt" : 1514187972592, "displayName" : "tom cruise", "email" : "tomcruise@firebasemyapp.com", "firstName" : "tom", "lastName" : "cruise", "profileLink" : " "status" : "happy christmas" }, "-L1CcUEBOECrJJozlHJv" : { "createdAt" : 1514204689673, "displayName" : "Robert John Downey Jr", "email" : "robertjohndowneyjr@firebasemyapp.com", "firstName" : "Rober John", "lastName" : "Downey Jr", "profileLink" : " "status" : "happy christmas" }, } **_Edit:-_** _I am using`react-native.js`._
You didn't mention what language you're using, but I'll answer in javascript and it shouldn't be difficult to change into a different language. var database = firebase.database(); var rootRef = database.ref(); rootRef.orderByChild('email') .equalTo('tomcruise@firebasemyapp.com') .on('child_added') .then(function(snapshot){ var result = snapshot.val(); //Do what you want with the result });
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "firebase, firebase realtime database" }
What is the value of bessel functions at 0? I would like to know what the value of the bessel functions of the first kind and the modified bessel of the first kind is at 0. I think for order 0 they are 1 and for orders greater than 0 they are 0. ie $J_0 (0) = 1$ and $J_v(0) = 0$ for $v$ > 0 $I_0 (0) = 1$ and $I_v(0) = 0$ for $v$ > 0 Is the above correct?
The Bessel and modified Bessel of the first kind can be expressed in series form as \begin{align} J_{\nu}(x) &= \sum_{k=0}^{\infty} \frac{(-1)^{k}}{k! (\nu + k)!} \left( \frac{x}{2} \right)^{2k+\nu} \end{align} and \begin{align} I_{\nu}(x) &= \sum_{k=0}^{\infty} \frac{1}{k! (\nu + k)!} \left( \frac{x}{2} \right)^{2k+\nu}. \end{align} The first term of each is \begin{align} J_{\nu}(x) &= \left( \frac{x}{2} \right)^{\nu} + \cdots \\\ I_{\nu}(x) &= \left( \frac{x}{2} \right)^{\nu} + \cdots \end{align} Since $0^{\nu} = 0$ for $\nu \geq 0$ and $0^{0}= 1$ for $\nu = 0$ then it is evident that $J_{0}(0) = 1$ and $J_{\nu}(0) = 0$ for $\nu \geq 0$. Applying the same to the modified function yields the similar result.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "special functions" }
Why are names abbreviated in certain books? When reading certain books I will encounter names of places or people that have been abbreviated. An example is in Catherine Hutter's translation of Goethe's "The Sorrows of Young Werther": > A few days ago I met a man called V., an ingenuous fellow with a very pleasant face. Why is this done?
Actually it's not a matter of translation. I've checked the Italian version and the original German version (it should be the second entry), and they both had it abbreviated. So they just took it _as is_ from the original work.
stackexchange-english
{ "answer_score": 8, "question_score": 2, "tags": "names, translation" }
Issues with nginx autoindex I am trying to set up nginx so that a certain url produces the directory index of a certain directory on my server. Currently this is what my default.conf looks like. location / { root /usr/share/nginx/html; index index.html index.htm; } location /files/ { root /home/myfiles/Downloads; autoindex on; } However when I try to go to mysite.com/files/ or mysite.com/files I get a 403 Forbidden error. Looking into the error log I saw 2012/01/08 16:23:18 [error] 17619#0: *1 "/home/myfiles/Downloads/files/index.html" is forbidden (13: Permission denied), client: some.ip.addr.ess, server: _, request: "GET /files/ HTTP/1.1", I don't want it to search for files/index.html, I just want the directory index of Downloads. What do I need to change to make things work this way?
Check whether Nginx has _execute_ permissions for the all the directories in the parent directory tree. In your case, Nginx should have execute permissions for `/`, `/home`, `/home/myfiles`, `/home/myfiles/Downloads` or else Nginx cannot chdir to those directories. An easy way to check this is to run `namei -l /home/myfiles/Downloads`.
stackexchange-serverfault
{ "answer_score": 8, "question_score": 6, "tags": "nginx, web server, configuration" }
When will session be expired? I set session timeout to be 5 minutes in web.xml. And once session expired sessionDestroyed() will be executed. But I want session to be alive as long as browser window is still there. So in each JSP page there is a piece of JavaScript code that visits an image on the server every 100 seconds. Basic idea regarding this part can be found at < However, the sessionDestroyed() will still be executed in 5 minutes. Here is my question, why sessionTimeout event is triggered even though I keep visiting it every 100 seconds?
Using firebug, open the net tab and watch for the javascript request. You should be receiving `HTTP 200` for each image GET, and each url should have random numbers appended to the end. You should probably just use a timestamp, rather than random numbers, as random numbers might eventually repeat and log the user out. Do you have an example page where this is happening?
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "jsp, session timeout" }
Disabling autoscaling when the text inside gets bigger than the object in Dia (diagrams editor)? When the text gets longer than, for instance, a circle. It just scales the circle. Is there any way to make the text go to the next line? !enter image description here !enter image description here
I think the answer is no. You'll have to keep pressing _Enter_.
stackexchange-askubuntu
{ "answer_score": 1, "question_score": 2, "tags": "graphics" }
Setup flask application for test, stage, prod environments So I have a requirement in which I have a flask app with multiple python files. Each file has some variables like API_URL, DEVICE_CONTEXT etc. which will be common in all python files. These variables will be decided by the type of environment i.e. test or stage or prod. So based on the environment mode, I need to populate the variables in each of the python files for my flask app. Please can someone tell me what is the standard way to do this.
More or less native way for Flask to configure enviroment is to use app.config variable in the following way: app = Flask(__name__) app.config.from_envvar('SOME_SYSTEM_ENVIROMENT_VARIABLE') api_url = app.config['API_URL'] #access to any parameter Where SOME_SYSTEM_ENVIROMENT_VARIABLE point to the file with a config that represents your environment (testing, prod et.c.). This file is written in the fashion: API_URL = ' For each of your environment you have to define separate config file and setup enviroment variable before running Flask. There are also several other ways to config the enviroment, you can read this about them.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, flask, dockerfile" }
Random Distorted / Garbled Sound In Windows XP I have laptop **Pavilion dv5282** and sometimes sound gets garbled / distorted. Listen to this sound file. Note that this happens only when music/video is playing, i mean only when there should be any sound coming off i.e sound card not idle. I had this problem in the beginning when i purchased laptop, but as a few years passed by, problem disappeared. 2 weeks ago i formatted and reinstalled Windows XP and now this problem came up again. Should i put headphones on, or listen through built-in speakers, problem is still there which should indicate that the problem is with sound card or drivers. When i am watching online video, the problem happens, but i have noticed that if i start playing music in Winamp, the problem disappears, until i stop music from playing. Mostly i have noticed this problem mostly occurs after **Stand By** mode.What should i do to fix this problem? Thanks.
In XP go to Control Panel... Performance and Maintenance... System... Hardware...Device Manager... Click on the IDE ATA/ATAPI Controllers to see a list of your Primary and Secondary Channels. Right click on each and select Properties... Under the Advanced Settings check to see if the Transfer mode is set to DMA if available and that the Current Transfer Mode is NOT PIO. If it is PIO Right click the drive channel in the device list and click Uninstall! This might seem a LITTLE RADICAL, but it will fix the problem. After you have uninstalled the drive channel, Windows will want to Restart your computer. During that time, it will reset to a DMA setting in most cases. If it does not, then you are stuck with PIO. I think that my DMA problem was created when I installed a second hard drive. Oddly the Primary was PIO and the newer drive was already set to DMA. Give it a try! It worked wonders for my sound and the darn thing runs a little faster too!
stackexchange-superuser
{ "answer_score": 2, "question_score": 2, "tags": "laptop, audio, hp pavilion, distortion" }
Did Yoda live on a hill? I had the following dialogue with my mother this morning, which took an unexpected turn > Me: All this time gone by and only now do I find out that Yoda has a surname, it's Layheehoo > Her: Oh, that's funny because he lives on a hill Now, my mother has always been a bit of a left-handed monkey-wrench, but did she just make this up off the top of her head, as she does with many things, or **is there any evidence that Yoda did actually live on a hill?**
I believe her reply was just an addition to your (funny!) joke, and not based on anything in the movies. In your joke, you say that Yoda's full name is pronounced as though he's yodeling. Yodeling comes from the Alps, which are mountainous. Your mom quickly made this association, and said "he lives on a hill". Hill = Alps = birthplace of yodeling . _And that, readers, is how I ruin humor through analysis. :-)_
stackexchange-movies
{ "answer_score": 11, "question_score": -10, "tags": "character, star wars" }
Recycle abandoned question? Somebody has already asked/described the same question/problem I have. But since he does not provide any details, he ends up with comments requesting details and no answers. Then the OP abandons the question. Should I a) Open a new question with the same title? b) Edit his question and provide the details even so I do not know if for his scenario the details would have been different?
If the old question lacks sufficient information to diagnose the problem, you should vote (or flag) to close it as off-topic with a close reason of: > This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself. If your question is fundamentally the same, be sure to include enough information to make it answerable, and feel free to ask away. It is also helpful in those circumstances to link to the existing question in a comment to explain the reasoning. In this case you may want to link to this question on meta as well for anyone who wants further discussion.
stackexchange-meta_stackoverflow
{ "answer_score": 9, "question_score": 14, "tags": "discussion, edits, old questions" }
Angular - Bold Search Term in Results ng-repeat I have a company search page where I pass in the search term "test" and it returns an array of objects [{CompanyName: 'Test Company', Description: 'This is a test description.'}] I have an ng-repeat that displays these in a table <table> <tr ng-repeat="company in companies"> <td>{{company.CompanyName}}</td> <td>{{company.Description}}</td> </tr> </table> I want to bold the search term in each of the results. <b>Test</b> Company | This is a <b>test</b> description. But the only posts I can find on this have to do with filtering which I don't want to do. I assume I have to use a directive, but the specifics are what allude me here. I can't seem to put all the pieces together to make this work the way I want. Any help would be appreciated. Thanks! -Jim
Thanks to @kanchirk, I've figured it out. I'm still new to angular, but with your suggested post I got it. What I had read is that I had to pass in $sce as a "dependency injection," but I thought passing it as a variable in the function was doing that. Once I figured that out how wrong I was, it worked like a charm. .controller("SearchCtrl", ['$scope', '$sce', function ($scope, $sce) { $scope.boldText = function (text) { var htmlText; var regex = RegExp($scope.textField, 'gi') var replacement = '<strong>$&</strong>'; htmlText = $sce.trustAsHtml(text.replace(regex, replacement)); return htmlText; }; }]); Along with: <span ng-bind-html="boldText(company.Keywords)"></span> Thanks to all for their help and suggestions. I really appreciate it.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "angularjs, angularjs ng repeat" }
Scala: issues using functions as first class objects I need to have a collection of generic functions, but I can't get it done in the way I like. I created a List[(Any)=>Unit] but as soon as I try to insert a function, for example a String=>Unit I get an error. How could I declare a generic function collection that does not consider parameter and return values types?
Just to finish of `@Moritz`'s answer, you need to choose type argument for `T1` that is a subtype of the input type of every function in the list. `Nothing` fits the bill -- it is a subtype of every type. scala> val l: List[Nothing => Any] = List((b: String) => b, (a: Int) => a) l: List[(Nothing) => Any] = List(<function1>, <function1>) An existential type also works: scala> val l: List[_ => _] = List((b: String) => b, (a: Int) => a) l: List[Function1[_, _]] = List(<function1>, <function1>)
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 5, "tags": "scala, function, contravariance" }
How to set a default file manager for qt's app? I am running on ubuntu with awesomeWM which does not have specific file manager. When I launch vlc or any other Qt app and try to open a file from there, it does segfault after the following error message : <application_name>/kdeui (KIconLoader): Error: standard icon theme "oxygen" not found! Do you know how to set a specific file manager for Qt apps and why it's expecting a kde part one ? Basically, how does it work ? Why are only GTK's app able to open a file manager ? Is there a lib missing for Qt ? Do they both have their own default file manager ?
Problem solved by uninstalling the following packages : kdelibs5-data kde-style-qtcurve sudo apt-get remove kdelibs5-data kde-style-qtcurve
stackexchange-askubuntu
{ "answer_score": 2, "question_score": 1, "tags": "qt, filemanager, awesome" }
friendly_id generate slug with ID I am trying to use the friendly_id gem to generate a slug in the format of "#{id}-#{title}" It looks like friendly_id uses before_save, and won't have access to the ID attribute. Is there a work around for this ? # Permalinks #----------------------------------------------------------------------------- extend FriendlyId friendly_id :id_and_title, :use => :slugged def id_and_title "#{id} #{title}" end
Instead of using friendly_id for this, you could override `to_param` in your model, to include the title class YourModel < ActiveRecord::Base def to_param "#{id} #{title}".parameterize end end This should have the effect you're after without having to use friendly_id.
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 5, "tags": "ruby on rails, friendly id" }
tkinter: my scrollbar hides some characters I have a the main window in my program as a Text widget, with a vertical scrollbar on the right side, along all its height - with the usual code: yscrollbar=Scrollbar(mytext, orient=VERTICAL, command=mytext.yview) mytext["yscrollcommand"]=yscrollbar.set It is just annoying that when I insert/input text, the last 1-2 characters before the line returns are hidden by the scrollbar. There is some easy way to tell the text widget to return the line before hitting the scrollbar? PS the main window is user resizable, so I'm looking for some general solution...
Based on your response to a question, the problem is that you are placing the scrollbar _inside_ the text widget rather than _alongside_ it. The solution is to give both the text widget and the scrollbar the same parent. If you want the visual effect of the scrollbar being in the text widget, create a frame and give it a borderwidth of 1 and a relief of "sunken". Then, give your text widget a borderwidth of zero. Place both the text widget and the scrollbar in this frame and the scrollbar will have the appearance of being inside the text widget.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "tkinter, scrollbar" }
Understanding the array of objects TwoDShape shapes[] = new TwoDShape[2]; shapes[0] = new Triangle("outlined",8.0,12.0); shapes[1] = new Rectangle(10); There is a superclass which is TwoDShape and there are subclasses of it.(Triangle , Rectangle vs.) I understand well that superclass reference can refer to subclass object.Yet , I couldn't understand what is happening in the above.Did we create a object which is `shapes` ? I know , arrays are objects.(I'm not sure whether it is relevant or not .. ) Could you explain the logic of these statements ?
Arrays are objects. You created an array object. The array can hold references to other objects of its type. And when you assign individual elements of the array like this, shapes[0] = new Triangle("outlined",8.0,12.0); shapes[1] = new Rectangle(10); the objects are assigned to the allocated index in the array. This is possible because a reference of _Super_ Type can hold an object of _Sub_ Type. Here is a brief tutorial on Arrays. * * * Hope this Helps!
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "java" }
How to handle exception in java Im working on spring mvc app. My problem is when I call delete method in dao by controller class, exception is not handle in dao. but if I use try catch around calling method in controller it'll catch the error. controller class method: customerDao.delete(id); Rapository class: public void delete(long id) { try{ em.remove(em.find(id)); } catch(Exception e) { //not come to here } } If I use try catch around "`customerDao.delete(id);`" handle error. Why I cant handle exception in dao class. Note : Exception thrown is child record found unexpectedrollbackexception
EntityManager.remove does nothing immediately - the transaction commit forces JPA to flush its statements to the database, which is when you will get exceptions. If you want to handle the exception in your DAO, add in em.flush(); within the try block. This will force the statement to the database and throw any exceptions immediately.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "java, spring, jpa" }
OData services with Elastic search I am new to OData services.I have written a query to retrieve the specific field with null values.I build the query in OData and pass it on to elastic search to retrieve data.But the query seems to be not working. The query is as follows: $filter=assignedToEM eq null. I have also tried giving as: $filter=assignedToEM eq 'null' The query has been built as : { "from" : 0, "size" : 15, "query":{ "bool" : { "must_not" : { "term" : { "assignedToEM" : "null" } } } } } In elastic search schema,The not_null value for assignedToEM is given as "_null_". It would be really helpful if i get a solution for this as soon as possible. Thanks.
One way to achieve this would be to create a `query_string` query with the special `_missing_` field name instead, like this: { "from": 0, "size": 15, "query": { "query_string": { "query": "_missing_:assignedToEM" } } } Or what should also work is to use the `NOT` operator like this: { "from": 0, "size": 15, "query": { "query_string": { "query": "NOT(assignedToEM:*)" } } }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "elasticsearch, odata" }
Running a script before the page is displayed I've built a site that does a bunch of calculations as the page loads (basically it determines the users screen size, then assigns all of the page images sizes and positions and applies them). The problem I am having is on a slower connection, this is visible (all of the images will start in the corner, then resize and reposition). This isn't a huge deal, but it's kind of an eyesore. I'm using jQuery to do this, and all the calculations are happening on `$(document).ready`, is there someway to do this before then? Or should I use a preloader? What's a good one (`queryLoader` wasn't working for me, and all the other ones I can find are all just for preloading images). Any suggestions would be much appreciated!
If you're just worried about the images, how about styling them to be invisible (display: none) until after they've been repositioned?
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "javascript, jquery, css, jquery events" }
Geometrical progression from 1 to $\sqrt5$ to 3 by arithmetics How do you formulate arithmetically this pretty simple Euclid geometric progression from one to three via square root of 5? ![Square root of 5 progression]( GK = 1, AE = $\sqrt5$, GH = 3 but what is the equation behind the last line?
The two triangles $AIH$ ( $I$ is the intersection of $GH$ and $AE$) and $AKE$ are similar and so $${IH\over AI}={AE\over AK}$$ We have $AE=\sqrt{5}$, $AK=GK=1$ and finally $AI={AE\over 2}={\sqrt{5}\over 2}$ and $GI={AK\over 2}={1\over 2}$. We deduce $IH={5\over 2}$ and so $$\begin{align} GH&=IH+GI\\\&={5\over 2}+{1\over 2}\\\&=3\end{align}$$
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "geometry, irrational numbers, geometric progressions" }
Messing up Jcrop size I'm using Jcrop in a project I'm building. The site allows users to upload a profile photo and crop it with an aspect ratio that fits where I'm displaying the photo, fx. forum posts, tagwall posts etc. However, since Jcrop is sending the crop coordinates as POST variables, I'm thinking that one might be able to mess with the cropping size using something like Tamper Data to modify the request sent to the server after selecting the part of the photo that they want. How would you go about this and ensure that the photos are showing up correctly?
Okay, I got this sorted out now.. Now I'm just checking if the height and width sent by Jcrop fits the aspect ratio I want! In case anyone else needs this: function GCD($a, $b) { while ($b != 0) { $remainder = $a % $b; $a = $b; $b = $remainder; } $a = abs($a); return $a; } $a = $_POST['w']; // width $b = $_POST['h']; // height $gcd = GCD($a, $b); $a = $a / $gcd; $b = $b / $gcd; $ratio = $a . ":" . $b;
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "resize, photo, crop, jcrop" }
How can I obtain Items on short ledges? In Star Wars Dark Forces, how can you get items located on short ledges? I've recently acquired an old copy of the game and I'm playing it on DOS box. From within the first level and the first 5 minutes of the game, I've spotted multiple items on short ledges, that are too tall to be steps, but are short enough to look like something you can jump on. To my knowledge, jumping isn't possible. How can I get items like the one below? !How do I get that item?
Jumping is very possible in **Dark Forces** and required to get through many parts of the game. `X` is the default jump button on the keyboard.
stackexchange-gaming
{ "answer_score": 4, "question_score": 4, "tags": "star wars dark forces" }
Is it possible to apply a texture inside a GL_LINE_LOOP? I am creating a game using Box2D and OpenGL ES 1.1. I am taking the `b2PolygonShape` vertices and converting them into an OpenGL ES 1.1 `GL_LINE_LOOP`. The debugging view looks great, but now I want to apply textures to the **inside** of the line loop. Is this possible? I used line loop instead of triangles because I am not sure how to handle complex polygons using triangles.
No. Only rendered primitives get rasterized and shaded, and when you render using `GL_LINE_LOOP` your primitives are just the lines themselves, not the area enclosed by the lines. If you want to rasterize and shade the area within the line, you have to render using a solid primitive like GL_TRIANGLES. If you have complex polygons you will first need to break them down into triangles using some kind of triangulation technique (you can also search this site for other questions about polygon triangulation if you get stuck).
stackexchange-gamedev
{ "answer_score": 6, "question_score": 4, "tags": "box2d, opengl es" }
Модификация DOM дерева Суть задачи такая, посреди страницы будет `div` блок, в котором c абсолютным позиционированием должны появляться кнопочки. Такая проблема, не могу поместить генерируемые DOM элементы в этот самый div блок. Надо чтобы генерируемые скриптом элементы помещались в `<div id="menu222"></div>` html <input type="button" onclick="NewTeg()" value="Добавить кнопку"> <div id="menu222"> </div> JS function NewTeg() { var d=document.createElement('div'); NUM = (!self.NUM) ? 1 : ++NUM; d.style.textAlign = "center"; d.style.padding = "8px"; d.style.color = "#fff"; d.style.borderRadius ='5px'; d.style.background='#6492cb'; d.style.position='absolute'; d.id ="Dialog" + NUM; d.className = ('drag'); d.innerHTML = NUM; document.body.appendChild(d); }
Вы добавляете в `body` вот этой строчкой: `document.body.appendChild(d);`, а нужно выбрать ваш `div` `var box = document.getElementById('menu222')`, а уже для него добавлять ваши элементы `box.appendChild(d);`
stackexchange-ru_stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, html, dom" }
Error after running flutter doctor : Unable to locate Android SDK I got these errors after installing flutter then running flutter doctor to check if the installation succeeded, Although I've installed both Android Studio and Android SDK in Android Studio's installation progress steps with no issues at all, what do I have to do now? !Click here to show the image!
If you're using android studio, try these steps : 1. Click Tools > SDK Manager. 2. In the SDK Platforms tab, select Android 10 (29). 3. In the SDK Tools tab, select Android SDK Build-Tools 29 (or higher). 4. Click OK to begin install. In case if above steps don't solve your problem then try updating the SDK path flutter config --android-sdk <path-to-your-android-sdk-path> Note: path must be enclosed within double quotes "C:\Users\username\AppData\Local\Android\Sdk"
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "flutter, android studio, sdk, flutter test" }
Fastest way to create column in pandas based on multiple conditions I'm currently using this function: def age_groupf(row): if row['Age'] <= 19: val = '15-19' elif row['Age'] <= 24: val = '20-24' elif row['Age'] <= 29: val = '25-29' elif row['Age'] <= 34: val = '30-34' elif row['Age'] <= 39: val = '35-39' elif row['Age'] <= 44: val = '40-44' elif row['Age'] <= 49: val = '45-49' elif row['Age'] <= 54: val = '50-54' elif row['Age'] <= 59: val = '55-59' else: val = '60 and more' return val to generate AGE-GROUP fields by calling: DF['AGE-GROUP'] = DF.apply(age_groupf, axis=1) seems like it's working but it's slow. I have multiple 100MB TXT files and I need this to be faster.
Use `pandas.cut` with defined `bins` and `labels`. For example: bins = [15, 20, 25, 30, 35, 40, 45, 50, 55, 60, np.inf] labels = [f'{x}-{y-1}' if y!=np.inf else f'{x} and more' for x, y in zip(bins[::], bins[1::])] pd.cut(df['Age'], bins=bins, labels=labels)
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "python 3.x, pandas" }
insert ... returning where X hi i have an issue im trying to solve using the following to do a insert statement begin; with t1 as (values (2),(3),(4)) ,in1 as (insert into table123 (id,val,num) select nextval('table123_id_seq'),t1.val,42 from t1 on conflict do nothing returning *) ,ins2 as (insert into table456 (id,num,fkey_id) select nextval('table234_id_seq'),333, (select table123.id from table123 where val = 2) from in1 on conflict do nothing returning *) ;commit; what I get is 3 entries into table456 where I want only one is there a clever way to do returning where X or something similar to avoid the duplication? currently i workround just divide the insert through 2 queries ins1a with val=2 and ins1b with t1.v
I hope this is what you are looking for begin; with t1(val) as (values (2),(3),(4)) ,in1 as (insert into table123 (id,val,num) select nextval('table123seq'),t1.val,42 from t1 on conflict do nothing returning *) ,ins2 as (insert into table456 (id,num,fkey_id) select nextval('table456seq'),333, in1.id from in1 where in1.val = 2 on conflict do nothing returning *) commit;
stackexchange-dba
{ "answer_score": 1, "question_score": 1, "tags": "postgresql" }
Is TFS exclusive checkout possible for one project only? At first I want to apologize because it's for sure a silly question, but I'm not an administrator but a software developer. As far as I know there's an option in TFS named > Check out - Prevent other users from checking out and checking in I want to ask about a scope of this setting. Is it possible to turn it on/off for a single project or only for a whole server?
The setting is configured per Team Project and cant be set at the server level. However if you use local workspaces t is ignored as the client does not tell the server what is checked out.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "tfs" }
“Class Not Found” during SonarQube analyse I have many errors with sonarqube analyse in the Jenkins job with the analyse success [ERROR] [14:36:44.124] Class not found: org.joda.convert.FromString [ERROR] [14:36:44.126] Class not found: org.joda.convert.ToString [ERROR] [14:34:42.441] Class not found: org.apache.commons.logging.Log [ERROR] [14:34:42.724] Class not found: org.apache.oro.text.perl.Perl5Util [ERROR] [14:34:31.442] Class not found: io.swagger.annotations.ApiModel [ERROR] [14:34:31.442] Class not found: io.swagger.annotations.ApiModelProperty [ERROR] [14:28:37.756] Class not found: org.apache.commons.logging.Log [ERROR] [14:28:40.030] Class not found: org.apache.oro.text.perl.Perl5Util SonareQube : 5.1.2 sonarQube jenkins plugin : 2.6 JDK : 1.7 Any help please thanks
Add the following dependency to your pom <dependency> <groupId>org.joda</groupId> <artifactId>joda-convert</artifactId> <version>1.8.1</version> <scope>provided</scope> </dependency>
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 15, "tags": "jenkins, sonarqube, sonarqube5.1.2" }
Using beautifulsoup to extract data from html content - HTML Parsing The contents of my script using beautifulsoup library is as follows: <meta content="Free" itemprop="price" /> and <div class="content" itemprop="datePublished">November 4, 2013</div> I would want to pull the words Free and November 4, 2013 from that output. Will using a Regex help or does beautifulsoup has any such attributes that will pull out this directly? Here is the code I used below: from BeautifulSoup import BeautifulSoup import urllib import re pageFile = urllib.urlopen(" pageHtml = pageFile.read() pageFile.close() soup = BeautifulSoup("".join(pageHtml)) item = soup.find("meta", {"itemprop":"price"}) print item items = soup.find("div",{"itemprop":"datePublished"}) print items
Ok got it! Just access the values by the following method(for the above case): from BeautifulSoup import BeautifulSoup import urllib pageFile = urllib.urlopen(" pageHtml = pageFile.read() pageFile.close() soup = BeautifulSoup("".join(pageHtml)) item = soup.find("meta", {"itemprop":"price"}) # meta content="Free" itemprop="price" print item['content'] items = soup.find("div",{"itemprop":"datePublished"}) print items.string No need to add regex. Just a read up through the documentation would help.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "regex, python 2.7, html parsing, beautifulsoup" }
Origins of the word "terrible" What are the origins of the word "terrible". Do the words "terror" or "terrific" come from the same roots? I am curious since I believe the word "terrible" can be used to mean "great" in French.
Both _terrible_ and _terrific_ go back, through French and Latin to Proto Indo European roots meaning to shiver. The origin is self explanatory: extreme fear being well known to provoke shivering. To these two you can therefore add _tremor_ and _tremble_. In English "terrible" and "terrific" are antonyms. _Terrific_ means exceptionally good and on the contrary, _terrible_ means exceptionally bad. In French however, _terrific_ does not exist and _terrible_ has both significations. Only the context, common sense or the status of the speaker will tell you which meaning to choose from. If one says "c'est pas _terrible_ ", that will mean below average. If a youngster says "this singer is _terrible_ ", that has to be understood as appreciative. In "Ivan le terrible" though, the meaning is obviously not "the Great".
stackexchange-english
{ "answer_score": 6, "question_score": 5, "tags": "etymology, adjectives" }
Immediate lookup of value in a hash table defined as a literal What is the shortest and nicest way to have a hash table literal and instantly look up a value in it? e.g. I was expecting something like $city = @{"30328" = "Atlanta"; "60608" = "Chicago"} [$zipCode] but that ends with: > Unexpected token '[$zipCode]' in expression or statement.
Just remove the space: $city = @{"30328" = "Atlanta"; "60608" = "Chicago"}[$zipCode] or $city = @{"30328" = "Atlanta"; "60608" = "Chicago"}.$zipCode
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "powershell, hashtable" }
How to declare a weakSelf object in iOS What's the difference between: `__weak __typeof(&*self)weakSelf = self` and `__weak __typeof(self)weakSelf = self` anyone know this?
Use 0xced's answer: > In the latest clang version Apple clang version 4.0 (tags/Apple/clang-421.1.48) (based on LLVM 3.1svn), i.e. Xcode 4.4+, the `__typeof__((__typeof__(self))self)` trick is not necessary anymore. The `__weak typeof(self) bself = self;` line will compile just fine. <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ios, block" }
boost::lockfree::queue is eating up my CPU So I wrote a multi-thread program using boost::lockfree::queue, and the code is pretty much the same as the given example < Well, I have 4 queues and the data is a struct rather than int. The problem is that my program eats up 95% of my cpu when running and it's super slow. After a little investigation I found out that boost::lockfree::queue::pop takes 80% of the cpu usage, which isn't surprising because of these two loops while (!done) { while (queue.pop(value)) ++consumer_count; } Is there anything I can do to reduce the cpu usage, or should I upgrade my CPUs? I am using boost 1.61, visual studio 2015 on windows 10, btw. Thanks so much
What did you expected? The following piece of code is the same as yours (in terms of eating CPU) int counter = 0; bool condition_1 = false; bool condition_2 = false; while(!condition_1) { while(!condition_2) { ++counter; condition_2 = true; } } What you need, IMHO, is some notification mechanism (e.g. condition_variable), when poll queue. Otherwise, constantly polling it, obviously, eats cpu.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++, multithreading, boost" }
jQuery .each() to add event handler I'm having an issue with the .each() function in jQuery, I'm calling these lines when I successfully getAjax and store it in the data variable: $.each(data, function() { $('#modulesList').append("<p><a href='#'>" + this.code + "</a></p>") .click(function(){ alert($(this)); }); }); The problem is, Once I click on one of my a elements(Which all look fine and have the correct text) I get the alert popping up 5 times for each of them. Iterating from the 0 to 5 objects in the JSON. Anybody know why? Thanks!
Use the `appendTo` method $("<p><a href='#'>" + this.code + "</a></p>").appendTo('#modulesList') .click(function(){ alert($(this)); }) jQuery ~ always returns the main element: now you selector is a dom element and this gets created and returned as a jQuery Object. And to answer you question of why you get 5 alerts . Before you bound the click event to `#modulesList` one for each object in the data array. (Thats why the 5 alerts) You can also store your `<p><a>...` in a variable like so: var pAndATag = $("<p><a href='#'>" + this.code + "</a></p>"); $(modulesList).append(pAndATag); hope you see how this works...
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "jquery, json, iteration, each" }
What's the difference between subtyping and inheritance? In object-oriented programming, I have learned the concept of `subtyping` and `inheritance`. I thought they're the same thing, in the beginning. But I was told that they're totally different. So what's there difference? What's there relationship?
See the following discussions in other stack exchange groups. See discussion in < Also see < However there is some differences of opinion. See Inheritance Is Subtyping as well as Inheritance Is Not Subtyping
stackexchange-cs
{ "answer_score": 2, "question_score": 2, "tags": "object oriented" }
How to programmatically tell if the terminal server service is running How can I programmatically tell if the terminal services service is running and is healthy? I'm creating a .net console application that will check if terminal services are running on a list of computers. I can check the remote registry entry to see if it's enabled, but that doesn't mean it's running. I was thinking of making a socket connection to port 3389, but it doesn't have to be listening on that port either. Is there an elegant way to check for this? Regards,
If you (or, specifically, the user the application runs as) has permission to do so, you could remotely query the SCM of the target machine to determine if the TS service is running. You should be able to use System.ServiceProcess.ServiceController.GetServices(string machineName) to get a list of all the services on the computer, iterate the result to find the Terminal Services service and query its status.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#, .net, terminal, service" }
How to show that the orthogonal complement of this space is empty? This is a question from the back of the book "Functional Analysis, Spectral Theory and Applications" by Einsiedler & Ward. Let the space $ \ell^{2}_c $ the space of all sequences in $ \ell^2 $ with bounded support, with the norm $||.||_2$ in $\ell^2$. The space $V$ is defined as $$V:=\\{ x \in \ell^2_c | \sum_{n\geq 1}\frac{x_n}{n}=0 \\}.$$ I am able to see that this space is closed. It is required now that I show the orthogonal complement of $V$ is empty. The strategy I have tried is to look at arbitrary element $ w $ in the complement of $V$ with support $ \\{ 1, 2, ...,m\\} $ and use the sequence $ (1,1/2,...,1/m) $ and bound $ ||w||_2 $ to zero. But it has not worked so far. Could anyone give me a hint? Thanks a lot!
Assume that $x=(x_1,x_2,x_3,...)\in\ell_c^2$ is orthogonal to all elements of $V$. Then it is orthogonal to $e_n=(0,0,...,0,n,-(n+1),0,...)$, where the first non-zero component is the $n$-th component. From $x\cdot e_1=0$ we get that $x_2=x_1/2$. From $x\cdot e_2=0$ we get that $x_3=2x_2/3=x_1/3$. From $x\cdot e_3=0$ we get that $x_4=3x_3/4=x_1/4$, and so on. Therefore, $x=x_1(1,1/2,1/3,1/4,...)$. But this element is $\ell_c^2$ only for $x_1=0$. Therefore, $x=0$. Hence, the orthogonal complement is $\\{0\\}$. Note: The $0$ vector is always in the orthogonal of a subset of vectors. So, the orthogonal is never empty.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "functional analysis" }
How to easily pull diffs between working dir and remote, skipping local repo? I am looking for a way to show the deltas between my local working directory and the remote, i.e. what other people have pushed + what I have changed since the last time I pulled. In that comparison, the local repository is not of concern to me, so I am not looking to `pull` and then `status`. I am looking more for something like a status of the working directory directly against the remote.
If you run `git fetch`, you'll get all of the updates from the remote without any modifications to your local branches. You can then do `git diff remote/whatever` to get a diff against the current state of the `whatever` branch on `remote`. In case it's useful - you can see all of the remote branches your repository knows about by doing `git branch -a` or `git branch -r`.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "git" }
Is it possible to use d3.js drawn elements as Isotope components Hi we are drawing certain rectangular shapes and with some info in it. Now I would like to use those shapes in different layout offered by isotope (jquery).js. Is it possible for me to do that ? I am left clueless after I searched for a while on the web. Any resources to learn if there are any alternate approaches. Thanks.
If you draw them in separate container svg elements, then the can be positioned using normal css. So you should be able to position them with isotope. If you give the svg elements class names / ids that are expected (the ones you set in the isotope config) by isotope. D3 can also be used to generate divs not just svg. So if you're in need of simple shaps such as rectangles you might get away with just generating divs. Note: This is a very old answer now, It appears that Isotope explicitly excludes svg (thanks Geraldo), I'd recommend using D3js for layout in full or html elements (for isotope) in this case.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "javascript, jquery, d3.js, jquery isotope" }
What are the spawn chances of items from lunchboxes? I have found roughly 50 lunchboxes out in the wasteland now and I have noticed the wide variety of things that spawn from them. The occurrence of anything useful seems very low though. Does anyone know the probability of the items that are eligible to spawn from the lunchboxes?
From the wikia, the possible items you can get are: **Models** > Mr. Gutsy model > > Mr. Handy model > > Protectron model > > Sentry bot model > > Eyebot model **Aid Items** > Nuka Cola > > Ice cold Nuka Cola > > Nuka Cola Quantum > > Ice cold Nuka Cola > > Quantum Nuka > > Cherry Bubblegum > > Noodle cup > > Gum drops > > Dandy Boy Apples **Junk** > Plastic fork > > Plastic knife > > Plastic spoon > > Table knife > > Dinner fork > > Table spoon > > Chalk Baseball > > Economy wonderglue > > Pen Pencil > > Wonderglue > > Ammo **Other** > Fusion core There does not seem to be a proven formula for drop rate of any of these items, but it is worth noting that you are able to reload a save if you get an undesirable item, in order to try to get a better one.
stackexchange-gaming
{ "answer_score": 3, "question_score": 5, "tags": "fallout 4" }
coinbase and accounts[0] - web3.js What is the difference between `web3.eth.coinbase` and `web3.eth.accounts[0]`? Which is the best method to get the current address? I am new to this community and I know this may be a silly question
`web3.eth.accounts[0]` refers to very first address created on an Ethereum node. `web3.eth.coinbase` returns you the coinbase. Coinbase or the Etherbase is the account in which your mining Ether i.e Block Reward will be credited. When there is one account, it is same as accounts[0] but you can also set it for other available address of same node. Related: What is coinbase?
stackexchange-ethereum
{ "answer_score": 4, "question_score": 2, "tags": "web3js, coinbase" }
Multipage React App Deployment I have a multipage React App that I have used the create-react-app tool to make, however it's come to the point where I need to deploy it. The issue I am having is that the Router doesn't seem to work properly when I upload to cPanal, for example /Library will throw a 404, when locally it will just serve the /Library page. Does anyone have any experience with deploying multipage apps with React to cPanal?
This has actually been answered here. cPanal has a .htaccess file but it's hidden. It just needs opening up and editing to include the code from the answer to the question below. Apache web server doesn't allow me to refresh on /about but on localhost its working fine
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, reactjs, deployment" }
How to clear floats properly Css noob here in need of some advice. I have a form that sometimes has 2 divs side-by-side (with input/labels inside/validators). Any further divs after this don't format correctly, not even with a clearfix. [div] [div] --> clear div goes here [ div ] I've fixed it with another Div with css {clear:both;} but this is superfluous. Whats more I've found that IE needs a height on the clear div to honour any margin on the lower div. Is there a better method of dealing with this?
It's tough to see exactly what issue you're having without seeing the code, but hopefully this helps. <div class="one" style="float: left;"> This div is floated left </div> <div class="example1" style="clear: left;">this is text in example 1</div> <!-- notice clear left means this dive will appear after the float, no matter how much stuff is in the float --> if class one is floated left, then example 1 would appear right next to it, but in this case you cleared the float to the left (which is class one) so example 1 appears below your floated object.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "css" }
Placement of decoupling capacitors The recommended power schematics for Atmel's AT32UC3C (figure 6-1) shows the use of 2 decoupling capacitors from the power supply to the digital circuitry, CIN1 and CIN2. These are meant to decouple VDDIO1, VDDIO2, VDDIO3, and VDDIN_5. However, the pin layout of the chip has these pins on different sides of the IC, each with their individual grounds. The IC is 16mm*16mm so it seems to me that the traces connecting all the pins to a common decoupling capacitor set might get quite long (somewhere I found a recommendation that decoupling capacitors should be within 1/2" of the pins). Should I duplicate CIN1/CIN2 for each VDDIOx/GNDIOx combination? Why or why not? If not, which pins should I place the decoupling capacitors closest to, if it even matters?
The designers did a perfect job in the pin assignment: !enter image description here Each of the power pins is right next to a ground pin; you can't get better than that! All you have to do is place the caps on each of the pin pairs, as close as possible to the pins.
stackexchange-electronics
{ "answer_score": 5, "question_score": 2, "tags": "decoupling capacitor" }
FTP error - Filezilla crash when drag and drop a file I am having issues both with filezilla and with gftp. Basically, when I attempt an upload or a download, Filezilla just crashes and closes down, while gftp sometimes says it cannot open the destination folder although what I'm trying to upload is a file. Any suggestion on how to solve this? I'm using Ubuntu 11.10
It's caused by a known (now fixed) bug in wxwidgets. Follow the steps & and the issue should be resolved in no time. First, run the following command (only if curl isn't already installed): sudo apt-get install curl (Everything that follows is mandatory) Then issue this command: curl | sudo apt-key add - Then go to System Settings > Software Sources > "Other Software" tab > click "Add..." and add the following one after the other (or edit /etc/apt/sources.list file): deb natty-wx main deb-src natty-wx main Then run the following commands one after the other: sudo apt-get update sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n That's it! You don't even have to restart your PC. **source:** [detailed instructions here]
stackexchange-askubuntu
{ "answer_score": 3, "question_score": 2, "tags": "ftp, filezilla" }
How to chown a directory so that new files are also owned? (web server) I'm operating my own development web server and have run into a bit of a squeeze. I have my server with disallowed root login and my own account, let's call it bob. I have apache2 virtual host set to make the website at `/var/www/site/public_html/` How can I chown `site/public_html` to bob so that anything bob makes there belongs to him, and so that he can delete files there as well? Thanks in advance (running Ubuntu Server 13.04) I've tried: `chown -R bob:bob *` \- This worked (allowed me to delete files that I was previously unable to, however I want to be sure that this will stick.
Any files made by Bob (on a filesystem that allows ownership of files, most do), will be owned by bob, and because he owns them he will be able to delete them. Of-course, if root makes files which bob can not write, then bob can't delete them. Long story short, the changes will stick - provided bob makes the files.
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "linux, permissions" }
How can I select dates in SQL server to show? Is there a way for me to show dates using a select statement in sql dates from to To? Like if I select the date Jan. 15 2013 as from and Jan. 20, 2013 as To the query will show the following: DATE 2013/01/15 12:00 2013/01/16 12:00 2013/01/16 12:00 2013/01/17 12:00 2013/01/18 12:00 2013/01/19 12:00 2013/01/20 12:00 Is this possible?
A better approach would be to write something as: DECLARE @from DATE, @to DATE; SELECT @from = '2013-01-15' , @to = '2013-01-20'; SELECT DATEADD(DAY, n-1, @from) FROM ( SELECT TOP (DATEDIFF(DAY, @from, @to)+1) ROW_NUMBER() OVER (ORDER BY s1.[object_id]) FROM sys.all_objects AS s1 CROSS JOIN sys.all_objects AS s2 ) AS x(n); Check Demo here.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "sql, sql server" }
SQL injection in Drupal Is this all to stop SQL injection in Drupal? db_query('INSERT INTO {tablename} (field1, field2) VALUES ("%s", "%s")', $field1, $field2);
Is your question "Is this all I need to do to stop SQL injection in Drupal?" The answer is "Almost, but not quite." db_query("INSERT INTO {tablename} (field1, field2) VALUES ('%s', '%s')", $field1, $field2); Single quotes are more standard for quoting values in SQL. Alternately, if you've defined tablename table via hook_schema, you can use drupal_write_record instead, as the other answer states. The advantage of drupal_write_record is that you don't have to deal with any sql, you just do this: $tablename = array('field1' => $field1, 'field2' => $field2); drupal_write_record('tablename', $tablename);
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "drupal, drupal 6" }
Factorization in noetherian domains I changed the title (and the body) of this question page, since user26857 provided a nice answer for my original question in a more general setting. Here's what the accepted answer below provides: > If $m_{1},…,m_{r}$ are distinct maximal ideals of a noetherian integral domain $R$ which is not a field and $m^{e_{1}}_{1}\cdots m^{e_{r}}_{r}=m^{f_{1}}_{1}\cdots m^{f_{r}}_{r}$, then $e_{i}=f_{i}$ for all $i=1,...,r$.
> If $m_1,\dots,m_r$ are distinct maximal ideals of a noetherian integral domain $R$ which is not a field and $m_1^{e_1}\cdots m_r^{e_r}=m_1^{f_1}\cdots m_r^{f_r}$, then $e_i=f_i$ for all $i$. By localizing at $m_i$ we have $m_i^{e_i}R_{m_i}=m_i^{f_i}R_{m_i}$, that is, $(m_iR_{m_i})^{e_i}=(m_iR_{m_i})^{f_i}$, and thus we can reduce the problem to the local case. > Consider $R$ a local noetherian domain which is not a field with maximal ideal $m$ and $m^i=m^j$. Then $i=j$. Suppose $i<j$. Since $m^i=m^j$ we get $m^i=m^{i+1}$ and by Nakayama $m^i=0$. It follows $m=0$, a contradiction.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "abstract algebra, polynomials, commutative algebra, ideals" }
Pull the content out of a page I wanna pull the data from this area "see the red area on the image below" !enter image description here Out to a specific template I have a page template named page.php <div class="contentholder"> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php comments_template( '', false ); ?> <?php endwhile; // end of the loop. ?> <br /> </div> but this just send me a comment field.. i need the text in the page and i need the header
While inside a query loop, this function will output the current posts title: the_title(); This function will output the content: the_content(); What I suspect has happened however is that you are instead calling `get_template_part( 'content', 'page' );` and expecting it to output the content for the page, when what it's actually doing is checking if there's a `content-page.php`, and including it if it's present, if not it checks for `content.php` and includes that, and because neither exist, it's doing nothing, and so you get no content. For more details on what `get_template_part` actually does, look here: < **EDIT*** Working snippet: <?php while ( have_posts() ) : the_post(); ?> <?php the_title(); ?> <?php the_content(); ?> <?php endwhile; // end of the loop. ?>
stackexchange-wordpress
{ "answer_score": 1, "question_score": 1, "tags": "php, cms" }
Let $f : \mathbb{R} \to \mathbb{R}$ be a continuous function and $A \subseteq \mathbb{R}$ Let $f : \mathbb{R} \to \mathbb{R}$ be a continuous function and $A \subseteq \mathbb{R}$ (i) If A is connected, is $f^ {−1} (A)$ so? (ii) If A is compact, is $f^{−1} (A)$ so? (iii) If A is finite, is $f^ {−1} (A)$ so? (iv) If A is bounded, is $f^ {−1} (A)$ so? No, consider $f(x)=(x-1)(x-2), f^{-1}(0)=\\{1,2\\}$, the rest of three can be countered by constant function right?
Your suggested counterexamples are correct. While continuous functions must map connected sets to connected sets, compact sets to compact sets, and finite sets to finite sets, and uniformly continuous functions must map bounded sets to bounded sets, the same does not hold for preimage.
stackexchange-math
{ "answer_score": 3, "question_score": 3, "tags": "general topology" }
Checking connectedness by an associated graph Let $X$ be a topological space with an open cover $\\{U_\alpha\\}$ such that each $U_\alpha$ is connected and nonempty. Form a graph as follows: for each $\alpha$ put a vertex $v_\alpha$. Also $v_\alpha$ and $v_\beta$ is connected by an edge if and only if $U_\alpha \cap U_\beta$ is nonempty. Let $G$ be this associated graph. Is it true that $X$ is connected if and only if $G$ is a connected graph? I see that if $G$ is not connected then so is $X$. But I can't show the converse. Here is the similar question A topological space is path connected if and only if the associated graph is connected, considering path-connectedness instead of connectedness, but I can't get any help from it..
Suppose that $X$ is not connected, that is $X = A\cup B$ where both $A,B$ are open, non-empty and disjoint. That for each $\alpha$ either $U_\alpha\subset A$ or $U_\alpha\subset B$, coz otherwise $U_\alpha = (U_\alpha\cap A)\cup (U_\alpha \cap B)$, which makes $U_\alpha$ not connected. That contradicts existence of $\alpha$ and $\beta$ such that $G$ connects $\alpha$ and $\beta$, while $U_\alpha\subset A$ and $U_\beta \subset B$. I'm bad at set theory, so I hope no fancy induction is needed for the last step.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "general topology, graph theory, connectedness" }
Finding the equation of a solid in terms of x and y when rotating a 2-d function about a line Lets say you have a function: $$f(x) = 3x^4, \quad 0 \leq x \leq 1$$ and we want to revolve it around the x-axis. We can find the volume of the solid created by: $$\pi \int_{0}^{1} (3x^4)^2 dx$$ However, instead of finding the volume of the solid, is there a way to find the **_equation_** of the solid in terms of $x$ and $y$? For example, I believe if $f(x)=x^2$, the result should be $g(x,y)=x^2+y^2$. Any help would be greatly appreciated!
If we have the function $f$ defined on $D \subseteq \mathbb R$ so that $f(x) \ge 0$ for all $x \in D$, revolving its graph about the $x$-axis gives us the points $p = (x,y,z)$ whose distance from the $x$-axis is equal to $f(x)$. Since $f(x) \ge 0$, this happens iff the _squared_ distance from $p$ to the $x$-axis is equal to $f(x)^2$. Thus, the surface of revolution about the $x$-axis consists precisely of those points $(x,y,z)$ so that $x$ is in $D$ and the equation$$ f(x)^2 = y^2 + z^2 $$ holds. If we want $z$ as a function of $x$ and $y$, we can rearrange the above equation to $$ z^2 = f(x)^2 - y^2 $$ which tells us that $z$ will be defined whenever $f(x)^2 - y^2 \ge 0$, and it will have up to two values given by $$ z = \pm \sqrt{f(x)^2 - y^2}$$ So for your example of $f(x) = x^2$, we have the equation $y^2 + z^2 = x^4$, which can also be written as $z = \pm \sqrt{x^4 - y^2}$.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "calculus" }
page_size parameter doesn't work for kloudless service I'm trying to fetch folder's content from Dropbox through kloudless (< I write next query: curl -H 'Authorization: Bearer TOKEN' \ ' but receive the collection of 600 elements instead of 100. What am I doing wrong?
You aren't doing anything wrong. As mentioned in the documentation, the `page_size` parameter is advisory. As such, certain services (like Dropbox) do not currently take that parameter into account and may return a different number of objects than is specified.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "page size, kloudless" }
Tomcat: Accessing java web application without port number i am running my java web application using tomcat server and i am accessing it with the url "//localhost:8080/Authority/" . But i want to access it using "//localhost/Authority/" . Pls help me out...
When the http port is not specifier, it is assumed to be port 80. So your web container must listen on port 80. But on a Unix-like OS, only root can listen to a port number lower that 1024. Anyway; to change the port number, you need to edit tomcat's server.xml file and change the port number of the http <Connector>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "tomcat" }
Полная загрузка страницы (загружается скриптом) Сайт < Дело в том,что он загружается каким-то фрэймворком наверное. И некоторые скрипты несмотря на строчку $(document).ready(function() {} выполняются раньше, чем загрузится ДОМ. Как можно решить эту проблему? На ум приходит только setTimeout, но это ни есть хорошо.
1) Событие **ready** не может (теоретически) срабатывать раньше загрузки dom-дерева. 2) Попробуйте использовать событие **onload** , оно срабатывает позже, когда загружен еще и весь контент (например, картинки).
stackexchange-ru_stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "html, javascript" }
Internationalization and Validation My app has a registration page for new users and I'm trying to carefully support as many languages and locales as possible. One of the rules for their desired username is that it must be alphanumeric, but when I type Japanese characters into that field it never passes validation. Do you know of any good resources on best-practices for this type of issue?
How are you doing your validation? +[NSCharacterSet alphanumericCharacterSet] includes Japanese letter characters.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "objective c, iphone, cocoa touch, internationalization" }
How to populate against foreign keys mongoose? if (req.params) { const val = await userServices.find() .where({ title: req.params.categoryName }) .populate('profileId', null, { stateId: { $in: [`${req.params.stateId}`] }, cityId: { $in: [`${req.params.cityId}`] }, } ); return res.json({ success: true, val }) } Details: Here is the Query for populating profile details, but I want to populate inside foreign keys against `StateId` and `CityId`.
Well you can do it this way actually: .populate({ path: 'profileId', populate: {path:'stateId'} }) .populate({ path: 'profileId', populate: { path: 'cityId'} }); Reference:Deep Populate
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "node.js, mongodb, express, mongoose, mongoose populate" }
How to send huge datapool as response in node.js? In **node.js** application I take a huge datapool (200000 rows) from **MySQL** database. await pool.query(query, binds, function (error, results) { if (error) throw error; res.send(JSON.stringify(results)); }); I think the best way is sending data in chunks and streams instead of everything at once. I tried to use JSONStream package for this task but it's really confused. Can someone show me correct way to send huge datapool as response in node.js by this package?
Here's an example: app.get('/data', (req, res) => { // Make sure to set the correct content type res.set('content-type', 'application/json'); // Stream the results pool.query(query, binds) .stream() .pipe(JSONStream.stringify()) .pipe(res); }); The trick is to call the `.stream()` method on the query, to stream the results, and pipe those results through `JSONStream` to stringify them into a JSON stream, which subsequently gets piped to the response. More info on `mysql` streaming here: * Streaming query rows * Piping results with Streams
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "javascript, node.js, json" }
ClearOS as domain controller I'm attempting to use ClearOS as my Domain Controller for a Windows network with no success. When attempting to join the domain I get this fun error: An error occurred when DNS was queried for the service location (SRV) resource record used to locate a domain controller for domain su.dc. The error was: "No records found for given DNS query." (error code 0x0000251D DNS_INFO_NO_RECORDS) The query was for the SRV record for _ldap._tcp.dc._msdcs.su.dc But when I do an nslookup on _ldap._tcp.dc._msdcs.su.dc I get the address of the ClearOS box. I'm using WinXP Pro to test with. The domain is su.dc. ClearOS is running: DNS and DHCP Any ideas?
Doing an nslookup will by default look for A records. The error says that it is looking for an SRV record. You'll need to ensure that all the SRV records are there. If you need domain controllers why not use Windows servers which were made to be domain controllers.
stackexchange-serverfault
{ "answer_score": 6, "question_score": 1, "tags": "domain name system, domain controller, clearos" }
Can the .git folder be used for backup and restoring? Seeing as git's book says that git keeps, as they call it, a database of all the snapshots of changes, does this mean that I can use `.git` for reliably backing up my code? That is, can I only back up my (local) `.git` directory to a cloud for example, and then if at any point I lose my entire hard disk, presumably I would be able to download the `.git` folder from the backup on my cloud, and from that I could restore all the source code files?
Yes, that would work. You can check this yourself by copying the `.git` folder to another directory, open Terminal / Command Prompt, navigate to that folder and execute git checkout -- * The repository will be completely restored to the last committed version.
stackexchange-superuser
{ "answer_score": 4, "question_score": 2, "tags": "backup, git" }
Sequelize - dateonly vs date format If I store timestamp `1625555827900` in 2 separate fields whose format are `dateonly` and `date`, will there be any difference?
You can not store the unix timestamps in both of the fields as their types are DATEONLY and DATE. Sequelize will through an error DatabaseError [SequelizeDatabaseError]: date/time field value out of range: "1625555827900" First you need to format the date like `Tue Jul 06 2021 07:55:33` or `2021-07-06 07:55:33` in your code. In that case, it will save the complete date `2021-07-06 07:55:33.000000` for DATE field and skip the time part for DATEONLY field `2021-07-06`. Or you can use BIGINT instead if you are intended to store the unix timestamps.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "mysql, node.js, sequelize.js" }
How Do I Show A Live Video Feed On A C# Form? I have a C# Windows Form Application and a live video feed. I need a way to display the live video feed on one of the forms. Does anyone have any ideas? We're using a robot and getting the video feed off a camera attached to it, so we will not be using the internet at all. Thanks!
Check out AForge.Net. Here is a tutorial for pulling webcam data and displaying in a form.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "c#, video streaming" }
Unable to render menu in theme I'm creating a custom theme in Drupal 7 but I'm having trouble getting it to render the menu I'm using the following code in page-front.tpl.php <?php if ($page['main_menu']): ?> <div id="main-menu"><div class="section clearfix"> <?php print render($page['main_menu']); ?> </div></div> But it does not render anything. I have double checked that a menu exists.
$page['main_menu'] is not menu. It's the region with name main_menu. You can put there any block what you want. You can configure blocks on this page admin/structure/block But in the basic drupal themes the main menu can be available in this variable $main_menu in the template page.tpl.php
stackexchange-drupal
{ "answer_score": 1, "question_score": 0, "tags": "routes, theming" }
How to safely decommission Analytics DC in Cassandra? I have a Cassandra cluster with 6 nodes, 3 are in the main Cassandra DC, and 3 are in an Analytics DC. I no longer need the Analytics DC, and I want to decommission it. I want to make sure I am doing it safely, in that I do not want to affect the Cassandra DC or my clients. I have only one keyspace that is replicated across the DC's, and I was planning to use ALTER KEYSPACE to simply remove the replication to the Analytics DC. After that, I'd just terminate the Analytics nodes in ec2. Is this a safe plan?
1) Use `ALTER KEYSPACE` to remove the analytics DC from the `replication` strategy. 2) Use `nodetool decommission` to safely remove those nodes from the cluster (one at a time, ideally). They'll no longer own any data, so they'll have nothing to stream to their neighbors. 3) Terminate the instances.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "cassandra, datastax, datastax enterprise" }
Редактирование UILabel Добрый день. В моем проекте есть UILabel и три кнопки, с помощью которых редактируется содержимое label: - (IBAction)setToOneButton:(id)sender { [_label setText:[NSString stringWithFormat:@"1"]]; } - (IBAction)setToTwoButton:(id)sender { [_label setText:[NSString stringWithFormat:@"2"]]; } - (IBAction)setToThreeButton:(id)sender { [_label setText:[NSString stringWithFormat:@"3"]]; } Но в таком случае редактируется все содержимое label, то есть старое значение удаляется а новое появляется. Хотелось бы, чтобы при нажатии кнопки старый текст в лейбле не удалялся а к нему дописывалась еще одна цифра. Подскажите, пожалуйста, как это сделать. Спасибо за помощь.
Все просто :) NSString stringWithFormat:@"%[@1",_label.text] И так со всеми действиями. Для удаления предудущего символа можно добавить следующию функцию: - (IBAction)removePrevChar:(id)sender { if (_label.text.length > 0) { //будет выполнено если длина _label.text больше чем 0, иначе ничего не надо удалять _label.text = [_label.text substringToIndex:_label.text.length - 1]; } }
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "xcode, ios, objective c" }
what is the most popular mmorpg game that has an out-of-game api? World of Warcraft is off the table, because of the "WOW Glider Lawsuit" of 2008. Also see: Where is Blizzards official World of Warcraft API? Eve Online has an API But, what is the MOST popular (in terms of usership) MMO Game that does allow programmers to develop out-of-game things (like an Android app).
WoW does have an external API with the Armory. It is read only through. Unless you access the pages with a bad browsers, it returns a clear xml structure. According to various blue forums posts, automatic querying of those pages is okay, unless too many requests are sent. The Glider Lawsuit was about a bot that linked to the original game client in memory. It is pretty obvious that bots are bad for business because a) players spent less time paying while leveling up and b) other players get frustrated and may leave.
stackexchange-gamedev
{ "answer_score": 6, "question_score": 3, "tags": "mmo" }
What verb and payload to set an API resource to 301 Moved? Say I have two objects in a RESTful API: /resource/blue /resource/red Now I want to combine the two of them and point them to a new object /resource/orange When I go to /resource/blue or red I want to receive a response like HTTP/1.1 301 Moved Permanently Date: Thu, 10 Mar 2016 21:57:47 GMT Location: /resource/orange So far so good... we can set that pragmatically in Spring based on data in Mongo. But what would be the best RESTful request to make to change my blue resource into a 301 redirect to my new orange resource? Should it be... PUT /resource/blue {"movedto" : "/resource/orange"} Or DELETE /resource/blue {"movedto" : "/resource/orange"} Or something else?
This really looks like a `PUT`, because you're updating the resource (its location), and moving it twice should have no effect (you get the `301`/`303`), because it's already there. If you used a `DELETE` twice on the same resource, the call would try to delete a resource that's no longer there (it's been moved), so it should actually return a `404`. Also, by definition the `DELETE` verb: > SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location. And the location where you're moving the resource is not going to be inaccessible.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "api, rest, redirect" }
MSVC command-line option to remove debug information I have the following simple C++ program in a file called "hw.cpp": #include <stdio.h> int main(int argc, char* args[]) { printf("Hello, world!\n"); return 0; } Compiling with gcc 9.3.0 (Ubuntu), gives the following results: * gcc -g0 hw.cpp -o hw.out (disable debug info) => size is 17k (same if `-g0` is removed) * gcc -g3 hw.cpp -o hw.out (maximum debug info) => size is 44k But the default compile for MSVC (cl version 19.26.28806) outputs a much bigger file: * cl hw.cpp /link /out:hw.exe => size is 101k Why is the MSVC version so big? Is this related to debug information and how do is debug information disabled? The cl.exe compiler options don't have an obvious equivalent for the gcc `-gN` options.
These are the `hw.exe` sizes I am seeing for the combinations of static/dynamic linking of the C runtime vs. debug/release builds for a default 32b compile of your `hw.cpp` with VC++ 2019. debug release static (cl /MTd) 279,040 (cl /MT) 101,888 dynamic (cl /MDd) 10,240 (cl /MD) 8,192 The 32b release build `cl /MD hw.cpp` dynamically linked to VCRUNTIME140.DLL runtime has 8k. The big jump in size with `/MT` comes from statically linking the core C support, stream library etc.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "c++, visual studio, visual studio 2019" }
Exact NOT(Inverse) of CSS Media Query What is the exact "NOT" of the following CSS media query ? @media only screen and (device-width:768px) Just to add, it would mean..All EXCEPT iPAD...OR.....NOT iPAD.. and BTW...I have already tried @media not only screen and (device-width:768px) which does not work..
@media not screen and (device-width:768px) `not` and `only` are mutually exclusive in media queries; `only` is needed only to work around some downrev UAs who implement the HTML4 algorithm for media strings, so when the query starts with `not` the `only` is pointless.
stackexchange-stackoverflow
{ "answer_score": 26, "question_score": 22, "tags": "html, css, w3c, media queries" }
Exclude folders from TrueImage backups Acronis TrueImage 11 Home is advertised to be able to exclude Files _and Folders_ from the backup. But when creating a scheduled backup task it seems to only allow to exclude Files (by extension or name). How and where do I specify to exclude whole folders + subfolders?
Looks like you want to make sure to include the tailing "\" when you're defining your exlude list (in the Files to Exclude screen) in order for it to recognize the entry as a folder and not just a file. Page 34-35 in the TrueImage Manual.
stackexchange-serverfault
{ "answer_score": 3, "question_score": 1, "tags": "backup, acronis, trueimage" }
"find command -mtime 0" not getting the file i expect I am trying to find a file that are 0 days old. Below are the steps I performed to test this $ ls $ ls -ltr total 0 $ touch tmp.txt $ ls -ltr total 0 -rw-r----- 1 tstUser tstUser 0 Feb 28 20:02 tmp.txt $ find * -mtime 0 $ $ find * -mtime -1 tmp.txt $ Why is '-mtime 0' not getting me the file? What is the exact difference between '-mtime 0' and '-mtime -1'? Im sure there must be other ways to find files that are 0 days old in unix, but im curious in understanding how this '-mtime' actually works.
-mtime n File's data was last modified n*24 hours ago. See the comments for -atime to understand how rounding affects the interpretation of file modification times. So, -mtime 0 would be equal to: "File's data was last modified 0 hours ago. While -mtime 1 would be: "File's data was last modified 24 hours ago" Edit: Numeric arguments can be specified as +n for greater than n, -n for less than n, n for exactly n. So I guess -1 would be modified within the last 24 hours, while 1 would be exactly one day.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 7, "tags": "unix" }
Giving variables in a coordinate ring different weights I am reading a book and I am curious about a certain notion. Consider $R = k[x_1,x_2,x_3,x_4,t]$ and let $G = \\{\underbrace{x_1 x_3-x_2^2 + t x_3^2}_{f_1}, \underbrace{x_1 x_4-x_2 x_3 +t x_2^2}_{f_2} \\}$. When $t=0$, we obtain the standard twisted cubic. After imposing the following weights to the variables: $$ wt(x_i)=1 \mbox{ and } wt(t)=0. $$ does this mean I am viewing $t$ as a constant, and would you say $f_1$ and $f_2$ are homogeneous of degree 2, rather than think of it as a mixed degree polynomial? $$ $$ What if I, instead, impose the weights to be $$ wt(x_i)=2 \mbox{ and } wt(t)=1? $$ What is the purpose of giving variables different weights? $$ $$ _Addendum:_ is there a geometric significance to the notion of weights?
Setting different weights to a variable is changing the fact wether a polynomial is homogeneous or not. For a grading you might want to fix a factor $G$ of $\mathbb{Z}^n$ and give your indeterminates weights $g \in G$. After that you can talk about homogeneous elements and wether the ring or a module over it is generated in certain degree. You can also talk about wether a ring homomorphism is one of graded rings or not. For me the main thing that changes is the set of homogeneous prime ideals of a graded ring $S$, the so called ${\rm proj}(S)$. If K is an algebraically closed field and you have a look at the ring $$ S := K[x_0,x_1,x_2,x_3] $$ and take $G =\mathbb{Z}$ and ${\rm deg}(x_i) = 1$ for all $i$, then you get $$ {\rm proj}(S) \cong \mathbb{P}^2. $$ If you take $G = \mathbb{Z}^2$ and set ${\rm deg}(x_0)={\rm deg}(x_1)=(1,0)$ and ${\rm deg}(x_2)={\rm deg}(x_3)=(0,1)$ you get $$ {\rm proj}(S) \cong \mathbb{P}^1 \times \mathbb{P}^1 \not\cong \mathbb{P}^2. $$
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "geometry, algebraic geometry" }
Why do electrons in a conductor not connected to a power source not fly away due to repulsion? Let's assume that a conducting element is kept on a table (to indicate that no power source is connected across its ends). So, all the electrons move in random directions and repel each other. The question I have is _"Why do they not fly away?"_ I think that they don't have enough energy to escape the strong pull of the nucleus which is positively charged. They get that energy when they are connected to a power source i.e. when there is some electromotive force to push them by increasing their energy levels. The latter is what happens in a wire when its ends are connected to the terminals of a cell/battery. Am I thinking about this correctly?
Your answer is not really correct. The electrons bound in atoms don't carry the current. It is true that these electrons don't escape because of this, but I don't think its what the question is asking for given the electrostatics tag. Electrons that carry current in a conductor are free electrons, so I think you should talk about field emission.
stackexchange-physics
{ "answer_score": 1, "question_score": 0, "tags": "electrostatics, electrons, charge" }
How do I fix a car door that is wavy along the edges and has weird textures I am a newbie to Blender and I am making trying to make a car for my second project. I really don't know how I'm going to make the car door look right. It is physically wavy and not straight along it's edges and the window also has flawed texturing. Think coloring outside the lines, that is basically what it looks like. It also has some lump of car door materials on it. Here's the link for the .blend file. < ![Door from the side.]( ![Door from the side in Edit Mode.]( ![Door from the front.](
The waviness seems to be a result of a subsurf modifier. The easiest way to handle this is to simply double up the edges along the border. This should make it appear as a hard edge, eliminating the ripples where the faces are subdivided and averaged into the places you don't want them.
stackexchange-blender
{ "answer_score": 0, "question_score": 0, "tags": "modeling, mesh, materials" }
jQuery get input value after keypress I have the following function: $(document).ready(function() { $("#dSuggest").keypress(function() { var dInput = $('input:text[name=dSuggest]').val(); console.log(dInput); $(".dDimension:contains('" + dInput + "')").css("display","block"); }); }); For some reason, for the first keypress, I'm getting an empty string to the console log.
This is because `keypress` events are fired _before_ the new character is added to the `value` of the element (so the first `keypress` event is fired before the first character is added, while the `value` is still empty). You should use `keyup` instead, which is fired _after_ the character has been added. Note that, if your element `#dSuggest` is the same as `input:text[name=dSuggest]` you can simplify this code considerably (and if it isn't, having an element with a name that is the same as the `id` of another element is not a good idea). $('#dSuggest').keypress(function() { var dInput = this.value; console.log(dInput); $(".dDimension:contains('" + dInput + "')").css("display","block"); });
stackexchange-stackoverflow
{ "answer_score": 174, "question_score": 147, "tags": "jquery, jquery events" }