INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Stop watching the output of a particular program after using watch command? I have come to know that we can use `watch` command to monitor the output of other command and it prints the output every 2 seconds by default, which is really useful. I start to use it to monitor the output of `nvidia-smi`, for example. But now I do not know how to quit the program (stop monitoring the output of `nvidia-smi`). I tried to press `q` and there is no response.
From `man watch`: > By default, watch will run until interrupted. The key words are "until interrupted", which basically can be interpreted as until (but not limited to) the following happening: * The user (you) pressed `CTRL`+`C` in the terminal. * The system restarted. * The process was issued a `kill` request.
stackexchange-unix
{ "answer_score": 8, "question_score": 4, "tags": "linux, watch" }
Changing the text color of Facebook like button I added Facebook like button to my site, but the text color is too dark and the background is black, so it is very hard to read what is says ("xyz people like this"). Can anyone tell me how to fix this? defining some additional class maybe? nothing comes to my mind. Thanks
Facebook button can be set with dark or light background < Just change the color scheme to "dark" and it will fit your dark background.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "html, css, facebook like" }
AWS Glue Crawler does not append data I have created aws crawler which uses classifier to import csv files to data table. Which is working fine. Issue: Every time crawler overwrites old data. I want to keep previous data and append new content of csv files. i.e I have uploaded csv file with 250 records. And when I execute that crawler it populated table with 250 rows. Now If I replace that csv file with some other content then It is overwriting old 250 rows and populate table with latest data only. Can anyone please help me how can I keep old records and append new data. Thank you,
Glue crawler doesn't populate table with rows/records. It simply defines meta information about your data, i.e. infers table schema and location of those files on S3 (or other resources) etc. This means that you need to keep both files on S3 if you want to preserve old records. **Note** , that if you keep new files in the same "folder" on S3 as the old ones, you don't need to re-run crawler, since information required to query those files (e.g. with Athena) had already been define.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "aws glue, aws glue data catalog" }
How to connect CircleCI and AWS? I'm new to CircleCI, and trying to connect CircleCI - terraform - AWS. For security reasons, I enforced MFA for aws cli. In other words, I'm using temporal 24-hour lasting: * aws_access_key_id * aws_secret_access_key * aws_session_token. It's quite tricky to apply circleCI in this situation. What should I do? Should I have to change the above mentioned AWS credentials before every commit?
Your only option is to create an access key with MFA disabled and use it for ciecleci. There is no way around this as MFA code should be entered manually. Also you should configure the AWS credentials as environment variable to your circleci project. Remember, MFA is for people, not for machines
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "amazon web services, terraform, circleci, multi factor authentication" }
how to sync an exchange attribute to on premise AD Object I have a few users with custom attributes. I want to copy the value of these custom attributes and add them to the users ExtensionAttribute property in their AD object. So far I have tried : $CustomAttr1 = get-mailbox $upn | Select CustomAttribute1 Set-ADUser -server Server -identity Identity -Add @{ExtensionAttribute1=$CustomAttr1} The end result is just "@{$CustomAttribute1}" in the actual AD attribute. How can I extract the string value of 'CustomAttribute1' from Exchange and pass it into AD?
The `Select` will filter the resulting object to a have a single property, `CustomAttribute1`. So when you need to set the value, you have to reference the property `$CustomAttr1.CustomAttribute1` to get the value: $CustomAttr1 = get-mailbox $upn | Select CustomAttribute1 Set-ADUser -server Server -identity Identity -Add @{ExtensionAttribute1=$CustomAttr1.CustomAttribute1}
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "powershell, exchange server" }
becomeFirstResponder seems to work only 1st time for shake gesture I'm making my app shake-gesture-compatible by doing this in my UIViewController: - (void)viewWillAppear:(BOOL)animated { [self.view becomeFirstResponder]; [super viewWillAppear:animated]; } The problem is that when I flip to another view (I'm using the "Utility App" template which has a flipside view and a root view controller to manage them both) the shake gesture ceases to work when I come back. I see that the `viewWillAppear` method is called, it just doesn't seem that the view regains first responder status the second time around.
Who knew .. you have to put the call to `becomeFirstResponder` in `viewDidAppear` instead of `viewWillAppear`.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "iphone" }
magento 1.7 : Cannot reindex product_flat_data I get the following error while trying to reindex my magento database.. > Product Flat Data index process unknown error: exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint >violation: 1452 Cannot add or update a child row: a foreign key constraint fails >(`d014505f`., CONSTRAINT >`FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) >REFERENCES `catalog_product_entity` (`e)' in >/www/htdocs/w00f5624/lib/Zend/Db/Statement/Pdo.php:228 How do i fix this??
as stated correctly by Sander, deleted products still present in the product flat table cause this error. Anyway, truncating the whole table will not be necessary. You can find these products by this SQL-query: SELECT pf1.entity_id FROM catalog_product_flat_1 pf1 LEFT JOIN catalog_product_entity p ON pf1.entity_id = p.entity_id WHERE ISNULL( p.entity_id ) You will then have to delete these items, which can be done using this SQL-query: DELETE pf1.* FROM catalog_product_flat_1 pf1 LEFT JOIN catalog_product_entity p ON pf1.entity_id = p.entity_id WHERE ISNULL( p.entity_id ) Taken from here (German): < Ask me if u need more advise.
stackexchange-magento
{ "answer_score": 29, "question_score": 10, "tags": "magento 1.7, sql, error" }
Oracle.EntityFrameworkCore release notes Does anybody know if there's a release notes for EntityFramework Core package? In my case, before upgrading to 2.19.70 version of the package, I would like to know which improvements or feature have been brought to the package. The NuGet.org site has not references to it. Also tried the Oracle Community forum but had no luck. Before upgrading production apps I would appreciate a changelog file or some information about the upgrade. Am I the only one?
I found how to get the changelog of the new Oracle.EntityFrameworkCore 2.19.70. Just **upgrade the package** using nuget and you will be prompted to the Readme.txt of the new package. A website with this readme.txt hosted would be appreciated by Oracle but anyway it was a nice surprise to discover it once installed. I don't share the content of the readme.txt in this answer since I don't want to violate any copyright.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, oracle, .net core, entity framework core, changelog" }
Spring Security: как сделать разделение ролей? Как в Spring сделать разделение ролей? Если, например, стоит, что администратор (значение из базы) true, то открыта конкретная ссылка для просмотра в jsp и на эту страницу (на которую вела ссылка) вход закрыт прочим пользователям (с другими ролями). Это делается через Spring Security, верно? UPD: Буду рад любым советам. Кто-то поставил минус, просьба отписаться в комментариях.
Как-то так, например **some_page.jsp** <sec:authorize url="/admin"> <a href="/admin">Админка</a> </sec:authorize> **SomeController.java** @Controller public class SomeController { @RequestMapping(path = "/admin", method = RequestMethod.GET) @PreAuthorize("hasRole('ROLE_ADMIN')") public String admin(Model model) { return "admin"; } } Совет простой - попробуйте почитать документацию, там всё очень подробно описано.
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "java, spring, spring mvc, spring security" }
Index best performance tuning I have 2 tables `Customer` and `Customerkpi` In both tables we have the column `Customer_id` which should contain unique values. `Customer_id` in `Customerkpi` is a foreign key of the `Customer_id` of the table `Customer` which is the primary key. I need to create indexes on `customerkpi` in the best way. Should I create a primary key on `Customer_id` and mentioned also the foreign key in this way it creates automatically a clustered index, or should I just declare it as a foreign key and then I create a cluster unique index on `Customer_id`. which solution give the best performance?
> Should I create a primary key on Customer_id and mentioned also the foreign key in this way it creates automatically a clustered index, or should I just declare it as a foreign key and then I create a cluster unique index on Customer_id. The physical indexes (clustered and unique) will be identical in both cases so it makes no difference from a performance perspective whether the index also supports the primary key constraint. I would personally use a clustered primary key index since relational tables should have a primary key and add the foreign key too.
stackexchange-dba
{ "answer_score": 4, "question_score": 0, "tags": "sql server" }
#1111 - Invalid use of group function I am using the following query in an attempt to get total number(sum) of slides retrieving the max number from each project, however I am receiving the following error (#1111 - Invalid use of group function). Here's the query: SELECT COALESCE(project,'Total') as Project, SUM(MAX(slides)) as Slides FROM projects_tbl WHERE date BETWEEN '2010-01-01' AND '2010-12-31' GROUP BY Project with ROLLUP If I remove the SUM(), then the it works, however, I do not get an accurate total for all of the projects/slides. Thanks in advance for any and all replies.
SELECT COALESCE(project,'Total') as Project, SUM(maxslides) AS slides FROM ( SELECT project, MAX(slides) as maxslides FROM projects_tbl WHERE date BETWEEN '2010-01-01' AND '2010-12-31' GROUP BY project ) q GROUP BY project WITH ROLLUP
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "sql, mysql, mysql error 1111" }
Does raspberry pi 3 has built-in termometer? I'm using Raspberry pi 3 model B for some college project with HC SR-04 ultrasonic for distance measurement. Since the sensor is using sound wave, which is depends on the velocity of sound and the velocity of sound is depends on the temperature of the environment. I have question: 1. Raspberry pi 3 have temperature monitor, can I use it for another program? 2. Does the temperature sensor measure CPU temperature only? I know there is a lot of temperature monitor project using sensor and Raspberry pi, but if the built-in temperature monitor can do that, why don't I use it.
1. Yes. > The system on a chip (SoC) of the Raspberry Pi has a temperature sensor that can be used to measure its temperature from the command line. source: Raspberry Pi Projects, Temperature log > To view the Pi's temperature, type: `cat /sys/class/thermal/thermal_zone0/temp`. Divide the result by 1000 to find the value in Celsius. source: Raspberry Pi Documentation, Overclocking options in config.txt 2. Yes. But: to measure the environment temperature you could attach an external sensor (like DS18B20).
stackexchange-raspberrypi
{ "answer_score": 11, "question_score": 5, "tags": "pi 3" }
For sales person (cost center) provision list of sales invoices paid In Exact Online you can not easily determine what invoices have recently been paid and get a total on that to base our provision for the sales persons on. How can I get such a list?
The general ledger account code 1300 or some other interim account is used to post the unpaid sales invoices to. When they are moved outside of that interim account, you will know that they have been paid. You will need an Invantive SQL query like: select costcenter , division , listagg(accountcode) lijstrelaties , sum(amountdc) , listagg(invoicenumber) facturen from transactionlines where glaccountcode = '1300' and financialyear = year(sysdate) and financialperiod = month(sysdate) group by costcenter , division You might need to specify additional that it is an outflow using for instance `amountdc < 0`. Now it sums both inflow and outflow.
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "invantive control, exact online, invantive sql" }
How does Ubuntu Desktop differ from Laptop I have Ubuntus on my laptop and desktop, and for curiosity reason I tried to mount my desktop ssd on my laptop SATA to see if it is bootable, and it turned out that it can't, the motherboard simply says no bootable environment was found. And for laptop to desktop vice versa, the only difference is that when I mounted the laptop ssd on desktop and booted, the grub shows that it tried to repair some error, however I ceased the operation because I am affair the grub may change my boot environment to desktop one. So I am just curious that how ubuntu differs between desktop and laptop, apart from battery control/mouse pad controls etc.. Thanks!
After reading the manufacturer guidline of compatibility, I realized the problem was that my SSD on desktop is 1TB and for most of the laptops nowadays don't support up to 512 GB SSD ( you can add 512*2 for two SATAs).
stackexchange-askubuntu
{ "answer_score": 2, "question_score": 4, "tags": "boot, grub2, laptop, .desktop" }
Crypto-period for keys used in PRF I am wondering about the crypto-period for keys used in pseudo-random functions. For example, let's say I am using HMAC-SHA256 with a secret key $K$. After how many computes do I have to update $K$?
You don't need to change the key at all in terms of it being "overused". The only reason to change a key is when you use it beyond the bounds given in proofs of security. You have to look this up, but if you are using HMAC-SHA256 with a 256-bit key then you can go on for about $2^{128}$ computations, which you will never every do. Having said that, the reason to replace keys is because of the fear that they may be stolen by adversaries breaching your network. This has nothing to do with crypto, but is related to other risks.
stackexchange-crypto
{ "answer_score": 5, "question_score": 2, "tags": "hash, pseudo random function" }
Using rewrite api cause wordpress Stop Working I have some wordpress website and when i try to change this link : < to this link < using this rule in functions.php : function custom_rewrite_basic() { add_rewrite_rule('^song/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top'); } add_action('init', 'custom_rewrite_basic'); my wordpress stop working ! can anybody know the reason or have some other solutions ?
Link in the example and rewrite rule does not match, if link is ` then rule should be add_rewrite_rule('^songs/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top'); , or even simpler `'^songs/(\d+)/?'`. Also do not forget to flush and regenerate the rewrite rules.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, wordpress, url rewriting" }
Why isn't there any compiler error when a return statement is not present? Unlike Java, in C/C++ the following is **allowed** : int* foo () { if(x) return p; // What if control reaches here? } This often causes crashes and it is hard to debug problems. Why doesn't the _standard_ enforce to have a **final return** for non-`void` functions? (Compilers generate an error for a wrong `return` value.) Is there a flag in GCC or MSVC to enforce this? (something like `-Wunused-result`)
It is not allowed (undefined behaviour). However, the standard does not require a diagnostic in this case. The standard doesn't require the last statement to be `return` because of code like this: while (true) { if (condition) return 0; } This always returns 0, but a dumb compiler cannot see it. Note that the standard does not mandate smart compilers. A `return` statement after the `while` block would be a waste which a dumb compiler would not be able to optimise out. The standard does not want to require the programmer to write waste code just to satisfy a dumb compiler. g++ -Wall is smart enough to emit a diagnostic on my machine.
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 19, "tags": "c++, c, return value, language lawyer, compiler flags" }
What keyboard shortcut open a smart tag menu in Word/Outlook? A lot of times in Office you get a small blue rectangle under some text, usually with the options for auto corrections (see screenshot below for an example). How can I access this menu using my keyboard? !enter image description here
The shortcut is **_Shift + Alt + F10_** and is context aware.
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "keyboard shortcuts, microsoft outlook 2010, microsoft word 2010" }
Security violation in c:\ProgramData? I am working on a SQL Compact demo app, and one of the things I my setup project does is copy an SDF file to the user's `c:\ProgramData` folder. However, when the app is run on the user's machine, I get the following error: > System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlServerCeException: Access to the database file is not allowed. [File name = c:\ProgramData\Foresight Systems\SQL Compact Demo\LocalData.sdf] I am puzzled as to what's causing this error. Isn't `c:\ProgramData` the preferred location for this sort of file? What do I need to do in my setup project to get this to work? Thanks for your help.
A few things to check perhaps(?): * the .sdf has a file attribute of readonly * is the application being run as administrator or UAC access being granted?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "sql server ce" }
How to load geometry/object/scene created in Clara.io with Three.js Does anybody know how to load anything created in Clara.io into your Three.js scene? Clara.io allows export of ThreeJS geometry, object or scene. I tried all those in combination with all THREE loaders (JSONLoader, SceneLoader, GeometryLoader, etc.) without any success (Parse function inside of three.js fails to process json structure). Structure of exported file from Clara.io looks to be completely different from what Three.js loaders expect. Can this be achieved in any way or is Clara export simply useless at this point? I am talking three.js v.65 in combination with current version of Clara.io
Clara.io exports `Scene` and `Object` data using the `THREE.ObjectExporter`. The resulting exported files are intended to then be loaded by the `THREE.ObjectLoader`. The start of these exported files will look like this: {"metadata":{"version":4.3,"type":"Object","generator":"ObjectExporter"},... Code to load files via the `THREE.ObjectLoader` is here on Github. You can load the data from an URL using the `ObjectLoader.load()` function or from an already in-memory JSON object using `ObjectLoader.parse(). I hope this helps. If you would like us to modify how we do things, we can. EDIT: We have added a documentation page that describes how to load ThreeJS scenes exported from Clara.io. It can be found here: <
stackexchange-gamedev
{ "answer_score": 2, "question_score": 1, "tags": "three.js" }
Google cloud functions inside VPC? Is it not possible to run GCP cloud functions (or any GCP serverless compute resources for that matter) inside private networks? Are they always using shared capacity and public networks? Am I missing something? Don't confuse this with egress, I know it is possible to access private networks from serverless resources, but is it possible to limit access to the functions at the network level? AFAIK you can do this with lambdas on AWS and with app service on Azure (although on Azure it was expensive since you need to move away from shared capacity).
You have 2 way traffic in Cloud Function: ingress and egress * Ingress: you can limit the traffic coming from internet, or uniquely from project VPC or VPC SC * Egress: By default, the traffic is directly routed to internet. You can use a serverless VPC connector for: * Either routing only the private IP (RFC1918) to the VPC * Or routing all the traffic to the VPC.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "google cloud platform, google cloud functions" }
showing no posts on wp_query I am setting up a custom post type for wordpress and now i'm trying to display the posts on the homepage. I would like to hide the posts until they are called via has_tag i'm using the following code but it displays all of the posts. $args = array( 'post_type' => 'homepage', 'posts_per_page' => -1 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); echo '<div class="entry-content">'; the_content(); echo '</div>'; endwhile;
So I was able to get this accomplished by using the following code. <?php $args = array( 'post_type' => 'homepage', ); $the_query = new WP_Query( $args ); ?> <?php // The Loop if ( $the_query->have_posts() ) { echo '<ul>'; while ( $the_query->have_posts() ) { $the_query->the_post(); if (has_tag('footer')) { echo '<li>' . get_the_title() . '</li>'; } } echo '</ul>'; } rewind_posts(); // The Loop if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); if (has_tag('cta')) { echo '<div class="cta-style">' . get_the_title() . '</div>'; } } } ?>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, wordpress, custom post type" }
Fetch data from sqlite? I have a table with four fields: ![enter image description here]( I want to fetch the data for RegionName(Pune, Delhi) or ProjectName(TPQ). My expected result is Checklist4,checklist1, and checklist3. How to write a SQLite query for this?
I think your main issue is the SQL query where you actually mean to use the "OR" keyword and not "AND" as you have in your mind.. The "OR" keyword will return results that satisfy any of your criteria so either the RegionName can be one of the two values (Pune, Delhi) OR the ProjectName can be TPQ. On the opposite, the "AND" keyword will return results that satisfy ALL of your criteria. In your table, in order to have a result returned, you should have for example a row where the RegionName is "Pune" AND the ProjectName is "TPQ". Try the following assuming your table is called "TableName": Cursor c = myDatabase.rawQuery("SELECT CheckListName from TableName where RegionName IN ('Pune', 'Delhi') OR ProjectName ='TPQ'", null);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -5, "tags": "android, sqlite, android sqlite" }
Find the extrema of $\sin(x)\cos(y)$ with the Hessian I've got the following function: $f(x,y) = \sin(x)\cos(y)$. I performed the Hessian matrix correctly, with the second derivatives: \begin{bmatrix} -\sin(x)\cos(y) & -\cos(x)\sin(y)\\\ -\cos(x)\sin(y) & -\sin(x)\cos(y) \end{bmatrix} But the trouble comes when I want to find the extrema (critical points and saddle points). By solving $\cos(x)\cos(y) = 0$ and $-\sin(x)\sin(y) = 0$ (the first partial derivatives) I obtain: > $\cos(x) = 0$ or $\cos(y) = 0$ > > $\sin(x) = 0$ or $\sin(y) = 0$. If $\cos(x) = 0$, then $\sin(x) = \pm 1$ and if $\sin(x) = 0$ then $\cos(x) = \pm1$. Well, here I think that we have got just two possibilities: 1. $\cos(x) = \sin(y) = 0$; 2. $\sin(x) = \cos(y) = 0$. Now, how do I find the extrema? I mean, with $\cos(x) = \sin(y) = 0$, which is the point $(x, y)$ and how do I substitute it in the Hessian matrix? (The solution says it must a saddle point but I don't get it, why?)
The critical points are * $f_x=\cos x \cos y=0$ * $f_y=-\sin x \sin y=0$ and thus * $x=k\pi \quad y=\frac{\pi}2+j\pi$ * $y=k\pi \quad x=\frac{\pi}2+j\pi$ the Hessian matrix is $$\begin{bmatrix} -\sin x \cos y & -\cos x \sin y \\\ -\cos x \sin y & -\sin x \cos y \end{bmatrix}$$ and for $x=k\pi \quad y=\frac{\pi}2+j\pi$ we obtain $$H_1=\begin{bmatrix} 0 & 1 \\\ 1 & 0 \end{bmatrix} \quad H_2=\begin{bmatrix} 0 & -1 \\\ -1 & 0 \end{bmatrix}$$ and for $y=k\pi \quad x=\frac{\pi}2+j\pi$ we obtain $$H_3=\begin{bmatrix} 1 & 0 \\\ 0 & 1 \end{bmatrix} \quad H_4=\begin{bmatrix} -1 & 0 \\\ 0 & -1 \end{bmatrix}$$ and $H_1$,$H_2$ have signature (1,1), $H_3$ have signature (2,0) and $H_4$ have signature (0,2).
stackexchange-math
{ "answer_score": 0, "question_score": 2, "tags": "trigonometry, partial derivative, quadratic forms, hessian matrix" }
Export oData query server side Good morning, I have a Kendo UI data source handling my oData request. The data source is sitting client side and as I filter it , it makes the necessary calls for me and I have some custom markup displaying results. I have a limit of ten records being returned and this is working fine. On the back end I am using WebAPi 4.0.30506.0 and oData 5.6 (we are stuck with .net 4 ). This is resolving the queries nicely. No problems here. The problem is that the client now wants to have the filtered data exported server side (data eventually going into a pdf or excel report) , does anybody have any ideas on how to cross the filter settings over to another call. I have had some success chucking the whole ODataQueryOptions into the cache for each user , but this feels dirty and inefficient. All ideas welcome.
After some serious google bashing I found this nuget package : < Examples here : < I can now pull the filter value out as a string an reapply as necessary.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net mvc, asp.net web api, kendo ui, kendo grid, odata" }
How to compute partial derivatives by definition? For $$f(x,y)=\begin{cases} \frac{x^{2}y}{x^{4}+y^{2}}, & x\ne0,y\neq0\\\ 0 & ,x=0,y=0 \end{cases}$$ I'm trying to compute $f_x(0, 0)$ and $f_y(0, 0)$. I'm trying to apply the definition but in both cases I get indeterminate forms: $$\frac{\partial f}{\partial x}(0,0)=\lim_{h\to0}\frac{f(h,0)-f(0,0)}{h}=\lim_{h\to0}\frac{\frac{h^{2}*0}{h^{4}+0^{2}}}{h}=\lim_{h\to0}\frac{h^{2}*0}{h^{5}+h*0^{2}}=\lim_{h\to0}\frac{0}{h^{5}}=\frac{0}{0}=?$$ $$\frac{\partial f}{\partial y}(0,0)=\lim_{h\to0}\frac{f(0,h)-f(0,0)}{h}=\lim_{h\to0}\frac{\frac{0h}{0+h^{2}}}{h}=\lim_{h\to0}\frac{0}{h^{3}}=\frac{0}{0}=?$$ What am I doing wrong here?
Note that $0$ divided by anything except $0$ is $0$. Also, note that infinite small value is not considered to be $0$. So, you do not get $\cfrac{0}{0}$ but $\cfrac{0}{\text{something very small}}$. Therefore, your limit is: $$\lim_{h\to 0} \frac 0 h =\lim_{h\to 0} 0 = 0 $$
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "calculus, derivatives, partial derivative" }
Php create namespace path from $_GET[] elements and use it i want from url like this: example.com/?module=index&controller=index&action=hello to get the values by $_GET[] and then create namespace path like application\modules\index\controllers\IndexController and then use application\modules\index\controllers\IndexController as IndexController; $IndexController = new IndexController; $IndexController->hello(); for example, but when i try to create the path in random ways -> error and .. i don't know how to do it please help!
As I mentioned in comment: you can't use variables in use statement, you have to use fully namespaced class name in variable when creating new instance. So it would look like this: $module = $_GET['module']; $ctrl = $_GET['controller']; //Remember to use double backslashes in strings $class = "application\\modules\\{$module}\\controllers\\{$ctrl}Controller"; $controller = new $class; $controller->{$action}();
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, namespaces, get" }
Draggable limited in movement I would like to create a **big** `draggable` element and put it into a smaller container that limits its movement, so 2 of the `draggable` sides must touch the container/container's sides. I also want that the `draggable` object will be `draggable` from anywhere in the frame, and not only while clicking on the object itself. I saw that **jQuery** provides a nice `draggable` object: < Here is an example I made of what is allowed and what is not: !Allowed !Not Alloed
You should set the containment to that object like following: $(".selector") .draggable({ containment: "parent" }); Here is doco
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "javascript, jquery, html, css, draggable" }
Can Valorous be my starting 16 trait? Can Valorous be my starting 16 trait in Pendragon 5th edition? In the Pendragon book fifth edition it states: > The Valorous trait always begins at a value of 15, reflecting your character’s martial training. but then goes on to say > 3. Assign Your “Famous Trait”: You may assign a value of 16 to any one trait, including those on the right side of each binary, such as Worldly or Reckless, if you desire. >
In the three games I played, it was allowed. The rule for Valorous just means you don't use the normal mechanism to start that trait off.
stackexchange-rpg
{ "answer_score": 6, "question_score": 9, "tags": "character creation, pendragon" }
How to create Chrome like application in Delphi which runs multiple processes inside one Window? Is it possible to create an "application group" which would run under one window, but in separate processes, like in Chrome browser? I'd like to divide one application into multiple parts, so that one crashing or jamming process cannot take down others, but still keep the look and feel as close to original system as possible. I know the Chrome source is available, but is there anything even half ready made for Delphi?
I guess basically you would create multiple processes each of which creates a window/form. One of the processes has the master window in which every child window is embedded. That is as simple as calling SetParent. The windows in different processes would talk to each other using an IPC (Inter Process Communication) mechanism like named pipes or window messages. See this question for an embedding example of using SetParent in Delphi. See this question for an example of using named pipes in Delphi.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 17, "tags": "windows, delphi, google chrome, parallel processing" }
Swift: Can Alamofire be used to storing data to Google drive I am a bit new to Xcode. I am trying to get the streaming data of an app and upload those data to an online platform, like google drive. I am just starting to learn a bit of Alamofire. I believe it can make a request from http and storing the JSON files back to the app. I am wondering can **Alamofire** be used to send the streaming data (as a .txt file) to the google drive? Thanks
You should to read more books, before ask such questions here. You can use Alamofire to make requests to server - get or post data. You can store data to Google Drive, using their API, but you need setup access to it: * setup google account, * implement authentification (OAuth) in your app for Google Drive. * and then implement requests (You can use or not Alamofire for it) to Google Drive API. I think it can be a bit hard for you. As alternative you can try to upload your data to Firebase Storage. * Setup Firebase Storage (its easy) - get link for upload your data * implement upload your data to this storage (You can use or not Alamofire for it)
stackexchange-stackoverflow
{ "answer_score": -2, "question_score": -2, "tags": "ios, swift, alamofire" }
Snowflake Timezone I am having a small doubt regarding time zone in snowflake Like different region contains different default time zone or it is the same for all irrespective of the region? Eg: SF account in Australia will have US time zone or Australia time zone as its default. If there is any proof for the answer kindly attach the documentation page too for reference.
Default timezone is set to America/Los_Angeles irrespective where the account is located. Documentation is here
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "timezone, snowflake cloud data platform" }
Python : How to print only nth row in print() result just recently learning web scraping using python 3 and beautifulsoup. I have problem to print the only row i want. Below i provide the code i use. product_sizes = view_product.find('dl', id='dl_1') for product_size in product_sizes.find_all('li'): product_size = product_size.span.text print(product_size) Suppose when i print this, i got this kind of result 35 36 37 38 39 40 I want to let say print the 2nd row. the "36". How do i do that? I tried [] on product_size = product_size.span.text[0] but what i got is 3 3 3 3 3 4 I expect when i print, i got something like this 36 Thanks. Got the feeling this is newb question but i do google around without success.
`product_size = product_size.span.text[0]` will output the character in the 1st position of a string, hence you are getting `3, 3, 3, 3, 3, 4`, instead of `35, 36, 37, 38, 39, 40` There is no need to do a for loop. If you want the 2nd element from your `product_sizes.find_all('li')`, you simply just need to call that position with `product_sizes.find_all('li')[1]` You can do this in fewer lines of code as below, but just to show the logic... #Get all elements in view_product dl, id='dl_1' product_sizes = view_product.find('dl', id='dl_1') # From product_sizes, find all the 'li' tags and choose the 2nd element product_size = product_sizes.find_all('li')[1] # Get the text product_size = product_size.span.text # print the text print(product_size)
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, python 3.x, beautifulsoup" }
How to copy text string from nfc tag I'm trying to copy a string of text from a nfc tag, but the only option I've been able to find is displaying the text with no ability to copy it (its a complex string with letters and numbers). Best case scenario would be to insert the string where the cursor is at the moment the tag is pressed, but I'm okay with somehow getting the string to the clipboard to paste. If this isn't the right place to ask this question, if you could tell me where I could find the answer, I'd be very grateful.
NXP's NFC TagInfo app can copy the text from a text record on a scanned NFC tag to the clipboard. There are other apps with similar functionality. Copying text from text records on NFC tags is not something that's built into Android without installing and running an app.
stackexchange-android
{ "answer_score": 1, "question_score": 0, "tags": "nfc" }
How to use Application Constants in applescript droplet I'm trying to create applescript for cueing software " _QLab_ ". I want to get QLab's constants [ _ **continue mode**_ ] within Applescript droplet. tell application "QLab" to tell front workspace set AllCueList to every cue list set AllCue to cue of item 1 of AllCueList set theMode to continue mode of item 1 of AllCue as string display dialog theMode end tell Run by "script editor.app" , that's program run successfully and get correct constant in string. But when save as "droplet" or "application" format and running, get Double Angle `«constant ****»`. I need any declaration or pre-processing ? I want to get constant defined by that application.
tell application "QLab" to tell front workspace set AllCueList to every cue list set AllCue to cue of item 1 of AllCueList set theMode to continue mode of item 1 of AllCue if theMode is do_not_continue then set theMode to "do_not_continue" else if theMode is auto_continue then set theMode to "auto_continue" else set theMode to "auto_follow" end if display dialog theMode end tell
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "applescript" }
I want to slightly tweak my PACE automatic page load progress bar I found a great plugin for a page loader, only the jquery is so overwhelming I don't know where to begin to execute a small change. Basically it's a bar that loads on the top of the page, but when finished loading I'd like the bar to stay instead of fade like it's programmed to do. Any ideas? Here is the plugin link: < and I have been using the Flat Top theme. Thanks in advance!
Set the `ghostTime` option in pace to be a big value. E.g. <script data-pace-options='{ "ghostTime": 10000000 }' src='
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, jquery, loader, manual" }
Sharepoint 2010. Api. How to get field history? I have SPListItem and some text field. I need in code get all versions of this field EX: 1. version 1 "hello rorld" 2. version 2 "hello world" 3. version 3 "new application" Any examples how to do that?
Try this: foreach (SPListItemVersion version in item.Versions) { Console.WriteLine(string.Format( "{0}. version {0} \"{1}\"", version.VersionId, version["this field"])); }
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "c#, .net, sharepoint 2007, sharepoint 2010" }
Mod_Rewrite with parameters - Dynamic Website I want to change my URLS. At the moment they look like this: (shows a mario skin with informations) I want them to look like this: What I have tried so far is following: RewriteEngine on RewriteCond %{QUERY_STRING} ^page=information&skin=217$ RewriteCond %{REQUEST_URI} ^\/$ RewriteRule .* [R=301,L] ^ This Code works for changing the URL-Addresse, but I get a 404 Error: Page not found. Seems like this isnt working too well. What did I miss and what do I have to change? This also has to work with given parameters so: < should still know the parameters page=information, skin=217 Thanks
You can use this code in site root .htaccess: RewriteEngine On RewriteCond %{THE_REQUEST} \s/+\?page=information&skin=217\s [NC] RewriteRule ^ /mario/? [R=301,L] RewriteCond %{THE_REQUEST} \s/+\?page=([^\s&]+)\s [NC] RewriteRule ^ /%1/? [R=301,L,NE] RewriteRule ^mario/?$ /?page=information&skin=217 [L,QSA,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([\w-]+)/?$ /?page=$1 [L,QSA]
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, apache, .htaccess, mod rewrite" }
Webview blank page shown in Nougat OS in my app I have called CCAvenue Payment Gateway Integration in my app. till it is working properly but when i update my device OS Marshmallow to Nougat, Webview page display blank white screen. No Error log found in logcat also. I have also tested in all another device which lower than Nougat and in that devices, WebView working properly. Only issue found in Nougat OS. I have searched this issue in google, but not found any proper solution from last three days.
I found the solution, when I update my android device from marshmallow to Nougat, I found on my updated device, android Webview system app is permanent disabled and Nougat OS uses Chrome browser's Webview by default as define in this link. And My device already installed old chrome browser does not rendering this webview. when I update my Chrome browser app than its working fine in all webview pages.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "android, android webview, payment gateway, android 7.0 nougat, ccavenue" }
UITableview not visible the last cell when scroll down I'm very new to iOS. I have a UITableView that filled with many custom cells, but the bottom cell is is not visible properly when scroll down.my Y value of the UITableView is 44 and Height is 480. Only the half of the last cell is visible when scroll down. How can I fixe this problem. Thanks in advance.
Use - tableView.contentInset = UIEdgeInsetsMake(0, 0, 120, 0); //values > passed are - top, left, bottom, right Pass bottom offset as per your needs.
stackexchange-stackoverflow
{ "answer_score": 74, "question_score": 20, "tags": "ios, uitableview, scroll" }
Whoops, it looks like you have an invalid PHP version I getting php version error message in my site. I have two magento instance in same server, One is ruining & another is not running. Please share idea/answer with me.
As far as I can see it could be one of the following things: 1) Corrupt index.php in your magento root dir. 2) Incorrect virtual host set up resulting in php not executing the code in index.php Could you post your apache site configuation and or your index.php
stackexchange-magento
{ "answer_score": 0, "question_score": 1, "tags": "magento 1.7, error, php 5.2.x.x" }
Unable to git add, remove, also there is no file in related location. What should I do? File not showing on related location. Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) # # added by them: app/etc/ local.xml~ #
Have you noted that there's a space at the beginning of the file name? Execute one of the following: `git add "app/etc/ local.xml~"` Or `git rm "app/etc/ local.xml~"`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "git, github, bitbucket" }
Fundamentally, what is the difference between redox and acid-base reactions? For example, consider: $$\ce{NH3 + H2O -> NH4+ + OH-}$$ Here, the $\ce{NH3}$ is acting as a base (By Lewis theory, it is an electron pair donor). Why don't we consider this to be a redox (there is a transfer of electrons taking place as $\ce{NH3}$ is acting as an electron donor and $\ce{H2O}$ as an electron acceptor)? I'm aware that calculation of oxidation states is the best way to figure out if a reaction is redox or not. Then I would like to ask: why exactly do we assign oxidation states according to those rules? Is there an intuitive way to explain why a certain reaction is acid-base and not redox?
In contrary to acid-base reactions(1), a redox reaction is such a reaction, which can be formally divided into two half-reactions. At least one reactant in such a half-reaction explicitly formally acts as a donor or acceptor of one or more electrons. $$\ce{Cl2(aq) + 2 Fe^2+(aq) -> 2 Cl-(aq) + 2 Fe^3+(aq)}$$ can be formally divided to: $$\ce{Cl2(aq) + 2 e- -> 2 Cl-(aq)}$$ $$\ce{2 Fe^2+(aq) -> 2 e- + 2 Fe^3+(aq)}$$ In the example, there was no electron transfer between $\ce{NH3}$ and $\ce{H2O}$. Oxidation states are nothing more but valence electron inventory with defined formal rules of electron distribution. Their sum does not change during a reaction, due the charge conservation law. * * * (1) A very generalized Usanovich theory of acids and basis does consider redox reactions as a special case of acid-base reactions. But this theory is not much known nor applied within chemistry community.
stackexchange-chemistry
{ "answer_score": 1, "question_score": -1, "tags": "inorganic chemistry, acid base, redox" }
SAS vertical merge i have a problem joining two datasets verticaly. I have two datasets that have some matching and some different variables. I need to verticaly join these two datasets and get all variables from first dataset and only matching variables from other dataset as a result. Dataset 1: ID V1 V2 V3 V4 1 aa bb 10 99 2 bb cc 20 99 Dataset 2: ID V1 V3 V5 3 xx 11 x1 4 yy 12 2x Result needed: ID V1 V2 V3 V4 1 aa bb 10 99 2 bb cc 20 99 3 xx . 11 . 4 yy . 12 . Any help? thanks!
Here's a couple of options: data out; set dataset1 dataset2; run; or proc append base=dataset1 data=dataset2 force; run; There is more info here which I found on the first page of Google results: <
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "sas" }
imwrite throwing compile error in OpenCV I have been using OpenCV for a while and also the `imwrite` function, but unfortunately this is not working any more. I am running with OpenCV 2.4.3 with following sample code: imwrite("somepath/somefile.png", myMat); The error: Undefined symbols for architecture x86_64: "cv::imwrite(std::string const&, cv::_InputArray const&, std::__debug::vector<int, std::allocator<int> > const&)", referenced from: MyProject::this_callback(int, void*) in MyProject.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) The error looks somewhat familiar but i cannot determine whats wrong. !enter image description here
Yes, I've thought you were using XCode. I had the same problem. :) If you change the project setup so that: * you use GNU++11 as C++ language dialect * libstdc++ (GNU C++ standard) as C++ standard library your linking problem will go away. I use Apple LLVM 4.1. * * * When I had this problem, I have tried just adding a new target to one of my old projects I knew, worked. Then I've just made that target a one-source-file program. This must be a "magic" part of XCode as I think there was a time I could not get the same project working after a restart. :S
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "xcode, macos, opencv, compiler errors" }
C# to call Cadence Allegro with SKILL code function I am trying to make some calls to Cadence Allegro from C#, I have some C++ examples but they are very incomplete. I don't see anything on S/O with this, some Allegro... But if anyone has ever called up a Allegro PCB etc.. , can you point me in the right direction? I have been looking on Cadence website. Looking to send "SKILL .il" code over from C# application to Cadence PCB / Editor etc.. for the .brd (board) files to show violations.
So Cadence Systems has a dll called mpsc.dll, and there is a header file mpsc.h in which there are many functions to call. This stuff does work, just very old and I will wrap it in C#
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "cadence" }
Global sections of holomorphic line bundles $\mathcal{O}(n)$ over $\mathbb{P}^1(\mathbb{C})$ What are global sections of holomorphic line bundles $\mathcal{O}(n)$ over Riemann sphere? We define $\mathcal{O}(n)=\mathcal{O}(-1)^{\otimes (-n)}$ for $n<0$ and $\mathcal{O}(n)=(\mathcal{O}(-1)^{\otimes n})^*$ for $n>0$, $\mathcal{O}(0)=\mathbb{P}^1(\mathbb{C})\times\mathbb{C}$, where $\mathcal{O}(-1)$ is the tautological holomorphic line bundle over $\mathbb{P}^1(\mathbb{C})$. I think I understand how to obtain global sections in the case $n=-1$: if $s$ is a section then when we compose it with $\mathcal{O}(-1)\hookrightarrow \mathbb{P}^1(\mathbb{C})\times\mathbb{C}^2\rightarrow\mathbb{C}^2$, we see that $s$ is constant $c$ and since $s(x)=(x,c)$ for all $x$, we have $c=0$. But I don't know how to take tensors in.
$\newcommand{\Cpx}{\mathbf{C}}\newcommand{\Hol}{\mathscr{O}}$Cover the projective line by charts $U_{0} = \Cpx$ and $U_{1} = \Cpx$, with respective coordinates $z = 1/w$ and $w = 1/z$. The transition function for $\Hol(n)$ is $g_{01}(z) = 1/z^{n} = w^{n}$. A holomorphic section of $\Hol(n)$ is an entire power series $$ \sigma_{0}(z) = \sum_{k=0}^{\infty} a_{k} z^{k} $$ such that $$ \sigma_{1}(w) = g_{01}(z) \sigma_{0}(z) = w^{n}\sum_{k=0}^{\infty} a_{k} w^{-k} = \sum_{k=0}^{\infty} a_{k} w^{n-k} $$ is entire. That is, a section of $\Hol(n)$may be viewed as an affine polynomial $$ \sigma_{0}(z) = \sum_{k=0}^{n} a_{k} z^{k} = \sum_{k=0}^{n} a_{k} w^{n-k} $$ of degree at most $n$, or as a homogeneous polynomial $$ \sum_{k=0}^{n} a_{k} z^{k} w^{n-k} $$ of degree $n$. (This is consistent with the fact that if $s_{m}$ and $s_{n}$ are sections of $\Hol(m)$ and $\Hol(n)$, respectively, then $s_{m}\, s_{n}$ is a section of $\Hol(m + n) \simeq \Hol(m) \otimes \Hol(n)$.)
stackexchange-math
{ "answer_score": 4, "question_score": 4, "tags": "riemann surfaces" }
Intro to GPU programming Everyone has this huge massively parallelized supercomputer on their desktop in the form of a graphics card GPU. * What is the "hello world" equivalent of the GPU community? * What do I do, where do I go, to get started programming the GPU for the major GPU vendors? -Adam
Check out CUDA by NVidia, IMO it's the easiest platform to do GPU programming. There are tons of cool materials to read. [ [1]: Hello world would be to do any kind of calculation using GPU.
stackexchange-stackoverflow
{ "answer_score": 78, "question_score": 186, "tags": "gpu" }
If $f$ is continuous ,$F_n$ is pointwise convergent to $f$ and $F_n$ is uniformly convergent... If $f$ is continuous ,$F_n$ is pointwise convergent to $f$ and $F_n$ is uniformly convergent. Then $F_n$ in uniformly convergent to $f$. To me, this result makes perfect sense. But I can not seem to find it in my analysis notes. Is this implication correct?
If $F_n$ converges uniformly to a function $g$, then it is also pointwise convergent to $g$. Since $F_n$ is also pointwise convergent to $f$, we have $f=g$ (pointwise limit is unique).
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "real analysis, analysis" }
npm cluster package on a server cluster So I have an app I am working on and I am wondering if I am doing it correctly. I am running `cluster` on my node.js app, here is a link to `cluster`. I couldn't find anywhere that states if I should only run `cluster` on a single server or if it is okay to run it on a cluster of servers. If I continue down the road I am going I will have a cluster inside a cluster. So that it is not just opinions as answers, here is my question. Was `cluster` the package made to do what I am doing (cluster of workers on a single server inside a cluster of servers)? Thanks in advance!
Cluster wasn't specifically designed for that, but there is nothing about it which would cause a problem. If you've designed your app to work with cluster, it's a good indication that your app will also scale across multiple servers. The main gotcha would be if you're doing anything stateful on the filesystem. For example, if a user uploads a photo and you store it on the server disk, that would be problematic when scaling out across multiple servers (that don't share the same disk).
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "node.js, cluster computing" }
R cor across rows and columns Hello I currently have a matrix that has genes as row.name and Tissue Type as colnames. If I: > cor(matrix) > str(DataCor2) num [1:39453, 1:19] 0.502 7.974 33.462 0 14.543 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:39453] "AC205376.4_FG003" "GRMZM2G024563" ... ..$ : chr [1:19] "V18_Meotic_TasselR1" "V18_Meotic_TasselR2" ... I get a correlation between tissue types. What I want to do is get a correlation of a subsets of genes across each tissue type for a heat map, I tried: cor(v, t(v)) But I get an error saying incompatible dimensions. Here is part of the data and I want to see a correlation of expression levels between genes across tissue types. The heat map would look similar to the matrix with genes on the Y axis and tissue on the X axis. Hopefully it makes more sense. !enter image description here
Suppose you want to `subset` the `genes` based on the `prefix` and do the `cor` on each `subset` res <- lapply(split(1:nrow(mat1), gsub("_.*", "", rownames(mat1))), function(i) cor(mat1[i,])) ### data set.seed(29) mat1 <- matrix(sample(0:80, 15*3, replace=TRUE), ncol=3, dimnames=list(paste(rep(c('V18', 'V19'), c(8,7)), LETTERS[1:15], sep="_"), paste0("AC", 1:3)))
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "r, matrix, heatmap, correlation" }
Can you use nginx reverse proxy to docker containers without exposing any ports? I'd like to know if it's possible to use nginx with docker compose as an api gateway / reverse proxy / ssl termination point without exposing any ports on the containers behind it. I.e. I want to use only the intranet created by docker compose when the containers are linked to communicate past nginx. Ideally the only publicly accessible port will be port 443 (ssl) on nginx. Is this doable? Or do I have to expose ports on my containers?
Yes is doable. Just define your application in one container and nginx in another container, both in the same docker-compose.yml. Link them. And only expose the 443 port in nginx container. docker-compose.yml nginx: image: nginx links: - node1:node1 - node2:node2 - node3:node3 ports: - "443:443" node1: build: ./node node2: build: ./node node3: build: ./node More info: < Regards
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "nginx, docker, docker compose, reverse proxy" }
Open WebView in Safari Can someone tell me how I can make an IBAction that opens the current link in the WebView in Safari. So ​​that all pages I open that WebView can be opened with that one button in Safari. Thanks.
- (IBAction)openLink { NSURL * currentURL = [myWebView.request URL]; [[UIApplication sharedApplication] openURL:currentURL]; } This should mostly work for URLs loaded via `loadRequest:` or traversed from there but won't work for other local load methods like `loadHTMLString:baseURL:`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "iphone, ios, safari, ibaction" }
how to merge audio using ffmpeg, not concat I want audio files to be merged and be the length of the longest one of course. Not to concat them, which means adding one behind the other. I tried googling since yesterday night, but didn't found any such thing. Is this really possible ?
For helping others, I'm posting the solution I found : < Mixes multiple audio inputs into a single output. For example ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT Above command will mix 3 input audio streams to a single output with the same duration as the first input and a dropout transition time of 3 seconds.
stackexchange-superuser
{ "answer_score": 24, "question_score": 16, "tags": "audio, ffmpeg, audio recording" }
Matching a string with regex? I am looking to match several full strings in regex for a cpanel filter, but cannot seem to get it working. I am wanting to match the string no matter where it is, even if its embedded or in strange casing like so.. embed **STriNg** embed For instance this string: **To view this email as a web page, click here** [Tt]o view this email as a web page, click here.*? but this doesn't work. I dont want to anchor it as it might not be at the beginning of a sentence, i just want to match it no matter where or how its written. Thanks.
You could add the case insensitive modifier in two different ways. 1. `/regex/i` We could add the case insensitive or any other modifiers by adding the corresponding letter next to the regex delimiter. In some languages, we need to add this as a separate parameter like `re.IGNORECASE` in python etc. 2. We could also add the modifier on the regex itself by adding `(?i)` at the start of the regex. You could include more num of modifiers inside those brackets like `(?im)`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "regex, pattern matching, match, cpanel" }
What comic is this scene between Darth Vader and C-3PO from? I ran across this image on Tumblr today: !three panel comic book page, showing first Anakin creating C-3P0 with his mother telling him the droid is his responsibility. Her speech bubble leaks over to the next page where we see an imperial officer ask Darth Vader what to do with the droid. In the final panel we see Vader's black-helmeted head resting against C-3PO's disembodied head. It depicts an in-between-scenes moment during the Bespin part of _Empire Strikes Back_ , where Darth Vader laments the fate that has befallen his creation. This acknowledges the fact that Vader as Anakin Skywalker created C-3PO, which might be one of the most out-of-place revelations from _The Phantom Menace_. What comic is this from? If there's a whole comic book devoted to placing wacky prequel revelations in context of the original series, I want to read it.
The image is from the 10-page comic _Thank the Maker_. In fact, the image you show above is what appears on the Wookieepedia page, with an extra panel above it.
stackexchange-scifi
{ "answer_score": 15, "question_score": 19, "tags": "star wars, comics, episode identification" }
PHP - preg_match() word after other word I have a text like this one: `The cat was born on 1980 and lives ...` So i want to get the cat's age with regex (the text could have more than 1 occurrence of a number with 4 digits). I'm trying this `preg_match('/born on [0-9]{4}/', $text, $matches)` but the result is: `array('born on 1980')`. I want to ignore everything before a year. Demo: <
Group the value you want then it will be the first item of the array. $text = 'The cat was born on 1980 and lives ...'; preg_match('/born on ([0-9]{4})/', $text, $matches); echo $matches[1]; Output: > 1980
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, regex, preg match" }
Increased backup file size when restoring SQL Server back up file to AWS RDS instance I am experiencing this behaviour when I am trying to restore a sql server backup file to rds instance in aws. Backup file size is 4.6GB. When I restore this file to RDS instance, it works fine. But when I try to backup this rds instance, backup file generated is aroung 25GB. I am not sure why file size is that much bigger than the original back up file size from SQL Server. Any help is highly appreciated.
I assume backups are not compressed, that is why you get different size: exec rdsadmin.dbo.rds_show_configuration; -- enabling EXEC rdsadmin.dbo.rds_set_configuration 'S3 backup compression', 'true';
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql server, database, amazon web services, amazon rds, rds" }
Opening Office 2007 files using a Vista or Win7 client on a server 2008 file share causes lockups and explorer crashes I think this mostly happens when trying to open files opened by other users. In the XP/2003 days you would get some kind of warning about a locked/read only file. With 7/Vista/2008 I'm just seeing clients hang (Word just sits there) and if I go into the file share and attempt to right-click on the file, explorer hangs for several minutes. I tried disabling AV on the file server as well as locally. No luck. I've read that SMB2.0 might be the culprit here, but even testing that solution means disabling it on both the client and server, and requires a server reboot. Does this sound like an SMB2 issue? The server is 2008 SP1. The clients are Win7 vanilla and Vista SP2 with all the current updates. Office 2007 SP2 with all updates. Thanks.
It turns out I had to just disable SMB2 on the server and reboot any machine that was still connected to it. Disabling caching helped (I think) but the real issue is SMB2.
stackexchange-serverfault
{ "answer_score": 0, "question_score": 1, "tags": "microsoft office 2007, microsoft office" }
What is the meaning of the term "Gear" that photographers say? I hear the word "Gear" often in photography discussion, as in "camera gear". Does gear mean the equipment like the camera itself, lens, grey card? I don't find a definition for it anywhere. Please help me to understand.
From Merriam-Webster: > **gear** (noun): supplies, tools, or clothes needed for a special purpose That's exactly the sense used here. The term includes camera bodies, lenses, tripods, lighting equipment, camera bags, and (although out of fashion now) maybe a vest with a lot of pockets (once common wear for professional photographers). Note that there is a sense of physicality to the word: one would not normally describe Adobe Lightroom as "gear", even though it or similar software (Darktable, Rawtherapee) is almost essential for modern digital photography. A laptop, though — that could be "gear". Also, in some parts of the world where British English is dominant (as opposed to American), the word "kit" is used in almost exactly the same sense. In America, the word "kit" in photography means "came in a set with the camera body". This difference occasionally leads to some confusion!
stackexchange-photo
{ "answer_score": 8, "question_score": 4, "tags": "terminology" }
JSON manipulation in Node.js I have a JSON string: `[ { name: 'Bob' }, { name: 'Kim' }, { name: 'Jack' } ]` and I want to save all list of names in an array. Is there any proper way to do that rather than looping?
Try using `Array.prototype.map()`: [{name: 'Bob'}, {name: 'Kim'}, {name: 'Jack'}].map(function(x) {return x.name}); If it's a string, you need to call `JSON.parse()` before, like that: var json = JSON.parse('[{"name": "Bob"}, {"name": "Kim"}, {"name": "Jack"}]'); var names = json.map(function(x) {return x.name}); Note that you have to use double quotes instead of apostrophes to make it a valid JSON string.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": -1, "tags": "javascript, arrays, node.js" }
Field collapsing / Grouping - How to make SOLR return intersection of 2 resultset groups? I have 2 fields for grouping, these 2 field can have different keywords stored in them Ex: Field1: CD, book, e-book Field2: repo1, repo2, repo3, repo4 Now I want to group the combination of CD/repo1 , book/repo2, e-book/repo3,e-book/repo4,CD/repo4 rather than grouping just on field1 seperately and field2 seperately. i.e I need to group based on 2 grouped results (intersection between the grouped results). Is there a way I can make SOLR return group results for all combination? Thanks. BB
I don't think you can have intersection between grouped results at query time. The other solution would be create the combination into a field at index time and use the field for grouping which would give you the results.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "solr, websolr" }
How did these equations go from Step 2 to Step 3? ![enter image description here]( ![enter image description here]( Following the example of the 1st equation, why doesn't the 2nd and 3rd equation result in $$\sum_{all\,x} \,\, \sum_{y:y=x} P(x,y) $$ $$\sum_{all\,x} \,\, \sum_{y:y=z-x} P(x,y) $$ ?
It does. However $$\sum_{y\colon y=z}f(y)=f(z).$$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "statistics, summation" }
How to execute a program on remote machine from Cruise Control .net build process? I want to run a tool as part of my build process which requires environment setup for its execution. I have setup this environment on another machine. Is there any way I can execute the program on the remote machine from my cruise control .net build process. I know how to run the tools on the same machine. but I am not able to figure out how can i execute it if this tool is on remote machine. Any suggestions?
One option is to use psexec to remotely call a command-line tool on another machine.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "cruisecontrol.net" }
How to add a circular background to a gif using css I want to add a circular background behind this gif. `<img src=" class="code-img" alt="Code">` I tried adding the following css properties .code-img { background-color: #66BFBF; border-radius: 100%; padding: 30px; width: 20%; } However, the border is covering part of the gif. ![Covered gif](
Put the image inside a div and it works perfectly. .img-box { background-color: #66BFBF; border-radius: 100%; width: 150px; padding: 23px; } .code-img { width: inherit; } <div class='img-box'> <img src=" class="code-img" alt="Code"> </div>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "html, css" }
Using Python to automate web-based processing? I'm trying to use Python to automatically upload, submit, and retrieve files on websites that do sequence processing. Example: < Does anyone know the best way to do this, whether it be specific modules or tutorials? Would this work with the requests module? Thanks a bunch in advance.
The example looks like an older system but if at all possible, I would suggest adding automating via an API due to your "retrieval" requirements prior to considering Selenium. However, if you find yourself using Python with Selenium Webdriver, save yourself some setup effort and check out SeleniumBase. Also, something worth checking out if there is a budget associated with this project and you want vendor support, UiPath RPA.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, bioinformatics" }
Prove an inequality by Induction: $(1-x)^n + (1+x)^n < 2^n$ Could you give me some hints, please, to the following problem. Given $x \in \mathbb{R}$ such that $|x| < 1$. Prove by induction the following inequality for all $n \geq 2$: $$(1-x)^n + (1+x)^n < 2^n$$ $1$ Basis: $$n=2$$ $$(1-x)^2 + (1+x)^2 < 2^2$$ $$(1-2x+x^2) + (1+2x+x^2) < 2^2$$ $$2+2x^2 < 2^2$$ $$2(1+x^2) < 2^2$$ $$1+x^2 < 2$$ $$x^2 < 1 \implies |x| < 1$$ $2$ Induction Step: $n \rightarrow n+1$ $$(1-x)^{n+1} + (1+x)^{n+1} < 2^{n+1}$$ $$(1-x)(1-x)^n + (1+x)(1+x)^n < 2*2^n$$ I tried to split it into $3$ cases: $x=0$ (then it's true), $-1<x<0$ and $0<x<1$. Could you tell me please, how should I move on. And do I need a binomial theorem here? Thank you in advance.
You "basis" proof is upside down: you should start with what is known and work towards what you want to prove. Can you see $(1-x)^n$ and $(1+x)^n$ are each positive if $|x| < 1$? And $(1-x)$ and $(1+x)$ are each less than $2$? So $(1-x)^{n+1}+(1+x)^{n+1} < 2(1-x)^{n}+2(1+x)^{n}$ and you should be able to complete the induction.
stackexchange-math
{ "answer_score": 6, "question_score": 6, "tags": "inequality, induction" }
TypeError: Unsafe NumPy casting, you must explicitly cast Python strings mixed with "" strings I have a data in the format of a DF that looks like: time_slice A B C 0 2014-01-23 14:30:00 1 A 1.15 1 2014-01-23 14:30:00 1 B 2.15 2 2014-01-23 14:30:00 1 C 18.1 3 2014-01-23 14:30:00 1 D 1 5 2014-01-23 14:30:00 1 F "1,100.14" All the elements in DF['C'] should be cast into floats (which they are). Right now, they are produced as strings, but some strings have "" and some don't. I can see these strings in Notepad - in python viewer all numbers look the same, without "" pd.Float64Index(DF['C']) provides the above error. Help please? :-(
you can do: >>> df['C'].str.replace(',', '').astype('float64') 0 1.15 1 2.15 2 18.10 3 1.00 5 1100.14 Name: C, dtype: float64 >>> pd.Float64Index(_) Float64Index([1.15, 2.15, 18.1, 1.0, 1100.14], dtype='float64')
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, string, pandas, floating point" }
Mutating nested object I'm trying not to mutate an object within an object before setting it to state like this: isDraggable = () => { let steps = [...this.state.stepsData]; steps = steps.map(step => { return { ...step, dataGrid.static: !step.dataGrid.static } }); this.setState({stepsData: steps}) }; The object structure looks like this: { stepsData:[{ dataGrid: { x: ... y: ... static: true } }] } This line `dataGrid.static: !step.dataGrid.static` doesn't compile. How do I solve this? Thanks in advance!
You'll need to clone the object `dataGrid` refers to. Also note that you must use the function callback version of `setState` when you're setting state based on state: isDraggable = () => { this.setState(prevState => { return {stepsData: prevState.steps.map(step => { return { ...step, dataGrid: {...step.dataGrid, static: !step.dataGrid.static} }; })}; }); }; Or more condensed but perhaps less clear: isDraggable = () => { this.setState(prevState => ({ stepsData: prevState.steps.map(step => ({ ...step, dataGrid: {...step.dataGrid, static: !step.dataGrid.static} })) })); };
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "javascript, reactjs" }
Disable javascript in a element I have an element with a a script for a mouseover to show an image. I can't change the HTML, so is it possible to disable the javascript in the link, but still keep the link for the href intact? I cant use the id of the a element since it isn't unique. HTML: <div class="container"> <a id="a211094" onmouseout="etim();" onmouseover="stim('/imgs/7c24b548-4f4c-418e-ad4f-53c73cf52ace/250/250',event,this.id);" href="/products/Computers/Desktops/Acer/Acer-Aspire-TC-705W-Towermodel-1-x-Core-i3-41?prodid=211094"><img src="" alt=""> </a> </div>
if you want to make all ancher tag or you can give class for those anchor tags on which you want to perform this and instead of $( "a" ) write $( ".myClass" ) $( "a" ).each(function( index ) { $( this ).removeAttr("onmouseout"); $( this ).removeAttr("onmouseover"); }); use can use attr("disabled", "disable"); to disable it
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 8, "tags": "javascript, jquery, html" }
Where does the LINE app store pictures and video files? Where does the LINE app store pictures and videos that are received through it? I don't see them in Gallery.
1. Pictures and videos from the LINE app are stored under the following directory: /sdcard/Android/data/jp.naver.line.android/storage/gallerybig 2. All the audio files are placed under directory: /sdcard/Android/data/jp.naver.line.android/cache/mo/(folder)/[audio files] 3. Profile pictures are cached in directory: /sdcard/Android/data/jp.naver.line.android/storage/p Just rename the files to `.jpg` to view them. **Update:** With recent update, the download folder name for image, video, and voice files has been changed to `LINE`. Please check the `LINE` folder when you look for files. **Update on 18 Feb. 2021** Today I check for a video (*.mp4) file, and find it deep somewhere under .../storage/mo with strange folder names, so you'd better use a file manager to search it.
stackexchange-android
{ "answer_score": 9, "question_score": 12, "tags": "files, line" }
Mapping Service to Appery.io HTML Component and Variables Is there a way to take a service that connects to an Appery database and map it to an HTML page component or a variable? I have successfully set up a service that connects to my Appery.io database and I'm mapping it to a page. I can get content into Text and Image components, but mapping a string to the HTML component doesn't seem to work, nor does mapping a string to a variable set up on that page (typed as a string). I tried mapping the $[i] object to the HTML object as well, but that didn't seem to change anything. I tried mapping a couple different columns to the variable and the HTML component and even the ones that successfully map to other components don't result in any content showing on the page. As a way of trying to see what was going on, I used the "log value to console" transformation and nothing shows up in the console for the variable or HTML component.
The basic mapping won't work for that purpose, so please use the following workaround: 1. Please add two custom includes (SafeHtml and DomSanitizer) and define variables, based on them:![see here details]( 2. On the HTML component add the property [innerHtml]: > [innerHtml]=value 3. Set the value to that variable with the custom code: this.value = this.sanitizer.bypassSecurityTrustHtml('<a href="
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "appery.io" }
What happened to the AT-TEs after the rise of the Galactic Empire? During the Clone Wars, the Republic is seen using many vehicles, ships and weapons which do not feature in the armies and fleets of the Empire, despite the fact that the Republic transformed into the Galactic Empire (meaning that the Empire would have full control of these weapons). I understand that the majority of the Republic's navy (especially the Venator/Victory class) were initially absorbed and gradually phased out of the Imperial fleet. However the saga seems to remain silent on the fate of the AT-TEs (All Terrain Tactical Enforcers).
Wookieepedia covers this in detail on the "Imperial use" section of AT-TE Article > During the Galactic Civil War, surviving AT-TEs were still used by the Empire, mainly in campaigns in the Outer Rim Territories.(Source: *The New Essential Guide to Vehicles and Vessels) > > The walkers no longer held a primary status in military campaigns, but were sometimes used for additional fire-support alongside larger assault vehicles, including AT-AT walkers and Juggernaut tanks. (source: _Star Wars: Rebellion: My Brother, My Enemy_ )
stackexchange-scifi
{ "answer_score": 3, "question_score": 2, "tags": "star wars" }
simplify boolean expression I have a boolean function. Unfortunately I am not able to simplify it to the minimal term. What I have done so far: $f = x_4 x_2 + \overline{(x_3 + x_2) \cdot 1 x_1} + x_2x_0$ $f =x_4 x_2 + \overline {(x_3 + x_2 )x_1} + x_2x_0$ $f = x_4x_2 + \overline {x_3} \overline {x_2}+ \overline{x_1} + x_2x_0$ $f = x_2(x_4+x_0) + \overline {x_3} \overline {x_2} + \overline {x_1}$ $f = \overline { \overline {x_2(x_4 + x_0) + \overline {x_3} \overline {x_2}+ \overline{x_1}}}$ $f =\overline {( \overline {x_2} + (\overline {x_4} \overline {x_0})) (x_3 + x_2)x_1} $ $f = \overline {(\overline {x_2} + (\overline {x_4} \overline {x_0})) x_3x_! + x_2x_!}$ The correct solution should be: $f = \overline {x_1} + \overline {x_3x_2} + x_2x_0 + x_4x_2$ Have I done a mistake or do I just don't see the next step?
Your deMorgans conversion from 2nd to 3rd step is incorrect. $f = x_4 x_2 + \overline {(x_3 + x_2 )x_1} + x_2x_0$ $f = x_4 x_2 + \overline {(x_3 + x_2 )} + \overline {x_1} + x_2x_0$ $f = x_4 x_2 + \overline {x_3}\ \overline {x_2} + \overline {x_1} + x_2x_0$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "boolean algebra" }
Implicit not operator (!) with enums explanation? I recently came across this piece of code and I'm wondering why it works. Enum declaration: enum BuildResult { RESULT_ERROR, RESULT_SUCCESS }; Later, this Enum is used in an if statement (ignore the fact that it could instead be `RESULT_ERROR`): if (!objectHere->build_result == ClassNameHere::RESULT_SUCCESS) I was not aware that you could use the not operator `!` to flip the value of an Enum. Does this only work with Enums that have two states? Are there other kinds of implicit operators that can be used with Enums? I did find this question about manually declaring operators, but it doesn't seem to mention any implicit operators for enums.
The `enum` is implicitly casted to `bool`. When you flip it, it is no longer an `enum` type, but a boolean pr-value. If you replace `enum` with `enum class`, which is type safe, this conversion is no longer possible. When simple enum declaration is used, `enum` rvalues behave exactly like integers. You can even specify the type of the integer: enum myEnum : uint32_t { NOT, TYPE, SAFE }; (note the implicit values of an enum: `{NOT=0, TYPE=1, SAFE=2}`)
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "c++, enums, operators" }
how do i format list view column to show currency symbol I have a ListView on one of the windows project using c#. One of the columns contains currency values. How do I format the List View so that this column presents the "£" sign (for Pounds Sterling)?
String.Format("{0:c}", CurrencyValue); is supposed to do the trick if you just want currency symbol for the locale of your application. If you're working with multiple currrencies your control of choice has to support Unicode.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "c#, winforms, listview, currency, symbols" }
Creating a sample of huge collection in mongodb to test queries I have a huge collection of tweets downloaded by someone else and I want to test an `aggregate()` query on that. But, it takes a lot of time to execute and I want to quickly check my results. Can I create a smaller sample collection using the huge original collection so that I can test new queries on that quickly? If yes, how can I do that? If no, how do people usually test the correctness of the query before execution? All the answers I found till now say about dumping the entire collection while I just want a sample of it to run my `aggregate()` query. I've tried doing a `db.collection.findOne().aggregate(/*QUERY*/)` but it throws an error saying that `aggregate is not a function`
you can easily create a subset of your collection like this : db.collection.aggregate({$limit: 1000}, {$out: "subsetCollection"}) this will take 1000 results from yout original collection and write the to a new collection named "subsetCollection". You can then test your aggregation queries on this new collection
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "mongodb, aggregation framework" }
How do I configure my MVC app to run in iis integrated mode? How do I configure my MVC app so that the Visual Studio development server runs it in integrated pipeline mode?
Sorry, but I don't believe the Web Development Server supports that. If you want to test under integrated mode, you'll need to install IIS or IIS Express, create a Web Application, and tell Visual Studio to use the Local IIS server.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": ".net, visual studio 2010, visual web developer, integrated pipeline mode" }
Tracking individual visitors in Wordpress and Google Analytics **Here is what I'd like to achieve:** I have a landing page and a list of contacts. I want to send each of my contacts the link and be able to see the analytics (duration, visitor flow, conversion) for each individual. Most importantly, I just want to confirm they visit the link. What I'm thinking of doing is using a Wordpress URL parameter to add a unique identifier to the page for each contact, and then track those pages in Google Analytics. What is the best practice? Is there a better/faster/easier way to do track individual visitors in Wordpress and Google Analytics?
You should be building your own url for each user. I would build a url first with this link, then write a script or something to create a unique url for each user in your contacts list. < Hope that helps! EDIT: You can also try just adding ?contact_id=99999, visit the link and then go to Google Analytics, look at the live view, and see if your parameter shows up. Whats Happening Now: < Parameters do show up in GA because on most shopping carts each page, product etc have url parameters that are unique, and can be viewed from GA. If it didn't most website applications would not be compatible with GA.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, wordpress, google analytics" }
Why don't aircraft have DME that can automatically convert the slant range to ground range? Knowing that $a^2 = b^2 + c^2$ where $a = \text{slant range},\ b= \text{ground range},\ c = \text{height}$. Why can't the DME equipment which calculates the slant range then just convert it to the ground range? Surely for navigation and position fixing knowing the actual ground range would be more useful? Is there a practical reason why the slant range has stuck?
There's no accurate and simple way to know the height above the station in order to do the calculation with the existing equipment. Altitude is not an indicator as the DME station may be above sea level. If your airplane is at 15,000ft and the station is at sea level you'll get one answer, if the station is at 10,000ft you'd get a completely different result, and mistakes could compromise safety. The only way your proposed system would work is if the DME device had a complete database of every station height and altimeter readings, which would require upgrading the DME devices at great expense. I don't think anyone is interested in that when you can have GPS for a lot less money.
stackexchange-aviation
{ "answer_score": 12, "question_score": 4, "tags": "avionics, dme" }
Cocoa: iOS: fopen fails sometimes with error: "Operation not permitted" I have a very weird behaviour in which I sometimes get a "Operation not permitted" error when using fopen in my code, and sometimes everything runs smoothly. My first thought was a sandbox issue, but in both cases I write the files to the same location. I run only up to 4 fopens before I fclose them, so I don't believe I maxed-out my files descriptors. The next batch of files will always run after the 4 previous ones were fclosed. I'm out of ideas how to approach this ambiguous behaviour, and would love to hear what you have in mind. Thanks, Nili
May be related to data protection caused by Passcode set on the Device's Settings. If the fopen is called when the device was locked and passcode is needed, "Operation not permitted" will be returned. Use these events in AppDelegate to identify this scenario and stop/start file manipulation: - (void)applicationProtectedDataWillBecomeUnavailable:(UIApplication *)application; - (void)applicationProtectedDataDidBecomeAvailable:(UIApplication *)application; See also: UIApplicationDelegate documentation
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "ios, objective c, cocoa, fopen" }
Ubercart 2.x: Given a product nid, retrieve its manufacturer I'm trying to figure out how Ubercart stores manufactures. Currently it's set up as a Vocabulary, but I can't figure out how to grab that info programmatically given a product nid. Any advice?
In Drupal 6 taxonomy terms are linked to the node object, Ubercart just piggy-backs off the way Drupal core handles this. You can use the very handy `taxonomy_node_get_terms_by_vocabulary()` function to grab all of the terms associated with a node in a certain vocabulary. You would use it like so: $vid = 1; // Vocabulary ID $nid = 1; // Node ID $node = node_load($nid); $terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
stackexchange-drupal
{ "answer_score": 1, "question_score": 1, "tags": "6, ubercart" }
Mutex Stored Procedure I want to create some distributed mutual exclusion using a database table. It would be nice to have the following interface on a stored procedure: Wait(uniqueidentifier) I was originally thinking of implementing this by having a table of unique identifiers. A call to the procedure would wait until the unique identifier does not exist in the table. However, I'm not sure how I would make the calling thread wake up when the specified unique identifier was removed from the table. Any ideas? If the database is not the right place to do this, are there any third party tools that would work (open source preferably)? (To avoid deadlocks, I either want to include a timeout in the wait operation or have the SqlCommand have a timeout)
Take a look at the system stored procedure: sp_getapplock It may help you accomplish what you are trying to do. < You can put it in a proc that parametrizes the uniqueidentifier... BEGIN TRAN DECLARE @result int EXEC @result = sp_getapplock @Resource = 'YOUR_uniqueidentifier_HERE', @LockMode = 'Exclusive', @LockTimeout = 90 IF @result NOT IN ( 0, 1 ) -- Only successful return codes BEGIN PRINT @result RAISERROR ( 'Lock failed to acquire...', 16, 1 ) END ELSE BEGIN -- DO STUFF HERE END EXEC @result = sp_releaseapplock @Resource = 'YOUR_uniqueidentifier_HERE' COMMIT TRAN
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "c#, sql server, concurrency, distributed, mutual exclusion" }
Evaluating $\int_0^1 \max (x, 1-x) dx$ I have a question related to definite integrals and series from this site here. It is written that the definite integral of $\max(x,1-x)dx$ from $0$ to $1$ is equal to $\frac34$: $$ \int_0^1 \max (x, 1-x) dx = \frac34$$ but I have question, there are two different cases (I don't consider when $x$ is between $0$ and $1$, because in this case it is undefined which one is maximum), but in the second case, if $x<0$, then it is clear that $1-x$ is greater than $x$, so its integral is $x-x^2/2$, and after plugging values,we get $1/2$, and on the other hand, if $x>1$, then $x$ is maximum, its antiderivative is $x^2$ so we get $1/2$, so when is it equal to $3/4$? Please help me to understand this problem.
Since $1-x\geq x$ when $x\leq1/2$ and $x\geq 1-x$ when $x>1/2$, we have $$\max (x, 1-x)=\left\\{ \begin{array}{ll} 1-x, & \hbox{if }x\leq1/2; \\\ x, & \hbox{if }x>1/2. \end{array} \right.$$ Hence, $$\int_0^1 \max (x, 1-x) dx =\int_0^{1/2} \max (x, 1-x) dx +\int_{1/2}^1 \max (x, 1-x) dx$$ $$=\int_0^{1/2} (1-x)dx +\int_{1/2}^1 x dx=(x-\frac{x^2}{2})\Big|_0^{1/2}+\frac{x^2}{2}\Big|_{1/2}^1=\frac{3}{4}.$$
stackexchange-math
{ "answer_score": 6, "question_score": 3, "tags": "calculus, integration, definite integrals" }
HowTo print with Qt5 without driver (PostScript / PCL) I'm developing a application that should run on an embedded device. The app should be able to communicate with different printers, without deploying a driver for each. That's why I figured out, that PostScript or PCL are good options for me. Since Qt5 does not support PCL or PostScript, I would like to use another library for my exports but wasn't able to find a single library till now. I would also like to know, if there are other standards like PCL or PostScript to use a printer without installing a driver.
Qt supports CUPS which sports a flexible driver architecture and supports PostScript, PCL and PDF printers, and many more.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++, printing, qt5, printer control language" }
Google App Engine PHP setting x frame options to same origin I have made an App that has recently gone through a penetration test. I am required to set the X-Frame options in the application to SAMEORIGIN. This is to prevent clickjacking. I believe this is possible in the App.yaml file, but I am not sure how to implement something like this. I have scanned the docs and still can't work out how to deny, only allow. handlers: - url: /.* script: public/index.php http_headers: X-Frame-Options SAMEORIGIN
I have found a solution to this using a Middleware within Laravel 5.1 The middleware is called FrameGuard and is stored at the following > Illuminate\Http\Middleware\FrameGuard To enable this add the following line to the protected middleware array 'Illuminate\Http\Middleware\FrameGuard', This sets the frame header option to SAMEORIGIN, which can be changed if required. This prevents the Clickjacking vulnerability in a Laravel application
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, security, google app engine, laravel 5.1, clickjacking" }
AddValidation to IConfiguration.Bind .NET Core 2.2 In .NET Core 2.2 we can do this services.AddOptions<EventsSettings>() .Bind(configuration.GetSection("Settings")) .ValidateDataAnnotations(); I am trying not to rely on `IOptions` for DI, so I have the following: var settings = new EventsSettings(); configuration.Bind("Settings", settings); services.AddSingleton(settings); This works great, but now I want to add validation to my settings for the second option, but I see that IConfiguration.Bind doesnt have any way to add validation check. The `IOptionBuilder` has the needed steps but not sure how to apply it without using the .`AddOptions`
You could leave it like it is and register the `EventsSettings` services.AddOptions<EventsSettings>() .Bind(Configuration.GetSection("Settings")) .ValidateDataAnnotations(); // Register the EventsSetting service using the factory overload services.AddTransient(srv => srv.GetService<IOptions<EventsSettings>>().Value);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "c#, asp.net core, .net core" }
Watermark text in asp.net? in my web application i am using javascript for water mark text in textboxes it is working fine but for textbox if TextMode property set to Multiline then the water mark text is not displaying is there any particular reason. this is my code... <TextBox ID="txtone" runat="server" tooltip="Enter comments" onblur="if(this.value=='') this.value='Enter text,150 characters only';" onfocus="if(this.value == 'Enter text,150 characters only') this.value='';" value="Enter text,150 characters only"> </TextBox>
When a `TextBox` is in multiline mode, it's rendered as a `textarea` instead of an `input` element. The `textarea` element doesn't use the `value` attribute, so your code fails to set the initial value. Use the `Text` property of the server control instead of the `value` argument of the client control: <TextBox ID="txtone" runat="server" tooltip="Enter comments" onblur="if(this.value=='') this.value='Enter text,150 characters only';" onfocus="if(this.value == 'Enter text,150 characters only') this.value='';" Text="Enter text,150 characters only"></TextBox>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "javascript, asp.net" }
Sumar valores de un conjunto de campos en Javascript Tengo un problema con un codigo que estoy desarrollando en javascript. function sumaTotales() { var totalsum=0; var j=document.getElementById("padre").childNodes; console.log(j); for(i=1;i<j.length;i++) { totalsum=+Number(j[i].value); console.log(totalsum); } } el problema es que cuando intento sumar el valor de los campos, los campos no se suman a la variable total, sino que se sobreescriben. > 3 generaciondinamica.html:41:14 > > 4 generaciondinamica.html:41:14
Huyyyyyyy casi lo tienes, cambia ésta linea y verás que magia: totalsum=+Number(j[i].value); por esta: totalsum+=Number(j[i].value); Te explico lo que está pasando: En la primera le estas asignando un número positivo es decir si `Number(j[i].value` vale 5, lo que estás haciendo es esto: totalsum= +5; En la segunda línea lo que estas haciendo es incrementar al valor de totalsum el valor `Number(j[i].value)`.
stackexchange-es_stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "javascript" }
Cumulative distribution function via plt.hist() I have data and I want to plot empirical cumulative distribution function. I took a piece of code from matplotlib official site. They use histogram to plot step function. data = np.array([5, 8, 5, 9, 10, 15, 7, 12, 19, 21, 7, 10, 11, 13, 18, 20, 20, 14, 15, 15, 21, 3, 8, 13, 14, 14, 15, 14, 17, 24, 22, 28, 24, 22, 25, 16, 21, 24, 18, 20]) hist_cum, bin_edges, patches = plt.hist(data, bins='sturges', density=True, histtype='step',cumulative=True) Output: histogram The problem is: there is one '28' in the data. Formula says F(x) = P{X < x}. Strict inequality. That means it can't be 1 on the left of x=28. I cannot understand how to fix it.
A couple things. First, I think your understanding of CDF is shaky. The CDF plot is 1.0 for all X > max(your data) for an empirical distribution. Right? The probability that a random sample from this distribution, X is less than the particular point, x, wayyyy off to the high side of the plot is 1.0. That said, I think what you are looking to do is control the axis limits of your plot. Try tinkering with these commands before rendering the plot: plt.xlim(0, 28) plt.xticks(np.arange(0,30,2))
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, matplotlib, distribution" }
What is the chicken/Cuckoo in the Kakariko Village windmill for? So I found this Cuckoo by longshotting into the windmill in Kakariko Village as adult Link. I have absolutely no idea what it's there for. I've flown around the village on it, but it doesn't seem to take me anywhere that I can't get to in other ways... Is there a purpose to this chicken? > **Link** : _How did this bird even get up here, anyway?_ !What is happening right now
The Cucco in the windmill is one of several ways to get **into Impa's house** for the heart piece. You can, however, get to that heart piece using only the longshot. Past that, there is **no use for it** at all.
stackexchange-gaming
{ "answer_score": 12, "question_score": 13, "tags": "zelda ocarina of time" }
Using induction in a measure theory proof I use $\mu^*$ to denote the outer measure of a subset of $\mathbb{R}$. Recently on a HW, I had a countable collection of measurable, pairwise disjoint sets {$E_k$}, and I wanted to show $\mu^*(A\cap\bigcup_kE_k)=\sum_k\mu^*(A\cap E_k)$, where $A$ is bounded. In a previous HW, I proved that $\mu^*(A\cap (E_1\cup E_2))=\mu^*(A\cap E_1)+m^*(A\cap E_2)$. So I used the latter equation as my base case, and WLOG, since my index set is countable, assumed that the index set for my collection of sets $E_k$ was the set $\mathbb{N}$. My professor said I am not allowed to use induction here since induction only works for a finite number of objects. Aren't all the dominoes supposed to fall? That's what the axiom of induction says: 1. $P(i)$ Base Case ($i=2$ in my case) 2. $\forall n. P(n)\Rightarrow P(n+1)$. 3. Then $\forall n.P(n)$ Is induction only allowed for finite sets?
What you are trying to prove here is a statement that holds for a countable collection (abusing language, since you titled your post "using induction like a sir": you want to prove a statement is true for a lil infinity). Induction lets you prove something is true for each individual positive integer (cf. your #3) but not for an entire collection (cf. Henning Makholm's comment). Re-abusing language, just because you know something is true for every positive integer, doesn't mean you can draw conclusions about what happens for an infinite case (even when it's just a lil infinity, like this countable case).
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "induction" }
Change ownership and permission without terminal - Python I have a gui made in glade and am stuck on one thing. I have a button that changes the ownership and permissions; it works fine except for folders and files owned by root. Is there anyway of invoking root privilages to run this command without having to input the root password in terminal? i.e. either predefine it within the script or activate a popup promt for the password and impliment it. Example of the code below: def on_button_clicked(self, widget): path = {defined from combobox} os.chdir(path) uid = os.getuid() gid = os.getgid() for root, dirs, files in os.walk(path): for d in dirs: os.chown(os.path.join(root, d), uid, gid) os.chmod(os.path.join(root, d), 0o755) for f in files: os.chown(os.path.join(root, f), uid, gid) os.chmod(os.path.join(root, f), 0o755)
The prize goes to @intepidhero for proviving some useful links; the first one did the trick! All you have to do is make sure that your user/group is in sudoers and put the folling code in the head of your script, and hey presto ... you are running your app elevated to sudo! import os import sys euid = os.geteuid() if euid != 0: print "Script not started as root. Running sudo.." args = ['sudo', sys.executable] + sys.argv + [os.environ] # the next line replaces the currently-running process with the sudo os.execlpe('sudo', *args) print 'Running. Your euid is', euid
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "python, linux, glade" }
What causes leaves to be hydrophobic? In my garden, I'm growing broccoli. I was spraying it with water the other day, and I noticed that water bounced off the leaves. When I just misted it instead of a full-on spray, the water beads collected, but stayed as beads instead of spreading out. Some of them bounced off, but some accumulated. **So what makes that happen? I know the leaf is hydrophobic, but I haven't found by searching Google if there's a coating of some type on the leaf or if it's something else that's making it hydrophobic.**
This is due to presence of a hydrophobic chemical called as cutin present at the the aerial surfaces of plants. > Cutin is one of two waxy polymers that are the main components of the plant cuticle, which covers all aerial surfaces of plants. The other major cuticle polymer is cutan, which is much more readily preserved in the fossil record,.[1] Cutin consists of omega hydroxy acids and their derivatives, which are interlinked via ester bonds, forming a polyester polymer of indeterminate size. * * * Source: <
stackexchange-biology
{ "answer_score": 12, "question_score": 6, "tags": "botany, plant anatomy" }
How to Remove brew install bash I installed bash via brew to check out version 4. I would like to remove this. I cannot use my npm packages correctly and am at a standstill. Wondering how to remove an installation from homebrew?
Have you tried `brew uninstall bash`? If that doesn't work for you, you could try removing the actual files, usually `/usr/local/Cellar/bash/` and `/usr/local/bin/bash`. This should get you at least far enough to be using your old `bash` binaries, from where you could do any further cleanup.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "bash, homebrew" }
Is it illegal to post a software without permission? I am making a software which would do gridcomputing (i.e combine many computers processes to speed up a Function/App/Computer) I would post it online like a virus and spread to computers. This software will not take any of data. Delete it. Use it. It will only use a little bit of internet and 10MB of RAM.
Unauthorized use of a computer is illegal in most of the United States, and in many circumstances it is a federal crime. Here's a round-up of applicable laws from the National Conference of State Legislatures.
stackexchange-law
{ "answer_score": 5, "question_score": -2, "tags": "software, india" }
Why does this call to (read in-from-make-pipe) block in racket? I have this code from the documentation: (define-values (in out) (make-pipe)) (write "234234" out) (read in) This produces `"234234"` like in the docs. This next piece of code, just blocks on the read. Why does this happen? (define-values (in out) (make-pipe)) (write 234234 out) ; <-- NOT A STRING (read in) ; <-- BLOCKS
The underlying problem here is that the reader must parse a complete value from the input. When you send "234234" to the pipe, the pipe contains 8 characters, and the last one (the second double-quote) informs `read` that the value is complete. When you write 234234, the only thing in the pipe are the digits, and the reader can't tell whether the number is complete. To see this, try the following: #lang racket (define-values (in out) (make-pipe)) (write 234234 out) (write 111 out) (display " " out) (read in) this produces the number 234234111.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 4, "tags": "racket" }
non static or const array syntax what's wrong with this syntax? sorry for the newbie question. source: Level::Level() { NintyDegreeDirections[4] = { 1.0f, 1.4f, 2.4f, 0.1f } ...rest of class header: //all necessary includes class Level { private: float NintyDegreeDirections[4]; ...rest of header how do I have an array as a instance member? I'm converting from C#
In the current version of C++ (C++11), you can initialize the member array like this: Level::Level() : NintyDegreeDirections( { 1.0f, 1.4f, 2.4f, 0.1f } ) { } C++11 isn't universally supported and if you don't have support for this in your compiler you will have to assign to each member in turn. E.g.: NintyDegreeDirections[0] = 1.0f; NintyDegreeDirections[1] = 1.4f; //...
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c++" }
How to the red dot draw an ellipse? \documentclass[pstricks]{standalone} \usepackage{pst-node,multido}% \begin{document} %\multido{\rA=180+1}{180}{% \begin{pspicture}showgrid(4,4) \pscircle{3} \pnode(3;180){A} \pscircle(A){.5} \rput(A){\pnode(.5;180){B}} \psline(A)(B) \psellipse(3.5,2.5) %% <<-- I think so! \psdot(A) \psdot*linecolor=red \end{pspicture} %} \end{document} ![enter image description here]( Question: How to create an animation as the following: ![enter image description here]( ![enter image description here]( ![enter image description here](
\documentclass[pstricks]{standalone} \usepackage{pst-node,multido}% \begin{document} \multido{\iA=180+5}{72}{% \begin{pspicture}showgrid(4,4) \pscircle{3} \pnode(3;\iA){A} \pscircle(A){.5} \rput(A){\pnode(.5;-\iA){B}} \psline{*-}(A)(B) \psellipselinecolor=black!10 \psdot*linecolor=red \psellipticarclinecolor=red,linewidth=2pt(3.5,2.5){180}{(B)} \end{pspicture}% } \end{document} ![enter image description here](
stackexchange-tex
{ "answer_score": 7, "question_score": 5, "tags": "pstricks, animations" }
Difference between ^ Operator in JS and Python I need to port some JS code which involves `Math.random()*2147483648)^(new Date).getTime()`. While it looks like for smaller numbers, the python function and the JS function are equivalent in function, but with large numbers like this, the values end up entirely different. Python: >>> 2147483647 ^ 1257628307380 1257075044427 Javascript: > 2147483647 ^ 1257628307380 -1350373301 How can I get the Javascript value from python?
Python has unlimited-precision integers, while Javascript is using a 32-bit integer. You can manually apply a 32-bit limit to get the result you want: def xor32bit(a, b): m = (a ^ b) % (2**32) if m > (2**16): m -= 2**32 return m
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "javascript, python, bit manipulation, xor" }