INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
How to display error message to User when InvocableMethod throws an exception **Background** I am using Process Builder to run an Apex `InvocableMethod` which sends some data to a 3rd party REST API. Sometimes the 3rd party REST API returns a validation error. **Question** How can I return this message from the `InvocableMethod` to the User as a friendly popup message? Similar to how triggers allow this: .addError('REST API Validation Message Goes Here!');
You cannot perform a callout after a transaction has started a DML operation, so your callout would necessarily need to be asynchronous, starting some time after the record is committed to the database. As such, there's no way to return an error to the user, and subsequently cancel the save operation, because it runs in a separate transaction. The best you could hope for is to do something like sending a message or updating/deleting a record.
stackexchange-salesforce
{ "answer_score": 4, "question_score": 7, "tags": "apex, process builder, error messages, invocable method" }
Undefined index: leveluser php in session? why user-level posts Undefined index what's wrong my code? <?php if ($_SESSION['leveluser'] == 'supplier') { include "menu_sup.php"; } else if($_SESSION['leveluser'] == 'distributor') { include "menu_dis.php"; } else{ ?> Notice: Undefined index: leveluser in C:\xampp\htdocs\apotikphp\menu.php on line 4
As error say $_SESSION['leveluser'] is not defined or initialize. better to use like this: if (isset($_SESSION['leveluser']) && $_SESSION['leveluser'] == 'supplier') { include "menu_sup.php"; } else if(isset($_SESSION['leveluser']) && $_SESSION['leveluser'] == 'distributor') { include "menu_dis.php"; } else{
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "php" }
VBA - How to Retrieves the column number and use it to fill another column? How to make the code work when the Column number is dynamic? I want the code to work when some of the time i need to work with col B and some of the times is col C (the title stay the same)? I tried to use function but i don't think I'm doing it right. Public Function GetColumn(str As String, rng As Range) As Integer GetColumn = Application.Sheets("Sheet1").Match("Supplier", "POC[#Headers]", 0) End Function Sub i() NumRows = cells(Rows.Count, "e").End(xlUp).Row For i = 2 To NumRows Supplier = cells(i, 16).Value Select Case Supplier Case "EDLC", "ANC", "EdTD", "ENC", "APASA P", "EBANROPE", "EVANC" GetColumn.Value = "Zaya" End Select Next i End Sub
Try this: Sub test() Dim Supplier As String Dim POC As String NumRows = Cells(Rows.Count, "e").End(xlUp).Row For i = 2 To NumRows Supplier = Cells(i, Sheet1.Rows(1).Find("Supplier").Column).Value POC = Cells(i, Sheet1.Rows(1).Find("POC").Column).Value Select Case Supplier Case "EC", "AC", "ED", "ENC", "ATHP", "EBPE", "EVANC" Cells(i, Sheet1.Rows(1).Find("POC").Column).Value = "Za" End Select Next i End Sub
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "excel, vba, function" }
CakePHP 2.6 Validation Rule isUnique per belongsTo Parent I'm trying to figure out how to build a validation rule, and the simplest example I can give would be a class signup with students emails. I want each class to be able to have unique student emails signup, but I also want students to be able to sign up with the same email for multiple classes. Class hasMany Students (id, name, limit) Student belongsTo Class (id, email, class_id) Example Scenario: Class A, has student signup: [email protected] (If [email protected] signed up again for this class, it would not allow.) Class B, could have student signup: [email protected] again since it's a different class. So is there a way to use isUnique in combination with another rule, or is this a custom validator situation? Thanks!
I think I have to answer a different question here, because your model association doesn't make sense. If any one Student can take multiple classes and a Class can have multiple students, then your association needs to be **hasAndBelongsToMany**. Your `students` table, then, would not have a `class_id`. You would instead set up a join table, `classes_students`, which would have a `class_id` and `student_id`. Then you could add a validation rule on the join table to make sure no student is taking the same class twice. See this Making HABTM relationships unique in CakePHP question.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "validation, cakephp, cakephp 2.6" }
Most efficient way to check a URL I'm trying to check if a user submitted URL is valid, it goes directly to the database when the user hits submit. So far, I have: $string = $_POST[url]; if (strpos($string, 'www.') && (strpos($string, '/'))) { echo 'Good'; } The submitted page should be a page in a directory, not the main site, so ` How can I have it check for the second `/` without it thinking it's from ` and that doesn't include `.com`? Sample input: Valid: Invalid: facebook.com/pageName facebook.com
if(!parse_url(' PHP_URL_PATH)) { echo 'no path found'; } See `parse_url` reference.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, database, forms, verification" }
Namespace declaration statement has to be the very first statement or after any declare call in the script Gostaria de saber o que causou este problema que resolvi "meio que sem saber como". Criei o arquivo `mysql.php` usando o editor PSPad para debugar algumas queryes e, misteriosamente, começou a parecer o erro: Fatal error: Namespace declaration statement has to be the very first statement in the script in C:\localhost\teste\libraries\teste\mysql.php on line 2 Sendo que no código não há nada que denote tal erro: <?php namespace MysqlTESTE; //utilização de namespaces (CRUD) include 'server.php'; use Mysqli; ... Resolvi o problema criando um novo arquivo `mysql.php` no Notepad e colando nele o código copiado do arquivo criado no PSPad
Eu já passei por isso, a solução é simples, mas até encontrar ela... É o seguinte: Alguns editores de texto em ambientes UTF-8 adicionam o BOM no começo dos arquivos de texto. No seu caso bastaria alterar para o editor usar UTF-8(Sem BOM), caso ele lhe desse essa opção. No Notepad++ por exemplo, você encontra essa e outras opções, no menu "Formatar". Mas o que é o "BOM"? A marca de ordem de byte (BOM) é um caractere Unicode usado para denotar a extremidade (ordem de bytes) de um arquivo de texto ou fluxo de dados, com código U+FEFF. Seu uso é opcional e, se usado, deve aparecer no começo do fluxo de texto. (< Lembro que se eu abrisse o arquivo no netbeans, conseguia ver o caracter  no começo da folha
stackexchange-pt_stackoverflow
{ "answer_score": 10, "question_score": 2, "tags": "php, codificação de caracteres, namespace" }
Intersection of Subcomodules is a Subcomodule? Let $(C, \Delta, \epsilon)$ be a coalgebra over a commutative ring $k$. Let $M$ be a right comodule over $C$, that is a $k$-module $M$ together with a $k$-linear map $\delta \colon M \to M \otimes C$ such that $(1 \otimes \epsilon)\delta = 1$ and $(1 \otimes \Delta)\delta = (\delta \otimes 1 )\delta$. Let $P$ and $N$ be subcomodules of $M$, i.e. $P$ is a $k$-module such that $\delta(P) \subseteq P \otimes C$, similarly for $N$. Is it true that $N \cap P$ is a subcomodule of $M$? To me it seems simple that $\delta(N \cap P) \subseteq \delta(N) \cap \delta(P) \subseteq (N \otimes C) \cap (P \otimes C) = (N \cap P) \otimes C$... But there is something wrong with my reasoning, since my internet searches tell me that $C$ has to be flat. Can someone help?
You write $N \otimes C \cap P \otimes C$ and implicitly assume that this intersection makes sense in $M \otimes C$. In other words, you assume that $N \otimes C \to M \otimes C$ is injective (the same for $P \otimes C$). This is not true in general. And even if these maps are injective, it is not clear at all why $N \otimes C \cap P \otimes C = (N \cap P) \otimes C$. But both are true when $C$ is flat / $k$.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "commutative algebra" }
How to generate the keys of a dictionary using permutations I need to create a dictionary, values could be left blank or zero but i need the keys to be all the possible combinations of ABCD characters with lenght k. For example, for k = 8 lex = defaultdict(int) lex = { 'AAAAAAAA':0, 'AAAAAAAB':0, 'AAAAAABB':0, ...} so far i have tried somethink like this, i know it's wrong but i have no idea how to make it work, i'm new in python so please bear with me. mydiction = {} mylist = [] mylist = itertools.permutations('ACTG', 8) for keys in mydiction: mydiction[keys] = mylist.next() print(mydiction)
You can do it in one line, but what you are looking for is `combinations_with_replacement` from itertools import combinations_with_replacement mydict = {"".join(key):0 for key in combinations_with_replacement('ACTG', 8)}
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "python, dictionary, permutation" }
select elements ajax automaticly after call My question is, how is possible select or manipulate the elements take from a call ajax without every time put the `.on/.live` method of jquery? there is another way more fast?
as the elements are not inside the DOM when DOM is ready, you have to do such delegation like .on()
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -4, "tags": "ajax, jquery" }
Cannot rake db:migrate (Pin error) i'm working on the One Month Rails app and I recently run into this error when i try to `run rake db: migrate`: !enter image description here Here is what my migration file looks like: !enter image description here Any help on how to solve this? Thanks in advance
Try with specifying the version and run. rake:db:migrate VERSION = your_file_version In your case,it is rake:db:migrate VERSION = 20140418122310 **Edit** In your migration file change this line create_table :pins do |t| to like this change_table :pins do |t|
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ruby on rails, migration" }
Does Assembly.Load use cache? I have a resource assembly which stores a lot of reusable scripts, styles and controls. I'm not sure if I should cache this assembly after loading it. Does Assembly.Load use internal cache within the same app-domain? Thank you!
Assemblies when loaded into an AppDomain remain loaded, so there is nothing for you to do, this is the default behaviour. In fact you will have an issue if you want to unload an Assembly, in that case you need to unload the entire AppDomain, that's why you would often load an assembly into a new AppDomain in your case you wouldn't need to go to that effort.
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 4, "tags": "c#, .net, caching, assembly.load" }
How can I show a String for a certain seconds I got a question. How can I show a string for only a certain time , and then the the textview changes the string. Hope you can help me.
Use a timer to set text _tv = (TextView) findViewById( R.id.textView1 ); _t = new Timer(); -tv.setText("hi"); _t.scheduleAtFixedRate( new TimerTask() { @Override public void run() { _count++; runOnUiThread(new Runnable() //run on ui thread { public void run() { if(_count==5)//after 5 seconds change the text { _tv.setText("hello"); } } }); } }, 1000, 1000 ); Remember to cancel the timer when done.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "android, string, timer, countdown, countdowntimer" }
google geocode api unknown error for random cities I've been noticing that google geocoding api returns "unknown error" for some cities, some of the time. Example from right now: `curl ' returns: ` { "results" : [], "status" : "UNKNOWN_ERROR" } ` Also: `curl ' returns: ` { "results" : [], "status" : "UNKNOWN_ERROR" } ` while `curl ' works fine. I had this problem the other day as well, but it seemed to have resolved itself & now it's back again.
This is ongoing issue on Google side reported on April 11 2018 in the Google issue tracker and handled in < Google is aware of this issue, acknowledged it and hopefully they will fix it soon. On issue tracker the priority was set to P2. Please star the bug to add your vote and subscribe to further notifications from Google. **UPDATE** The bug was marked as Fixed by Google on April 20, 2018.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 6, "tags": "google maps, google geocoder" }
How does the Run dialog know where applications are? As a power user, I frequently use the Run dialog. I can understand why the following commands work, as they are in the `PATH` environment variable. mspaint diskmgmt.msc explorer These commands also work in CMD. The commands below work in run, but they are not in the `PATH`, and they don't work in CMD. firefox winword iexplore How does Run know where these files are?
When you execute a command from Run dialog, the system looks at the `App Paths` registry key here: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths EXAMPLE HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\filezilla.exe `(default)` value data has the full path to the executable. If it's not found, it looks at each folder included in the PATH. Whereas the Command Prompt doesn't reference these registry keys. It only searches the PATH.
stackexchange-superuser
{ "answer_score": 89, "question_score": 72, "tags": "windows, run dialog" }
Can the Pro version of Windows 10 be installed by the Media Creation Tool? I ran the Media Creation Tool, selected `Create installation media for another PC` and planned to select `Windows 10 Pro` from the `Edition` drop down menu. But all it has is `Windows 10` and `Windows 10 N`. So - Can the Pro version of Windows 10 be installed by the Media Creation Tool? (I have an activation key for the pro version.)
It will install both the Home and Pro edition. The existing digital entitlement, or product key entered during Setup, will determine which one gets installed. So unless you want the "N" version, pick "Windows 10". :)
stackexchange-superuser
{ "answer_score": 1, "question_score": 0, "tags": "windows, windows 10" }
Odoo 10 - How to hide a One2many field I have a `One2many` field, and against the attrs I want to put something along the lines of - if this `One2many` is blank then hide it. The `One2many` is already auto populated from other objects, so all I need to do is set the invisible to something like... {'invisible':[('this_field_ids','=',False)]} There is only one problem... this does not work for a `One2many` field. If it was a `boolean`, `char`, or `Many2one` then it would work, but the `One2many` acts differently. What can I put in the attrs to make this (or in this case, the 'page' that this is within) invisible if it is empty? I believe that I can make a separate computed field to get the job done, but I wanted to know if I can achieve this without the computed field.
The comparaison should be with an empty list: {'invisible':[('this_field_ids', '=', [])]}
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "odoo, odoo 10, one2many" }
Windows 8 Slide out menu What control do I need to create my own slide out menu (i.e. Charm menu) for my app? I want to do this in `XAML`.
Check out the library from this blog post to create charm flyout controls: <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, xaml, windows 8" }
Why is $(T + N_X)(x) \subset T(x)$ when $Dom T \subset X$? I'm trying to show that given a maximal monotone operator $T$ and a closed convex set $X$ with $Dom T \subset X$ then for a given $x \in Dom T$ it holds $(T + N_X)(x) \subset T(x)$ where $N_X(\cdot)$ is the normal cone, that is $N_X(x) = \\{y\text{ st }\langle y, x - u\rangle \geq 0 \quad \forall u \in X\\}$ But can't seem to figure it out. Any ideas?
Note that $T\subset T+N_X$ (because $Dom(T)\subset X$ and $0\in N_X (x)$, $\forall x\in X$) and because $T$ is maximal while $T+N_X$ is monotone one gets the equality $T=T+N_X$. You do not need $X$ closed convex.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "analysis, convex analysis, convex optimization" }
Jquery deleting element in ".each" function I try to scrape a webpage using Node.js. I just want to delete the div node inside the link and get the string "John Doe". What am i doing wrong here ? <div class="myclass"> <a href="page.html"> <div><img src="image.jpg" /></div> John doe </a> </div> $('div.myclass a').each(function(i, e) { $(e).each(function(i, e) { console.log($(e).remove("div").html()); } } This javascript chunk of code return the exact same html part (the div isn't deleted) <div class="myclass"> <a href="page.html"> <div><img src="image.jpg" /></div> John doe </a> </div> **Thanks for your help !**
Try this $('div.myclass a').each(function (i, e) { $(e).each(function (i, ex) { $(ex).find("div").remove(); $(ex).html(); }); }); **DEMO** Even simpler $('div.myclass a').each(function (i, e) { $(e).find("div").remove(); $(e).html(); }); **DEMO2**
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, html, each" }
Google TV emulator not able to play HLS I have a google TV emulator for android 3.1 (API 12) i am trying to play an hls file but I am getting the message "cannot play this video" I am using the below code: mVideoView = (VideoView) findViewById(R.id.videoView1); mVideoView.setVideoURI(Uri.parse(" mVideoView.setOnCompletionListener(this); mVideoView.setOnErrorListener(this); MediaController mc = new MediaController(this, true); mc.setMediaPlayer(mVideoView); mc.setAnchorView(mVideoView); mVideoView.setMediaController(mc); mVideoView.requestFocus(); mVideoView.start(); What could i be possibly missing? does anyone has a solution or suggestion for this problem?
emulator for Google TV does not support HLS. I will file a feature request for this. Thanks!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "streaming, android videoview, http live streaming, google tv" }
Azure Pipeline - Zip deployment I have just begun in Azure DevOps. I made the CI/CD pipeline for our dot net project. CI successfully done and generated the artifact, but in CD getting failed always, configured deployment type = zip; I am completely new for Azure, so anyone look at this issue earlier and sorted out. Pls share your experience. ![enter image description here]( ![enter image description here](
Your array before red line says "There is not enough space on the disk". Please check your disk - probably storing or replacing the zip is not possible because of missing space.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "azure, azure devops, azure pipelines" }
How do I fix a dent on my frame? I suspect that something has pierced my frame. At any rate, I have a dent in my bike frame. I would like to avoid the possibility of corrosion, with minimium cosmetic trade off. So, how do I go about fixing the dent? **EDIT** I have since noticed that nothing has pierced my frame. However, there is corrosion. Here is the frame spec: Frame Material: Steel Frame Size: 17-18 Frame: Voodoo Black Magic butted thin wall heat treated Cro-mo frame !View 2 !View 3 !View 4 !View 5 !View 6 !View 7
If your frame isn't pierced through, I wouldn't bother with it much. Apply some paint of correct type (I'm no expert, consult your local home improvement/paint shop) to stop further corrosion. You might want to remove the existing rust with a fine sandpaper before putting the paint on (again, refer to the manual of the paint or consult the shop). I think there are even some special paints for fixing car finishes available in car shops but that might be a little too expensive. The important thing is to prevent direct contact between the bare steel and water / air humidity if you don't want the rusting to progress. * * * EDIT: A cheap solution might even be a waterproof and airtight adhesive tape.
stackexchange-bicycles
{ "answer_score": 2, "question_score": 4, "tags": "frames, damage, corrosion" }
Visualize graphs in java I'm currently working on a university project to implement simple graph algorithms in java (< and I'm struggling to find a simple solution to export my created graphs into a image file (i.e. .png) I already looked at tools like GraphViz and GraphStream, but they seem to focus more on visualizing their own code to create graphs. Has anybody knowledge of a simple library or maybe even external tool which can interpret my generated output in a image file? If possible something lightweight and easy to implement. [My code] ---> [Output] ---> [What I'm in search of] ---> [Image File]
If you generate output in the Graphviz Dot language, you can visualize it with `dotty` and export to PNG or other image formats with the `dot` program. The Dot language is very simple, for example here's a directed graph with 3 nodes making a cycle, and a self-edge in the third node. digraph { A -> B B -> C C -> A C -> C } This is how it's rendered in dotty: ![enter image description here](
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, graphviz, graphstream" }
Open source OCR tool available in the market Is there any open source OCR library written in .NET, or written in any language but can be used in an ASP.NET application? Or is there any open source OCR API available in the market for image to tabular formats ?
Use Tessnet. Tessnet is C++/CLI .NET Wrapper for tessdll (and tesseract) for .NET 2.0.
stackexchange-stackoverflow
{ "answer_score": 15, "question_score": 25, "tags": ".net, ocr" }
Seeking QGIS equivalent for ArcGIS route editing tools? In ArcGIS Desktop I frequently use the route editing Tools for line features and I was wondering if the same or similar tools exist in QGIS as well. I couldn't find them so far. With "create route" I can select two or more line objects from my line feature layer and the tool creates a new object combining the selected lines and giving me the length of the route from the start of the first line till the end of the last line. Does anyone know whether these tools exist in QGIS or not?
I think the closest would be the LRS pluggin > **Features** > > * Standard LRS tasks: calibration (creation of LRS), creation of punctual and linear events and calculation of measures for points. > * Support for all vector formats supported by QGIS. > * Supported are lines, multi-lines, points, multi-points. The lines don’t need to be oriented. Single route may be represented by > multiple features. > * Dynamic list and layer of errors and layer of quality which are updated immediately when source layer features is edited. > * The generated LRS is stored in memory only. > * Interpolation between points by default, optional extrapolation. >
stackexchange-gis
{ "answer_score": 1, "question_score": -1, "tags": "qgis, editing, route" }
Eslint: how to handle no-use-before-define for dependent functions? I have 2 dependent functions that call each others, so one or the other has to be declared first which fires an eslint `no-use-before-define` error. I know I can disable the rule but is there any better way do do this? Simplified example: const a = number => { if (number === 0) { return b(number); } c(number); } const b = number => a(number + 1); a(0); I can't merge `a` and `b` as they both need to be called separately somewhere else in the code.
You may use callback or higher order functions. Hope that will help. Plz try this code and leme know if it works fine with your linting rules. const a = (number, call) => { if (number === 0) { return call(number); } c(number); } const b = number => a(number + 1, b); const c = number => console.log(1); a(0, b);
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "javascript, ecmascript 6, eslint" }
Wait until the mining is done I'm trying to get a transaction once mining is done without a random timeout. I've checked similar questions but they aren't conclusive enough. How do I get a transaction receipt once the mining is done? Full code on Github. try { ethereum .request({ method: "eth_sendTransaction", params: [tx], }) .then( async (result) => { let nftTxn = await nftContract.safeMint; console.log("Minting... please wait"); const transactionReceipt = await web3.eth.getTransactionReceipt(result); await transactionReceipt.wait; //cannot await because of null if (transactionReceipt!=null) { console.log(`Mined... ${transactionReceipt}`); } else { console.log(`error`) }; //getting this })
I think your question is partially answered here: How to wait until transaction is confirmed web3.js? This shows how to wait for a TX to be mined by periodically checking the output of `getTransactionReceipt(...)` untill it returns a value that is not `null`. Also, I think there might be an issue with the following line: let nftTxn = await nftContract.safeMint; I think the method `safeMint` is not being called and is not making any transaction.
stackexchange-ethereum
{ "answer_score": 0, "question_score": 0, "tags": "web3js, metamask, etherscan, react" }
Can't figure out whats wrong in the javascript portion of code document.getElementById('go').onclick = function() { var data = document.getElementById('number1').value; data = parseFloat(number1); var data = document.getElementById('number2').value; data = parseFloat(number2); var total = number1 + number2; document.getElementById('result').value = total; };
You store the value after the parseFloat into wrong variable. You're basically just overriding the same variable `data`, and also you did not initialize variables `number1` and `number2`. It should be like this: document.getElementById('go').onclick = function() { var number1 = document.getElementById('number1').value; number1 = parseFloat(number1); var number2 = document.getElementById('number2').value; number2 = parseFloat(number2); var total = number1 + number2; document.getElementById('result').value = total; };
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -4, "tags": "javascript" }
How to compute $\int_0^s \frac{r\, \mathrm{d}r}{\sqrt{s^2-r^2}\sqrt{t^2-r^2}}$ if we know that $s<t$? In a integral equation problem, I came across the following integral $$ \phi(s,t) = \int_0^s \frac{r\, \mathrm{d}r}{\sqrt{s^2-r^2}\sqrt{t^2-r^2}} \, . $$ We can remark that the integral is given by $$ \phi(s,t) = \frac{1}{2} \ln \left( \frac{t+s}{t-s} \right) \, . $$ But is there a way to prove that analytically, provided that $s < t$? Thanks R
Use the change of variable $\tau = r^2$ and the following indefinite integral $$ \int \frac{d\tau}{\sqrt{\tau^2-a\tau+b}} =\ln\left(\frac{a}{2}-\tau-\sqrt{\tau^2-a\tau+b}\right). $$ Then \begin{align} \int_0^s \frac{r\, \mathrm{d}r}{\sqrt{s^2-r^2}\sqrt{t^2-r^2}} &=\frac{1}{2}\int_0^{s^2}\frac{d\tau}{\sqrt{\tau^2-(s^2+t^2)\tau+s^2t^2}} \cr &=\left.\frac{1}{2}\ln\left(\frac{s^2+t^2}{2}-\tau-\sqrt{\tau^2-(s^2+t^2)\tau+s^2t^2}\right) \right|_{\tau=0}^{s^2} \cr &= \frac{1}{2}\ln\left( \frac{t+s}{t-s}\right). \end{align}
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "integration, definite integrals, indefinite integrals, integral equations, integral transforms" }
Carry forward current value from ddl to another .aspx page I want to get the current selected content from the dropdown list to the next `aspx` page.
This might be helpful. This video shows how to pass value from textbox to next page you can replace the textbox to Drop Down list and it should work. Click to see video
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net" }
Free stock footage for open-source project I'm implementing a video processing framework. Where can I get high quality free stock footage so I could use it to demonstrate functionality? The framework is open source, so I'd like the videos to be as well (I'm not charging for the final product, so I wouldn't want to pay for the videos either).
The internet archive has a section with movies in the public domain, you could for example use Night of the Living Dead. Another option would be creative commons licensed videos, using for example this Flickr query
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "open source, video processing" }
Migration from Firebird 1.5 to PostgreSQL-9.3 I'm migrating all the tables and data from Firebird 1.5 to PostgreSQL-9.3. The software was build using Delphi 7 and I'm migrating to Java web. My question is: **How to make this works in PostgreSQL?** TELA BLOB SUB_TYPE 0 SEGMENT SIZE 80
The equivalent of Firebird's `BLOB SUB_TYPE 0` in Postgres is `bytea`. So the column definition would be `tela bytea`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "database, postgresql, firebird, postgresql 9.3, firebird1.5" }
how to disable/enable a button by jquery how to disable/enable a specific button by jquery ( by name )? The button does not have ID , just this code: <button onclick="$('ChangeAction').value='SaveAndDoOrder';" value="Bye" name="SaveAndDoOrder" type="submit"> <i class="Icon ContinueIconTiny"></i> <span class="SelectedItem">Bye</span> </button>
I would recommend using ID instead of name, like: $("#myButton").attr("disabled", true); This will add the `disabled` attribute to the button which your browser will then automaticallly disable. If you want to use name you can use it like this: $("button[name=myButton]").attr("disabled", true);
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 5, "tags": "jquery" }
Finding maximum and minimum with given constraints > $y=(10-a)(10-b)(10-c)$ > > $\text{where } (a+b+c)=3\text{ and each of (a,b,c) are positive}$ > > What is the maximum and minimum value $y$ can have? I have created this question with these small values for ease of understanding. From my trials in excel, It appears as Maximum is when $a=b=c=1$. Then, $y=9×9×9=729$ Minimum is when any two of $(a,b,c)$ is zero and other is $3$. Then, $y=10×10×7=700$ So, $700 \lt y \le 729$ is the required range. But, These are based on my trials and may be wrong also. Please tell whether my answer is right or wrong and also help in deriving this answer mathematically. > Update:wolframalpha.com gives the following results > > maximum : 729 < > > minimum : no global minima found <
The set $D=\\{(a,b,c)\in\mathbb{R}^3:a+b+c=3,a,b,c>0\\}$ is not a closed set with a smooth boundary, hence the method of Lagrange multipliers requires to be adjusted. By computing the partial derivatives of $(10-a)(10-b)(10-c)$ and $a+b+c$ we have that $a=b=c=1$ is a stationary point (indeed an absolute maximum) but we still have to study what happens on $\partial D=\\{(a,b,c)\in\mathbb{R}^3:a+b+c=3,abc=0\\}$. Since $\partial D$ is symmetric with respect to cyclic shifts of the variables, we may assume $a=0$ and study $10(10-b)(10-c)$ under the constraints $b+c=3$ and $b,c\geq 0$. It follows that $\color{red}{700}$ is an infimum over $D$ and $\color{red}{729}$ is a maximum, as conjectured.
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "maxima minima" }
how to Get a list of applications being download? In my application, I need to know if a particular app is being downloaded from the android market or not. How Do I achieve this functionality? Is it possible to get a list of all the downloads that are in progress?Does the android market broadcast any intents that can be caught? Note:Since my target application is on android 3.0+ devices therefore, I have no issues with using the DownloadManager class(which is 2.3 onwards).
I found an API that will accomplish what you want but you need to have an API of 9 or higher to use it. You can get all the downloads that have been requested for download from a download manager by using this: DownloadManager manager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Query query = new DownloadManager.Query(); Cursor c = manager.query(query); You can get more information on this here. I don't think there are any other methods available that will give you this information at a lower API level.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "android, broadcastreceiver, google play, android 3.0 honeycomb, download manager" }
Is the set W a vector space? > Let $W = \\{ (a,b): a, b \in \mathbb{R}, a + b = 1 \\}$. For any $(a,b), (c,d) \in W$ and scalar r, define $$ \begin{split} (a, b) + (c, d) &= (a+c-1, b+d)\\\ r \cdot (a, b) &= (ra - r +1, rb) \end{split} $$ Prove or disprove $(W,+,\cdot)$ is a vector space. **This is what I have:** Let $u,v,w ∈ W , W \subset \mathbb{R}^2$. I proved the 2nd axiom as $$ u+v= (u_1 + v_1 - 1, u_2 + v_2)= ( u_1 + v_1 -1 , v_2 + u_2)= v+u. $$ To prove that the set is a vector I just need to show that it is closed under addition and scalar multiplication but I cant figure out the scalar multiplication part.
Yes, $W$ is a vector space, where the identity element of addition is $(1,0)$ and additive inverse of $(a,b)$ is $(2-a,-b)$. Moreover by considering the map $\Phi: (W,+,\cdot) \to (S,+,\cdot)$ given by $$\Phi(a,b)=(1-a,b)$$ you may _translate_ any operation over $W$ into an operation in $S=\\{(x,x):x\in\mathbb{R}\\}$, a subspace of the vector space $\mathbb{R}^2$ with the usual operations $+$, $\cdot$. Indeed, since $\Phi^{-1}=\Phi$ it follows that that for any $(a,b),(c,d)\in W$ and scalar $r$: $$\Phi^{-1}(\Phi(a,b)+\Phi(c,d))=\Phi^{-1}((1-a,b)+(1-c,d))= \Phi^{-1}(2-a-c,b+d)=(a+c-1,b+d)=(a,b)+(c,d)$$ and $$\Phi^{-1}(r\cdot\Phi(a,b))=\Phi^{-1}(r\cdot (1-a,b))=\Phi^{-1}(r-ra,rb) = (ra - r +1, rb)=r \cdot (a, b).$$
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "linear algebra, vector spaces, proof writing" }
Inserting a Space in to a Text String Preparing a File Directory I've prepared a code that reads cells within a sheet and uses those cells to determine the directory to follow to open the necessary file. Workbooks.Open Filename:= _ "Q:\Accounts Department\JM Period End ADI\1516\Stats\Period 0" & Range("C3").Value & _ "\Eng PERIOD Reports SOUTH P" & Range("C3").Value & Range("C6").Value & " 15 16.xls" What I want this to return is `"Q:\Accounts Department\JM Period End ADI\1516\Stats\Period 01\Eng PERIOD Reports South P1 Jul 15 16.xls"`. But rather than this, it's returning `"Q:\Accounts Department\JM Period End ADI\1516\Stats\Period 01\Eng PERIOD Reports South P1Jul 15 16.xls"` ( _notice the lack of a space between_ `P1Jul` _at the end_ ). Can anyone please assist in getting a space in there?
Change Range("C3").Value & Range("C6").Value to Range("C3").Value & " " & Range("C6").Value I am assuming that `Range("C3").Value` is `1` and `Range("C6").Value` is `Jul`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "vba, excel" }
ASP.NET FormsAuthentication Cookie Problem We use FormAuthentication to manage logins and I have a case where a customer complains where he can login from one computer but to from another. I can see in my logs that his authentican is successfull but he gets bumped back to the login page. I can reproduce the symptons by disabling cookies so I asked the customer to test if cookies are enabled on < but this came out positive. What have I missed? Is there any antivirus/security software that can mess up (ASP.NET) cookies? The user is using IE7 and claims to have F-secure installed.
First ask from your customer to try to **login using some other browser like google chrome**. If with other browser works, **then ask from your customer to clear the cookies on his browser** , if he can clear only your page cookies, then you must be check if you using too much cookies, or too big ones, and create a diferent shecma. **You maybe have set to store/cache the roles on cookie** \- this make cookie too big ones, and big cookies create problems.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "asp.net, cookies, internet explorer 7" }
AWS IOT limit of creating things Is there a limit that per time we can create some particular number of things in AWS IOT? I have a requirement to create 10,000 of things in aws iot. Please help
The default limit for the `CreateThing` API is 15 requests per second. This limit is adjustable if you reach out to AWS customer support. AWS IoT limits
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "aws iot" }
How to replace a React component I plan to have a base app where most of the components should be replaceable at a later time, depending on specific customer needs without touching the base app code. What is the best mechanism to achieve this within the React ecosystem? Is there a registry that can be updated, or any other deferred binding of components similar to the GWT _replace-with_ construct? Thanks. Update 1: My understanding is that Dependency Injection would allow one to inject into static components. The question I'm asking is more about whether it's possible to implement a registry of sorts and compose the application via component registry keys, thus enabling later updates to specify which component that key will be resolved to. React seems to expect a static relation there, and I want it to be dynamic if possible.
No, there's no central registry, but it wouldn't be too difficult to create one. Something like (sorry about mixing JS syntaxes) // Registry module var Component1 = require('component1') var components = { Component1 } var replace = function(name, cfn) { components[name] = cfn } // Render module var registry = require('registry') var Component1 = registry.components['Component1'] render...Component1 // Override module var registry = require('registry') var Component1override = require('component1override') registry.replace('Component1', Component1override) The only trick is to make certain that the Override module gets loaded before the Render module.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "reactjs" }
How can I open another page when pressing the Edit button on a gridview? I have a Gridview control in asp.net with C#. In my application when I press the edit button from Gridview I need to open the information in another window. At this moment I use 'Response.Redirect("..")' but it opens in the same window. I've tried: protected void OutputGridView_RowEditing(object sender, GridViewEditEventArgs e) { outputGridView.EditIndex = e.NewEditIndex; GridViewRow row = outputGridView.Rows[outputGridView.EditIndex]; string url = " Response.Write("<script>"); Response.Write("window.open('" + url + "')"); Response.Write("<" + "/script>") e.Cancel = true; } But with no luck. What's the best way to do this?
This code will open the window in new window. for this you need to use the ScriptManager string BrowserSettings = "status=no,toolbar=no,menubar=no,location=no,resizable=no,"+ "titlebar=no, addressbar=no, width=600 ,height=750"; string URL = " string scriptText = "window.open('" + URL + "','_blank','" + BrowserSettings + "');"; ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ClientScript1", scriptText, true);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "c#, asp.net, gridview" }
MySQL, numero de linhas numa tabela com valores de outra tabela hoje tenho uma pergunta se calhar um pouco básica mas o meu mysql ta um pouco enferrujado. tenho 2 tabelas uma com os nomes dos users é outro com uma lista de mensagens e queria saber quantas mensagens tem cada user. tabela `users` id | username ------------- 1 | joao 2 | nuno 3 | rui tabela `mensagens` id | msg |user ------------------ 1 | msg1 | joao 2 | msg2 | joao 3 | msg3 | nuno o resultado que pretendo (por ordem de numero de mensagens) user | msg_count ------------- rui | 0 nuno | 1 joao | 2
> Faça uso de subselect para isso. Segue abaixo um exemplo de SQL para te ajudar: SELECT username as user, (SELECT count(1) as qtd FROM mensagens WHERE mensagens.user = users.username) as msg_count FROM users ORDER BY msg_count ASC
stackexchange-pt_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mysql" }
Non destructive split in Ruby I want to split the string `"hello+world-apple+francisco-rome"`, into `["hello", "+world", "-apple", "+francisco", "-rome"]`. `String::split` actually loses the splitting element. Anyone can do that?
You can do it with this simple regular expression: "hello+world-apple+francisco-rome".scan(/[+\-]?\w+/)
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "ruby, string, split" }
Nesting child selectors in CSS I have this HTML: <div class="navbar"> <ul> <li>Foo <ul> <li>Bar</li> </ul> </li> </ul> </div> I want to apply CSS only to item "Foo." I do not want to tag every top-level <li> with a special class. My limited knowledge tells me I should be able to do this: .navbar > ul > li { text-transform: uppercase; } But the style gets applied to "Bar" as well when I do it like this. I thought that '>' specifies only immediate children, does it not work the same way when it's nested? Is what I'm trying to do even possible?
> I thought that '>' specifies only immediate children, does it not work the same way when it's nested? It does work the same way. Since you're anchoring the `ul` directly to `.navbar` with `.navbar > ul`, your selector does apply to `li` elements directly that particular `ul` only. The problem is not with the selector; it's the fact that `text-transform`, like most text properties, is inherited by default. So even though you're applying the style only to immediate `li` elements, the nested ones receive it by inheritance. You will need to reverse this manually on the nested elements: .navbar > ul > li li { text-transform: none; }
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 8, "tags": "html, css, css selectors, html lists" }
как создать динамический массив размером с получаемую строку С++ В консоль вводится строка, размер которой заранее неизвестен. Как можно создать динамический массив размером с получаемую строку? Нельзя использовать string, только массивы char.
Держите в честь праздника :) char * read() { int sz = 8, i = 0; char * buf = malloc(sizeof(char)*sz); for(int c = fgetc(stdin); c != EOF && c != '\n'; c = fgetc(stdin)) { buf[i++] = c; if (i == sz) { sz *= 2; buf = realloc(buf,sz); } } buf[i] = 0; return buf; } Полный код - <
stackexchange-ru_stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "c++, массивы, строки, память, ввод" }
Java script how to write an if condition passed to a $.modal() Hi I have wrote a method like this and i want to include a condition inside the string passed to the model and my method did not work . How to include an if condition? $.modal("<div id='edit_user_form' class='user_mange_popup' align='center'>/'if(true){//do something}'/</div>")
a = "<div id='edit_user_form' class='user_mange_popup' align='center'>" if (true){ a += something } a += </div> $.modal(a) dOes this solve your problem ?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, jquery" }
ASP.NET, Is it possible for forms authentication ticket to timeout in the middle of code behind routine? Please consider the code below: if (Request.IsAuthenticated == true) { string id = Membership.GetUser().ProviderUserKey; } Is it possible for the conditional statement to evaluate true and some background process cause the authentication to timeout before the code inside the block is executed causing it to throw an exception? Thank You
Authentication is checked at the beginning of the request, before your code is executed. It will not be re-checked while the current request is executing.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "asp.net, forms authentication" }
slf4j automatically log method entry/exit We're using slf4j in a java webapp, and i'd like to be able to enable via log4j.properties an option which means that every method entry (and maybe exit?) is logged, so that we can track what is happening. Of course, I could add logger.debug(xx) statements in every method, but is it possible to do this automatically? I've seen vague references to intereptors but I dont know yet if thats what I should be looking at. Thanks, Dan
Use need to use Aspect Oriented Programming and write up a tracing intercepter and apply that to all the interested classes.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "slf4j" }
How to correctly set up internal ip for django-debug-toolbar First time i'm editing `setting.py` file in `google` `cloud` `computing` please forgive me for this silly Question ... I wanted to run `django-debug-toolbar` and followed every step in that tutorial. And the thing i want is the tool bar to be visible in (`our` `office`) only. So i just put our `public` `address` into `INTERNAL_IPS` like `INTERNAL_IPS = ('182.74.xx.xx',)` and i did `restart` run server. but the tool bar not visible. If changed back to 127.0.0.1 then tool bar visible again
It's should work. Just `restart` and make sure recompile all the things. If production server running behind `nginx` make sure restart that too... And if you want to check just replace your internal Ip address with different `Ip address` then confirm it.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 4, "tags": "django, django debug toolbar" }
Как запустить JS функцию из другого файла по нажатию на кнопку У меня есть кнопка и файл main.js. Как сделать так, чтобы при нажатии на кнопку, например в консоль выводилось сообщение? <body> <p><button>Button</button></p> </body>
Ну приблизительно все должно выглядеть так ( функцию опиши в файле с скриптом): function clickListener(){ console.log('test'); } <body> <p><button onclick ="clickListener()" >Button</button></p> </body> <script src="/path/to/script.js"></script>
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "javascript, html" }
I am a newbie to nhibernate fluent mappings. Can the HasManytoMany mapping be set only on one side of the relationship? I created a many to many realtionship for 2 entities. But the mapping was only set on one side. for example OrderMap class: HasManyToMany(x => x.Fields) .Access.CamelCaseField(Prefix.Underscore) .ChildKeyColumn(ColumnNames.Field_Id) .ParentKeyColumn(ColumnNames.Order_Id) .LazyLoad() .Cascade.All() .Table(TableNames.Order_Fields_Join); But the other side ie for FieldMap class. I did not specify this mapping. Nhibernate is throwin errors as of now and I am no sure if it is because of this. Can you let me know if this is correct? My nhibernate errors are : "a different object with the same identifier value was already associated with the session"
it is not nessesary to map the ManyToMany on both sides, it is perfectly legal as you posted. The error you are getting is because you have want to save/update/delete two different objects with the same Identifier which indicates a bug hence NHibernate throws. Post the code which throws the exception.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c# 4.0, fluent nhibernate, nhibernate mapping" }
Endless Infinite Scrollview Is there anyway to produce a vertical scroll view that will have the illusion of an endless continuous scroll? Apple has released sample code for something called StreetScroller that does this for a horizontal scrollview but can this be reproduced for a vertical one?
Try This it is a great control the allows horizontal and vertical infinite scrolling.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "ios, animation, uiscrollview, scrollview" }
MarGo for Sublime I tried to install MarGo for GoSublime go get github.com/DisposaBoy/MarGo However it appears that the path is not correct. Has MarGo moved, or it's not needed anymore for GoSublime ? **Update** MarGo is part of GoSublime apparently.
Command margo: `github.com/DisposaBoy/GoSublime/src/gosubli.me/margo` GoSublime/src/gosubli.me/margo: `github.com/DisposaBoy/GoSublime/tree/master/src/gosubli.me/margo`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "go" }
how to find the difference between two cols with strings I have a df as below, and I could like to get for each ID `what is in subject 1 but not in subject 2`, and `what is in subject 2 but not in subject 1`. Any suggestion/ ![enter image description here]( df <- structure(list(ID = c("Tom", "Jerry", "Marry"), Subject1 = c("Art; Math", "ELA;Math", "PE; Math; ELA"), Subject2 = c("Math; PE", "Math; ELA", "Math; Bio")), row.names = c(NA, -3L), class = c("tbl_df", "tbl", "data.frame"))
We could split the columns and use `map2` to find the difference (`setdiff`) between those two list columns library(dplyr) library(purrr) library(tidyr) library(stringr) df %>% mutate(In = map2( strsplit(Subject1, ";\\s*"), strsplit(Subject2, ";\\s*"), ~ tibble(`_1_notin_2` = str_c(setdiff(.x, .y), collapse = "; "), `_2_notin_1` = str_c(setdiff(.y, .x), collapse = "; ")))) %>% unnest_wider(In, names_sep = "") -output # A tibble: 3 × 5 ID Subject1 Subject2 In_1_notin_2 In_2_notin_1 <chr> <chr> <chr> <chr> <chr> 1 Tom Art; Math Math; PE "Art" "PE" 2 Jerry ELA;Math Math; ELA "" "" 3 Marry PE; Math; ELA Math; Bio "PE; ELA" "Bio"
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "r" }
Nginx configuration with gunicorn Api is in Django framework and the Web app is in Angular both are different projects. Nginx and gunicorn worked well and upload both projects in the same directory but when I hit my domain it shows Django application default page. I want to show my static html page instead of Django default page. 'server{ listen 443; server_name class.domain.com; root /var/www/html/; index index.html; location /static/ { try_files $uri $uri/ /index.html; } location ~ ^/ { include proxy_params; proxy_pass } }'
'server{ listen 443; server_name class.domain.com; root /var/www/html/; index index.html; location /static/ { try_files $uri $uri/ /index.html; } location /api { rewrite ^/api(.*) $1 break; include proxy_params; proxy_pass } }'
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "python, django, nginx, gunicorn" }
How to read fopen() errors It seems that whatever I try, I don't get data in a fifo file. $fifo_action = fopen( "/tmp/fifo_action", "w+" ); die( "first fifo fail" ); $fifo_value = fopen( "/tmp/fifo_value", "w+" ); die( "second fifo fail" ); fwrite( $fifo_value, $id ); fwrite( $fifo_action, "ly" ); fclose( $fifo_value ); fclose( $fifo_action ); Whatever I try, I get "first fifo fail" as result. The fifo's exists. I tried to chmod them in 777. I can write to the fifo from c++. Even if I login as the www-data user in my terminal. At this time, I have no clue on how to proceed further. Is there a way to output the exact error?
You are running the `die()` regardless of what happens in the first `fopen()` so it is bound to tell you it has failed. `fopen()` will return `false` if it fails so you have to test for that. Note the use of `===` which is also important when a function can return a good status that might also be interpreted accidentally as false. $fifo_action = fopen( "/tmp/fifo_action", "w+" ); if ( $fifo_action === false){ die( "first fifo fail" ); } $fifo_value = fopen( "/tmp/fifo_value", "w+" ); if ( $fifo_value === false){ die( "second fifo fail" ); } fwrite( $fifo_value, $id ); fwrite( $fifo_action, "ly" ); fclose( $fifo_value ); fclose( $fifo_action );
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php" }
Get querystring from URLReferrer I am trying to get the QueryString value like this `Request.QueryString("SYSTEM")` from a UrlReferrer. I see i can use this `Request.UrlReferrer.Query()` but it doesn't allow me to specify the exact parameter I could parse the Query() value, but I want to know if it is possible to do something like this `Request.UrlReferrer.QueryString("SYSTEM")`
You could do HttpUtility.ParseQueryString(Request.UrlReferrer.Query)["SYSTEM"] That is c# in vb is is probably something like HttpUtility.ParseQueryString(Request.UrlReferrer.Query())("SYSTEM")
stackexchange-stackoverflow
{ "answer_score": 75, "question_score": 29, "tags": "asp.net, vb.net, query string, http referer, request.querystring" }
SMTP throttling I need to be able to restrict the amount of bandwidth used by SMTP port 25. Basically, we have a routine in our server software that will send out bulk faxes, not much data per fax but a lot of different faxes to send. This is done over SMTP to a fax relay. However, when a particularly large amount goes through, we notice a decrease in the performance on the server and the internet connection in general. Does anybody know of any software that would allow me to set up restrictions on this process? Thanks SMTP server is VPOP3 running locally on Windows Server 2000. The OS on the live servers are Windows Server 2000 and Windows Server 2008. The relay is external (interfax.net). We want to restrict everybody sending faxes. Other emails can be restricted also.
VPOP3 can limit its own bandwidth usage. See this knowledgebase article.
stackexchange-serverfault
{ "answer_score": 1, "question_score": 2, "tags": "smtp, bandwidth" }
Can I get album art for songs only on my iPod? I have an iPod Classic (the 160 gig one) that I use, and I want to have album art for all of the songs. Problem is, I cannot just use the "Get Album Art" option on iTunes, because that will only find art for songs currently on that particular computer, and I have many songs on my iPod that are not on my computer. Short of manually adding the art to every album (like I have been doing), is there a way I can get iTunes (or any other program) to go through my iPod and find the appropriate album art for the songs there?
There is no way for iTunes to know what is on your iPod if you manage it manually. So the answer is NO. I assume you are aware that you risk losing all your iPod-only tracks in case your iPods breaks down, gets damaged or stolen. So it may be a good idea to get all tracks into iTunes (and your computer) anyway.
stackexchange-apple
{ "answer_score": 1, "question_score": 0, "tags": "ipod, album art" }
Coffeescript - Replacing string I have a text and some strings coming from a JSON object: links: [ {text: "Bharath Karunamurthy", type: "User", id: 4}, {text: "Raj Sanghvi", type: "User", id: 2} ] text: "Bharath Karunamurthy follows Raj Sanghvi" What I would like to do is to create a new text with links: text_with_links: "<a href=/users/4 >Bharath Karunamurthy</a> follows <a href=/users/2 >Raj Sanghvi</a>" I've tried the following but it doesn't work: text = this.text for element in this.links text = text.replace /element.text/, "<a href='/users/"+element.id+"' >"+element.text+"</a>" return text
Just get rid of the slashes. text = text.replace element.text, "<a href='/users/"+element.id+"' >"+element.text+"</a>" The string replace method works with strings as well as regex.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "regex, coffeescript" }
building img tag jquery php string via echo not working Hey all i am trying to get this working here: <? echo ('<script type="text/javascript"> $(\'#fileupload\').fileupload({ }).bind(\'fileuploaddone\', function (e, data) { jQuery("#shadow").attr("src", "bannerImg/slider/\'' . ' + jQuery(\"#slideNum\").val(); + '); echo ('\'.jpg"); jQuery("#theText").html("New Slider Image:");') ?> After it uploads an image it calls this script and i need it to see what value is selected in the select box. However, all i am getting this: So naturally it does not work with showing the image. How can i rework this in order to get it working the way i need it too?
<script type="text/javascript"> $('#fileupload').fileupload({ }).bind('fileuploaddone', function (e, data) { jQuery("#shadow").attr("src", "bannerImg/slider/" + jQuery("#slideNum").val() + '.jpg'); jQuery("#theText").html("New Slider Image:"); instead of: <? echo ('<script type="text/javascript"> $(\'#fileupload\').fileupload({ }).bind(\'fileuploaddone\', function (e, data) { jQuery("#shadow").attr("src", "bannerImg/slider/\'' . ' + jQuery(\"#slideNum\").val(); + '); echo ('\'.jpg"); jQuery("#theText").html("New Slider Image:");') ?>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, jquery, echo, image" }
Use spam assasin to block message with From and To address the same I am using zimbra server as our email server. Today I saw some weird emails in my inbox. The **From** and **To** address both belongs to my email address. The header of the email. To: [email protected] From: "[email protected] But Received address is the following. Received: from p3smtphosting04-02.prod.phx3.secureserver.net (p3smtphosting04-02.prod.phx3.secureserver.net [208.109.80.81]) Is there any solution if **To** and **From** address is my own that should go to SPAM folder. I know **From** address could be anything and generally this could not be stopped but at-least it goes to Junk. If there is any general rule I can add to spamassasin, so if the **From** and **To** matches it should be considered as SPAM.
If you do implement this, it will likely do more harm than good. A _lot_ of people do this when Bcc'ing a large group of people. They put themselves in the To: field and Bcc: everyone else. You'll just end up up with a lot of false positives. Just ensure that you've classified this and other emails like it as spam in SA and let the heuristics do their thing.
stackexchange-serverfault
{ "answer_score": 4, "question_score": 0, "tags": "email, spam, zimbra" }
Convolution of function I need find $x^2\cdot e^{{-x^2}/2} * e^{{-x^2}/2}$. I used statements, that $\widehat{xf}=i \widehat{f}'$ and $\widehat{f*g}=\sqrt{2\pi}\widehat{f}\cdot \widehat{g}$. So, $\widehat{x^2\cdot e^{{-x^2}/2}}(\lambda)={e^{{{-\lambda^2}/2}} \cdot(1-\lambda^2)}$ and $\widehat{e^{{-x^2}/2}}(\lambda)=e^{-\lambda^2/2}$. Then, $\widehat{{(x^2\cdot e^{{-x^2}/2})*e^{{-x^2}/2}}}(\lambda)=\sqrt{2\pi}\cdot e^{-\lambda^2}\cdot(1-\lambda^2)$. So, $(x^2\cdot e^{{-x^2}/2} * e^{{-x^2}/2})(y)= \int_{-\infty}^\infty e^{-\lambda^2+i\lambda y} \cdot (1-\lambda^2) \, d\lambda$, but I don't know how solve this integral, perhaps, I did some mistake in counting. Please help me solve this problem.
$$\begin{align*} \left(x^2e^{-x^2/2}\right)*\left(e^{-x^2/2}\right) &= \int_{-\infty}^{\infty}t^2e^{-t^2/2}e^{-(x-t)^2/2}\;\mathrm dt\\\ &= e^{-x^2/2}\int_{-\infty}^{\infty}t^2e^{-t^2+xt}\;\mathrm dt\\\ &= e^{-x^2/4}\int_{-\infty}^{\infty}t^2e^{-t^2+xt -(x/2)^2}\;\mathrm dt\\\ &= e^{-x^2/4}\int_{-\infty}^{\infty}t^2e^{-(t-x/2)^2}\;\mathrm dt\\\ &= \sqrt{\pi} e^{-x^2/4}\int_{-\infty}^{\infty}\frac{1}{\frac{1}{\sqrt{2}}\sqrt{2\pi}}t^2e^{-(t-x/2)^2/2(1/\sqrt{2})^2}\;\mathrm dt \end{align*}$$ where the integral can be recognized as the value of $E[X^2]$ for a normal random variable $X$ with mean $\frac{x}{2}$ and variance $\frac{1}{2}$. Since $E[X^2] = \frac{1}{2}+\left(\frac{x}{2}\right)^2$, we get $$\left(x^2e^{-x^2/2}\right)*\left(e^{-x^2/2}\right) = \sqrt{\pi}\left(\frac{1}{2}+\left(\frac{x}{2}\right)^2\right)e^{-x^2/4}$$
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "functional analysis, fourier analysis" }
How can I uninstall git on Eclipse? Can anyone tell me how can I uninstall git on the Eclipse. Whenever I open Eclipse it will popup and showing some errors. I want to uninstall it from the eclipse, please can anyone help me out in this regards.
To uninstall the EGit Plugin do the following: **Help** > **Eclipse Marketplace...** > **Installed** Tab > **EGit** > **uninstall**
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 8, "tags": "eclipse, git" }
Есть аналогия autopep8 для JS или PHP? Есть аналогия autopep8 для JS или PHP? Авто линтеры для файлов. Если есть то напишите их пожалуйста. Желательно чтобы работало в любом редакторе
Для JS посмотрите: < < < Сам использую eslint из командной строки, но вроде бы должны быть плагины для редакторов.
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, php" }
Modfiying inflated inflated view in a dialogfragment after calling show() Let's say you have a `dialogfragment` with a `listView`. The title of the dialog is a custom view which is inflated in `onCreateDialog()`. Is it possible to toggle visibility of the inflated view when the list item is clicked.
In the onCreateDialog() function, you can hold the dialog view which referencing to title view which you want to toggle on. On click event of listview. lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position,long id) { //Toggle your title here } });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, dialogfragment" }
is it possible to override ifstream::read, ifstream::open methods without deriving child class from ifstream ?? if possible how? std::ifstream in; in.**open**("file path",std::ifstream::in ); in.**read**((char *)&array[0],size); I want to override the **open & read** so that it won't do any file operation and I can write my own open & read functionality.
You can't override methods without deriving new classes. And you can only override virtual methods. But `std::ifstream::open()` and `std::ifstream::read()` are not virtual. To do what you want, you need to derive a new class from `std::basic_streambuf` and implement the functionality (or lack of) you want, then give an instance of that clasd to `std::ifstream` (or better, `std::istream` directly) via its `rdbuf()` method.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c++, std, ifstream, istream" }
How to get the value that is passed to Runtime.getRuntime.exit(value) in a JUnit test case I have to write a Test case in `JUnit` for a `Class` lets call it `C1` which internally calls `Runtime.getRuntime.exit(somevalue)`. The class `C1` has a `main` method which accepts some `arguments` and the creates a `CommandLine` and then depending on the passed `arguments` does the specific tasks. Now all tasks after executing call a `Runtime.getRuntime.exit(somevalue)`. The `somevalue` defines whether the task was executed successfully (means somevalue is 0) or had errors (means somevalue is 1). In the JUnit test case of this I have to get this `somevalue` and check whether it is the desired `somevalue` or not. How do I get the `somevalue` in the JUnit test case.
You can override security manager to catch the exit code, if you use a mocking framework it would be more concise: @Test public void when_main_is_called_exit_code_should_be_1() throws Exception { final int[] exitCode = new int[1]; System.setSecurityManager(new SecurityManager() { @Override public void checkExit(int status) { exitCode[0] = status; throw new RuntimeException(); }}); try { main(); } catch(Exception e) {} assertEquals(exitCode[0], 1); } public static void main() { System.exit(1); }
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "java, junit, runtime, runtime.exec" }
Multiple Inheritance for RMI unicodeRemoteObject I am tring to write server side code for Remote Method Invocation. I am writing a **"rmiServer"** class that is a class on server. This class is already extending another class. Now, I want to extend this class with **"unicodeRemoteObject"** class. but the problem is that java didn't allow multiple inheritance, So How can I do this?
You don't have to extend `UnicastRemoteObject.` Instead, in your constructor, call `UnicastRemoteObject.exportObject().` The effect is the same.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, rmi" }
removing grout from very narrow gaps between tiles? Wanting to re-grout wall tiles in the bathroom, I realize that the gaps between tiles are very uneven from area to area, and are sometimes too narrow for either the oscillating tool's 1/8 inch blade or manual grout blade which has approximately the same thickness. Even the 1/16 blade would not cut it in all places. Trying a thin screwdriver or another pointy metal tool immediately made a chip on the tile edge. What would be the recommended way to proceed here?
One way to proceed is to remove all the tiles and then install new ones using a better quality installation technique to get uniform gaps between the tiles. This approach also allows for: 1. The possibility to update the tile backer to the most modern methods to ensure no leaks and inspect for old mold in the walls. 2. Selecting tile that may be more pleasing or modern. 3. With the walls open you have the option to replace any plumbing fixtures that protrude through the tile.
stackexchange-diy
{ "answer_score": 1, "question_score": 1, "tags": "bathroom, tile, grout" }
Add events to google calendar,yahoo calendar, outlook and ical The users of my Javascript based site often need to create an event where they post an event name, event description, start time and the end time of the event along with the date. Now, they would like to add those event details to the their Google calendar or Yahoo calendar or iCal or Outlook, is their any standard library for that? I am trying to figure it out for the past 3 days though I am aware of google api's but I am not aware of iCal and Outlook or even Yahoo too. I am looking for something very similar this "< In the right hand side you can see this "Add this to your site" part, I would like to do the same thing. Please help me to get in hands on.
I've been searching for something similar tonight and found this jQuery plugin which seems that could help you out. You can directly generate .ics files "on the fly" with it which should be good for Google, Outlook, iCal and Yahoo. < I haven't had a chance to test it myself though, but plan to do it in the next days. However HTH!
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 25, "tags": "javascript, outlook, google api, icalendar, yahoo api" }
Mocking private field in servlet filter Is is possible to mock (currently using Mockito, may be also other testing lib) the field 'sf' in the class shown below: public class SomeFilter implements Filter { private Logger log = Logger.getLogger(getClass()); private SomeField sf = new SomeField(); @Override public void init(FilterConfig fc) throws ServletException { log.info(""); } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc) throws IOException, ServletException { fc.doFilter(request, response); } @Override public void destroy() { log.info(""); } } If so, how?
I would be tempted to make the field either `protected` or `package-private` and then inject the mock in your test, e.g.: final SomeField sf = mock(SomeField.class); someFilter.sf = sf; Otherwise you could provide a constructor to inject the mock: ... public SomeFilter() { this(new SomeField()); } public SomeFilter(SomeField sf) { this.sf = sf; } ... Then in your test you could pass the mock in like so: final SomeField sf = mock(SomeField.class); SomeFilter someFilter = new SomeFilter(sf);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 4, "tags": "java, servlets, servlet filters, mockito" }
Is this proof of $(A \times B) - (A \times C) \subseteq A \times (B - C)$ Suppose $x \in (A \times B) - (A \times C)$. We know $x \in (A \times B)$ and $x \notin (A \times C)$. We also know $x$ is a pair $(a, d)$, by the definition of $\times$, where $a \in A$ and $d \in B$ and $d \notin C$. Hence, $a \in A$ and $d \in B - C$. Hence $x \in A \times (B - C)$, which leads to $(A \times B) - (A \times C) \subseteq A \times (B - C)$ by the definition of subset.
Yes, your proof is correct. You have demonstrated every step of the proof very clearly.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "elementary set theory, proof verification, proof writing" }
Is it possible to disable an action in pre-dispatch? In my controller I have a preDispatch method where I check if the user is logged in. If he is not I redirect the user to login form. Is there any way to disable one of the action's from the preDispatch method? Because I do not need the authorisation for this action.
In the plugin, you can check if that specific controller and action is being called and allow the request to continue. Something similar to the following in your plugin will work. public function preDispatch(Zend_Controller_Request_Abstract $request) { // ... $controller = $request->getControllerName(); $action = $request->getActionName(); if ($controller == 'login' && $action == 'login') { return ; // do not execute any more plugin code } // deny access and redirect to login form
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "zend framework, zend controller" }
How to import iPhone pictures directly to Flickr to save space? I don't like to keep pictures on my small Macbook Air SSD nor on my iPhone, so I am wondering is there a way to upload iPhone pictures directly to my Flickr account without having to import them on my hard drive, and by doing so automatically removing the pictures from my phone to save space? I tried to do it with iPhoto, but it looks like it always has to import those pictures on my hard drive... Thanks!
Assuming you have a Flicker on your iPhone!! Click the camera button. This will take you to the camera screen. To the left of the camera shutter button is a symbol that looks like 4 layered squares, click that. This opens up your photo albums, depending on how many albums you have, but usually 'camera roll' will be listed at the top, click and open. Click on the image you want to upload and hit the 'done' button to the top right - you now be sent to the filter page, from here you can add filters or crop. To access the editing click the pencil symbol, when you finished click done and you'll be brought back to the filters page, add filter or not, then click 'next. Now you should be at the 'Details' page, here you can add title, description, change privacy levels, share to fb, twitter, tumblr, add location data. If you want to add tags, add to sets or groups you need to click on 'Advanced'. When you've finished adding at the info you need to click 'upload'. Job done :)
stackexchange-apple
{ "answer_score": 0, "question_score": 1, "tags": "data synchronization, photos.app, photos, import, flickr" }
Check if object contains property with specific value I have an object like below: var _obj = { '[email protected]' : { '[email protected]' : { channel: 'V2231212', from: 'bob' }, '[email protected]' : { channel: 'V223231212', from: 'judy' } }, '[email protected]' : { '[email protected]' : { channel: 'V123123', from: 'bill' } } }; How can i check to see if anywhere in the object a "`channel`" exists that is equal to "`V123123`" ? In the above case bill@gmail is equal to V123123 and should return true. Any ideas?
Try it: console.log(containsPropertyValue(_obj, 'channel', 'V123123')); function containsPropertyValue(obj, propertyName, propertyValue){ var contains = false; function a(o){ for(var prop in o) if(o.hasOwnProperty(prop)){ if(prop === propertyName && o[prop] === propertyValue){ contains = true; return; } if(typeof o[prop] === 'object') a(o[prop]); } } a(_obj); return contains; } JSFiddle
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "javascript" }
Get time difference between am and pm using time span need to get time difference between 10 pm and 4 am. below is my code _firstShiftStartTime = new TimeSpan(_oOrgShiftDetailDTO.StartTime.Value.Hour,_oOrgShiftDetailDTO.StartTime.Value.Minute, _oOrgShiftDetailDTO.StartTime.Value.Second); _firstShiftEndTime = new TimeSpan(_ShiftDetailDTO.EndTime.Value.Hour, _ShiftDetailDTO.EndTime.Value.Minute, _ShiftDetailDTO.EndTime.Value.Second); this returns two timespans 22.00.00 and 6.00.00. i need to get time difference between these two.
Using Stefano's Solution of using Subtract and then handling negative values var difference = _firstShiftEndTime.Subtract(_firstShiftStartTime); if (difference.Ticks < 0) { difference = new TimeSpan(TimeSpan.TicksPerDay - difference.Negate().Ticks); }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#" }
Survival analysis - sideways I have a typical Survival analysis data-set - patients progressing through various stages of Alzheimer's Disease over 8 years of time, with some covariates, plenty of censored records. However, I'm trying to ask a different question, that is somewhat sideways to Survival analysis. I'd like to take the group of patients that progressed (event) and those who did not (no event) and compare them against one another at a certain point in time, taking the censoring into account. Perhaps I just can't get my head around this, but it doesn't seem to me that Cox Proportional Hazards or Accelerated Failure Time models can do that. Any advice, please?
I'm fairly certain the type of analysis you are interested in conducting is a case-cohort design. If censoring is informative, you have competing risks for censoring versus outcome, and you cannot use regular techniques to calculate the necessary weights for your Cox model. There is no method for which I'm aware to do this.
stackexchange-stats
{ "answer_score": 2, "question_score": 1, "tags": "survival" }
Issue regarding order by CHARINDEX Sql Server This is my whole script CREATE TABLE #TEST ( STATE CHAR(2)) INSERT INTO #TEST SELECT 'ME' UNION ALL SELECT 'ME' UNION ALL SELECT 'ME' UNION ALL SELECT 'SC' UNION ALL SELECT 'NY' UNION ALL SELECT 'SC' UNION ALL SELECT 'NY' UNION ALL SELECT 'SC' SELECT * FROM #TEST ORDER BY CHARINDEX(STATE,'SC,NY') I want to display all records start `with SC first` and `second with NY` and then rest come without any order. When I execute the above sql then first all records come with `ME` which is not in my order by list. Tell me where I am making the mistake. Thanks.
Use `CASE` statement SELECT * FROM #TEST ORDER BY CASE WHEN STATE LIKE 'SC%' THEN 0 WHEN STATE LIKE 'NY%' THEN 1 ELSE 2 END Output STATE ----- SC SC SC NY NY ME ME ME
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "sql, sql server, tsql" }
Running 5V status LEDs on 24V circuit? So I have a relatively simple circuit. I have a little float sensor that is connected to a 24V circuit and when that float sensor is triggered (water is too low in the container) it connects the circuit, which triggers a solid state relay to connect a 120VAC circuit to turn on a pump which pumps up the container until the float sensor disconnects. I would like to add a status LED on the side of the 24V, probably on the low side of the SSR, so that I know when it is pumping and when it is off. Is there any clever way to add a 5V LED onto this circuit, or do I just need to bite the bullet and buy a 24V LED? I've included my circuit below: ![enter image description here]( UPDATE: Here is the updated schematic based on the help I've received:![enter image description here](
First, take note that your SSR is drawn backwards in your schematic. Most LED's are current driven devices that will illuminate properly with 10 to 15 mA of current. When this much current passes through the LED, it generally has about 2 volts across it. This means that you need a resistor that will have the other 22 volts across it when ~10 mA of current is passing through it. A simple Ohm's law calculation of 22 volts / 0.010 amps shows that a resistor of ~ 2200 ohms should do the job. Then calculate the wattage rating of the resistor as 0.010 amps * 0.010 amps * 2200 ohms and you have 0.22 watts. For reliability sake, you should use at least a 0.5 watt resistor. The LED is connected in parallel with the LED of your SSR with the same polarity as the LED in the SSR (recalling that your schematic shows it backwards).
stackexchange-electronics
{ "answer_score": 3, "question_score": 3, "tags": "voltage, led, solid state relay" }
How to save android web driver screenshots while executing test cases? I am getting failure exception while taking the device screenshots my code as below: //open the page driver.get(" //take another screenshot try { File screenshot = new File("screenshot1.png"); File tmpScreenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); } catch(IOException e){ System.out.println("Failed to take screenshot."+e.getMessage()); } //quit driver.quit(); } Can any body help me out this issue?
I tried to execute your code but didn't get the exception, although i didn't get the screenshot either. I have modified your code a bit see if this work for you driver.get(" File screenshot = new File("screenshot1.png"); File tmpScreenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); org.apache.commons.io.FileUtils.copyFile(tmpScreenshot, screenshot); System.out.println("the screenshot printed at:- " + screenshot.getAbsolutePath());
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "android, selenium, webdriver, android webview" }
System of linear equations: and a small perturbation If $Ax=b$ and $Ax'=b'$ where $x'$ and $b'$ are $x$ and $b$ with a small perturbation, the following inequality will always hold: $ (\left\lVert x-x' \right\rVert/\left / \lVert x \right\rVert) \le \left\lVert A^{-1} \right\rVert \cdot \left\lVert A \right\rVert \cdot (\left\lVert b-b' \right\rVert / \left\lVert b \right\rVert) $. My question is, when is this inequality an equality? (assuming $b \neq b'$)
The inequality comes from multiplying $\|x - x'\| = \|A^{-1} (b - b')\| \le \|A^{-1}\| \|b - b'\|$ and $\|b\| = \|A x\| \le \|A\| \|x\|$, and dividing the result by $\|x\| \|b\|$. So you'll get equality whenever $\|x - x'\| = \|A^{-1}\| \|b - b'\|$ and $\|b\| = \|A \| \|x\|$. Choose $x$ to maximize $\|A x\|/\|x\|$ with, say, $\|x\| = 1$, and $b = A x$. Choose $y$ to maximize $\|A^{-1} y\|/\|y\|$ with, say, $\|y \| = \epsilon > 0$. Take $b' = b + y$, $x' = x + A^{-1} y$.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "linear algebra, matrices, numerical methods, numerical linear algebra" }
Использование создаваемой колонки в Generated column Мне нужно при помощи If else вычислить значение создаваемой через Generated column колонки, но тк я эту колонку создаю и при ее создании вычисление провожу с ней же, выдает ошибку `"generated column can refer only to generated columns defined prior to it"` Вот пример кода: CREATE TABLE `Slicer` ( `id` int NOT NULL, `name` varchar(255) NOT NULL, `Polimer_consumption_ml` FLOAT NULL, `Side_consumption_ml` FLOAT GENERATED ALWAYS AS (CASE WHEN `Polimer_consumption_ml`<4 THEN `Side_consumption_ml` = `Polimer_consumption_ml` * 0.7 ELSE `Side_consumption_ml` = `Polimer_consumption_ml` * 0.2 END) NULL, PRIMARY KEY (`id`)); Помогите пожалуйста, что делать, как использовать создаваемую колонку в этом же Generated column
CREATE TABLE `Slicer` ( `id` int NOT NULL, `name` varchar(255) NOT NULL, `Polimer_consumption_ml` FLOAT NULL, `Side_consumption_ml` FLOAT GENERATED ALWAYS AS (CASE WHEN `Polimer_consumption_ml` < 4 THEN `Polimer_consumption_ml` * 0.7 ELSE `Polimer_consumption_ml` * 0.2 END) NULL, PRIMARY KEY (`id`) );
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "mysql, sql, база данных" }
PHP 2 ASP cross domain script translation I need to call via Ajax a routine on my PHP server from my clients site on his server. If my client has PHP, I have a short PHP script used to call a PHP from one server to another and avoid cross-scripting issues using CURL: <?php $q=$_GET["q"]; $q=str_replace(" ","^",$q); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, " curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); ?> The problem are the clients with ASP sites, so this routine won't work and I have No idea how this would translate in ASP, so ASP does not run into a cross-browser issue. Any help, please?!!! Regards, Michael
This should work: <% Dim q q = Replace(Request("q")," ","^") Dim httpObject Set httpObject = Server.CreateObject("WinHttp.WinHttpRequest.5.1") httpObject.Open "GET", " & q httpObject.Send Set httpObject = Nothing %>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, asp classic" }
How do small icons appear on wikipedia? I was looking at the source code of wikipedia and I noticed for small icons like this (look at the small pdf icon) ![enter image description here]( For icons like this there should an `<a href>` tag somewhere linking the small pdf icon's image. But I looked at source and I couldn't find anything. ![enter image description here]( I was just curious how do these small icons appear then?
> For icons like this there should an `<a href>` tag somewhere linking the small pdf icon's image. No, there shouldn't. The link goes to the PDF. There is no link you can click on to view the icon by itself. > I was just curious how do these small icons appear then? It's a background image on the link element.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -4, "tags": "html, css, wikipedia" }
Reverse request query string back to defined pattern I have a route configured like this in my app: config.add_route('book', 'book/{id}). When I make a GET request, e.g `localhost:8000/book/2`, I would like to output route pattern like the one defined in config, so the output would be `'book/{id}'`. I have tried regex, but maybe there are better ways. What would be the best way to achieve that?
Use `request.matched_route.pattern`. I found it by using the `pyramid_debugtoolbar`, searching for "route", and found it under the Request Vars tab with its attributes listed.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, python 3.x, pyramid" }
Modal bootstrap does not display correctly formatt text on modal-body This is my modal-body <div class="modal-body"> root 2934 2.9 2.7 660824 222192 ? Sl 07:57 12:02 skype root 3029 0.0 2.3 904676 189744 ? Sl 07:57 0:20 /usr/lib/firefox/firefox </div> but when I show it in Modal dialog bootstrap, it lost all formats and become only one single line like this: root 2934 2.9 2.7 660824 222192 ? Sl 07:57 12:02 skype root 3029 0.0 2.3 904676 189744 ? Sl 07:57 0:20 /usr/lib/firefox/firefox How can I show it correctly? Thankyou.
wrap your content in a `pre` tag to persist formatting. Bare html won't maintain formatting otherwise unless you specify explicit unicodes try this: <div class="modal-body"> <pre>root 2934 2.9 2.7 660824 222192 ? Sl 07:57 12:02 skype root 3029 0.0 2.3 904676 189744 ? Sl 07:57 0:20 /usr/lib/firefox/firefox </pre> </div>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "css, twitter bootstrap, bootstrap modal" }
META-INF/MANIFEST.MF file not found in unnamed.war I am using Intellij idea and I want to deploy my project to the server. Before that I tried to create a .war file but when i create a war file, i am getting this error META-INF/MANIFEST.MF file not found in unnamed.war How can I solve this problem ?
Add `MANIFEST.MF` to `YOUR_PROJECT_NAME/web/src/main/webapp/META-INF/` folder with the **simple content**: Manifest-Version: 1.0 Or you can generate it using **IntelliJ Artifacts Configuring**
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "java, maven, intellij idea, manifest.mf, war" }
Word for "having characteristics of the beach?" > The city had a tropical, [...] feeling to it. I thought of the word _beachy_ but I worry people will confuse it with the other similar-sounding word.
"Beach-like"? > The city had a tropical, beach-like feel to it
stackexchange-english
{ "answer_score": 6, "question_score": 1, "tags": "single word requests, adjectives" }
RewriteRule not "greedy" enough I am trying to create a htaccess file that would show a simple index.html no matter what the url is. ### Folder structure / .htaccess a/ index.html When request comes to /a/* or /a I would like to serve index.html .htaccess file has Options +FollowSymLinks RewriteEngine on RewriteRule ^a(.*) a/index.html [NC,L] RewriteRule ^a$ a/index.html [NC,L] and it seams to work on my localhost, but it does not work on test server (default Apache configuration on Digitalocean). To me it looks like it is not "greedy" enough. What am I doing wrong? urls I have tested /a/ <- works both locally (uwamp is local engine) and remotely /a <- works both locally and remotely /a/anything/ <- works locally but not on server Is there a way to debug this? Any logs to follow in order to see what is going on here?
If you want to rewrite everything in **/a/** to **index.html** , it should be enough to put .htaccess in a folder /a/ Options +FollowSymlinks RewriteEngine on RewriteRule .* index.html [NC] This way the rest of the website won't be affected by this rewrite. Also, check if rewrite is enabled on Apache, since it is a clean install. Default Ubuntu install does not enable it.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "apache, .htaccess, mod rewrite" }
Regenerate master certificates to kubernetes cluster We have a few k8s clusters in AWS that were created using Kops. We are trying to improve security by setting up RBAC using service accounts and users. Unfortunately, some of our devs were given the master/admin certificates. Would it be possible to regenerate the master certificates without creating a new cluster? Other best practices related to security would also be appreciated! Thanks.
This is a community wiki answer based on a solution from a similar question. Feel free to expand it. As already mentioned in the comments, the answer to your question boils down to the below conclusions: * Currently there is no easy way to roll certificates without disruptions * You cannot disable certificates as Kubernetes relies on the PKI to authenticate * Rotating secrets should be graceful in the future as stated in this PR
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "amazon web services, kubernetes, rbac, kops" }
Using support library Is there any tutorial available on the net about using support library? I am little confused because in my activity I imported all the widgets from a support library and I still get markers that say I need api 11. Do I have to extend FragmentActivity instead of Activity to use it? EDIT: My problem was that I extended Activity instead of FragmentActivity. This problem is mentioned here: getLoaderManager().initLoader() doesn't accept 'this' as argument though the class (ListFragment) implements LoaderManager.LoaderCallbacks<Cursor>
Here is a good explanation on how to use the support library. Regarding `FragmentActivity`, you have to use it if you are trying to use a `Fragment` in an `Activity`. Also be careful to import the proper classes. An example for a Fragment: import android.support.v4.app.Fragment; instead of import android.app.Fragment;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android, android support library" }
Help with a curl command and reading from a file I have a curl command that needs to make a post and send my ssh key as one of the params, the command I am using looks like this: SSH_KEY=`cat ~/.ssh/id_rsa.pub`; curl -d "login=username&token=apikey&title=test&key=$SSH_KEY" The problem is that there is a `+` in the ssh key and the string is terminating at that point, how can I avoid this?
Apparently in version 7.18.0 curl added the --data-urlencode option: curl --data-urlencode "login=username&token=apikey&title=test&key=$SSH_KEY"
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "bash, shell, scripting, curl, github" }
What are the steps to solve this limit $\lim_{x\to 1} \frac{4x^2 - 4}{x-1}$? I'm reviewing for a quiz but this one has got me stumped. I know the answer is $8$, but I'm confused about how to get there. What is $$\lim_{x\to 1} \frac{4x^2 - 4}{x-1}?$$ I know when you plug in $1$ you get $\frac 0 0$, so there is more work to be done, but I'm not sure what to do. Thanks
$\require{cancel}$ Here you need only _factor the numerator,_ then _cancel_ the common factor in the numerator and denominator, and evaluate the limit of the resulting function as $x \to 1$. $$\frac{4x^2-4}{x-1}=\frac{4(x^2-1)}{x-1}=\frac{4\cancel{(x-1})(x+1)}{\cancel{x-1}}=\;\;4(x+1) \;\;\;\text{when}\;x \neq 1$$ Now, evaluate $$\lim_{x \to 1} 4(x + 1)$$ Recall, when we find the limit of a function $f(x)$ as $x \to a$, $f(x)$ might not be defined _at_ $x = a$. But with functions like this, the limit as $x$ _approaches_ $a$ nonetheless exists, and with limits, we are interested in what happens very near $a$, not what happens precisely _at_ $x = a$.
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "calculus, limits" }
Why isn't MavensMate picking up changes that I make directly on the config files? I have an existing MavensMate project and I want to include StandardValueSets. I edited package.xml in Sublime and included the list of StandardValueSets provided here - < When I open the project in MavensMate it does not show any entries under StandardValueSet. I tried a similar thing for the metadata subscription - I edited .settings in Sublime to include all the metadata that I want to subscribe to, rather than ticking each box in MM. As with the above though, MM does not detect the changes that I have made manually when I re-open the project. What step am I missing? Thanks. Following Akram's advice to 'Refresh from Server', I now have the metadata locally, but still not showing in MM: ![enter image description here](
You need to refresh from Sandbox: In Sublime text: \- Right click on "src" folder \- Go to "Mavens Mate" then "Refresh from Server" It will take a while to refresh all the metadata described in the package.xml
stackexchange-salesforce
{ "answer_score": 0, "question_score": 1, "tags": "picklist, mavensmate, package.xml" }
Obtaining Components of the Vector Potential I am given $\boldsymbol A(r,\phi) = \frac{i}{e}a(r)U(\phi)\nabla U^{\dagger}(\phi)$, where $U(\phi)=e^{in\phi}$. I want to obtain the magnetic field $\boldsymbol B$ from this vector potential, so thus I must use the equation: $$\boldsymbol B = \nabla \times\boldsymbol A$$ Since $\boldsymbol A$ does not depend on a variable $z$, I will be left with $$\boldsymbol B = \frac{1}{r}\left(\frac{\partial}{\partial r}(rA_{\phi}) - \frac{\partial}{\partial \phi}(A_{r})\right)\boldsymbol z$$ How do I get the values for $A_{\phi}$ and $A_{r}$?
The potential provided is, $$\vec A = \frac{i}{e}a(r)e^{in\phi}\nabla e^{-in\phi} = \frac{i}{e}a(r)e^{in\phi} \left( -\frac{in}{r}e^{-in\phi}\hat\phi\right) = \frac{n}{e}\frac{a(r)}{r} \hat\phi.$$ using the definition of the gradient of a scalar in cylindrical coordinates. Thus, there is only one non-zero component, $A_\phi$. The magnetic field follows from $\vec B = \nabla \times \vec A$. Can you take it from here?
stackexchange-physics
{ "answer_score": 1, "question_score": -1, "tags": "homework and exercises, electromagnetism, potential, vector fields" }
The purpose of second square brackets in this PHP code Is there a basic explanation or resource about what the second square brackets - [$i] - does in this if statement on the third line? And while I'm here.. What does the greater than or equal to mean in the array function? Its intention is to create an array if any of four checkboxes are selected. $passtime = array("beachwalks"=>0,"gardening"=>0,"playingsports" =>0,"other"=>0); for($i=0; $i < count($pastime); $i++) { if(isset($_POST["pastime"][$i])) { $pastime[$_POST["pastime"][$i]] = 1;
As mentioned in comments, $_POST['pastime'] is an array something like this: Array ( [0] => beachwalks [1] => gardeningArray ... ) So, with `$pastime[$_POST["pastime"][$i]]` You are get the value of specified index `0` or `1` and so on.. using `[$i]` And `=>` is used for defining key-value pairs in an array. So, in your case `[beachwalks]` is a key and [0] is a value See doc for more info on Arrays
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php" }
Find the base of the linear function $T(p(x))$ Let $T:P_1(\mathbb{R})\rightarrow \mathbb{R}^{2}$ where $P_1$ are the polynomial with the most degree 1. And $T(P(x))=(P(0),P(2))$ with the standard basis $b=\left \\{ 1,x \right \\},g=\left \\{ e_1,e_2 \right \\}$ I want to find $\left [ T \right ]^{g}_{b}$ so I take from the first element of the $b$ basis $p(1)=1+1=2$ $(p(x)=1+x)$ so $T(P(1))=(2,2)$ then $T(P(x))=(P(0),P(2))=(1+0,1+2)=(1,3)$ so $\left [ T \right ]^{g}_{b}=\begin{pmatrix} 2 & 1\\\ 2 & 3 \end{pmatrix}$ the answer I should get is $\begin{pmatrix} 1 & 0\\\ 1 & 2 \end{pmatrix}$ I am assuming I just do row operations to take that matrix or am i doing something wrong?
Let $p_1(x)=1$ and $p_2(x)=x.$ Then $$T(p_1)=(1,1)=1 \cdot e_1+1 \cdot e_2.$$ Hence the first column of $\left [ T \right ]^{g}_{b}$ is given by $(1,1)^T.$ We have $$T(p_2)=(0,2)=0 \cdot e_1+2 \cdot e_2.$$ Hence the second column of $\left [ T \right ]^{g}_{b}$ is given by $(0,2)^T.$
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "linear algebra, linear transformations" }
Can I rely on Operating System (OS) Anti Virus (AV) scanning to scan files shares? I have an EC2 instance with an Windows OS with anti virus installed. I have a requirement to attach a file share to the OS where the application is hosted. The file share is Amazon Fsx ( Amazon's native windows file system). Can I rely on the OS scanning the Fsx file share or should the Fsx have its own file scanning capability?
I would do BOTH because in the event that either system was compromised it could then become a pivot point on the network to attack other nodes. In all of my secure implementations I've installed antivirus even on Linux OS's, granted the probability of being attacked is less than Windows but it's still a possibility. Also you should consider hardening everything with a framework like NIST and or CIS-CAT to reduce the attack surface and only run what's necessary from a services standpoint. Lastly, configure the machine to also scan on mounted file systems as well as when files are accessed. I like and use ESET because their licensing model is affordable and they have good 3rd party reviews, but there's a TON of options out there for this.
stackexchange-security
{ "answer_score": 0, "question_score": 0, "tags": "windows, antivirus, aws" }
How can I find the points of intersection between the curves $r=1+\sin\theta$ and $r=1-\sin\theta$? Find the points of intersection for the curve $r=a(1+\sin\theta)$ and $r=a(1-\sin\theta)$ My book says the answer is $(0,0),(a,0),(a,\pi)$. However I calculated $ (a,0),(a,\pi),(a,2\pi)$.
Two of your points, $(a,0)$ and $(a,2\pi)$, are the same. It is easy to miss the solution $(0,0)$, since $(0,\theta)$ is the origin whatever $\theta$ is: the origin has many polar addresses. So $(0,0)$ is on one of the curves in the disguise $(0,\pi/2)$, and on the other in the disguise $(0,3\pi/2)$. To spot this sort of thing, one has to examine algebraically the possibility that $r=0$ for some $\theta$. Or make a sketch.
stackexchange-math
{ "answer_score": 3, "question_score": 3, "tags": "calculus, geometry, trigonometry, plane curves" }