INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Radio Button Group in ASP.NET MVC3 I am having a field of Boolean in Model named `Child_With_Bed` . !Image Now, I want radio button group in which yes = true and no = false. So when I select it `Child_With_Bed`'s value is set. I tried below code but it is not getting bind with my model. <tr> <th> <%: Html.LabelFor(model => model.Child_With_Bed)%> </th> <td> <%: Html.RadioButton("child", Model.Child_With_Bed)%> Yes <%: Html.RadioButton("child", !Model.Child_With_Bed)%> No </td> </tr> I don't know how to do this. Please help. Thanks in Advance.
Try this: <% foreach (var item in Model) { Html.RadioButtonFor(m => m.item, "Yes")%> Yes <% @Html.RadioButtonFor(m => m.item, "No")%> No <% }%>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, asp.net, asp.net mvc, asp.net mvc 3" }
How to write html string to a asp Lable which is showing as text instend of HTML object? I want to show some html string in text in my asp web, however it is creating some html object. mylab.Text = "<br/>";
You can do the following easily: **Default.aspx:** <asp:Label ID="Label1" runat="server"></asp:Label> Finally do the following: **Default.aspx.cs:** Label1.Text = Server.HtmlEncode("<title>ASP.NET Tutorial - Label Display HTML</title><br/>"); For more, see this: Display HTML Tags in an ASP.NET Label
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "asp.net" }
AngularJS app: How to properly implement authentication and authorization I have a requirements to implement a password-based local user authentication, and a role-based authorization in a new AnguletJS application. As a part of my requirements, user passwords must not be transmitted in a clear case from the client to server. Is there a standard way of implementing local user password-based authentication and role-based authorization in an Angular SPA?
Use HTTPS and the password and username would be encrypted during the communication with the server. Here's a article that you might find useful: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "angularjs, authentication, authorization, single page application" }
Oracle: not group by expression error select case when x.a in (select y.c from join2) then x.a end, x.b, x.c, y.a, z.c from join1 x, join2 y, join3 z where x.a = z.a group by x.a, x.b, x.c, y.a, z.c order by x.c; While running this query I am getting `error ORA-00979` a group by expression. I already tried by removing x.a from group by but still not working. Can any body help me on this.
You need to have this expression in your `GROUP BY` clause instead of `x.a`: case when x.a in (select y.c from join2) then x.a end So putting it all together: SELECT CASE WHEN x.a IN ( SELECT y.c FROM join2) THEN x.a END , x.b, x.c, y.a, z.c FROM join1 x, join2 y, join3 z WHERE x.a = z.a GROUP BY CASE WHEN x.a IN ( SELECT y.c FROM join2) THEN x.a END , x.b, x.c, y.a, z.c ORDER BY x.c; I do have to point out, however, that you're doing a cartesian join between `x` and `y` and it's not completely clear why you're using `GROUP BY` since there are no aggregates.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "oracle" }
Socket.io examples with Swift and Node.js on the backend I am trying to find a working example of a Socket.io implementation on iOS with Swift, but have been unlucky so far. I did get a few examples from Github, but each have some issues and I cannot tell why they don’t work. Does anyone know where I can get an out of the box working example, so that I can go through the code and understand the implementation?
Since I asked the question there have been changes and we now have socket.io for iOS. Here's the original blog post on it: <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 5, "tags": "ios, swift, socket.io" }
Making the drawables work according to resolution I made all the drawables for my android app, and it is in xxhdpi folder. How can I make sure that the app will downsize the drawables according to the resolution phone?
you can use this link < for converting your image to the 9 patch images and down load it in .rar format. Extract it and paste into resource folder.by using 9 patch images are chooses according to the resolution of the device.. and if you want to take the icons you can use vector drawable . it will help to reduce your app size and best for all resolution devices. for taking Vector Drawable Right click on Drawable --> New --> Vector Assest .
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android, android layout" }
How to provide Google Maps API key with php and curl I am trying to develop a small client to geocode the address and display it on the map. It all works fine, but I wanted to provide the api key so I can check the number of requests. I am using curl and php. Here is the code: $url = ' $client = curl_init(); curl_setopt($client, CURLOPT_URL, $url); curl_setopt($client, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($client); //$http_status = curl_getinfo($client, CURLINFO_HTTP_CODE); curl_close($client); When I try this i get request denied from google. any suggestions?
please provide full URL of request or use this one for test (works for me)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, curl, maps, key" }
Why does $\sin{x} = \frac{1}{2}$ have two solutions but $\arcsin{\frac{1}{2}}$ has one solution? Can anyone help me understand why $\sin{x} = \frac{1}{2}$ have two solutions but $\arcsin{\frac{1}{2}}$ has one solution? Aren't they equivalent?
It is the same reason that $$ x^2 = 1 $$ has two solutions ($x = 1$ and $x = -1$) but $\sqrt{1}$ has only one solution (the square root of $1$ is $1$, not $-1$.) The weird thing about $\arcsin y$ is that it does NOT give you all possible values $x$ such that $\sin x = y$. It cannot do that, because we want it to be a function, in other words, for every input there is only exactly one output. So if I put in $\frac12$ for $y$ and look at $\arcsin \frac12$, $\arcsin$ can only give me one output, not multiple outputs. So $\arcsin$ gives me back $\frac{\pi}{6}$, even though there are infinitely other many values of $x$ that satisfy the equation. $\arcsin$ just gives me ONE of them. In summary, there are infinitely many $x$ such that $\sin x = \frac12$, but $\arcsin$ is a function so it can only give one of them back. $\arcsin \frac12$ is therefore just A solution to the equation, not ALL solutions.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "algebra precalculus, trigonometry" }
How to perform addition to number rather than appending to end in Linq Trying to update a table in ASP.net MVC with a Linq query. It works fine in terms of actually doing the update, but I can't figure out how to mathematically update it. For example, the Printer Credit Fund was set to "50", added 12 to it then sets it "5012" as opposed to "62". The following is the code that is doing the update: tblOption fund = ( from n in db.tblOptions where n.ID == 1 select n).First(); fund.PrinterCreditFund = fund.PrinterCreditFund + tblPrinterCredit.Money; We're using Entity Framework if that makes any sort of a difference. Any tips towards the right direction of doing a mathematical update rather than appending the value would be hugely appreciated. Many thanks
That's it. Convert `fund.PrinterCreditFund` and `tblPrinterCredit.Money` to using `Convert.ToInt32()` and also make sure `fund.PrinterCreditFund` is also `int` type tblOption fund = ( from n in db.tblOptions where n.ID == 1 select n).First(); fund.PrinterCreditFund = Convert.ToInt32( fund.PrinterCreditFund) + Convert.ToInt32( tblPrinterCredit.Money);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, asp.net mvc, linq, entity framework" }
National Health Insurance in Korea Where do I go to register for the National Health Insurance in South Korea if I am there on an intra-company transfer visa?
There's a pretty good guide here on the NHIC website. It should walk you through the entire process. You should be able to find your specific visa information there. Otherwise, you can call the NHIC hotline. They have an English line number at 02-390-2000.
stackexchange-expatriates
{ "answer_score": 6, "question_score": 4, "tags": "health insurance, south korea" }
What is the maximum number of pieces that a pizza can be cut into by 7 knife cuts? (NBHM 2005) I am seeing this question very first time and do not know any formal way to solve it. Which part of mathematics it is related to? **What is the maximum number of pieces that a pizza can be cut into by 7 knife cuts?** A pizza is usually round shaped. So I was cutting a circle into pieces by seven straight lines. Minimum number is eight. But no maximum I am getting. It is better to add complete answer with references. Thank you for your help.
This is a known problem: it is appropriately called the **Circle Cutting Problem**. I suggest to you to read the linked page --- it is quite informative. However, the important part is that with $n$ cuts, you can divide a circle into at most $f(n)$ parts, where: $$f(n) = \frac12\left(n^2 + n + 2\right)$$ In your case, $f(7) = \frac12(49+7+2) = \frac12(58) = 29$.
stackexchange-math
{ "answer_score": 12, "question_score": 10, "tags": "geometry, reference request, discrete mathematics, combinatorial geometry" }
Subclass a collection and use generics I'm not very skilled in java generics, I must admit. But here's the problem. I need to subclass LinkedList to add some (not all) methods typical of a Map. Let'a say I do this way: public class TalendList<T extends Serializable> extends ArrayList<T>{ private Map<T, T> map; public TalendList(){ super(); map = new ConcurrentHashMap<T, T>(); } Is this the correct way? Why I cannot do this in my caller code: List<String> ggg = new TalendList<String>(); but only: TalendList<String> ggg = new TalendList<String>(); ?
This is happening because you are importing: import java.awt.List: instead of: import java.util.List; The awt type of List doesn’t support the parameterizing, and it is not a generic collection.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 4, "tags": "java, generics, collections, dictionary, linked list" }
Camel Case and case insensitive I would like your opinion about using Upper or lowerCamelCase in a case insensitive and procedural language (Oracle PL/SQL). Some guys wanna use this pattern in my job, but the programmers don't like the idea... Oracle Forms and Reports do not support autocomplete. My opinion: I don't see any reason to use Camel Case in a case insensitive language... What's your opinion?
CamelCase really increases readability for variables when you need multi-word names, and its easier to write than using underscores for spaces, especially for programmers who use them all the time in most common languages. in the long run, being case insensitive should free people to use whatever case they prefer, so not sure why this is an issue, but I vote Yes for CamelCase. SQL Keywords should probably be all caps or all lower, depending on your shop standard.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "plsql, case insensitive, camelcasing" }
Email notifications for inbox messages? Is there any way to have magento send me an email when I get a message in my admin inbox? I don't log in often and would like to stay on top of of security patches, etc.
There's no direct way to do this. However, the messages come from a RSS feed: < You can use a service like IFTT to send updates to yourself via mail
stackexchange-magento
{ "answer_score": 3, "question_score": 2, "tags": "magento 1.9, admin, email" }
How do I prepare my new bathtub alcove? I will be expanding my bathroom and moving the bathtub, meaning I need to prepare a new bathtub alcove. I know how to frame and plumb - but preparing for tile is new to me. I know that there are different products out there to use to prepare for tile, such as concrete backer-board which would apply direct to the studs and get sealed with thinset, vs. waterproof membranes which would be applied directly to greenboard without the backerboard. What I don't know is - what are the advantages/disadvantages to each approach? Is one better than the other? The plan is to use ceramic and glass tiles - does that make a difference?
First of all, greenboard is no longer accepted as a suitable product for wet areas. It has been replaced with "purpleboard" or glass-backed products without paper for mold growth. Consider doing to tub alcove in a cementicious board like Hardi500 or a fiber-glass backed gypsum like DensGuard. Do not apply a vapor barrier behind these if you intend to seal them from the room side. This will promote the dreaded "moisture sandwich." where any moisture which _does_ get through the first barrier cannot escape the second. From recently doing a similar project I am a supporter of the Kerdi membrane. You set the wall boards and seam them as usual (any board will do, but I like mold-resistant and water-resistant board)... then you "shingle" on the kerdi membrane with thinset. **EDIT:** I changed where I said "blueboard" to "purpleboard" as some googling showed I was using the wrong slang....
stackexchange-diy
{ "answer_score": 3, "question_score": 5, "tags": "tile, waterproofing" }
Getting notifications for functional location Is it possible to get notifications for a functional location; as in: not link it to an equipment first, but just link it to the functional location? And if so, where is the connection between them?
Notifications with functional location only (aka empty equipment) are created via `IW21` just fine. ![enter image description here]( If it's not the case for you then some customizing setting prevents it. To find the link between the created notification and functional location use chain: QMEL-qmnum = QMIH-qmnum >> QMIH-iloan = ILOA-iloan >> ILOA-tplnr
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sap erp" }
Find all real solutions: $36x^3 + 6x^2 = 9x$ I am having trouble finding all the real solutions to this problem. I do not undertand how to solve it, and I have a test on Polynomials tomorrow. The problem is "Find all real solutions using your calculator. Round to the nearest hundredth: $36x^3 + 6x^2 = 9x$"
You can factor the equation as follows. $$36x^{3} + 6x^{2} - 9x = 0$$ $$3x\left(12x^{2} + 2x - 3\right) = 0.$$ From this, you know that one solution is $\boxed{x = 0}.$ We must now find the solutions to $12x^{2} + 2x - 3 = 0.$ As this is not factorable, we can use the quadratic formula to find the others. We do this as follows. $$x = \frac{-2 \pm \sqrt{4 + 144}}{24}$$ $$= \frac{-2 \pm \sqrt{148}}{24}$$ $$= \frac{-2 \pm 2\sqrt{37}}{24}$$ $$= \boxed{-\frac{1}{12} \pm \frac{\sqrt{37}}{12}}.$$ I leave you to find the decimal approximations.
stackexchange-math
{ "answer_score": 4, "question_score": 0, "tags": "polynomials, graphing functions, quadratics" }
Binding height, width, etc to a variable I don't know if I'm just not understanding what I've found so far, or if it really is too complex to apply to such a simple idea as it seems. I'm trying to bind a button's height and width to variables that are stored in user settings. I can't seem to get this to work, or rather I simply don't how to, as in what commands to use. The issue lies in not knowing what to put in the Binding field of the xaml. If anyone could point to a guide that involves just this, could explain what to do I would be very appreciative. Edit: I've solved the problem of binding the variable, it now saves to the User setting file when it should. Now I'm having an issue with the value stored in user setting beig overwritten every time the program loads with the default value. I am running this through VS debug menu selection, so I suppose the issue could lie there, but I've tried publishing it and running and still getting the same results. Any ideas?
Assuming by 'User Settings' you mean the built-in Settings not a custom implementation: See < for an example of this - essentially you want to set up `TwoWay` bindings to `Properties.Settings.Default`: note that you have to define the settings in advance using the Settings UI, and you have to call `Properties.Settings.Default.Save()` when the app exits to persist the settings.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, wpf, variables, binding" }
What is the class name for in this variable declaration? The Objective-C tutorial I'm following has has created a class called `Square` and a new instance of `Square`, the assigned it to a variable named `square` like so: Square *square = [[Square alloc] init]; Now to my understanding this is what's happening. This is creating an instance of the class `Square` and returning it; the returned instance is then being initialised, and set to the variable `square`: *square = [[Square alloc] init]; I can't figure out why the first "`Square`" is needed in this or what it is doing.
Square *square = [[Square alloc] init]; (1) (2) (3) (4) (5) (1) is the Type of the object, so the instance created is of the type `Square` (2) is the pointer to that instance. (3)+(4) is the allocation method of this instance, meaning its alocating memory for this instance. (5) is an initialization method which you can implement by yourself, for example, set the width of the square to 1.0
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "objective c" }
Does SVD give the best rank 1 approximation with respect to the Frobenius norm, L2 norm, or both? From what I've observed in practice the SVD gives the best rank 1 approximation with respect to the Frobenius norm. But from what I've heard from others, it also minimizes the distance to the L2 matrix norm. I'm wondering doesSVD give the best rank 1 approximation with respect to the Frobenius norm, L2 norm, or both?
The SVD produces the best rank-1 approximation (or more generally, the best approximation of at most any fixed rank) with respect to both the Frobenius and $L_2$ norms. Proofs of these results are given on this wiki page.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "linear algebra, matrices, normed spaces, matrix decomposition, svd" }
How i can get a variable from javascript to PHP or HTML if i make a variable in javascript with this script var kakakSisa = 10; and i wanna call it in PHP for example <?php echo <script type="text/javascript">kakakSisa;</script> ?> and that doesn't work!! how i can make it work?
You can't use javascript variable in php code. Php code run's on the serverside and javascript code runs in the client side (If you are not using Node.js). You can't ask the browser to run php code. Your variable loc will have a value only when the code reaches the browser. If you want to get some value from server and combine it with javascript variables then do the following. Use an ajax request and send the desired values to server. The server will return with a response. Use that response text and store it in your action variable.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, php, jquery" }
Sort BlockingCollection<IComparable> while saving to text file I have a consumer that enumerates on a `BlockingCollection<T> where T : IComparable` then writes a row to a text file for each item. The end result are text files of a maximum of about 7Gb-10Gb. However they are not in order. I cannot sort the list in memory as it could end up being very big. The only way I could think of toward a solution is to write to temp text files in order they arrive then shuffling them at the end but I can't imagine that's very efficient. Any ideas on how this can be done?
I ended up loading the results into a staging table in SQL using SSIS and sorted them that way.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 3, "tags": "c#, c# 4.0" }
Opening a file from the script directory without mentioning entire file path Previously I could open a file from Anaconda's Spyder editor by following command when the file and the script are in the same directory df = pd.read_csv("Results_Space_Type_Comparison.csv") But now, I need to mention the entire path of the csv file even if its in the same directory as the code. Otherwise, it gives this error FileNotFoundError: File b'Results_Space_Type_Comparison.csv' does not exist I haven't made any changes to the path variable or anything else and I don't know what happened. How can I change this back to the way it was previously?
If you specify only the name of the file, it depends from which directory the python script is run, wether it is able to find it or not. You can use the following to get script's dir: import os.path script_dir = os.path.dirname(__file__) then use that to prepend the path to your filename: os.path.join(dirname, 'Results_Space_Type_Comparison.csv') and it will work in any case.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "python, path" }
Как заменить содержимое Frame Есть окно "MainWindow", в нем Frame "Go" в который при запуске окна помещается "Page1", в "Page1" еще один Frame "Main", в котором лежит "Page2". Как при нажатии кнопки в "Page2" поместить Page3 в Frame "Go", при этом не создавая нового "MainWindow" ? ![MainWindow](
Использовать схему загрузки `Page` с помощью `<Frame Element Name> .NavigationService.Navigate(pageClassHandle);` Сравнивать текущую загруженную страницу можно таким способом: **MainWindow.cs** Type t = ContentFrame.NavigationService.Content.GetType(); if (t == typeof(PageHandle)) ... и в xaml добавить примерно следующее: **MainWindow.xaml** <StackPanel Orientation="Vertical"> <Frame x:Name="ContentFrame" Margin="0,0,0,0" Width="{Binding ActualWidth, ElementName=MainWindow, Mode=OneWay}" NavigationUIVisibility="Hidden" /> </StackPanel> MainWindow - условно главное окно WPF приложения.
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "c#, wpf" }
Get ID of parent object in ActiveAdmin / Formtastic I have a resource Photos, which belongs to Adverts. In ActiveAdmin, users should be able to upload Photos directly from the Advert's edit page (obviously only once the advert has been created). The form is generated as follows: form do |f| [... the usual forms ...] f.inputs "Photos" do f.has_many :photos, :title => "Photo" do |p| p.input :advert, :as => :hidden, :value => Advert.find(params[:id]) p.input :title p.input :image end end end I would like the line p.input :advert, :as => :hidden, :value => Advert.find(params[:id]) to produce a hidden field with the ID of the Advert the user is editing, however this just produces an empty field. I've tried a number of other options as well, but can't seem to figure it out. Any hints?
You can use advert variable, which holds Advert object with id from params. p.input :advert, :as => :hidden, :value => advert.id by the way, your code is invalid. You get whole Advert object, not just id. Valid code: p.input :advert, :as => :hidden, :value => Advert.find(params[:id]).id this should works, too
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails, activeadmin, formtastic" }
What is the difference between “unique to” and “unique for”? For example is it better to say: “This problem is not **unique to** Australia.” than “This problem is not **unique for** Australia.”?
_Unique to_ is an established expression. "Not unique to Australia" means "occurs not only in Australia, but other places too". _Unique for_ is not an established expression, but there's nothing wrong with it. I would interpret "not unique for Australia" as "as far as Australia is concerned, this is not unique", or more simply "this occurs more than once in Australia". It doesn't say anything about whether it occurs elsewhere, or how often.
stackexchange-ell
{ "answer_score": 2, "question_score": 1, "tags": "prepositions" }
Hide Password Input On Console Window When typing in my password to the console window it is visible, is there anyway this can be changed so that it can't be visible? Here is my code: String user, pass, host; Scanner sc = new Scanner(System.in); System.out.println("Type userid, password, hostname or ipaddress: "); user = sc.next(); pass = sc.next(); host = sc.next(); System.out.println(user + " " + pass + " " + host); Methods md = new Methods(); md.createTable(user, pass, host);
Use the Console `readPassword()` method: char[] passwd = System.console().readPassword("[%s]", "Password:");
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 1, "tags": "java, passwords, hidden" }
Help with QueryOver and WhereExists I have a problem. I have Persons and Cats. Each Person has some Cats (there is a foreign key in Cats that points to the primary key in Persons). Each Cat has an Age. I want to select the Persons that have "Old" Cats. I want ALL the Cats of these persons, and not only the "Old" Cats. I need to do it with the QueryOver syntax. In T-SQL it would be something like: SELECT P.*, C.* FROM Persons P LEFT JOIN Cats C ON P.Id = C.OwnerId WHERE EXISTS ( SELECT 1 FROM Cats C2 WHERE P.Id = C2.OwnerId AND C2.Age > 5) I know I have to use the subqueries, and I could to easily with the "old" nhibernate syntax (the Criteria/DetachedCriteria), but I can't do it in QueryOver syntax. I DON'T want an "IN" condition. My Primary Key is a complex key, so I can't do it with the IN. var persons = session.QueryOver<Person>.WithSubquery.WhereExists( ??? );
Example taken from this page and adapted (tested with my own classes): The trick seems to be using an alias. Person personAlias = null; IList<Person> persons = session.QueryOver<Person>(() => personAlias).WithSubquery .WhereExists(QueryOver.Of<Cat>() .Where(c => c.Age > 5) .And(c => c.Owner.Id == personAlias.Id) .Select(c => c.Owner)) .List<Person>();
stackexchange-stackoverflow
{ "answer_score": 28, "question_score": 12, "tags": "c#, nhibernate, fluent nhibernate, queryover" }
Chrome App: Doing maths from a string I have a basic Chrome App that I'm building that constructs strings like this: "1 + 4 - 3 + -2" Seeing as you can't use `eval()` in Chrome Apps, how can I get the answer to a string like so? eg. If this was just a normal webpage I would use something like this: var question = { text: "1 + 4 - 3 + -2", answer: eval(this.text) } Is there any possible way of replacing `eval()` with something else to answer a string like `question.text`?
Try modifying string to "+1 +4 -3 -2" utilizing `String.prototype.split()` , `Array.prototype.reduce()` , `Number()` var question = { text: "+1 +4 -3 -2", answer: function() { return this.text.split(" ") .reduce(function(n, m) { return Number(n) + Number(m) }) } }; console.log(question.answer())
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "javascript, google chrome app" }
Is it possible to run two services on the same ports with different IP but on the same machine? My question is simple. Is it possible to run TWO different game servers using exact same port but on different IP's using same network interface on the same server ? Does each IP adress have it's own port pool or is it limited to machine's network interface ?
It is possible. You just have to bind on the right IP address/interface each service using the same port. Ports (be them UDP or TCP) have their own pool per IP address. You can listen on the same port if you change: IP address or protocol (UDP or TCP). See: <
stackexchange-serverfault
{ "answer_score": 13, "question_score": 9, "tags": "linux, networking, interface" }
CKEditor <p> tag and removing padding How do i remove p tag margins? I've read a lot of solutions online, and it doesn't seem to work including this a link
I think the solution I linked to above worked but my browser (Firefox) was caching the css, so i didn't see it until I tried another browser (Safari)....which is weird.
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 0, "tags": "php, css, styles, ckeditor" }
Restoring an email message sent in 2012/2013 that can not be found in users mailbox Novice here. Have had a request to restore a sent message that can not be located in the users Sent Items folder, probably because the message is 1+ years old. Running SBS 2008, Exchange 2007 and Outlook for users. I don't know the history of the system but is it even possible to restore something like this? Would it have to be from an Exchange backup from that time-period? If so, would the backup have to be restored to a separate location and then the single message pulled from that and then copied across? The user has the exact email address the message was sent to. And as previously mentioned, a rough time-period it would have been sent. Along with some keywords that would have been used. I'm unsure if it's not available for him to see because of archiving, being deleted, etc. I believe archiving has not been done on his mailbox before. Any help much appreciated. Thanks.
The default retention policy period in Exchange 2007 is 14 days (as far as I can remember) - Exchange will keep items for this interval after the user has deleted it. In order to recover items in retention, do this from Outlook (snipped from here): 1. Open an Outlook client that has access to the mailbox that has deleted items. 2. Select the Deleted Items folder. 3. From the Tools menu, select Recover Deleted Items. 4. Select the item that you want to recover, and then click Recover Selected Items. Any older than that, you need to look into whether there's some sort of archiving in place,or you would need to restore from a backup taken before the mail was permanently deleted (so, within 14 days of the message being deleted). My bet is that you don't have backups that old lying around, most companies wouldn't anyway. The restore procedure depends on which backup software you're using.
stackexchange-serverfault
{ "answer_score": 0, "question_score": 1, "tags": "email, exchange 2007, outlook, windows sbs 2008, restore" }
Is there a python equivalent to Laravel 4? Laravel 4 enables me to develop both small scale and enterprise scale app's easily and efficiently, and its modular concepts allow me to extend it core, build custom reusable packages, and easily follow TDD practices. I have been diving into the wonderful world of python (v3) and wondered what the equivalent web framework would be in the python community? A framework that follows some of the same core concepts built into Laravel 4 such as MVC design pattern, easy testing, modular design, packages etc.
Yes. Pyramid is what you are looking for. It's written from the ground up to be based in common Python libraries and components, and you can swap out pieces for other pieces as you wish. Python as a language is geared for TDD, and Pyramid takes advantage of that. You can push your own libraries, if they are abstract enough, out to PyPi for yourself, if you wish, but you can of course just keep them within your own projects too. There are other Python frameworks, but if you're looking for modular and extensible, without a whole lot of framework interference in your working style preference, Pyramid is the way to go. P.S. this question is better suited for programmers.stackexchange.com.
stackexchange-stackoverflow
{ "answer_score": 26, "question_score": 19, "tags": "python, python 3.x, laravel" }
MariaDB opens instead of MySQL in cmd prompt I have been using XAMPP for MySQL which works fine when I am using in browser but if I open MySQL in command-line it opens MariaDB instead of MySQL. Let me know the reason soon. ![enter image description here](
Looks like Xamp now ships with MariaDB. Check out this article for more information > < The `MYSQL` apache extension works with `MariaDB` so although it seems apache is using MYSQL i think it is connecting to your `MariaDB` server. I wouldn't worry too much. MariaDB runs and works almost identical to `MYSQL`. What sort of concerns do you have running MariaDB? If it is an issue have a look at installing and older version of Xamp that contains `MYSQL` eg > <
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "mysql, xampp" }
How to enable wire logging with Apache HttpClient 5 The Apache HttpClient logging documentation says: > The simplest way to configure Log4j 2 is via a log4j2.xml file. Log4j 2 will automatically configure itself using a file named log4j2.xml when it's present at the root of the application classpath. It then gives examples of XML that can be used. None of the examples work, and no debug information is printed. This answer says this can be fixed by adding log4j-core and log4j-1.2-api jars to the classpath. I've added log4j-core-2.9.1.jar and log4j-1.2-api-2.9.1.jar and this doesn't fix the problem. I'm using httpcomponents-client-5.0-beta7 and httpcomponents-core-5.0-beta11. Exactly which jars do I need to use, and exactly what configuration do I need to do?
Through experimentation, I've made it work by including the following jars: log4j-api-2.9.1.jar log4j-core-2.9.1.jar log4j-slf4j-impl-2.9.1.jar
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "java, apache httpcomponents, apache httpclient 5.x" }
Is this form of distribution considered Bimodal or Uniform? !Distribution Example Would this form of distribution be considered Bimodal or Uniform? I have been searching through distribution images and the Bimodal distributions generally appear to refer to a pair of Normal distributions not a pair of Uniform distributions.
Bimodal is a term for when there are multiple maxima in a pdf. Here, your function is monotonic, hence it has only one mode at the far left. It is also not uniform. I would call it a "piecewise uniform" distribution.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "statistics, probability distributions" }
What's the equivalent of assert.rejects in TypeScript? In node js we use `assert.rejects` to assert an error caused by async function. I found the `rejects` method was missing in TypeScript, how to assert async errors in TypeScript?
I think using this function will solve your issue: import * as assert from 'assert'; async function assertThrowsAsync(fn, regExp) { let f = () => {}; try { await fn(); } catch(e) { f = () => {throw e}; } finally { assert.throws(f, regExp); } } And use it in your tests: await assertThrowsAsync(async () => async_function_call_here(), /Error/);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "node.js, typescript, assert" }
Why React event handler is not called on dispatchEvent? Consider the following input element in a React component: <input onChange={() => console.log('onChange')} ... /> While testing the React component, I'm emulating user changing the input value: input.value = newValue; TestUtils.Simulate.change(input); This causes `'onChange'` to be logged, as expected. However, when the `'change'` event is dispatched directly (I'm using jsdom): input.value = newValue; input.dispatchEvent(new Event('change')); the `onChange` handler is not called. Why? My motivation to use `dispatchEvent` rather than `TestUtils.Simulate` is because `TestUtils.Simulate` doesn't support event bubbling and my component's behavior relies on that. I wonder whether there is a way to test events without `TestUtils.Simulate`?
React uses its own events system with `SyntheticEvents` (prevents browser incompatabilities and gives react more control of events). Using `TestUtils` correctly creates such a event which will trigger your `onChange` listener. The `dispatchEvent` function on the other hand will create a "native" browser event. But the event handler you have is managed by react and therefore only reacts (badumts) to reacts `SyntheticEvents`. You can read up on react events here: <
stackexchange-stackoverflow
{ "answer_score": 19, "question_score": 30, "tags": "reactjs, reactjs testutils" }
Parsing values from a JSON Python? bb_strings = re.findall(r'var model = ({.*})', ad) bp = {} if bb_strings: bp = json.loads(bb_strings[0]) for bl in bp['AVAILABLE_SIZES']: footlocker.append(('size', bl)) out csv: IMG 1 CSV How to get output data: IMG 2 CSV
size = 0 bb_strings = re.findall(r'var model = ({.*})', ad) bp = {} if bb_strings: bp = json.loads(bb_strings[0]) for bl in bp['AVAILABLE_SIZES']: size +=1 footlocker.append(('size%s' %size, bl))
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -3, "tags": "python, json" }
Using own field to define others in Django Models If I want to set a default value in a field and that value is derived from another field from same model. How can do something like that: class MyModel(models.Model): field_1 = models.CharField() field_2 = models.Charfield(defualt=field_1 + 'extra info')
You cannot use the `default` in this case. You can use the model's save method for this purpose: class MyModel(models.Model): field_1 = models.CharField(max_length=80) field_2 = models.Charfield(max_length=80) def save(self, *args, **kwargs): #Here you can have all kinds of validations you would need self.field_2 = self.field_1 + "extra info" super(MyModel, self).save(*args, **kwargs) Now, you can hide/exclude the `field_2` from the forms/modelforms if you choose to.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "python, django, django models" }
Regenerating a custom list form .designer.cs file I'm writing a custom list form in VS2010, but I can't get the .designer.cs file to regenerate to properly reference the controls in the aspx file. I've tried deleting the designer file, but the "Convert to Web Application" button that I'd usually use to regenerate the designer file isn't there. I could manually write out the designer file, but I think that would stop it from auto-updating with further changes. The file is under Source Control, if that makes a difference. Any ideas?
Missing/Incomplete designer file causes Visual studio (VS) to fail the build. First of all try to switch between designer and source view, it sometimes solve the problem. If it didn't work for you, try solution on this post. <
stackexchange-sharepoint
{ "answer_score": 0, "question_score": 0, "tags": "visual studio, asp.net, list form" }
Is $f\colon\mathbb{Z}\to\mathbb{Z}, f(x)=x^2$ injective? Surjective? I would say no: $\text{Suppose } f(a)=f(b) \text{ then } a^2=b^2 \implies \pm a = \pm b \implies -a=b$. Or simply by counterexample: $f(-1)=f(1)$ Further, I would say it does not map $\mathbb{Z}$ onto $\mathbb{Z}$ because it is always positive.
You are right. **Not injective (example):** $$ f(-3)=(-3)^2=(3)^2=f(3);\qquad -3\neq 3 $$ **Not surjective (more explicit description):** To be surjective, every element in the codomain must be mapped to by some element in the domain. This is clearly not the case when $f\colon\mathbb{Z}\to\mathbb{Z}$ is defined by $f(x)=x^2$ because none of the negative numbers in the codomain are being mapped to.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "proof verification, self learning" }
Openid show images for providers While trying out the tutorial from Followed the instructions to add the facebook.png like so Dictionary<string, object> facebookExtraData = new Dictionary<string, object>(); facebookExtraData.Add("Icon", "../Images/facebook.png"); But it didn't work so anyone able to get the images on the browser ?
came across zocial and this blog post which addresses this specific question < the sample project is here < the final result looks like so !enter image description here
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "c#, .net, asp.net mvc, asp.net membership, openid" }
Does outputstream.write(int c) in java overwrite the previous stream dat with byte c or does it increment it? Will writing to an output stream from an input stream one byte at a time increment the stream content by the written byte or will it replace the current stream with this byte? If I want the stream to contain several bytes at once do I have to write a byte array to it, or use an appropriate java class function for the specified data?
Output streams are sequences of data. If you write new data to a stream, that data will follow any previous data, neither incrementing it nor replacing it. Imagine that the stream is being sent along a wire directly. Sending a new piece of information doesn't affect what went before.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, stream, iostream, outputstream" }
Which NoSql solution should I choose? I'm having a system distributed on dozens of servers. It supposed to perform about 10000 reads and writes per second. The record size is about few KB. The data integrity is not very important. Which NoSql solution should I choose? Thanks! Daniel
Well.. that depends a great deal on the type of data you want to store, how you want to access it, etc. Here is a comparison of the hottest contenders: < For your needs, where data integrity is not of upmost importance you might want to try Redis. It is all in memory, making it blitz-fast, but with persistence to disk... it is not a database per se, though, but a key/value store, so you'll have to think a little different as to how to store and retrieve data, there are a number of good tutorials on this online...
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "database, nosql, bigdata" }
How to use method as filter in AngularJS? I have a custom data type `Message`: function Message(body, author, date) { this.body = body; this.author = author; this.date = date; this.stars = []; } Message.prototype.hasStars = function() { return this.stars.length !== 0; }; I'm also doing a repeat on an array of these messages: <li ng-repeat='message in messages | orderBy:"-stars.length"'>…</li> How can I add a filter to it that calls `message.hasStars()`? I tried the following but none of them had effect: message in messages | filter:message.hasStars() | orderBy:"-stars.length" message in messages | filter:message:hasStars() | orderBy:"-stars.length" message in messages | filter:message.hasStars | orderBy:"-stars.length" message in messages | filter:message:hasStars | orderBy:"-stars.length"
< `filter` expects there to be an expression that evaluates to a predicate on the scope. That is a function that takes in an element as its parameter and returns whether or not the element should be included in the collection. In your controller: $scope.hasStars = function (message) { return message.hasStars(); }; In your view: <li ng-repeat='message in messages | filter:hasStars | orderBy:"-stars.length"'>...</li>
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "javascript, angularjs" }
How to create shadow effect of UIScrollView, UITableView when scrolling? I have a UITableView and I would like it ho have the same effect when scrolling as the picture. (Shadow below UINavigationBar and above of UITableView) How can I do this?: !alt text
You can create a view on the top of the uitable with a custom background. See this related question: Light gray background in "bounce area" of a UITableView In your case you could have an image instead of a solid color.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "iphone, cocoa touch" }
"Access not configured" when accessing google cloud endpoints from web app I wrote a webapp with angularjs frontend, google app engine for storing data, and google cloud endpoints for api access from the frontend client. I tested everything fine locally, but after deploying, accessing the api from the frontend javascript client gives me the following error: [ { "error": { "code": 403, "message": "Access Not Configured", "data": [ { "domain": "usageLimits", "reason": "accessNotConfigured", "message": "Access Not Configured" } ] }, "id": "gapiRpc" } ] I've checked the production api explorer after deployment and it works fine. Also, I tried directly accessing the api by URL which also works fine. Just the frontend client does not work. Any ideas?
Turns out I set the API key in the client with gapi.client.setApiKey(API_KEY); where the API Key is the browser key from the cloud console. I removed this and it works fine. I have no idea what the API key is for.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "angularjs, google api, google cloud endpoints" }
Projective geometry. Interpretation of a cross product between a line coincident with a point Let $p \in \mathcal{P}^2$ be a point in projective 2-space coincident with a line $l\in\mathcal{P}^2$ such that $l^\top p = 0$. What does $l \times p$ mean? For example, $p = \left(x,y,1\right)^\top$ and $l=\left(-1, 0, x\right)^\top$, the line is coincident with the point, i.e. $(l^\top p = 0)$. The cross product is $v = l \times p = \left(-xy, 1+x^2, -y\right)^\top$. Wondering, what is the physical meaning of $v$?
This is not a natural operation between lines and points. The cross product of two different lines is a point (intersection) and the cross product of two different points is a line (connecting the points). In this case you have to take the dual of either the point or the line. In the first case the cross product is the point on $l$ at maximum distance from $p$. In the second case it is the line through $p$ orthogonal to $l$.
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "projective geometry, cross product" }
Need to implement a web server to handle sql queries and html web pages For my databasing class, I need to create a working remote database. The database itself is not of issue, but I am quite ignorant on the specifics of a web server. I need to: -Have a web site where users can select SQL queries and/or construct their own -Have those queries sent to the database -print the results of the query on the web site (formatted for readability) I have a strong understanding of java and SQL, what I don't know are the options for hosting the server, how clients will access it, and the html for displaying generated results (as opposed to static content) I am aware of server implementations such as apache tomcat and java database stuff like JDBC, but I don't really know how they are used and where they fit in. I apologize if this is too unfocused of a question but any help with understanding what I will need to learn specifically will be greatly appreciated
Start with some basic steps. * Install Tomcat * Install mysql * Install an IDE like eclipse * Create a sample web project and you can google for helloworld servlet * convert that servlet to access the database and then you can implement the other functionality. Here is some tuts <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, sql server, webserver" }
Combining formulas I have this formula in a table which basically collects data from two columns and combines them. Now, I'm looking to combine this formula with a `REPLACE` formula that basically takes these characters `æ,ø,å` and replaces them with `a,o,a`. Here's the formula: =LOWER(LEFT(tableFaste[[#This Row];[Fornavn:]])&tableFaste[[#This Row];[Etternavn:]])
You can use SUBSTITUTE =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(LOWER(LEFT(tableFaste[[#This Row];[Fornavn:]])&tableFaste[[#This Row];[Etternavn:]]),"æ","a"),"ø","o"),"å","a")
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "excel, formula" }
How to read HTML file and store its content into UITableView cell? I have a HTML file containing Terms and conditions of signup process of my app. I want to show all the contents of that file in normal text format onto Table cell. How it can be implemented ? Thanks in advance. I am also thankful for last answers.
You should have to create one Customcell for doing this... And for this, take new file with UITableViewCell class and remove view and add UITableViewCell in it..and then take UIWebView in this XIB file.. and set IBOutlets properly... and For displaying html file in UIWebView please follow this Link
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, file" }
I Need Create Cookie On Domain And Get It On subdomain I'm with an difficult to create cookie an domain and use it another subdomain. I'm trying set cookie whith this code: ini_set("session.cookie_domain", "mydomain.com.br"); setcookie("test", "test_value", time()+3600); And get cookie whith this code on my subdomain(subdomain.mydomain.com.br): echo "<pre>"; print_r($_COOKIE); print_r($_SERVER ['HTTP_COOKIE']); die("</pre>"); What I did wrong? rs
I use this: setcookie(); setcookie("test","test_value",time()+3600,'/','.mydomain.com.br');
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "php, cookies, dns, subdomain" }
How to append to list within multilevel dictionary? I'm traversing through a file and want to build a dynamic dictionary of multiple levels. The last level needs to store a list of values. myDict = defaultdict(dict) for key in lvlOneKeys: # this I know ahead of time so I set up my dictionary with first level. I'm not sure if this is necessary. myDict[key] = {} with open(myFile, "rb") as fh: for line in fh: # found something, which will match lvlOneKey and dynamically determine lvlTwoKey and valueFound # ... myDict[lvlOneKey][lvlTwoKey].append(valueFound) I need to do this because lvlTwoKey will be found multiple times with different valueFound's. Unfortunately this code results in a KeyError for lvlOneKey. What am I doing wrong?
Replacing the code under the `for` loop with the following should solve your problem: # if there is no `lvlTwoKey` in `myDict`, initialize a list with `valueFound` in it if not myDict[lvlOneKey].get(lvlTwoKey, None): myDict[lvlOneKey][lvlTwoKey] = [valueFound] # otherwise, append to the existing list else: myDict[lvlOneKey][lvlTwoKey].append(valueFound) This uses the `get()` method on the dictionary, which you can read about here. Besides that, it's just a standard dictionary, which I find often to be more readable / intuitive than complex defaultdicts.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, dictionary" }
How to make Outlook "Attach File" always use default location I've done a fair amount of Googling on this and seem to be asking the opposite question to everyone else. In Outlook 2010, how can I make "Attach File" always show the default location rather than showing the last location visited after the first time of use. I have set the default location and this is shown when attaching a file the first time after opening up Outlook. I want Outlook to not remember where I've been in this instance. Closing Outlook and opening a new instance appears to be the only way to make it use the default location again. In summary - How do you stop Outlook, and Office apps in general, remembering the last location visited? Thanks
I submitted this question on the Microsoft Answers site and was informed that what I would like to achieve is impossible. The closest functionality is to add the required location to the Favorites section of the navigation pane; requiring a single click. Full answer here
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "outlook, ms office, outlook 2010" }
Does Hibernate JPA support mysql InnoDB and MyISAM engines Do I need to annotate the java domain classes differently. I have two tables one created with InnoDB and other with MyISAM. The requirement is like that I could not create both with InnoDB. I have created their domain java classes using JPA. Now I am not sure, will my java code work properly as it works in case of InnoDB tables!
Same entity will work for both InnoDB and MyISAM, which means you do not need to change any annotation. The underlying DB details are transparent to your persistence layer code and that is what JPA provider does. By the way, the question title "Does JPA XXX implementation support..." makes more sense.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "mysql, hibernate, jpa" }
Why are some basic kanji not in any JLPT level? I'm reviewing my list of kanjis to limit myself to JLPT N2 and below for now, but I find that some of them aren't in any JLPT level yet are quite common. Examples: * (in , , etc.) * (in all the , very common suffix) and I'm only starting so I'm sure I'll find more. I use jisho.org and this list also agrees: < Why is that? And given that common kanjis seem missing from the JLPT levels, are they a good reference for studying?
See, the jouyou kanji list is no less imperfect. Why simple and common kanji, such as , are suspiciously absent is anyone's guess. As for the JLPT list, well, you've pointed out some grave offenders yourself. So are such lists a good study tool? If you're just preparing for the JLPT, and you're positive that only the kanji on those lists can appear, then keep at it; however, in general, I don't recommend this type of approach at all. As long as you're consuming media in Japanese and learning vocabulary in context, you'll amass so much vocabulary that the N2 multiple-choice kanji section will seem trivial in what it asks of you. If you're serious about learning the language beyond just passing the N2, then do keep the jouyou list in mind as a guide or a reference, but nothing more.
stackexchange-japanese
{ "answer_score": 6, "question_score": 1, "tags": "kanji, jlpt" }
Problems in Subscription of global event in JavaScript I have the following JavaScript Code, I have some queries on these lines, 1. what does this lines `.events.slice (-1)[0][0]` means? 2. and `nodes_params += "&ns=" + GLOBAL_EVENT + "," + start_from + ",-,-";` this lines as well? 3. What does the _Subscription of the global events_ means? The whole code is too big, but I can post some of the parts of the code, in case it is not understable. // Subscribe to the global events var start_from = "0"; if (nodes[GLOBAL_EVENT].events && nodes[GLOBAL_EVENT].events.length > 0) { start_from = nodes[GLOBAL_EVENT].events.slice(-1)[0][0]; } nodes_params += "&ns=" + GLOBAL_EVENT + "," + start_from + ",-,-";
1 - `events` is on array and `events.slice(-1)` returns the last element in this array, witch seems to be an multidimensional array itself ,and [0][0] returns the first element in the first array. 2 - its a simple string concatenation, += mean appending to the existing variable instead of replacing it 3 - can't say for sure, it depends on what the other codes are
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery" }
Python + Sqlite 3 query with multiple conditions I want to query a table `paths` with 5 columns (`user`, `trial` , `t`, `x`, `y`) to get user, `trial` and `t` where first condition: `x*x+y*y<100` and second condition: `t` has the max value. I solved only the half of the problem, implemented the first condition: query = ''' SELECT user, trial , t, FROM paths WHERE x*x+y*y<100 ''' Got this: enter image description here I must add the second condition such as only the `user + trial` with max value for `t` should be selected. Example: `row 1226 5 2.348045` Please help me to find a solution. Thank you!
For SQLite3 specifically (it won't work with any SQL), you can simply change `t` to `max(t) t` in your `SELECT` statement. (Also, remove the dangling comma after `t,`). If you need max for each user, add `GROUP BY user` at the end.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python, sqlite" }
what do you call starting the smoking activity When anyone starts smoking, he/she "fire" the cigarette. I am sure the "fire" word is not correct. so what should I say? I tried using the dictionary to translate from my language to English, but all I got is: 1. "burn" the cigarette? 2. "grill" the cigarette? which I am sure is not correct in English.
He or she **lights** _a_ cigarette (cigar/pipe), unless we are talking about some cigarette that we want to reference as uniquely indentifiable, such as one that fell on the ground; in that case, use _the_. When a person lacks matches or a cigarette lighter, he can ask someone "Do you have a **light**?"
stackexchange-ell
{ "answer_score": 12, "question_score": 8, "tags": "word request" }
apt-get not found on my VPS? Today, I bought a Ubuntu 12.04 VPS from < but when I access it via SSH, I can't use apt-get. [root@vps /]# apt-get install python-software-properties -bash: apt-get: command not found edit: For some reason, it can't find lsb-release [root@vps /]# cat /etc/lsb-release cat: /etc/lsb-release: No such file or directory
From your shell prompt, it appears you have CentOS or some other Red Hat-derived distribution rather than the Ubuntu you were expecting. You can confirm this by running: cat /etc/*-release and inspecting the output.
stackexchange-serverfault
{ "answer_score": 5, "question_score": 0, "tags": "ubuntu, vps, apt, ubuntu 12.04" }
How to find out the value of 1 iteration in microblaze I am trying to find out a way to increase the computation time of a function to 1 second without using the sleep function in xilinx microblaze, using the xilkernel. Hence, may i know how many iterations do i need to do in a simple for loop to increase the computation time to 1 second?
You can't do this reliably and accurately. If you want do a bodge like this, you'll have to calibrate it yourself for your particular system as Microblaze is so configurable, there isn't one right answer. The bodgy way is: Set up a GPIO peripheral, set one of the pins to '1', run a loop of 1000 iterations (make sure the compiler doesn't optimise it away!) set the pins to '0'. Hang a scope off that pin (you're doing work on embedded systems, you do have a scope, right?) and see how long it takes to run the loop. * * * But the right way to do it is to use a hardware timer peripheral. Even at a very simple level, you could clear the timer at the start of the function, then poll it at the end until it reaches whatever value corresponds to 1 second. This will still have some imperfections, but given that you haven't specified how close to 1 sec you need to be, it is probably adequate.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "xilinx, microblaze" }
how to add a clear button in jquery autocomplete how to add a clear button jquery autocomplete. Adding an image what I actually need.!enter image description here How to add that X button. It has to clear the autocomplete search text-box. This comes automatically in ie10+ but don't come in other browsers.. I am adding jQuery autocomple. no css is there.. <input type="text" id="skin"/> <script> $('#skin').autocomplete({ source: abcd.php }); </script>
Insert an image inside input field using CSS, then make that image clickable and put this in your script: $("#cancel").click(function() { $('#search').autocomplete('close'); }); JSFiddle demo here
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "jquery, html, internet explorer, google chrome, firefox" }
A Problem about Common Eigenvector > **Question 1:** Let $A$, $B$ be two $n\times n$ complex matrix satisfy: $AB-BA=0$. Then $A$, $B$ have a common eigenvector. > > **Question 2:** Let $A$, $B$ be two $n\times n$ complex matrix satisfy: $AB-BA=B$. Then $A$, $B$ have a common eigenvector. * * * **Question 1** It is easy to prove. > Let $\lambda$ be a eigenvalue of $A$ and $V_\lambda$ be the eigensubspace. For any $x\in V_\lambda$, we have $A(Bx)=\lambda(Bx)$. So $V_\lambda$ is the invariant subspace of $B$. **Question 2** I have some ideas but fail to solve it all. > Let $Ax=\lambda x$. Then we have $A(Bx)=(\lambda+1)(Bx)$. Assume $V_{\lambda_1}$, $V_{\lambda_2}$,..,$V_{\lambda_s}$ are all eigensubspaces of $A$ and $n_0,...,n_s$ are the index: for any $i$, there exists $x\in V_{\lambda_i}$ and we have $B^{n_i}x\not=0$ but for all $y\in V_{\lambda_i}$, $B^{n_i}y=0$. How is the next step? Or is there any different idea? Can someone help me? Thank you.
For the second, you already have what is needed, you just need to wrap it up: If $x$ is an eigenvector to the eigenvalue $\lambda$ of $A$, then you have $$A(Bx) = B((I+A)x) = B((\lambda+1)x) = (\lambda+1)Bx,$$ so $Bx = 0$ or $Bx$ is an eigenvector to the eigenvalue $\lambda+1$ of $A$. Now choose an eigenvalue $\lambda_m$ of $A$ such that $\lambda_m+1$ is not an eigenvalue of $A$ - such an eigenvalue exists since $A$ has only finitely many eigenvalues. Then if $x_m$ is an eigenvector to the eigenvalue $\lambda_m$ of $A$, the above shows $Bx_m = 0$, hence $x_m$ is an eigenvector to the eigenvalue $0$ of $B$, and thus a common eigenvector.
stackexchange-math
{ "answer_score": 4, "question_score": 3, "tags": "linear algebra, matrices" }
How do you access the recovery mode of Windows 8? Microsoft disabled the recovery mode key (F8) and replaced it with some automatic detection algorithms. These detection algorithms begin every couple of times you boot up but it doesn't complete the boot process. I can get that far. However, I can not get to any menus. Is there anything else I could try before I reformat the drive and try again?
For Windows 8, the `Shift+F8` keyboard shortcut at boot should open up recovery mode.
stackexchange-superuser
{ "answer_score": 3, "question_score": 1, "tags": "windows 8" }
Sequences and series and what is good enough It seems like so much of this is based on intuition and assumptions. I don't understand the limit comparison test contrapositives so I ignore the limit comparison test as it seems largely useless and cumbersome. In trying to find the convergence or divergence of $\sum_1^\infty \frac{1}{\sqrt{n} + \ln n}$ why is it wrong to use the comparison test? I know that this can't converge because lnn is much smaller than $n^\frac{1}{2}$ so by p series it could never converge. $\sum_1^\infty \frac{1}{\sqrt{n} + \ln n} > \sum_1^\infty \frac{1}{\sqrt{n} + n^\frac{1}{4}}$ and that $.5 + .25 < 1$ so by p series it diverges and it is a smaller function so by comparison test it diverges. Everyone says this is wrong, but how accurate and precise do I need to be because it seems like a cumbersome approach like the limit comparison test makes just as many assumptions.
Unfortunately, you cannot apply the $p$-series result to $$\sum_{n=1}^\infty\frac1{n^{1/2}+n^{1/4}},$$ since it is not a $p$-series. However, you're nearly there. Noting that for $n\ge 1$ we have $2n^{1/2}\ge n^{1/2}+n^{1/4}$ then we have $$\sum_{n=1}^\infty\frac1{n^{1/2}+n^{1/4}}\ge\frac12\sum_{n=1}^\infty\frac1{n^{1/2}}.$$ **Now** you can apply the $p$-series result.
stackexchange-math
{ "answer_score": 5, "question_score": 0, "tags": "calculus, sequences and series" }
Should questions be split into subsections? Should questions be split up into separate sections ( **Background** , **Problem** , **Question** , etc), using headers or bold lines? Does it help with readability, or does it make it more of a chore to read the whole thing? I came across this issue while trying to improve my questions after a question ban. For example, here is a sectioned question while this is unsectioned.
When I take the time to do something like that, I put a short version at the top: just the question. Then background and supporting data farther down. That way readers can determine if they might be interested without a large investment of time or brainpower but all the details are available if they _are_ willing to invest some time in helping me. This is a writing decision and it should be driven by your audience and by the context in which they will be reading the question. You want to make it _easy_ for potential respondents, because you _are_ asking them to give you something for no return beyond some quite worthless internet points.
stackexchange-meta
{ "answer_score": 4, "question_score": 3, "tags": "discussion" }
ERROR ITMS-90023: “Missing required icon file” Xcode 9 I'm trying to upload my App to Apple Store but it's doing this error ![enter image description here]( All of my icons it's all ok. I already clean project and added icon name in info.plist. Anyone help me, please!
1. Go to your Assets.xcassets, click the + in bottom left -> App Icons & Launch Images -> New iOS App Icon. 2. Add the correct icon sizes in their place just like normal. Remember to change your 'App Icons and Launch Images' (in the General Settings) to the new icon set you just created.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ios11, xcode9" }
on input get only new input value I have a text input where I get the input and use it. I have: $(myinput).on('input', function() { $(somediv).append($(this).val()); }); I would like to keep using the append function, but the problem is on every input, the entire input val() is being appended. So when I click 'a', its adding 'a', but when I click 'b' after a, it appends 'ab' not 'b'. is there a way to only get the input of the most recent .input event without clearing out the input box?
you could use `.text()` instead of `.append()`. This will set the whole text, not just append it. `$(somediv).text($(this).val());` Or you could use the last char of your string. `$(somediv).text($(this).val().slice(-1));` See: how to get the last character of a string?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "javascript, jquery, html" }
Object variable not set by looping through NotesViewNavigator I try to loop through all ViewEntries in a view. After looping to some documents I get the error message "Object variable not set" when I want to set the "docOrder" document. Debugging of the code shows that there are deletion stubs of documents in the ViewNavigator (no idea why?). When a deletion stub is in place the error message appears. Here a code snippet of the LS-Script Agent: Call vwDelete.Refresh() vwDelete.AutoUpdate = False Set navOrders = vwDelete.createViewNav() Set veOrder = navOrders.getFirstDocument() While Not veOrder Is Nothing Set docOrder = veOrder.Document //do something Set veOrder = navOrders.getNextDocument(veOrder) Wend I know I can use an If-Statement to check if the "document is nothing" but I'm curious why there are deletion stubs in ViewNavigator. It is an index problem? Any ideas?
From the documentation for the `NotesViewEntry` class > If a document is deleted after a ViewEntryCollection containing that document is created, the result of navigating to the deleted document will be a ViewEntry that can be used to navigate to the next entry, but nothing more. All of the properties or methods on this type of ViewEntry, except IsValid, will return an error. If you are sure that none of the documents in a ViewEntryCollection have been deleted, you don't need to check this property; otherwise, it should be checked. You don't want to check against `is nothing`. You want to check `if vOrder.isValid()`.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "lotusscript" }
sleep_until in embedded_linux in multi-threaded environment (embedded Linux) I have a pseudo RT system that is running multiple threads. I want each thread to execute at specific frequency (period interval). I have been using usleep(time_until_reschedule). The problem is that time_until_reschedule could be computed, then a higher priority thread could preempt this thread, and I would like to avoid such behavior. I would like to implement something that acts like "sleep_until". I am thinking of using hrtimers (built in my kernel) with SIGEV_THREAD_ID to notify each thread while the thread calls sigwait(). Is this a sensible way of implementing a sort of sleep_until() or is there a better way under Linux please?
It is not clear what your threads need to do, but you could use a combination of `clock_nanosleep` and Earliest Deadline First scheduling. You could sleep without computing the sleep duration, and if you are scare that your thread is not going to be waken up because other threads are CPU hogs, than EDF may be a solution for you. For clock_nanosleep check this post. For the EDF scheduler, check this article.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "timer, embedded, embedded linux" }
Add missing xts/zoo data with linear interpolation in R I do have problems with missing data, but I do not have NAs - otherwise would be easier to handle... My data looks like this: time, value 2012-11-30 10:28:00, 12.9 2012-11-30 10:29:00, 5.5 2012-11-30 10:30:00, 5.5 2012-11-30 10:31:00, 5.5 2012-11-30 10:32:00, 9 2012-11-30 10:35:00, 9 2012-11-30 10:36:00, 14.4 2012-11-30 10:38:00, 12.6 As you can see - there are missing some minute values - it is xts/zoo so I use as.POSIXct... to set the date as an index. How to add the missing timesteps to get a full ts? I want to fill the missing values with linear interpolation. Thank you for your help!
You can `merge` your data with a vector with all dates. After that you can use `na.approx` to fill in the blanks (NA in this case). data1 <-read.table(text="time, value 2012-11-30-10:28:00, 12.9 2012-11-30-10:29:00, 5.5 2012-11-30-10:30:00, 5.5 2012-11-30-10:31:00, 5.5 2012-11-30-10:32:00, 9 2012-11-30-10:35:00, 9 2012-11-30-10:36:00, 14.4 2012-11-30-10:38:00, 12.6", header = TRUE, sep=",", as.is=TRUE) times.init <-as.POSIXct(strptime(data1[,1], '%Y-%m-%d-%H:%M:%S')) data2 <-zoo(data1[,2],times.init) data3 <-merge(data2, zoo(, seq(min(times.init), max(times.init), "min"))) data4 <-na.approx(data3)
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 8, "tags": "r, time series, xts, zoo" }
JavaScript passing a string into a method, which is an a attribute I have the following code: myFunction('test') I wish to set this on the onclick of an html element <a href="#" onclick="myFunction('test')" >Link</a> I need to capture this as a string and add it via JavaScript as an inner element. How can I capture this? "<a href="#" onclick="myFunction('test')" >Link</a>" '<a href="#" onclick="myFunction('test')" >Link</a>' Neither seem to work.
Do you mean you want to capture _'test'_ as a string, and pass it as the parameter? Try using backslahes before the single quotes surrounding _test_ <a href="#" onclick="myFunction(\'test\')" >Link</a>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript" }
Excel Avoiding nested if statements I have a datasheet in Excel with several columns to a row of data. Across these columns I have dates. These dates show the time an item has passed a certain criteria. Is there a way (via formula) a way to have excel look at each column on a line and spit out only the lastest date. Currently I am using this monster: =IF(X3="",IF(W3="",IF(V3="",IF(U3="",IF(S3="",IF(R3="",IF(Q3="",IF(P3="",IF(O3="",IF(N3="","No Dates",N3),O3),P3),Q3),R3),S3),U3),V3),W3),X3) It works fine, but I'm looking for something a little more elegant. Please and thank you.
If you want the latest date, use =MAX(N2:X2) If you want the right most date, use this array formula =INDEX(A2:X2,1,MAX((NOT(ISBLANK(N2:X2)))*(COLUMN(N2:X2)))) Enter array formulas with Ctrl+Shift+Enter, not just Enter. Is finds the largest column that isn't blank and inserts that into INDEX.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "excel, excel formula" }
What are the differences between a fiber bundle and a sheaf? They are similar. Both contain a projection map and one can define sections, moreover the fiber of the fiber bundle is just like the stalk of the sheaf. But what are the differences between them? Maybe a sheaf is more abstract and can break down, while a fibre bundle is more geometric and must keep itself continuous. Any other differences?
If $(X,\mathcal{O}_X)$ is a ringed topological space, you can look at locally free sheaves of $\mathcal{O}_X$-modules on $X$. If $\mathcal{O}_X$ is the sheaf of continuous functions on a topological manifold (=Hausdorff and locally homeomorphic to $\mathbb{R}^n$), or the sheaf of smooth functions on a smooth manifold, you get fiber bundles (the sheaf associated to a fiber bundle is the sheaf of "regular" (=continuous or smooth here) sections).
stackexchange-math
{ "answer_score": 8, "question_score": 26, "tags": "sheaf theory, fiber bundles" }
K-group properties of quasi-diagonal $C^*$-algebras Let $A$ be a separable unital quasidiagonal $C^*$-algebra. What can be said about the $K$-theory of $A$, for example some properties? Especially, are there some criterions to decide whether or not $K_*(A)$ has torsion? I appreciate any reference request in this direction. Thank you.
This is not necessarily an answer, but it was too long for a comment: Note that for any separable unital $C^*$-algebra $A$ its suspension $SA := C_0(\mathbb{R}) \otimes A$ is quasidiagonal. This can be found as Corollary 7.3.7 in the (excellent) book "$C^*$-algebras and Finite-dimensional Approximations" by Brown and Ozawa. Here is the link. Using $K_i(SA) \cong K_{i+1}(A)$ and Bott periodicity it follows that quasidiagonality does not impose any restrictions on the K-theory groups, if you allow _non-unital_ $C^*$-algebras (like $SA$).
stackexchange-mathoverflow_net_7z
{ "answer_score": 6, "question_score": 3, "tags": "reference request, oa.operator algebras, kt.k theory and homology, c star algebras" }
android linkfy for part of textview I'm using Textview to show text with URLs inside. How to linkfy part of text? This tag doesn't work: <a href=\" terms</big></a>
tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setText(Html.fromHtml(Your string));
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "android, encoding, webview" }
Detecting TLD for localization I have many TLD's for my domain, for US users it's .COM, for German users it's .DE, etc. I redirect them all to the .COM domain using CNAME records. The reason is to prevent getting a penalty from Google for duplicate content. Is there a way to still detect the TLD the user entered, so I can display the page in the right language?
If you use CNAME records, google will still regard the sites as different domains, and will penalize them for duplicate content. You should redirect your users with a HTTP 301 response. When you do this, you can also add a query string when redirecting: www.example.de -> www.example.com/?lang=de This way, you won't be penalized for duplicate content, **and** you can detect your user's language.
stackexchange-serverfault
{ "answer_score": 2, "question_score": 0, "tags": "iis, redirect, cname record, tld, localization" }
Query(IMPORTRANGE) function to skip columns I'm currently using the following function to import data from one spreadsheet to another based on a value in Column K of the source spreadsheet: =QUERY( IMPORTRANGE("URL","Sheet Name!A2:P1000"), "SELECT Col1,Col2,Col3,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15 WHERE Col11 CONTAINS 'West'", 1 ) Notice I am not importing Columns 4 & 5 (D & E) because in my destination spreadsheet, those two columns need to be fixed and unchanging. However, I'm now getting: > #REF Error: Array result was not expanded because it would overwrite data in D2. Is it possible to edit the function above and tell it to skip Columns 4 and 5 when it's pasting the data from the source spreadsheet?
No, it's not possible to "skip columns". Instead you could use two query functions, one to be used to get the columns A - C, the other to get the columns F and following. First formula (A1): =QUERY( IMPORTRANGE("URL","Sheet Name!A2:P"), "SELECT Col1,Col2,Col3 WHERE Col11 CONTAINS 'West'", 1 ) Second formula (F1): =QUERY( IMPORTRANGE("URL","Sheet Name!A2:P"), "SELECT Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14,Col15 WHERE Col11 CONTAINS 'West'", 1 ) REMARKS: Note that instead of `Sheet Name!A2:P1000` was used `Sheet Name!A2:P` as this take the whole columns instead of only 1000 rows.
stackexchange-webapps
{ "answer_score": 5, "question_score": 5, "tags": "google sheets, google sheets query, importrange" }
Angular life-cycle hook when parsing large quantity of Json I am using Angular to query a java backend that returns 1000 json objects, these then get parsed into a HTML table: <tr class="businessItemList" *ngFor="let x of businessItemsInitialSearchResults"> <td *ngFor="let y of headingsBeingDisplayed"> <a [routerLink]="['/businessItem', x.uniqueNumber]">{{x[y.propertyName]}}</a> </td> </tr> My question is, I want to show a loading wheel when the user does a search and have this disappear when the Json is returned and is parsed into the table - the query returns pretty quickly but as there is a lot of parsing Json the UI is not fully updated for 5+ seconds afterward. How can I be notified when the UI completes so I can then hide the loading wheel?
You need to create service for show and hide loading spiral like: @Injectable() export class ShareService { isLoading:boolean; showLoader(){ return this.isLoading=true; } hideLoader(){ return this.isLoading=false; } } now you can use this service in your component where you call in your function like: loadData(){ this.isLoading = this.shareService.showLoader(); this.dataService.getAllData() .subscribe( news=>{ this.data=data; this.isLoading = this.shareService.hideLoader(); },err=>{ alert("Something went wrong"); this.isLoading = this.shareService.hideLoader(); } ) } In your HTML file add <div id="loader" *ngIf="isLoading"></div> add css for loader id
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "json, angular, parsing, html parsing" }
How to hide folder > **Possible Duplicate:** > How can I hide directories without changing their names? How can I hide a folder and only see it when Ctrl+H is pressed? I have checked in Properties and couldn't find it.
It is very simple. Just put a dot before the folder name you want to hide. .folder
stackexchange-askubuntu
{ "answer_score": 3, "question_score": 0, "tags": "directory, hidden files" }
How to slice PSD template to html/css? I'm coding a PSD template into html/css. The file consists of about 50 layers, which I have exported to PNG with a Photoshop script. I started like this: <div id="container_1"> <div id="container_2"> <div id="containter_3"> etc </div> </div> </div> Each layer is exactly the template size, with transparent background. At first I was happy with this approach, as it worked all right and allowed me not to worry about positioning much, but as the number of divs is now enormous, the code starts looking weird to me, not to mention the page loads really slowly now. This must be a really stupid question to ask, but should I have cropped the images after exporting them from the PSD? Maybe even combine several layers together instead of putting them on the page separately one over another (there are several layers that create a decorative border around blocks with text)?
You could give this tutorial a try: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "html, css, templates, psd" }
Python strip every double quote from csv Hi I have a csv file that looks like the following. "AB" ; "AA" ; "BA" ; "HI" "CD" ; "BB" ; "BC" ; "JK" "EF" ; "CC" ; "CE" ; "LM" "GH" ; "DD" ; "DG" ; "MN" How can I get the following code to strip off all the double quotes from every column in a csv file as for now it strips only the first column. Thanks import csv f = open("wakhawakha.csv", 'rt') try: for row in csv.reader(f, delimiter=' ', skipinitialspace=True): print('|'.join(row)) finally: f.close()
Open it and read the string first. import csv with open("wakhawakha.csv", 'rt') as f: data = f.read() new_data = data.replace('"', '') for row in csv.reader(new_data.splitlines(), delimiter=' ', skipinitialspace=True): print ('|'.join(row))
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "python, parsing, python 3.x, imacros" }
Form data cleared when press the browser back button I am using views concept in my asp.net form control.my first view consist of a form to capture user details.when user press continue it will move to the second view. The problem is ,When user press the back button of the browser,It does not keep state of the previously entered data.the form got cleared. we cant use both viewsstates and Sessions for this since they got reset in the back button click, Is there any solutions we can take to overcome this issue ?
Assuming you are using MVC, if there is a post happening between the first and the second view, you can store the data from the first view in the user's session on the server, which should not have been rest by a back button click. You can force the browser to reload the first form on back button navigation by setting the NoCache attribute on it. Then, just check to see if they have any existing form data in their session, and populate it when they request that action.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "asp.net, asp.net mvc, sharepoint 2010" }
Outlook.MailItem - Is there any way to determine if two mailitems (sent to different recipients) are the same? I would like to know if there is any way to compare two `Outlook.MailItem`s to see if they are the same. For example, If two people in our company receive the same email, is there a way to compare them for equality? I was thinking about comparing the the folowing properties: `Subject`, `To`, `From`, `CC`, `Body` which may work 99% of the time, however as the database grows bigger and bigger this routine will become slower and slower. Is there a better way to acheive this?
If you are storing the values, then a hashcode of the properties might be the way to go, using the properties you stated. You could then make this an indexed column to improve search and retrieval performance. So I guess in C# : var mailHash = String.Format("{0}{1}{2}{3}{4}", mail.To, mail.From, mail.CC, mail.Subject, mail.Body).GetHashCode(); Would that work for you? Cheers, Chris.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "c#, outlook, comparison" }
Can a struts 1 action mapping call struts 2 action My existing application is built using struts 1 framework and I m adding new business components into it using struts 2 framework . Enabling both in single application is successful but don't have any clue to call struts 2 action from within strut 1. Is it really possible ?
A link is a link, it doesn't matter how the link's server-side action is implemented. As long as you can generate the correct URL, you're fine.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "java, model view controller, jakarta ee, struts2, struts" }
C read part of file into cache I have to do a program (for Linux) where there's an extremely large index file and I have to search and interpret the data from the file. Now the catch is, I'm only allowed to have x-bytes of the file cached at any time (determined by argument) so I have to remove certain data from the cache if it's not what I'm looking for. If my understanding is correct, fopen (r) doesn't put anything in the cache, only when I call getc or fread(specifying size) does it get cached. So my question is, lets say I use fread and read 100 bytes but after checking it, only 20 of the 100 bytes contains the data I need; how would I remove the useless 80 bytes from cache (or overwrite it) in order to read more from the file. **EDIT** By caching I mean data stored in memory, which makes the problem easier
`fread`'s first argument is a pointer to a block of memory. So the way to go about this is to set that pointer to the stuff you want to over write. For example lets say you want to keep bytes 20-40 and overwrite everything else. You could either a) invoke `fread` on start with a length of 20 then invoke it again on `buffer[40]` with a size of 60. or b) You could start by defragmenting (ie copy the bytes you want to keep to the start) then invoke `fread` with a pointer to the next section.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c, file, file io, cache control" }
Old forgotten questions What happens to old questions with answers that never get accepted, but don't get any more answers or activity? Do they just hang out on the site getting more and more forgotten? They're usually asked by newer users who probably don't know that you should accept the answer that has solved the issue. This isn't really an issue I guess, but I was just wondering if there's something in place for this type of question.
The following is about open questions with at least one answer but no accepted one and without the OP's account having been deleted: 1. They will **not** be auto-deleted by Roomba due to the answer. 2. No one but the OP can accept an answer (there have been so far unsuccessful feature requests trying to change it) 3. They might be bumped by the Community User under some circumstances. These questions stay on the site and the solutions might help other visitors. New answers can also be added.
stackexchange-meta_stackoverflow
{ "answer_score": 27, "question_score": 22, "tags": "discussion, questions, answers, old questions" }
What's the equivalent of CastleWindsor's container.Release in LightInject? I saw ASP.NET Web API dependency injection in Seemann's site. It uses CastleWindsor though. request.RegisterForDispose( new Release( () => this.container.Release(controller))); What's the equivalent of CastleWindsor's container.Release in LightInject? <
There is not really a Release method in LightInject. Disposable services are registered either with the PerScopeLifetime og the PerRequestLifetime. These services are disposed when the surrounding Scope is disposed. container.Register<IFoo, DisposableFoo>(new PerScopeLifetime()) using(container.BeginScope()) { var foo = container.GetInstance<IFoo>() } -- foo is disposed here LightInject.WebApi provides an integration for Web Api that takes care of disposing controllers when the web request ends.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "asp.net web api, dependency injection, castle windsor, light inject" }
Erro estranho no For em Python Olá, meu amigo. Estou com um erro muito besta que nem to conseguindo entender porque está errado. a = [1, 4, 5] b = [] for i in range(0,len(a)): c = a[i+1] b.append(c) O erro é IndexError: list index out of range como assim o copilador não entende que i = 0, eu quero a[1]?? Obrigado pela atenção
Explicação de como está atualmente: a = [1, 4, 5] b = [] for i in range(0,len(a)): c = a[i+1] # primeiro 1, depois 2 e depois 3, você não tem a posição 3 no seu list a, você tem as posições 0, 1 e 2 b.append(c) Se for transferir os valores, um código melhor seria: a = [1, 4, 5] b = [] for i in a: c = a[i] b.append(c) Aqui tem exemplos com estruturas de repetição com range e outras maneiras <
stackexchange-pt_stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "python, python 3.x" }
.htaccess redirect a specific directory I am in need of help with build an htaccess file. Basically I am moving an website from www.abc.com to www.xyz.com. Now, here is the two things that I am trying to achieve: * All users should be redirected to `www.xyz.com` when accessing `www.abc.com` * If user accesses `www.abc.com/files/abcd.file` or `www.abc.com/files/folder/abcd.file`, etc. should be redirected to `arhive.xyz.com/abcd.file`, etc. Basicly, this URL `www.abc.com/files/`, should be replaced with `arhive.xyz.com`, keeping the same file/directory structure. Someone can help? Thanks in advance.
You have several requirements, but _if I understand correctly_ this should get what you need in the htaccess file in the root directory. RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.com [NC] RewriteCond %{REQUEST_URI} !^/files(/.*)?$ [NC] RewriteRule ^ [R=301,L] RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.com [NC] RewriteCond %{REQUEST_URI} ^/files(/.*)?$ [NC] RewriteRule ^ [R=301,L] Of course change to your domain names.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": ".htaccess" }
Does Upsert operation in apex take more time against huge data? I have a 50 gb data in my org for one object. My triggers will fire and upsert a record on it, does the volume of data show any impact in performing the UPSERT DML operation.
It will have approximately the same performance as it would to query the records by External ID and make the decision manually. In other words, there's no performance benefit from not using upsert. This is because External Id is indexed, so records can be identified very quickly.
stackexchange-salesforce
{ "answer_score": 4, "question_score": 3, "tags": "dml, upsert" }
Converting a PHP array to JSON string I have an array that looks like this: Array ( [1] => Laravel [2] => Volta [3] => Web [4] => Design [5] => Development ) Now I want to convert this array to a string that has to look like this data: [{id: 1, text: 'Laravel'},{id: 2, text: 'Volta'},{id: 3, text: 'Web'},...],
YOu can try $data = Array( 1 => "Laravel", 2 => "Volta", 3 => "Web", 4 => "Design", 5 => "Development" ); array_walk($data, function (&$item, $key) { $item = array("id"=>$key,"text"=>$item); }); print(json_encode(array("data"=>array_values($data)))); Output {"data":[{"id":1,"text":"Laravel"},{"id":2,"text":"Volta"},{"id":3,"text":"Web"},{"id":4,"text":"Design"},{"id":5,"text":"Development"}]}
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "javascript, php, json" }
How to get details from a Google Maps location? I use `GeoLocation` to get the current position from an user when they visit my webpage. But I want to get the details of that coordinates `GeoLocation` gives me. I mean, if the api gives me two specific locations, I want to gather the address, zip code, city, county, country (if they're able to) etc... Is there a way to do that? Thank you all!
Reverse geocoding (from the documentation): The term geocoding generally refers to translating a human-readable address into a location on a map. The process of doing the converse, translating a location on the map into a human-readable address, is known as reverse geocoding.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "google maps, geolocation" }
I want to know radius of convergence. $\sum ^{\infty }_{n=0}\left\{ 3+\left( -1\right) ^{n}\right\} x^{n}$ $$\sum ^{\infty }_{n=0}\left\\{ 3+\left( -1\right) ^{n}\right\\} x^{n}$$ I used ratio test to find radius of convergence. $$\lim _{n\rightarrow \infty }\left| \dfrac {\left\\{ 3+\left( -1\right) ^{n+1}\right\\} x^{n+1}}{\left\\{ 3+\left( -1\right) ^{n}\right\\} x^{n}}\right|=\lim _{n\rightarrow \infty }\left| \dfrac {\left\\{ 3+\left( -1\right) ^{n+1}\right\\} x}{\left\\{ 3+\left( -1\right) ^{n}\right\\} }\right|$$ But I don't know what to do next. Please tell me how to solve.
Hint. In this case you should use the root test (the general form is with $\limsup$): $$R=\frac{1}{\limsup_{n\to\infty}\sqrt[n]{|a_n|}}.$$ Now note that $$a_n=\begin{cases} 4&\text{ if $n$ is even,}\\\ 2&\text{ if $n$ is odd.} \end{cases}$$ Can you take it from here?
stackexchange-math
{ "answer_score": 4, "question_score": 1, "tags": "convergence divergence, summation, infinity" }
How can I find my subnet mask? The popular answer to the question " How does IPv4 Subnetting Work? " does a nice job in explaining subnets. I remember learning about the network classes back in CCNA class but that answer mentions "Classless Inter-Domain Routing" (CIDR) in the following way: Back in the "old days", subnet masks weren't specified, but rather were derived by looking at certain bits of the IP address. An IP address starting with 0 - 127, for example, had an implied subnet mask of 255.0.0.0 (called a "class A" IP address). These implied subnet masks aren't used today and I don't recommend learning about them anymore. So my question is if I have an ip address such as `71.75.232.132`, (that is my public ip address assigned to my cable modem via my ISP), how do I figue out what the subnet mask is so that I can annotate the address in the proper format with something like `71.75.232.132/32`
Whoever assigned you that IP address should have also told you the subnet mask, default gateway, and whatever other information you need to configure your machine. If they're using DHCP, the DHCP server will tell your computer the subnet mask. Then you don't need to know it, but you can look it up with the appropriate command for your OS if you're curious.
stackexchange-serverfault
{ "answer_score": 9, "question_score": 1, "tags": "networking, ip address, subnet" }
Gradient derived from Jacobian? I was reading this wikipedia page on gradient descent (section: Solution of non-linear system) when I came across this formula: $\nabla F(\mathbf {x} ^{(0)})=J_{G}(\mathbf {x} ^{(0)})^{\mathrm {T} }G(\mathbf {x} ^{(0)})$ How did this equation come about? Sorry for my shaky calculus if this sounds stupid, but this is the only point in this section that I don't understand.
From the article $$ F({\bf x}) = \frac{1}{2}G^T({\bf x}) G({\bf x}) = \frac{1}{2}\sum_j G_j({\bf x}) G_j({\bf x}) \tag{1} $$ Take the derivative w.r.t to $x_i$ \begin{eqnarray} \frac{\partial F}{\partial x_i} &=& \frac{1}{2}\sum_j \frac{\partial}{\partial x_i}\left[G_j({\bf x}) G_j({\bf x}) \right] = \sum_j \color{blue}{\frac{\partial G_j({\bf x})}{\partial x_i}} G_j({\bf x}) \\\ &=& \sum_j \color{blue}{[J_G({\bf x})]_{ij}} G_j({\bf x}) = [J_{G}({\bf x}) G({\bf x})]_i \tag{2} \end{eqnarray} where the $(i,j)$-th component of matrix $J_G$ is defined as $$ [J_G({\bf x})]_{ij} = \frac{\partial G_j({\bf x})}{\partial x_i} \tag{3} $$ Eq. (2) tells you what the $i$-th component of the gradient is, if you put them all together you get $$ \nabla F({\bf x}) = J_G({\bf x}) G({\bf x}) \tag{4} $$
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "calculus, nonlinear optimization, gradient descent, jacobian" }
Import SQL server type data into Oracle? I was trying to import data from sql to oracle and the only way I found was Oracle SQL Developer. Finally I gave up. Today I heard someone said there is a format which I can do it in table level only. but she couldn't remember the format. It is something like CVN or CSV or something similar. Anyone has heard about that?
What they were talking about was the Bulk Load Utility using a .CSV file format.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "sql, sql server, oracle, database migration" }
Tutorial for installing and configuring a mailserver on CentOS Anybody know of a good howto/tutorial/walkthrough on installing and configuring a mail server on CentOS using the commandline? I just got myself a fresh VPS. Last year I used a nice tutorial which basically was a walkthrough of installing / configuring and securing the mailserver and all related stuff, but I forgot the url of course :) . What do I want: Mail server for CentOS 5.6 IMAP + POP + SMTP Webmail Spamfilter Vscan anything else? Thanks in advance!
In the past, I used the following tutorial from the CentOS forums. However, times have changed, and as one of the comments in the above link states, why go through this when there are some more refined packages available. The easiest way to get all of this in a seamless solution is to go with something like Zimbra Open Source Edition. It puts all of these piece together and provides a more solid webmail interface than most of the other open-source solutions. Consider it...
stackexchange-serverfault
{ "answer_score": 1, "question_score": 0, "tags": "centos, command line interface, email server, tutorial" }
Function is expecting arrays but I want to pass a variable I have a PHP function that is expecting an unknown number of arrays as parameters. function cartesianProduct() { ... } It is expecting me to do something like this: cartesianProduct( array('blue', 'green', 'red'), array('apples', 'oranges', 'bananas') ); But I'm constructing the arrays beforehand and am having trouble passing them in. For example: $arrs = array( array('blue', 'green', 'red'), array('apples', 'oranges', 'bananas') ); cartesianProduct($arrs); Passing in the arrays this way doesn't work - obviously it is seeing it as one single array parameter. How can I 'expand' my `$arrs` parameter or call the function in a different way to make the function think I'm passing the inner arrays? Thanks
You can use call_user_func_array to accomplish that. $arrs = array( array('blue', 'green', 'red'), array('apples', 'oranges', 'bananas') ); call_user_func_array('cartesianProduct', $arrs); The first argument is the function name you want to call and the second is an indexed array of parameters that will be passed to it.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "php, arrays, parameters, parameter passing" }