INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Time Complexity of a Algorithm Which Runs in lg(n!) Time What is the Big-Θ (or lowest Big-O) time complexity of an algorithm which runs in lg(n!) time? (where lg -> log base 2)
You can write `lg(n!)` as: !enter image description here And now you can approximate it with integrals: !enter image description here Finally solve integrals: !enter image description here And your answer is: !enter image description here **`lg(n!)` has got `O(nlog(n))` complexity**
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "performance, time complexity" }
Using CSS to emulate <a target="_top"> Is it possible to alter a link behavior to target="_top" via CSS? **Edit:** Soon, my friends, soon. :) a[target="_top"], area[target="_top"], form[target="_top"] { target: root } <
No, it is not possible. CSS is for presentation. **EDIT** : The CSS3 Hyperlink Presentation Module talks about making this possible, but it is only a Working Draft and is not supported by any browsers.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "html, css, hyperlink" }
Convert timestamp to date? I have an array which gives: array ( 0 => 'Fri Mar 13 2020 00:00:00 GMT+0100 (Ora standard dell’Europa centrale)-Mon Mar 16 2020 00:00:00 GMT+0100 (Ora standard dell’Europa centrale)', 1 => 'Tue Mar 17 2020 00:00:00 GMT+0100 (Ora standard dell’Europa centrale)-Sat Mar 21 2020 00:00:00 GMT+0100 (Ora standard dell’Europa centrale)' ) I try to have it like this format `'m/d/Y'` -> eg. `13/03/2020` date_default_timezone_set('Europe/Berlin'); foreach($dates as $item) { echo "<li>".date('d/m/Y',$item)."</li>"; } But says: > Warning: date() expects parameter 2 to be integer, string given in I'm looking for 13/03/2020-16/03/2020 & 17/03/2020-21/03/2020
You need `foreach()`, couple of `explode()` and `strtotime()` foreach($array as $arr){ $exploded = explode('-',$arr); $finalTime = ''; foreach($exploded as $explode){ $timeString = trim(explode('(',$explode)[0]); $finalTime .= (!empty($finalTime)) ? "-".date('d/m/Y', strtotime($timeString)) : date('d/m/Y', strtotime($timeString)); } echo $finalTime; echo PHP_EOL; } Output:- < OR <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php" }
A Hahn-Banach type extension problem for multiple functionals Let $X$ be a closed subspace of a Banach space Y. I have functionals $f_0, f_1, \ldots, f_n\in X^*$ such that $f_0$ is in the span of the remaining ones. I fix an extension of $f_0$ to $Y$; let me call it $F_0$. Can I extend them to functionals $F_1, \ldots, F_n$ on $Y$ in a way that $F_0$ is in the span of $F_1, \ldots, F_n$? I don't really care about preserving the norms of the original functionals.
If $f_0\ne0$ or if $f_0=0$ and the $f_1,\dotsc,f_n$ are not linearly independent, then the answer is trivial: In this case there is another functional, say $f_1$, which is in the span of the remaining ones, say $f_1=\sum_{k\ne1}\lambda_kf_k$ with $\lambda_0\ne0$: Extend the $f_k$ to $F_k$ $(k=2,\dotsc,n)$ and put $F_1=\sum_{k\ne1}\lambda_kF_k$. In the remaining case, $f_0=0$ and $f_1,\dotsc,f_n$ being linearly independent, the answer to your question is obviously positive if and only if $F_0=0$ (because $\sum_{k=1}^n\lambda_kF_k=F_0$ implies by restriction to the subspace $\lambda_1=\dotsc=\lambda_n=0$).
stackexchange-mathoverflow_net_7z
{ "answer_score": 6, "question_score": 3, "tags": "fa.functional analysis, banach spaces" }
show js alert on certain conditions I would like to know how I can display an javascript alert in the following 3 conditions: 1. the reload button from the browser is clicked 2. Reloading the page with a keybort shortcut (e.g. CMD + R) 3. Leaving the actual page by clicking on links on the page. The user should be able to cancel the reload in the alert window.
try onbeforeunload which opens a prompt box for the user window.onbeforeunload = function() { return "noooooo... dont go"; } the return value will be displayed as the prompt text, if the user clicks the confirm button, the window continues with the navigation - and stops the navigation if the user chooses cancel example in action
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, jquery, html" }
How to simulate a mouse in c# - without tying up the actual mouse? I'm back with a rather interesting question this time. Is it possible to create your own mouse in your program, so that it'll click on certain areas within your program for you? I'm working on a program that will complete the idiot test automatically, faster than my friend (also using his own program), and I don't know how to create a mouse click inside the actual window, without tying up the mouse. So basically, if you minimized the browser, you could still use your own mouse to do other things, like work in a word document or something. Anyone have any ideas? I'm completely new to this, so if I'm being stupid don't be afraid to say so.
AutoIt3 ( < is your friend for the purpose. Look for C#/COM interface with autoIt3 for more information. In order to program in c#, (after installing autoit3) you can reference AutoItX3.dll and start using it in your c# project.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "c#" }
Calculating $\lim_{(x,y) \to (0,4)} \frac{xy-4x}{y^2-16}$ or proving it does not exist I've managed to get the limit into the following form: $y=mx \rightarrow \lim_{x \to 0} \frac{mx^2-4x}{mx^2-16} \rightarrow \lim_{x \to 0} \frac{x (m-4)}{x^2 (m+4) (m-4)}$ I'm not sure how I'm supposed to procceed from here (and might be on the wrong path altogether).
We have $$\lim_{(x,y) \to (0,4)} \frac{xy-4x}{y^2-16}$$ $$=\lim_{(x,y) \to (0,4)} \frac{x(y-4)}{(y-4)(y+4)}$$ $$=\lim_{(x,y) \to (0,4)} \frac{x}{(y+4)}$$ $$= \frac{0}{(4+4)}=0$$
stackexchange-math
{ "answer_score": 6, "question_score": 1, "tags": "limits, multivariable calculus, limits without lhopital" }
Casting between Microsoft.SharePoint.Client and Microsoft.SharePoint types Is there any trivial casting between `Microsoft.SharePoint.Client` and `Microsoft.SharePoint` types? Such as `Microsoft.SharePoint.Client.BaseType` and `Microsoft.SharePoint.SPBaseType`, or such as `Microsoft.SharePoint.Client.ListItem` and `Microsoft.SharePoint.SPListItem`.
No, there isn't. These are completely different types, and even the whole assemblies are supposed to be used in different scenarios. * `Microsoft.SharePoint.Client.*` classes form the Client-Side Object Model, which, in fact, means your code interacts with SharePoint remotely, running outside any of SharePoint processes; * `Microsoft.SharePoint.*.SP*` classes form the Server-Side Object Model, which works for code running _within_ any of SharePoint processes. You shouldn't be mixing both in a single piece of code.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "csom" }
How to rewrite a particular block of file I want to rewrite a particular block in a file but its not working for me For example if I want to rewrite to offset 4 of the file I used lseek(fd,4,SEEK_SET) and called write system call but its writing at the end of the file instead of at offset 4.
Don't use `O_APPEND`. It will append everything to the end of the file, regardless of your seeking. Use: open("file.txt", O_RDWR); You're assuming the file already exists, so I don't see why you would use `O_CREAT`.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "c, unix" }
Javascript replace string and get string replaced I am getting a sometimes random string that will always contain [] with special string inside of it. I would like to use the text inside each bracket and use it in a function to replace the text inside each bracket. Here is an example: So far I have let string = 'test [a] test2 [b]' let test = string.replace(/\[(.+?)\]/g, ""+getValue(text inside bracket replaced here)+"") function getValue(text) { //this function will return a value based on the certain text it receives } console.log(test) 'test [replaced text based on a value] test2 [replaced text based on b value]' Thanks for the help in advance.
The second argument of `.replace` can be a replacer function, so you can put `getValue` there. The capture group will be in the second argument, so you'll have to alter `getValue`'s parameter list: let string = 'test [a] test2 [b]' let test = string.replace(/\[(.+?)\]/g, getValue); function getValue(wholeMatch, textInsideBrackets) { //this function will return a value based on the certain text it receives }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, regex, replace" }
How to use conditional statement "if not exists" in dynamic sql query within stored procedure? I have something like this. declare @insertQuery nvarchar(max) declare @ifQuery nvarchar(max) SET @insertQuery='...' SET @ifQuery='if not exists(select Id from '+@DbName+'.[dbo].[tbl_TestHere] where Id='+@id+')' BEGIN Exec sp_executesql @insertQuery END I need to execute dynamic query @insertQuery if "if not exists(...)" returns true..But i couldn't find right solution for this. Thanks in advance
Just combine to queries together. SET @FinalQuery NVARCHAR(MAX) = @ifQuery + @insertQuery; EXEC (@FinalQuery); Of course, you need to check if combined query is valid. Surround **@insertQuery** with `BEGIN` and `END` if needed. If above combination is not valid for you, please check How to get sp_executesql result into a variable?.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql, sql server" }
How can I put specific Coordinates in an array in Swift? in Swift Playgrounds I have solved a level where I had to place 16 Blocks at specific coordinates. for example: _let B1 = Block; world.place(B1, atColumn: 1, row: 6)_ If you have to do this 16 times, it is kind of lot to write down and doesn’t look really good. So my Question is if it is possible to create an array with coordinates (if yes, how can I do that) to just need to write something like that: _world.place(Block(), at: coordinate)_ Thank you already for your time and your answers.
You can create an array of named tuples and then loop over that array placing a block at each one: let coordinates: [(column: Int, row: Int)] = [(1, 2), (3, 4)] for coordinate in coordinates { let B1 = Block world.place(B1, atColumn: coordinate.column, row: coordinate.row) } or you can unpack the `column` and `row` directly by using: for (column, row) in coordinates { let B1 = Block world.place(B1, atColumn: column, row: row) }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "arrays, swift, coordinates" }
Rails Routes redirect to subdomain I would like all urls of the type www.mysite.co.za/learning/* to resolve to < I can get them to resolve to just < using match '/learning/*other', :to => redirect(' via: 'get' but how do I get the *other to append to that. e.g. www.mysite.co.za/learning/blah/blah to learning.mysite.co.za/blah/blah Does that make sense? Thanks, Matt
You can reference the dynamic segment with `%{other}`: match '/learning/*other', :to => redirect(' via: 'get'
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "ruby on rails, redirect, rails routing" }
In SQL Server 2005 is there any way to change the collation of a whole database at once? Using SQL Server Management Studio, I have backed up a database from one server and restored it to my local copy of SQL Server 2005. But the collation of the backed up database is SQL_Latin1_General_CP1_CI_AI and I am attempting to compare columns to a database which is Latin1_General_CI_AI. The database has a lot of keys and constraints which makes changing each column individually throw errors. What is the best way to change the collation of a whole database in SQL Server 2005?
There is no simple way, you must change collation of Db (`ALTER DATABASE`), and all columns individually (`ALTER TABLE`). Maybe there is a ready to use tools, maybe you need to write it youself. Maybe Data Comparison Tool of Visual Studio 2010 can be useful (`Data -> Data Compare` menu).
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "sql server, sql server 2005, collation" }
Show that there exists $f ∈ \mathbb{Z}$ such that $f^2 + f +1 ≡ 0 \pmod p$. > Let $p ≡ 1 \pmod 3$ be a prime. Show that there exists $f \in \mathbb{Z}$ such that $f^2 + f +1 \equiv 0 \pmod p$. I know the first few primes of this form are: $7,13,19$ So for example $p=7$ we have $2^2+2+1\equiv0 \pmod 7$ but this is the only example I can think of. Perhaps this has something to do with showing $f^2\equiv f\equiv1\equiv0 \pmod p$? Then summing them into one congruence? Or perhaps this has something to do with Hensel's lemma?
HINT: $f^2+f+1\equiv0\pmod p\iff (2f+1)^2\equiv-3\pmod p$ as $p$ is odd Now, show that $-3$ is a quadratic residue of $p$ if $p\equiv1\pmod 3$ Reference : Quadratic reciprocity 1 , 2
stackexchange-math
{ "answer_score": 4, "question_score": 5, "tags": "elementary number theory, prime numbers, algebraic number theory, modular arithmetic" }
Migrate from Windows 2008 SQL Server to SQL CE (for WebMatrix) I have some stuff in my remote SQL Server 2008 DB. I want to put it inside my SDF database (the WebMatrix one). But I can't just copy the rows from Navicat (while viewing table for SQL Server 08) into the SDF database because some rows don't let you manually insert stuff. So I need a way to "Migrate" from Windows SQL Server 2008 to SQL Server CE (.sdf). * * * I think I have the right tools to accomplish this, but would appreciate it if someone can point me in the right direction. I have: 1. Visual Studio 2012 Ultimate RC 2. Web Matrix 3. Navicat Premium
Well, after hours of searching, I've managed to solve this issue. * * * How to Migrate/Downsize a SQL Server database to SQL Server Compact 4.0 (and 3.5) has an extremely straightforward approach to doing this. Like myself, you may need to download the following tools (and place them in the same directory as your CMD.exe file: * SQL Compact Command Line Tool * SQL Compact data and schema script utility
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "sql, sql server, sql server 2008" }
Matching audio files with text using java I have a collection of audio files. Now, I have a piece of text (say a lyric) that i want to match with the audio files? In other words, which audio file contains this lyric. I am curious how we can do this in Java. I would prefer a solution that uses preprocessing of the audio files so that the search is fast. Is there any API that can help?
Recognizing words is hard. Recognizing words in songs is even harder. It sounds like you are not interested in how to do that, but more to locate things in your song database. If so, the simplest way to do so, may be to locate lyrics for each song based on its title and other meta data, and then just search in that text.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, javasound" }
Javascript/Jquery Syntax to Disable Text Selection on a Div AND all Child Elements? What is the syntax to disable text selection on a div and all of it's sub elements. I'm using $("#MyContent).disableSelection() to disable all of the text in the below code and it works in firefox and disable all three lines at once. In IE explorer 9 it doesn't work on child elements so to disable all of the text I'd have to do $("#text1).disableSelection(), $("#text2).disableSelection(), $("#text3).disableSelection(). What is the syntax to disable or apply this to all children at once? <div id="MyContent"> <div id="text1">Hello World</div> <div id="text2">Goodbye</div> <div id="text3">Asdf</div> </div>
This works for me: $('#MyContent').children().each(function(i, c) { disableSelection(c); }); function disableSelection(target) { console.debug(target); if (typeof target.onselectstart != "undefined") // For IE target.onselectstart = function() { return false }; else if (typeof target.style.MozUserSelect != "undefined") // For Firefox target.style.MozUserSelect = "none"; else // All other routes (Opera, etc.). target.onmousedown = function() { return false }; target.style.cursor = "default"; } **Demo** : <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, jquery, text" }
How can I make Module::Build install both X and X::Y? If I have a distribution with X and X::Y also in it, how do I make Module::Build install both the modules? I have put `X.pm` in `lib`, written a file `Build.PL` with the line my $build = Module::Build->new ( module_name => "X", ); This installs X OK, but how do I tell Module::Build to also include `X::Y` in the distribution?
Module::Build should automatically find and install both modules, though you should indicate to it (in Build.PL) which one the distribution name/version is taken from. Try creating your distribution with module-starter and let it worry about the details? module-starter -mb --module=X --module=X::Y --author=Me [email protected]
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "perl, module, distribution" }
Model binding and default value How to pass a default value to a model bound input? its not working @Html.TextBoxFor(model => model.City, new { @class="ctype", value="default city"})
You could do this in the controller action rendering this view: public ActionResult Index() { SomeViewModel model = ... model.City = "default value"; return View(model); } and then: @Html.TextBoxFor(model => model.City, new { @class = "ctype" }) or if you want to use the HTML5 placeholder attribute you could do the following: @Html.TextBoxFor(model => model.City, new { @class = "ctype", placeholder = "default value" }) or if you use a weakly typed helper (absolutely not recommended): @Html.TextBox("City", "default value", new { @class = "ctype" })
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, asp.net mvc 3" }
how to form array object in jquery Below I have a page design, where I have two input boxes. Name and age. I also have an add button. Upon clicking the add button I have span elements with name and age !enter image description here and above will be grouped, say "friends" like wise another group, contains a list of person objects now i have to store data like group 1- list of objects name - age name - age group 2 - list of objects name - age name - age. later will submit the data. I have tried `var person = new Object();` , but I am looking to have key value like name: firsname , age: 23 or is there any alternative way to achieve this..thanks in advance. EDIT- i need to do this dynamically upon click add button
Try this: var ary = []; var person = {}; person.name = "nimma"; person.age = 33; ary.push(person); person.name = "maddy"; person.age = 30; ary.push(person); you can also do like this: var ary = [{"name":"nimma","age":33},{"name":"maddy","age":30}]; Fiddle here.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "javascript, jquery" }
how to map a value from an object array into the style of a render element i have an object array like this. [{message:"text 1", likecolor:"blue"},{message:"text 2", likecolor:"yellow"}]. i am able to iterate the value of "message" into my Text element. However i cant assign the value of likecolor to the color of my icon. In my code below it doesnt make any changes to the color of the icon. Here is my code /** this is my object array [{message:"text 1", likecolor:"blue"},{message:"text 2",likecolor:"yellow"}] */ this.state.messagestable.map((count) => { return ( <Card transparent key={count.message_id}> <Text>{count.message}</Text> <Icon name ="ios-heart" style={{color:count.likecolor}} /> </Card> ) }
I think you can add your color just by doing <Icon color={count.likecolor}/> UPDATE. i created a snack that works, the code is like yours, see if you find some differences: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "react native" }
Oracle Apex - editing detail form in Master Detail form I've created a master detail form using the wizard. I can get LOV selects to work in the edit master table part of the form, but I want my detail forms to also have a LOV dropdown. I just can't find where to add this - I can't find the detail fields anywhere on the edit page area for the master detail page I've created. How can I do this?? I hope this is easy to answer - I feel as though I must be missing something obvious.
To answer my own question - it's there, but it's quite well hidden! You find and select the details form in the Regions section of the main form page. Then choose the Report Attributes tab. Click on the yellow pencil next to the field you want to edit and add your LOV. That seems obvious now, but took me over an hour of fiddling to find!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "oracle, oracle apex, master detail" }
Finding a specific text in a page using selenium python I'm trying to find a specific text from a page using selenium python. I'm looking for the element name - current version from the above url. I used the below code browser = webdriver.Firefox() # Get local session of firefox browser.get(sampleURL) # Load page elem = browser.find_elements_by_clsss_name("Current Version") # Find the query box print elem; time.sleep(2) # Let the page load, will be added to the API browser.close() I don't seem to get the output printed. Am I doing anything wrong here?
There is no class with name "Current Version". If you want to capture the version number that is below the "Current Version" text, the you can use this `xpath` expression: browser.find_element_by_xpath("//div[@itemprop='softwareVersion']")
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, firefox, selenium, selenium webdriver" }
Why isn't font rendered in HTML when surronded by &quot; I have some HTML stored in a database and I am generating an static HTML file out of it. However when i open the file in the browser, the font doesn't render as I expect it. I have tracked down the problem and I see it is because of `& quot;` <p><span style="font-family: &quot;Roboto Regular&quot;;">Some text</span></p> Now if I replace the `& quot;` with `double quotes`, it works fine. This is also generated through C#. What is the best approach to fix this? Should I just use `Replace function` to convert them to quotes or is there a library that I can use to do it more efficiently? or is it even simpler to fix. Thanks for your thoughts.
You can use `System.Web.HttpUtility.HtmlDecode` (and `Encode`) to handle this sort of thing. However you should be asking yourself why your font string includes HTML encoded characters.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "c#, html, html entities, html encode" }
Passing "unit" as type parameter to generic class in F# I have an interface which takes a generic parameter and has an abstract method type MyInterface<'a> = abstract member abstractMethod: 'a -> 'a ...and I have a derived class which inherits from base class using **unit** for the type parameter type Derived() = interface MyInterface<unit> with override this.abstractMethod (_) = () but the compiler complains that > Error The member 'abstractMethod : unit -> unit' does not have the correct type to override the corresponding abstract method. If I use another type instead of unit, **int** for example, the code compiles. Is this a bug in the compiler? Is there a workaround for it? Thanks!
`unit` is "special" in terms of interop: when a function takes a `unit` as parameter, it is compiled to IL as a parameterless function, and when a function returns a `unit` as result, it is compiled as a `void` function. As a result of this trickery, you can't really use `unit` as a "general-purpose" type in interop settings (such as classes and interfaces). In fact, when I try to compile your code on my machine, I get a different error: The member 'abstractMethod : unit -> unit' is specialized with 'unit' but 'unit' can't be used as return type of an abstract method parameterized on return type. Which is trying to say roughly what I described above. (I'm not sure why you're getting what you're getting; perhaps you're using an older version of F#)
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "f#" }
Weird tab error, can't put my finger on where I went wrong I'm trying to make use of a while loop to iterate through a list of three variables that's are also assigned to three queues implemented through linked lists. I called this list full. My while loop is supposed to keep running while my list of full queues is still at 3. Here's the chunk of code. I get the tab error after the pop function. while len(full) == 3: x = random.random() if 0 <= x <.33: if full[0].isEmpty() == True: full.pop(0) else: Runway.enqueue(airplane)
You have at least one tab character in your code at the start of your `else:` line. (There are two tabs in this editor--there may be only one in your code.) The other lines use spaces. In Python it is a _very good idea_ to use only spaces in your code and _never use tabs_. It is possible to use some tabs and get away with it, but getting away with it is very unlikely. Set your code editor to insert spaces when you press the Tab key--all good editors have a setting for that. In the code you show us, the line after the `else:` is not indented at all, so that should also give you an error. Indent that line by four spaces, after you replace the tabs with spaces in the `else:` line.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -2, "tags": "python, python 3.x" }
How can I get the position of a cursor in Kivy? I have to slice the 2 seperate strings according to the position of the cursor in the textinput. And this is what I've tried. (text_box is a textinput property.) text_box = ObjectProperty() x,y = self.text_box.cursor But then, I found that x, y position is not stable, and keep on changing whenever I click other position. Is there anyway I can find a stable cursor position information from Kivy? Also, is there a thing like on_click in textinput instead of on_focus? (so I can check the cursor position whenever I click the textinput.)
Well, `text_box.cursor` did not work in `on_focus` but it works fine in `on_touch_up`. I am not sure why is that. But at least now I can make it to work.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, kivy" }
how to limite the size of WSS_Content is there a way to limite the size of the Wss_Content_dataBase, because my Wss is non stopping growing with no reason. Is there a way with CA or I have to do it with SQL . And is there any logical reason for that ?
I think, its better to check why the Database growing unexpectedly. Couple of things to check. * Audit logging, many time cause this issue * Data in 2nd stage recycle bin are not count towards quota. * Also check if there is free/unused space in your content DB From SharePoint, * You can limit the number of site collection in a db via Central Admin * You can also Apply the quota to site collection, this will also restrict the Database size. * Manage the Recycle bin But if you want to restrict it for certain size i.e upto 100gb, then you can set that via SQL server. But keep in mind, if cap the database size then once Cap reached, your sites will become read-only. In that case you have to increase the size of DB.
stackexchange-sharepoint
{ "answer_score": 2, "question_score": 1, "tags": "sharepoint enterprise, central administration, sql server" }
How to convert dense vector to sparse vector in CUDA ? I have a large dense vector(not matrix) in GPU memory: > [1,3,0,0,4,0,0] and want to convert it into sparse format: > values = [1,3,4]; index = [0,1,4] I know I can call `cusparse<t>dense2csc()` in `cuSPARSE`, but that's designed for matrix, and may not be efficient for vector. Is there any other way to do this ? Or maybe a CUDA kernel. Thanks
Use `thrust::copy_if` int * d_index = [1,3,0,0,4,0,0]; int * d_index_compact; struct non_negative { __host__ __device__ bool operator()(const int x) { return x >= 0; } }; thrust::copy_if(thrust::cuda::par, d_index, d_index + this->vocab_size , d_index_compact, non_negative()); // d_index_compact = [1,3,4];
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c++, cuda, gpu, sparse matrix, cublas" }
Show always x rows (datatables) I am using datatables.net. For example if you want to show always 20 rows, 5 rows are real data and the other 15 should be empty(some kind of placeholder). I am not looking for(those kind of row-length): $('#example').dataTable( { "pageLength": 50 } ); Is there a way to show always x rows ,without big effort ?!
You can use the code similar to the one below and adjust `row.add()` call based on your table structure. var table = $('#example').DataTable({ 'initComplete': function(settings){ var api = new $.fn.dataTable.Api( settings ); var info = api.page.info(); for(var i = info.recordsTotal; i < 20; i++){ api.row.add(['&nbsp;', '', '', '', '', '']); } api.draw(false); }, 'order': [1, 'desc'], 'searching': false, 'lengthChange': false, 'pageLength': 20 }); See this example for code and demonstration.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, datatables" }
How to give an upper bound of the maximum eigenvalue of $A B A^T$? Let $A \in {\mathbb R}^{m \times n}$ and $B \in {\mathbb R}^{n \times n}$, where $A$ has full row rank and $B > 0$ (positive definite). Then, how to give an upper bound of the maximum eigenvalue $\rho(A B A^T)$ in terms of the singular values of $A$ and the maximum eigenvalue of $B$? Thanks!
Thanks very much for DanielRobert-Nicoud's help. I have solved this problem, but the answer was hidden in the conversations between DanielRobert-Nicoud and I. Now, I post an answer here as a summary of our conversations so that one can find the answer directly. Let $\sigma$ be the maximum singular value of $A$, and we get $\sigma = \|A\|_2 = \|A^{\mathrm T}\|_2$. Since $B$ is symmetric, we have $\rho(B) = \|B\|_2$, where $\rho(\cdot)$ returns the spectral radius for a given matrix. Now, we get the following result $$\sigma^2 \rho(B) = \|A\|_2 \|B\|_2 \|A^{\mathrm T}\|_2 \geq \|ABA^{\mathrm T}\|_2 = \rho(ABA^{\mathrm T}).$$ Therefore, an upper bound for $\rho(ABA^{\mathrm T})$ is $\sigma^2 \rho(B)$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "matrices, eigenvalues eigenvectors, positive definite" }
how to create new controller and model in Refinerycms and how use it? here, I want to create a application using refinery for that I need one new table resto. and to access that table I want to use my own controller resto. how it is possible ? **please help me....**
As @sevenseacat mentioned, that refinery guide has a basic walkthrough of extending refinirycms. Also if you haven't looked there already, Railscasts has a 2-episode series on refinerycms. The second one deals with the subject you want but is a pro episode and you'd need to subscribe, but if you're doing any work with rails the pro subscription ($9/month) pays for itself very quickly. Note: I am not affiliated with Railscasts in any way.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ruby on rails 3, controller, rubygems, ruby on rails 3.2, refinerycms" }
Looking up an array index by value in bash 3.x I call this script with: `./script_name 604` #!/bin/bash switchedChannel=($1) channelArray=('108' '162' '163' '604' '141' '113') for array_item in "${channelArray[@]}"; do if [[ $array_item == ${switchedChannel[0]} ]] then "$array_item MATCHES" fi done Is there a way to get the index of the array_item that matches (or otherwise get the position of the matched item in the array) without simply using a var as a counter and using this to do the iteration? There will always be a match, but the array values are unique so there's only one match. (I am asking because I need then to do something with the array items that are NOT matched, so my thinking is to remove the matched one from the array. I could move the unmatched items to a new array which is fine for a short list, but it would be preferable to terminate the loop as soon as the match is made.)
`"${!array[@]}"` will iterate over indices, rather than values. #!/bin/bash switchedChannel=$1 channelArray=('108' '162' '163' '604' '141' '113') for array_idx in "${!channelArray[@]}}"; do array_item=${channelArray[$array_idx]} if [[ $array_item = "$switchedChannel" ]] then "$array_item MATCHES at index $array_idx" fi done * * * That said, for your use case -- where anything you're doing a lookup by is a non-negative integer -- you can do better: declare -a channelArray=( [108]=1 [162]=2 [163]=3 [604]=4 [141]=5 [113]=6 ) echo "${channelArray[$switchedChannel]}" This creates a _sparse array_ where the keys are numbers `108`, `162`, etc.; and the values are `1`, `2`, `3`, etc.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "arrays, bash" }
How to perform predicate on UIbutton array which includes tag value of each buttons and i want to match the tag of each button I have an array of `UIbutton` objects. What I want to do is that I want to match each UIbutton object's `tag` value. For that I want to write a predicate. What should be the predicate for this?
try this: UIButton *btnSelected = [self.view viewWithTag:1]; NSArray* filteredArray = [[yourButtonArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"tag == %d",[btnSelected tag]];
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "iphone, ios, ios4, nspredicate" }
Have a NavigationController within a TabBarController Item I've looked around and been unable to find a clear example/explanation of how to do this. I've just started with swift, apologies if any terminology is off. What I'm looking to do is **add a NavigationController to one of my TabBarItems in a way that I can view multiple views from utilizing the NavigationController while still staying within that TabBarItem view** So far I have the TabBar created, with three items. I don't mind doing it in either storyboard or programatically.
In the storyboard give each page view controller it's own navigation controller and make the navigation controllers the view controllers pointed to by the tab bar controller. Do it like so: < !navigation controllers with tab bar controller
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "ios, xcode, swift, uinavigationcontroller, uitabbarcontroller" }
Git not working properly? I have a problem with my git repository, and I'm not sure weather the problem is me not using it correctly or if it is some kind of bug ... I am using git 1.7.9. inside cygwin. My problem is that I can't see log history of a file (any file). Let's say I want to see history of a file called index.php. I type this: > git log -p index.php But there's not response. Git just closes. When I try this: > git blame index.php I get "00000000 (Not Committed Yet 2012-05-10 19:27:07 +0200 1)" for every line in that file. But that file WAS commited many time before. Am I doing something wrong or is maybe my git repository corrupt ? Any ideas are welcome :) Thanks! EDIT: Here's output of status and ls-files commands: $ git status # On branch master nothing to commit (working directory clean) xx77abs@Ferdo ~/gaudeamus_ipad/HTML $ git ls-files
So to answer my own question ... First I want to thank larsks, because his asking for git ls-files output gave me idea of what's wrong ... My git repository is in gaudeamus_ipad folder. Inside that folder, I have folder called HTML. Initially it was called html, but somewhere along I renamed it into HTML. After I've executed "git ls-files" in HTML folder, I got nothing. Then I went one folder up and executed "git ls-files" again. This is part of the output: html/index.php As you can see, here HTML folder is spelled lowercase. I've also noticed that in cygwin I can enter folder HTML by using "cd HTML" and "cd html" commands. But when I enter it using "cd HTML", git isn't working properly. When I enter it using "cd html", git is working as it should. I guess it's some kind of cygwin bug (although I'm not sure if this can be classified as a bug) ... Anyway, that's how I solved my problem. Thanks everyone!
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "git" }
Automating iOS 8 app with Appium causes app freeze We have an app that we run automation tests on with Appium. We can launch the app on the device and simulator through Appium. However, the app hangs and freezes after Appium sends 2-3 tap commands. After the freeze, Appium can not find any other elements on the screen. We looked into writing a test script using Xcode 6.0.1 Instruments, but when the script is run, the app hangs as well. The app performs as expected when testing manually. It only hangs when we try to run automation on it either with Appium or with Xcode's Instruments. We are using Appium v1.3.0-beta1, and Xcode 6.0.1. This seems to be a similar issue to this question, but our test device is already on 8.0.2.
So it turns out that with iOS 8, logging too much data (particularly the case when you're logging API responses) can cause a race condition during Automation. We were able to solve our automation freezing issues by disabling logging from the app. The solution was discovered thanks to the wonderful analysis by @tbao on this post: <
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "ios8, instruments, appium" }
Particular Data extract(Date) I have a dataset that has a flow chart and a messy date. date contains the year, month, and day, respectively (4 digits, 6 digits, 8 digits). Name Color date 0 K A 2011 1 Y B 201411 2 B C 20151231 3 B A 2019 4 C B 201911 5 A A 20120507 6 Q G 20130601 I want to extract only the dataset for 2019 from this dataset(row). How can I do this? For example, I want the output as below Name Color date 0 B A 2019 1 C B 201911
df[df['date'].astype('str').str.startswith('2019')] df contains the table /data you have posted.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, pandas, dataset, row" }
iOS styling an input type="file" I'm trying to style the input with css to display the same way on iOS without the default iOS input styling that it applies. <input name="t1" class="imgupload" type="file" accept="image/*" capture="camera"> input[type='file'] { background: rgb(0, 0, 0); border-radius: 5px; color: rgb(255, 255, 255); font-family: 'Lucida Grande'; padding: 0px 0px 0px 0px; font-size: 16px; margin-bottom: 20px; width: 210px; vertical-align: top; margin-top: -2px; } Is there a specific -webkit class to disable the default styling.
You need to add `-webkit-appearence: none;`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "ios, css, mobile webkit" }
Drop-down menu options assigned but not visible? I can't really understand what I'm doing wrong.. I have a drop-down menu and I want to iterate over a list of elements. The list is read correctly and when I run the application I can even see the right options for the menu listed using "Inspect Element" from Firefox Browser...but why can't I access the selection rectangle? And it doesn't show anything. When I click on it, it's not possible to choose anything. this is the code for the selection in the jsp: <form:select path="list" class="selectpicker" multiple="true" data-max-options="4"> <form:options items="${av_list}"/> </form:select> Where list is the object that has to be "filled" with the selection. Any help is appreciated. ![enter image description here](
<form:options items="${av_list}"/> The template literal should be surrounded by backticks instead of quotes. Like this: <form:options items=`${av_list}`/> I wish I could tell you exactly why that causes the symptom you were seeing, but I cannot. Maybe someone brighter than me can comment regarding that.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "html, spring, drop down menu, frontend" }
Write WPF output to image file Is there a way I can write the output of WPF say a canvas to a image file, jpg or the like. I want to use WPF to create a background for me as I want to use the BitmapEffects for a rectangle and also radius the corners. I want to use the bitmap in a webpage. Is this possible? Malcolm
I have a blog post all about this here. Here's the code from the article: Rect rect = new Rect(canvas.RenderSize); RenderTargetBitmap rtb = new RenderTargetBitmap((int)rect.Right, (int)rect.Bottom, 96d, 96d, System.Windows.Media.PixelFormats.Default); rtb.Render(canvas); //encode as PNG BitmapEncoder pngEncoder = new PngBitmapEncoder(); pngEncoder.Frames.Add(BitmapFrame.Create(rtb)); //save to memory stream System.IO.MemoryStream ms = new System.IO.MemoryStream(); pngEncoder.Save(ms); ms.Close(); System.IO.File.WriteAllBytes("logo.png", ms.ToArray()); Console.WriteLine("Done");
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 7, "tags": "wpf" }
Maximal element for set of prime numbers with division as relation Set of all prime numbers $(P, |)$ (division operator as relation) is a poset. All elements are minimal element. In the same way all elements are maximal elements right? say m is maximal prime, then if m | p then p = m right? But in class, professor told maximal elements are none(probably i might have understood wrongly or did something wrong). Please clarify
If your professor was indeed talking about the division operator on the set of prime numbers, then no prime number divides any other prime number, so every element of that set is both minimal and maximal and there's not much more to be said. But I suspect that your professor, when making that statement about no maximal elements, was instead referring to the set of all natural numbers (or, perhaps, all integers). And indeed, no matter what natural number $n$ you pick, it is not maximal with respect to the division relation: certainly there exists a natural number $m \ne n$ such that $n$ divides $m$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "elementary set theory, prime numbers, relations, order theory" }
Looping solutions to While statements? I have a while statement that produces a a number between 15 and 32, and 212 and 229. import java.util.Scanner; import java.util.Random; public class Test { public static void main(String[] args) { int randNum = 0; Random randNumList = new Random(); while( !(randNum>=15 && randNum<=32)&& !(randNum>=212 && randNum<=229)) { randNum = randNumList.nextInt(251); } System.out.println(randNum); What type of loop can I use to produce a given number (such as 10) of these "randNum"'s produced? For example, if the while statement produced the number 24, how could I produce 10 more numbers between 15/32 and 212/229 from that while statement?
while your way of creating a random may not be the most efficient -- the least invasive change to your code would be to simply wrap your while in a for loop ... you can add the results to an Array, or a List to access them later. Random randNumList = new Random(); //do this only once - no need to re-create it you can re-use it for(int i=0; i<asManyAsYouWantPlusOne; i++){ randNum = 0; //important! reset here or you will end up with all the same random numbers ... while( !(randNum>=15 && randNum<=32)&& !(randNum>=212 && randNum<=229)) { randNum = randNumList.nextInt(251); } //add to list, or array here ... System.out.println(randNum); }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "java, random, while loop, numbers" }
Where can I find more information about former German internal enclaves and exclaves? This question is related to the question I asked previously: Why was the shape of German states pre-WWII (especially Prussia) so complicated? Most maps of pre-WWII are not detailed enough to see an exhaustive list of enclaves and exclaved territories. Only the major ones are visible. For example, the municipality of Achberg (today in Baden-Würtemberg) was an isolated exclave of the _Hohenzollernsche Lande_ , itself an exclave of Prussia. However, since this exclave is so small it cannot be seen on maps containing the entire country. I suspect many municipalities were in similar cases. Where can I find a complete, exhaustive list of all territorial irregularities of pre-WWII Germany?
Here's a zoomed-in screenshot of a map I made using Harvard's Geospatial Library. As you can see in the left, the layer I chose was "Germany State Boundaries, 1914." The little exclave in the bottom center of the screen is Achberg. If you zoom in a little more, it is labeled, but I chose to stay a little further out so you could see the other exclaves. !enter image description here It's possible there are other map layers that better suit your purposes. There are many, many layers available for Germany, though 1914 is the latest year I found.
stackexchange-history
{ "answer_score": 9, "question_score": 5, "tags": "germany, maps, political geography, resource" }
If you associate a Microsoft Account with a Local Account in Windows 8, will it maintain the original Local USERPROFILE path name? If you choose to use a Local Account, you get a nice "clean" USERPROFILE path of: C:\Users\username If you then associate a Microsoft Account to that Local Account, will it maintain the original USERPROFILE path created above by the Local Account or will it try to CHANGE the USERPROFILE path to what it uses when using ONLY a Microsoft Account without a Local Account? **Example - When adding an MS Account to Local Account will it try to change USERPROFILE:** * C:\Users\bill to * C:\Users\first_five_chars_of_email+three_digit_counter (C:\Users\bgate_000)
Not sure why you think it would try to change it, but associating a Windows 8 account to an MS account, or disassociating it, doesn't modify the user's profile path (I actually just did this myself today).
stackexchange-superuser
{ "answer_score": 1, "question_score": 2, "tags": "windows, windows 8, user accounts, environment variables, user profiles" }
How to pass string arguments to a function using QT and C++ When I call getCount function in the below code, QT 4.7.3 complier giving the error. Build Error pasing 'cont Person' as 'this' argument of 'int Person::getCount(const QString&) discards qualifiers bool Person::IsEligible(const QString& name) { int count = 0; count = getCount(name); } int Person::getCount(const QString& name) { int k =0 return k; }
The error isn't a problem with passing string arguments, it's that you've got a `const` person, e.g.: const Person p1; Person p2; p1.IsEligible("whatever"); //Error p2.IsEligible("whatever"); //Fine because p2 isn't const If `IsEligible` is meant to be callable on `const Person`s then you can say: bool Person::IsEligible(const QString& name) const { int count = 0; count = getCount(name); } (and change the corresponding declaration that you've not shown too obviously), but I'm not 100% sure that's what you intended to do.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "qt" }
How to create a dummy variable for date interval I have been trying to generate a dummy variable from the data column for interval. Sample data Date <- seq(as.Date("1988-01-01"), as.Date("2018-12-31"), by="1 day") DATASET <- data.frame(rnorm(11323), Date) I would like to create an interval: 20-04 : 20-08 for each year codes as 1. I would be grateful for the hint with code for doing this.
You could compare the day of the year. In base R that would be DATASET$day_of_year <- as.integer(format(DATASET$Date, "%j")) DATASET$flag <- +(with(DATASET, ifelse(as.integer(format(Date, "%Y")) %% 4 == 0 , day_of_year %in% 111:233, day_of_year %in% 110:232))) For leap years 20-04 is 111th day of the year and 20-08 is 233rd day and for rest of the years they are 110 and 232 respectively. We assign 1 when the date is between those 2 values.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "r, sequence, dummy variable, dateinterval" }
'str' object not callable in Python Selenium library The error I'm getting is: TypeError: 'str' object is not callable I searched through some other questions, they all said that i redefined a function earlier in my code, but i could not find any occasion where I did this. My code is: firstElement = driver.find_elements_by_xpath('//*[@id="assessment-leaderboard"]/li[1]') print(firstElement) if len(firstElement) > 0: print(firstElement[0].text()) else: print('no data')
Probably, the issue is that `.text` is not a function but an attribute, so you might want to try print(firstElement[0].text) without `()`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "python, selenium" }
Calculating custom bits of PI in hex or binary without calculating previous bits I tried some spigot formulas to calculate custom hexadecimal PI digits. But any formula I tried definitely needed iterating and calculating sum from i=0 to N to get N-th digit. How to get N-th hex digit without calculating previous digits?
Unfortunately (and this REALY was a **HUGE** let-down for me too when I discovered this), there aren't any currently known algorithms that can completely 'jump' to any digit, and if one was discovered, you can bet it would be popular and make it onto the news. But, I have a solution to your problem, it is an alternative to calculating that allows you to jump to any digit under 12.1 trillion. 1. Download as much as you can from here. 2. Optionally get an archiver such as 7zip (it will REALLY speed things up) 3. Unpack the zip archives you downloaded into useable pi digits. 4. Program a quick program to clear away the extra stuff in the files of pi, join the files of pi together, and convert them to hex. 5. Create a program to get the nth byte in the files (i.e the nth pi digit). 6. Your done, and ready to go! Source(s): enter link description here Anothe thing to check out: Distributed calculation of π
stackexchange-math
{ "answer_score": 2, "question_score": 3, "tags": "pi" }
How should I write to get '2' as output in this class? #include <iostream> using namespace std; class ParentClass { public: int id; ParentClass(int id) { this->id = id; } void print() { cout << id << endl; } }; class ChildClass: public ParentClass { public: int id; ChildClass(int id): ParentClass(1) { this->id = id; } }; int main() { ChildClass c(2); c.print(); return 0; } I run this C++ file and I get '1' as output, I want to know how should I write to get '2' as output ? Or say that how to access a redefined variable from a derived class.
You cannot access `ChildClass::id` from `ParentClass::print`. More generally: You cannot access members of a derived class, from a member function of the parent. You can access `ChildClass::id` within the member functions of `ChildClass`. `ChildClass::id` isn't a "redefined" variable. It is a separate, unrelated variable that happens to have the same identifier, but in different scope. There is no concept of "redefining" a member variable in a derived class, in C++. * * * I recommend considering, whether it makes sense for `ChildClass` to have two different ids.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "c++" }
WPF Adorner Transforms I am building a control, where the user can "draw" resizable rectangles that are laid over the content. To resize those rectangles, I use an Adorner on top of them which contains 4 Thumbs to change the size of the rectangle. The problem is, that this control is is "zoomable", meaning a ScaleTransform is applied to the whole control depending on a zoom factor. The Thumbs in the Adorner are affected by this ScaleTransform as well. But I need them to keep their size, independent of the zoom factor. I tried putting the Adorners in a Layer of another non-transformed control instead of the rectangle-layer, but this didn't work. How can I achieve this? Thanks, Andrej
Have you checked this post: Transformations on AdornedElement are also applied to Adorner?! ? Does it work?
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 6, "tags": "wpf, transform, adorner" }
How can i return different types from my method? I have a method which returns an object (`this._response`) which is of type `IResponse`. I want to return `this._response.details` which is of type `IDetails`. get response(): IResponse { if (this._response.response.header.statusCode === "0000" || this._response.response.header.statusCode === "YHOO") { return this._response.details; //IDetails } else if (this._response.response.header.statusCode === "6621" || this._response.response.header.statusCode === "6622") { this._response.response.isViewError = true; } else { this._response.response.showError = this._response.response.header; } return this._response //IResponse } > [ts] Property 'details' does not exist on type 'IResponse'. How can I return different types from method based on if condition?
You can use union types: get response(): IDetails | IResponse { ... } * * * ### Edit The problem with returning a union is that you'll need to check for the type of the result every time you invoke the function. So: function isResponse(obj: IDetails | IResponse) obj is IResponse { return obj && obj.response; } let value = myObj.response; if (isResponse(value)) { // value is IResponse } else { // value is IDetails }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "oop, typescript" }
Использование canvas как буфера Чтобы получить определенное значение мне периодически требуется рисовать на канвасе, а потом анализировать этот канвас попиксельно. При этом канвас никогда не вставляется в документ. Т.е. с ним работаю как с буфером. Каждый раз я создаю новый канвас (это бывает относительно не часто), и никак не показываю, что он мне больше не нужен. Верно ли такое использование `canvas` в веб-приложении и не будет ли утечек памяти?
Приходится порой использовать таким же образом. Вроде бы сильных проблем не замечено. В любом случае вы можете воспользоваться инструментами профайлинга в браузере и поверить
stackexchange-ru_stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "gwt, java" }
<Input type="number"> com máscara de horas Como fazer um `<input type="number">` com máscara no formato de horas, que aceite **00:00**. Se colocar `type="text"` basta utilizar uma máscara, mas e com o `type="number"`?
Este recurso de máscara não é nativo de campo input. Para isso você precisará JavaScript. JQuery por exemplo tem muitos plugins para máscara que voce pode ver clicando aqui. Em especial, recomendo que você tente usar o jquery input mask Link do projeto: < Nessa página, o autor disponibiliza várias formas de máscara que voce pode usar inclusive de máscara de datas, numericas, monetárias e vários outros formatos disponíveis.
stackexchange-pt_stackoverflow
{ "answer_score": 1, "question_score": 3, "tags": "javascript, html5" }
Unix command to find the number of debug statements in a source code How do i find the count of the number of debug statements that is **without** an `if` checking? This is an example of a debug statement that has an if checking: if(log.isDebug()){ log.debug("This is a debug statement"); } This is an example of a standalone debug statement that does not have if checking: log.debug("This is a debug statement"); For example, to find the number of debug statements, i would use this command: grep -ir "debug" * | wc -l
grep -ir "debug" * | grep -v "if" | wc -l
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "unix" }
Math.round troubles I want to round to two decimal points so naturally I'd use: Double number = Math.round(number*100.0)/100.0 But I ended up getting really long outputs, with lots of decimal points. So I tried different inputs for Math.round() similar to the ones I need to use and found that Math.round(8.3391700279483738E17) = 833917002794837376 Math.round(8.3391700279483738E17 * 100) / 100.0 = 9.223372036854776E16 Does this make sense to anyone?
Your code seems to be correct Math.round(8.3391700279483738E17) = 833917002794837376 makes sense as 8.3391700279483738E17 mathematically means 8.3391700279483738 * 10^17 or 8339170027948373800 and not a decimal number. The small marginal difference is due to Delta error.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "java, rounding" }
Change Azure DevOps Parent Work Item status when all linked children work items meet certain condition? I see there are plenty of options for creating custom rules in Azure DevOps, but I don't see one (or perhaps I'm not interpreting it correctly), that handles this scenario. I have an Epic. That Epic has a state of "In Progress". That Epic has 10 user stories as linked child items. Each Story has a state as well. Can I create a rule that when all 10 of those stories stages reach "Done", then the parent Epic will automatically change state to "Done"? Any thoughts on how to do this?
As of this time, however, automate state transitions of parent work items by Azure DevOps process rules is not supported. But you can add a web hook and use the code and configuration provided in the Automate State Transitions GitHub project. Click this link for detailed information about setting up the project.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "azure, azure devops" }
Show that $[1, \infty) \subset \mathbb{R}$ is complete Assume $\mathbb{R}$ is equipped with standard Euclidean metric, I need to show that $[1, \infty)$ is a complete space, when $[1,\infty)$ is viewed as a subspace of $\mathbb{R}$. However, the complete subsets of a complete space are exactly those subsets that are closed, how can $[1,\infty)$ be complete if $[1,\infty)$ is not closed?
The complement is open, therefore the set is closed.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "real analysis, cauchy sequences, complete spaces" }
What is a pull-through cache? I found a reference to this concept in the EHCache documentation, but I could not find any proper explanation of what it means. It tried Googling around but to no avail.
The more common term is _self populating cache_. In Ehcache docs a `SelfPopulatingCache` (= pull-through cache) is described as a: > A selfpopulating decorator for Ehcache that creates entries on demand. That means when asking the `SelfPopulatingCache` for a value and that value is not in the cache, it will create this value for you.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 5, "tags": "caching, ehcache" }
can any one tell me what is missing in my code please, i cant use the discord user name I want the user to start with 40 points, but if he already started just send how many points he has. The error that im currently geting is: message is a required argument that is missing. But i dont know what is missing. async def money(self, ctx, message): user = message.author read = open(user, 'a').close() if os.stat(user).st_size == 0: moneyfile=open(user, 'w') moneyfile.write('40') moneyfile.close() else: readfile = open(user, 'r').read() points=readfile int(points) await ctx.send(points)
The error reads itself, you are doing the command but not entering a message param. To fix this, delete the message param and set user in the 2nd line to ctx.author.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "python, python 3.x, discord, discord.py" }
No such file or directory in Heredoc, Bash I am deeply confused by Bash's Heredoc construct behaviour. Here is what I am doing: #!/bin/bash user="some_user" server="some_server" address="$user"@"$server" printf -v user_q '%q' "$user" function run { ssh "$address" /bin/bash "$@" } run << SSHCONNECTION1 sudo dpkg-query -W -f='${Status}' nano 2>/dev/null | grep -c "ok installed" > /home/$user_q/check.txt softwareInstalled=$(cat /home/$user_q/check.txt) SSHCONNECTION1 What I get is > cat: /home/some_user/check.txt: No such file or directory This is very bizarre, because the file exists if I was to connect using SSH and check the following path. What am I doing wrong? File is not executable, just a text file. Thank you.
If you want the `cat` to run remotely, rather than locally during the heredoc's evaluation, escape the `$` in the `$(...)`: softwareInstalled=\$(cat /home/$user_q/check.txt) Of course, this only has meaning if some other part of your remote script then refers to `"$softwareInstalled"` (or, since it's in an unquoted heredoc, `"\$softwareInstalled"`).
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "bash, heredoc" }
Multi project application, provide send information between applications I am writing a service based application, and a UI application within it. I am using Event Logs to log my error, but some of these errors are critical and user should be aware of. What I need is to check if The UI application (Windows Application Project) is available, and running... if it's running send the error directly to the UI through a service based application (Windows Service Project). Now, what to do? There are two step I should take, first check if UI is running, second send info like a class instance or a string or binary data (like using serialize) to the UI and UI receive it.
I think the two applications of yours can interact using the `Socket` mechanism. And check this for the "is running" bit: Checking if my Windows application is running
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, .net 2.0, messaging" }
Adobe-Brackets, Change the default syntax for a file extension I am using the Adobe Brackets text editor. I can't seem to find an answer for changing the default syntax to be used with certain file extensions (file-ext). In my case, I would like to change the default markdown syntax to instead use the included "Markdown (Github)" syntax. I assumed that there was an option somewhere to control this, as when I go to change the language manually, whilst editing a file, in the selection menu "Markdown" has the word _Default_ afterwards. How can I change the default syntax per file extension?
In the very top of that "File type selection" there is an option to set the current as default: ![Set language Default]( Alternatively, you can map file extensions (and file names) to existing languages in the preferences: { "language.fileExtensions": { "md": "gfm" } } * * * Note: This is valid for at least the latest version of Brackets (1.4).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "markdown, adobe brackets, github flavored markdown" }
Отслеживание изменения в адресной строке хэш JavaScript или jQuery Здравствуйте. Возможно ли отловить изменения в адресной строке хэш данных, всегда при вводе, стирании или вставке каких либо данных? Только без использовании HTML5, а только лишь в JavaScript или на jQuery. Такое вообще возможно?
При изменении части URL следующей за `#`, включая сам знак `#` генерируется событие hashchange window.addEventListener('hashchange', function(e) { console.log(e.newURL); }); document.getElementById('btn').addEventListener('click', function(e) { location.hash = 'button_clicked'; }); <a href="#first">first</a> <button id="btn">Change Location hash in js</button> Что характерно, данное событие является частью спецификации HTML5, но в предоставленной ссылке, также приведена реализация полифила.
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, jquery, хеширование" }
Does Java have any API for Gmail chat? I'm trying to make a chat application for Gmail on Java, but I couldn't find any API for this purpose. I was told about OAuth but I don't think it has any such feature. Please suggest me an API or help me use OAuth in this situation. Thanks in advance.
Google uses the XMPP protocol for its chats. * XMPP Java API Overview * a simple tutorial using the Smack library
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "java, oauth" }
Can't ping from Win7 running on an MacBook Pro and Can't ping MacBook Pro from any other PC I have Windows 7 Enterprise running on MacBook Pro and for some reason I'm not able to ping any PC in the house from it and the other way around meaning I can't ping the MacBook Pro running Win7 from any other PC. I looked online but I can't find anything that explains this issue or how to resolve it. Any help will be really appreciated. Thank you
It's quite likely inbound ICMP ping requests are being blocked either by default by the Windows 7 firewall or by an antivirus program like McAfee you're using.
stackexchange-superuser
{ "answer_score": 0, "question_score": 3, "tags": "windows 7, windows, networking, macbook pro" }
What happened to Earth? In _Guardians of the Galaxy Vol.2_ we see that the > terraform plants explode on Earth damaging a big area. You can see a quick glance of the scene at the beginning of this trailer. Given that the movie happens in 2014, it would have impacted in the MCU right? Was it reversed?
## We don't know for sure But, I believe that mass lump got dissolved after Ego died. When Rocket's bomb destroyed the brain of Ego, all mass acquired by Ego over millions of years started to turn into dust (Remember how Ego's human form turned into dust). As that mass lump on Earth was also part of Ego, it should also turn to dust. It should also explain why Avengers or S.H.I.E.L.D. didn't think it was a big supernatural phenomenon. Video recordings could be assumed hoax.
stackexchange-movies
{ "answer_score": 2, "question_score": 16, "tags": "marvel cinematic universe, guardians of the galaxy 2" }
Android recognize if resource id is drawable or string I would like to know if it is possible to recognize, if **id** is from `drawable` or `strings` resource. For example: If I call `R.strings.hello` that return `int` value `2131099681. Can i recognize that the **id** is from **strings** folder?
I guess you could use (in activity) getResources().getResourceTypeName(int resid); As suggested here
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, android drawable, android resources" }
How to select the records from a table1 where table1.id exists in id column of table2? I have two tables **people** name id man1 456 man2 123 man3 789 **notes** content id testing 123 hello 456 `SELECT DISTINCT id FROM people` is a superset of `SELECT DISTINCT id FROM notes`. I would like to write two queries. One which selects all the records from the table `people` for which a record in `notes` exists where the value in the id column of `notes` is equal to `people.id`. name id man1 456 man2 123 The other selects all the records from the table `people` for which a record in `notes` does not exist where the value in the id column of `notes` is equal to `people.id` content id man3 789
SELECT * FROM PEOPLE WHERE ID IN (SELECT ID FROM NOTES) Results Man1 456 & Man2 123 SELECT * FROM PEOPLE WHERE ID NOT IN (SELECT ID FROM NOTES) Results Man3 789
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "mysql" }
Files of parent repository inside child repository directory I have several applications which contain different sets of modules. Modules have such structure: foo_module |-foo.php |---views |---assets |---models |---controllers "Views" and "assets" directories vary depending on the application. I need "application" directory to be a "parent" repository which contains nested "child" repository (foo_module directory). "Views" and "assets" directories must belong to "parent" repository. Application structure: application (repository "parent") foo_module (nested repository "child") |-foo.php |---views (belongs to repository "parent") |---assets (belongs to repository "parent") |---models |---controllers Is there any way to do this without changing the structure?
One way would be for the parent repository to: * reference the children repos as **submodules**. * make symlinks to the right views and assets content in order for said content to be directly accessible from the parent repos main folder. Symlinks can be versioned, and are available even for Windows (see "Git Symlinks in Windows").
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "git" }
corda backup node data and syn with newly up network locally I need to preserve previous data once i rebuild and start new network locally. I tried with copying persistence.mv.db and just by replacing new jar but there is mapping issues always. Anyone has idea regarding pls.
The node won't be able to read in any new data from the external database because all the Corda states that are stored in the `Corda Vault` are hashed by the Corda Node for security reason. Learn more about `Hash Constraints`: < Swapping jars will always create the issue because every time you rebuild your Cordapp the hash is different. You can learn about Contract Upgrade to preserve the data for production-grade jar swapping/upgrading : <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, kotlin, corda" }
How to disable beep in bash script? When I take a screenshot of my browser, console makes a "beep" sound. The problem is that my script has a loop with sleep 0.1. Is there a way to turn off "beep" sound? #!/bin/sh while : do import -window "Welcome - Mozilla Firefox" screen.png convert screen.png -crop 713x50+5+900 output.png .... sleep 0.1 done
According to the fine documentation at imagemagick.org, `import` has a `-silent` option for suppressing the beep.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "bash, ubuntu, imagemagick" }
Apache getting DDoS My apache server is currently getting DDoSed. It looks like all the traffic is referrals from the file server of a russian file sharing site. How can I block only the traffic which is coming from the compromised site?
None of these answers above will help. If your site is under a DDoS attack, the only real, usable source of help is in the form of the technical contact at your upstream provider. Yes, you can deny and drop packets at the edge of _your_ network, but it won't make a wit of difference if your connection has already been saturated by the traffic coming in from the outside. You need to work with your provider to drop the traffic when it reaches the outside of their network, which has lots of spare redundant capacity, and is a lot easier to apply whole null route blocks to. Changing iptables, or rewrites on your webserver, might give you the impression of stopping an attack, but it's like trying to put a bandaid over a gashed artery. The sheer volume of attack traffic can even overwhelm your kernel, if it's doing iptables stuff, dropping traffic takes up CPU time too. Get your ISP/Transit provider to do it. It's easier from their point of view, too.
stackexchange-serverfault
{ "answer_score": 8, "question_score": 2, "tags": "apache 2.2, networking, firewall, ddos" }
Call commit on autoCommit=false connection for SELECT statements JDBC? I do have a webapp written in Java on Tomcat, all connections should be `autoCommit=false` by default. Now, if I do run SELECT statement only in a transaction. Do I still need to call `commit()` or is it sufficient just to close the connection? For what it's worth: I am on Oracle 11.2. There is a similar question but does not actually give an answer for this case.
It is sufficient to close the connection, no need to call `commit` or `rollback`. But according to connection.close(), it is recommended to call either commit or rollback.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "sql, web applications, jdbc, transactions, commit" }
jQuery plugin: callback option must return false(not working) So I have build a plugin which has a callback option. This callback is used to work as a validation part so we use a 'return false' to stop the plugin but I cant get it to work. So the **callback is working** but the return false is not(it must be a return false and not some kind of boolean variable) //the callback $('.a').click(function(){ if(typeof options.onValidate == 'function'){ options.onValidate.call(this); } // if the callback has a return false then it should stop here // the rest of the code }); // options ....options = { // more options onValidate:function(){ //some validation code return false;//not working } }
options.onValidate.call(this); returns false, but it can't stop the execution of your click handler. You should use: if(typeof options.onValidate == 'function'){ var result = options.onValidate.call(this); if(result === false) return; }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, jquery, jquery plugins" }
What does 1__qem mean? I reading through the default styling applied to HTML elements for Google Chrome, available here. I found this: p { display: block; -webkit-margin-before: 1__qem; -webkit-margin-after: 1__qem; -webkit-margin-start: 0; -webkit-margin-end: 0; } What does `1__qem` mean?
From the WebKit source: CSSPrimitiveValue.h // This value (__qem) is used to handle quirky margins in reflow roots // (body, td, and th) like WinIE. // The basic idea is that a stylesheet can use the value __qem (for quirky em) // instead of em. // When the quirky value is used, if you're in quirks mode, the margin will // collapse away inside a table cell. More information on Quirks Mode: < Modern sites should never be in Quirks Mode, so you're safe to assume that it's the same as `em` for all intents and purposes.
stackexchange-stackoverflow
{ "answer_score": 21, "question_score": 19, "tags": "css, google chrome, webkit" }
More idiomatic way to move item from one dict value(list) to another? Is there a more idiomatic way to handle the following scenario? I'm open to `lodash`, etc. if needed. This does what I want, but I feel that there is probably a shortcut I'm missing: const migrateValues = (obj, srcKey, destKey, value) => { updatedSrc = []; obj[srcKey].forEach(x => { if (x !== value) { updatedSrc.push(x); } }); obj[destKey].push(value); obj[srcKey] = updatedSrc; return obj; } obj = { "key1": [1, 2, 3], "key2": [4, 5, 6], "key3": [7, 8, 9], "key4": [10, 11, 12] }; valueToMove = 11; srcKey = "key4"; destKey = "key2"; console.log(obj); console.log(migrateValues(obj, srcKey, destKey, valueToMove));
I would propose something like so (given that you have assumed no dupes, etc) function migrateValues(obj, srcKey, destKey, value) { return { ...obj, [srcKey]: obj[srcKey].filter(w => w !== value), [destKey]: obj[destKey].concat(value) }; } We spread obj, and then overwrite the srcKey and destKey properties. There are several reasonable ways to make obj[srcKey].filter and obj[destKey].concat avoid TypeErrors, which is best is dependent on what you have planned for the function.
stackexchange-codereview
{ "answer_score": 3, "question_score": 1, "tags": "javascript" }
How to determine .NET cookie path I am writing a .NET application that uses cookies to store a login token. I'd like the user to be able to log into multiple installations of this application on the same server (let's say `jacob.local/Devel` and `jacob.local/Stable`), so I want to set the Path property for the cookies appropriately. Currently I'm using `Request.ApplicationPath` but am running into trouble when the user visits the site with a different case than what I've set up in IIS. For example, the user visits `jacob.local/stable` \-- the cookie's path will be `/Stable`, which the browser doesn't send back to me since it can't know that IIS is case insensitive. Do I have to parse apart the whole query string myself, or is there already a function for figuring out what the path of the application is?
The following trick grabs the application path with casing matched to the one specified in the URL of the current request. Request.Url.AbsolutePath.Remove(Request.ApplicationPath.Length)
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": ".net, asp.net, cookies, httpcookie" }
How do I find one number in a string in Python? I have a file called something like FILE-1.txt or FILE-340.txt. I want to be able to get the number from the file name. I've found that I can use numbers = re.findall(r'\d+', '%s' %(filename)) to get a list containing the number, and use numbers[0] to get the number itself as a string... But if I know it is just one number, it seems roundabout and unnecessary making a list to get it. Is there another way to do this? * * * Edit: Thanks! I guess now I have another question. Rather than getting a string, how do I get the integer?
Use `search` instead of `findall`: number = re.search(r'\d+', filename).group() Alternatively: number = filter(str.isdigit, filename)
stackexchange-stackoverflow
{ "answer_score": 19, "question_score": 11, "tags": "python, string" }
Проблема с NetBeans и не могу добавить иконку в jLabel! Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null - вот ошибка. Cтруктура проекта : ![введите сюда описание изображения]( Строка в которой что-то не так : jLabel_close.setIcon(new javax.swing.ImageIcon(getClass().getResource("com/img/user.png"))); Пробывал варианты с PNG,../ и др. - не помогают!
Всё оказалось куда прозаичнее - я доставал картинки из путей как относительных так и абсолютных, не уверен что до конца разбираюсь в чём их разница, но пути C:/Пользователи/User/Папка/Подпапка/ и т.д. "ругались", потому что моя папка **Пользователи** так и называется и отображается и используется как **Пользователи** , а не **Users**!(хотя в свойствах(Alt+Enter) папки отображается **Users** ,а если просто из проводника смотреть то **Пользователи** ) Решил проблему доставать картинки прямо из корня диска C :)(т.е. `jLabel_close.setIcon(new javax.swing.ImageIcon("C:/image.png"));`),ибо это мне не вредило , т.к. не требовался запуск программы с других ПК.
stackexchange-ru_stackoverflow
{ "answer_score": 0, "question_score": -2, "tags": "java, swing, netbeans, jar" }
add value from an object into each element of an array I have a json object that looks like this: { "data": { "id" : 1234, "details": [ { "vid": "332", "long": -79, "lat": 45 }, { "vid": "33", "long": -77, "lat": 32 } ] } } I would like output a csv file from this data that looks like this: "1234","332","-79", "45" "1234", "33", "-77", "32" E.g. I want to add something from a node in each of another node's array's objects, essentially de-normalize the data. Is there a way to access a value from somewhere else in the json data?
Or without a variable: jq -r '.data | [.id] + (.details[] | [.vid, .long, .lat]) | @csv' file.json If you really want all the values to be quoted, simply add `map(tostring)` to the pipeline before the final `@csv`.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "json, jq" }
Using Ajax to return JQuery I am using Ajax to call a PHP file to process a from on submit. My JQuery form validation checks the values of variables to determine whether or not to submit the form or return false and display the error messages. How can I return a JQUERY variable and value to the current script from my PHP file on success? My JQuery and Ajax: $.ajax({ type: "POST", url: "validate.php", data: dataString, success: // what do I do here? { } }); Do I just output a script on my PHP page and then return the HTML?
You can also return something as simple as "yes" or "no" as html and deal with it that way if you don't want to monkey with json for a simple response. I find json to be buggy and cause me a lot of unnecessary errors at times and why go through a rigamarole if you just need to know yes or no. $.ajax({ dataType: 'html', type: 'POST', data: {formfieldname:formvalue,formfieldname2:formvalue}, success: function(data){ if(data == 'yes') { // do your success stuff } else { // do your error stuff } } });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "javascript, php, jquery, html, ajax" }
Curl: Post Method with Submit Button of the Image Type An external ASPX page has an input text area. To send entered text, there is a submit button of the image type: <input type="image" name="ctl00$ibQGo" id="ctl00_ibQGo" src="../img/go.gif" /> This instruction explains the use of the type=submit button with a name and value, but in my case this doesn't work. What should I pass in CURLOPT_POSTFIELDS in PHP to have this button clicked?
First, install the HttpFox addon in FireFox (or an addon with a similar function in case of other web browsers). Open the ASPX page, then press Ctrl+Shift+I and open the **Network** tab. On the ASPX page, enter desired values in the text area and press image button. You will see all GETs and POSTs. See the **Parameters** subtab to find out what parameters should be passed and their values. Be sure to include __VIEWSTATE and __EVENTVALIDATION values. However, it is not as simple as that. You can adapt this script for your purposes. It worked for me.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "php, asp.net, curl" }
How does a Windows service differ from a standard exe? What's the difference between a Windows service and a standard exe?
A windows service always runs once the computer starts up (as long as it's so configured). A standard EXE only runs when a user is logged in, and will stop if the user logs out. You would use a windows service for things that always need to run even if nobody is logged in. You would use a standard EXE for programs that a user will run while logged in.
stackexchange-stackoverflow
{ "answer_score": 47, "question_score": 43, "tags": "windows services, service" }
Can i send an @entity through TCP java socket? all my test fails ... so is possible send an @entity using a TCP socket? **UPDATE** Problem is related at this post < Thanks.
I guess you should be able to send any object that is `Serializable` through a socket. The `@Entity` annotation has probably nothing to do with it. Could you however refine your exact problem and what you are trying to do? As it is now, it doesn't make much sense.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, hibernate, tcp, entity" }
Canonical URL Meta Tag for a View Page I'm using the Meta Tags Module and it has been a solid way to add meta tags throughout the site - especially the increasingly important Canonical URL meta tag. I'm having trouble adding the same tag to views connected to a static page. How can I add a canonical URL to some views pages?
I'm assuming you're using Drupal 7.x and the latest alpha version of the Meta Tags module, correct? They are still working out the views integration functionality for this module but there is a sandbox project for this issue called 'meta tag views'. In Drupal 6.x nodewords, this was easier to do based upon path by just adding a custom entry at: /admin/content/nodewords/meta-tags/custom/add. In the meantime, you can try the metatags_quick module which lets you assign meta tags to specific paths. You would need to add the 'canonical url' as a possible field but the interface is simple to use.
stackexchange-drupal
{ "answer_score": 3, "question_score": 2, "tags": "views, meta tags" }
Timezone Asia/Kolkata changed to PST **What I did:** Ran this command: sudo cp /usr/share/zoneinfo/America/Los_Angeles /etc/localtime **What happened:** My local time changed to PST. Now I ran: sudo cp /usr/share/zoneinfo/Asia/Kolkata /etc/localtime But my system time didn't change back to IST. Instead, it's showing PST's time with the IST label. ![screenshot showing the wrong time zone displayed]( (In picture: I'm pointing to IST Kolkata, but the time zone highlighted is Los Angeles. This may explain my problem.) **Expected result:** I want Asia/Kolkata to be back to normal. **P.S.:** With the command sudo timedatectl set-timezone Asia/Kolkata the timezone changed to IST with PST's time.
Uninstalling and reinstalling `tzdata` solved my problem: sudo apt-get remove tzdata sudo apt-get install tzdata
stackexchange-askubuntu
{ "answer_score": 2, "question_score": 2, "tags": "18.04, time, timezone" }
Manipulating datestamp string consistently with date format %Y%m%d I need create log files that are essentially date stamps with prefix `yp_` and suffix `.log`, and a manipulated day number: $ touch yp_$(echo "$(date +%Y%m%d)-10" | /usr/bin/bc -l).log $ ls yp_20150912.log # ... ok for today's date. That's fine for today, but all hell breaks loose when the day's number is between 01 and 10 included. The result cannot be interpreted as a date stamp any longer. E.g. just imagine that the day is the 8th of March, 2016, i.e. '20160308'. How do I code the above to make sure that subtracting 10 days will produce **_not_** '20150298' but '20150227' ? Also test yr answer with 19820103 ... \-- I looked at `man date`. \-- `apropos date` spews out 161 hits that I also reviewed. Can somebody help with that one-liner?
## I need to manipulate dates (whilst paying attention to leap years) Fortunately, `GNU date` has a _very handy_ `-d` option: > > -d, --date=STRING > display time described by STRING, not 'now' > _(from`man date`)_ This accepts arbitrary date descriptions, like "now + 1 year" "Jan 28 + 3 weeks"; or in your case: "now - 10 days": touch yp_$(date -d 'now - 10 days' +%Y%m%d).log No need for messy invocations of `bc`, no worrying about leap years- GNU `date` will handle it.
stackexchange-superuser
{ "answer_score": 6, "question_score": 5, "tags": "bash scripting, date" }
Defining static value in array in angular I need to add some static data in angular 1.5 verson Controller like $scope.restaurant.day[0].date = Some Date; $scope.restaurant.day[1].date = Another Date; but when I do so It shows error. other feild for day object of restaurant array is dynamic
You have to define objects and then push them into your array. For example: $scope.restaurant.day = []; day1 = {'date':'11/10/2016'}; $scope.restaurant.day.push(day1);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -5, "tags": "angularjs, arrays" }
Ion-Content Scroll horizontally with mousewheel I have a ion content with an horizontal scrollbar <ion-content [fullscreen]="true" [scrollX]="true" (wheel)="onWheel($event)"> The scrollbar works well but the mouse wheel does not. I would like to use mouse wheel to scroll horizontally Here is my try : onWheel(event: WheelEvent): void { console.log(event.deltaY); const element: HTMLElement = event.currentTarget as HTMLElement; element.scrollLeft += event.deltaY; event.preventDefault(); } The console log show +100 or -100, but the scroll does not make it.
The scroll is on a element under the ion-content. This works : onWheel(event: WheelEvent): void { const element: IonContent = event.currentTarget as unknown as IonContent; element.getScrollElement().then((scroll) => { scroll.scrollLeft += event.deltaY; }); event.preventDefault(); }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ionic framework, scroll, mousewheel" }
remove top and right border from ggplot2 Is it possible to to remove the top and right border from ggplot2 graphs? I.e, I'd like to keep the x and y-axis but remove the rest of the black frame that surrounds the graph. //M
see this thread, it deals specifically with the problem here < and gives a solution that appears to work.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 5, "tags": "r, ggplot2" }
How to change PPA to point to another distro I've installed Ubuntu 13.04, I want to install doublecmd (Double Commander). I've added the PPA, but when I update its looking at dists/raring/main. Its not there, but it's on Precise. How could I do to make it look in `precise` directory?
First open Software Properties * Software Center>Edit>Software Sources * Then go to the Other Software tab and click the Edit button on the PPA you want to edit. !enter image description here * Change the Distribution name and Accept. Then update your repositories running `sudo apt-get update`. You should be able to install the package now.
stackexchange-askubuntu
{ "answer_score": 8, "question_score": 6, "tags": "doublecmd" }
Trouble performing simple GET request returning JSON with Javascript I'm horrible at Javascript, so sorry in advance for what I'm going to go ahead and assume is an amazingly stupid question. I'm simply trying to perform a GET request to GitHub's public repo API for a given user, and return the value as JSON. Here's the function I'm trying to use: function get_github_public_repos(username) { var the_url = " + username $.ajax({ url: the_url, dataType: 'json', type: 'get', success: function(data) { alert('raw data: ' + data) var json_response = $.parseJSON(data); alert(json_response); } }); } This is returning Null for data. And in the console, I see `Failed to load resource: cancelled`. I know the URL is correct, because if I run `curl` on the url, it returns the expected data.
jQuery's ajax function supports JSONP which allows cross-domain requests (which you need because you're trying to request data from github.com from another domain). Just change the dataType from 'json' to 'jsonp'; function get_github_public_repos(username) { var the_url = " + username $.ajax({ url: the_url, dataType: 'jsonp', type: 'get', success: function(data) { var json_response = data; alert(data); } }); } UPDATE: It's import to note that the end pint (in this case github.com's API) has to support JSONP for this to work. It's not a guarnateed solution for ANY cross-domain request as pointed out in the comments.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "javascript, jquery, ajax, json" }
Scala Type Tags - Fully qualified versus non-fully qualified I have some code (difficult to share and I've not been able to trivially replicate) which is throwing the following error: found: reflect.runtime.universe.TypeTag[com.company.some.package.Individ] required: reflect.runtime.universe.TypeTag[Individ] My code was unable to find a TypeTag, so I attempted to pass it explicitly. I.e. Instead of abstract class Validator[T<: Product: TypeTag] {...} class Validator[Individ] extends Validator[Individ] {...} // Implicits not found I tried.. abstract class ValidatorT<: Product {...} implicit val tt = typeTag[Individ] class Validator[Individ] extends Validator[Individ]()(tt) {...} // Wrong type, as above `Individ` is just a case class Any ideas?
What you probably want is class IndividValidator extends Validator[Individ] {...} When you write class IndividValidator[Individ] extends Validator[Individ]()(tt) you create a new generic class `IndividValidator` with a generic type parameter called `Individ` and it shadows your imported class. So the term `Individ` in the `extends Validator[Individ]` is matched to this type parameter rather than your `com.company.some.package.Individ`. To put it otherwise, this is the same code as class IndividValidator[A] extends Validator[A]()(tt) which is clearly not what you want.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "scala" }
Downloading Android Source Code Using SDK Manager? SDK Manager gives me the option to download the source code of any Android version. I can explore the source code in the `sources` folder inside the `android-sdk`. However, For the version prior to API 14, I can't find that option to download! Any one knows how to download it? Or why I can't?
For 3.x version of Android the sources were not released. So for these versions I can understand why there is no such option. For 2.x versions, there is no such option in my case also. For 2.x version you can use a special plugin called Android sources. You can find instructions here. The second option is to download Android sources. In the properties of your android-ver.jar you can set the location of the sources.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, sdk" }
Windows XP Computer Management - Local Users and Groups error I opened Computer Management and happened to see that "Local Users and Groups" (under System Tools) had a red X over top of it. After clicking the link, it shows a message saying "Unable to access the computer EMACHINES-PC. The error was: Library not registered." What could have caused this, and how can I fix it? Thanks in advance!
You are probably missing the active directory store type library. You can restore it in a few easy steps: * Download `RegTLB.exe` from here. * Extract `RegTLB.exe` from `TypeLibrary\Release` (We'll extract it to the `C:\` drive to make it simple) * Open up command prompt and run this command: C:\RegTLB.exe c:\windows\system32\activeds.tlb * You will get a messagebox saying the type library was successfully created * Local Users and Groups should now open successfully.
stackexchange-superuser
{ "answer_score": 2, "question_score": 1, "tags": "windows xp, sp3" }
Не могу загрузить тему на WP? установил wordpress локально на мак хочу загрузить тему через плагины добавляю через плагины-установить новый и ругается на то что "Ссылка, по которой вы перешли, устарела." Что я делаю не так?
Темы надо устанавливать через установщик тем, а не плагинов!
stackexchange-ru_stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "wordpress" }
Using @NotNull in a project where both IntelliJ and Eclipse developers are working A co-worker on IntelliJ IDEA (working on another project) showed me the amazing @NotNull annotation. I've read messages here on SO about how starting to add @NotNull everywhere saved lots of time and headaches (and IntelliJ 10 can even add automatically @NotNull to old code when it detects that _null_ would wreak havoc). Since I read my first _"Probable @NotNull violation"_ message (in real-time, in the IDE, even on a partial _.java_ file that doesn't compile yet) my jaw dropped and I got hooked. So I was wondering: is there anything that needs to be known if we want to start using @NotNull in a project where developers are using both Eclipse and IntelliJ? I know IntelliJ ships with the _annotations.jar_. Is this compatible with Eclipse?
There is also the possibility to store the annotations outside of the source. Settings > Code Style > Code generation > Use external annotations. The annotations are then stored in an annotations.xml file instead of in the source. That way Eclipse users never have to see the annotations. The location of the annotations.xml can be configured and it is probably best to store the file with the project in version control. See < <
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 17, "tags": "java, eclipse, annotations, intellij idea" }
Why can't I use assign operator on multiple bits? For the below image, why does `assign out = a&~sel + b&sel` only output one instead of the ref solution below? Is there any way to do this problem with `assign` only? ![enter image description here]( ![enter image description here](
Looks like I'm too new to comment here, but I wanted to expand on the previous answer. With one-hot mux selects, that you want to synthesize into an and-or tree, you can't use the ternary conditional operator. You have to use the replication operator. This is one thing that vhdl (I think) does better than verilog. assign foo = in1 & {WIDTH{sel1}} | in0 & {WIDTH{sel0}} ; If the original questioner tries something like this to replicate the select, it should work. But ternary conditional is preferred. So is if/else inside an always block.
stackexchange-electronics
{ "answer_score": 2, "question_score": 0, "tags": "digital logic, verilog" }