qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
6,734,128
I am working on a script that develops certain strings of alphanumeric characters, separated by a dash `-`. I need to test the string to see if there are any sets of characters (the characters that lie in between the dashes) that are the same. If they are, I need to consolidate them. The repeating chars would always oc...
2011/07/18
[ "https://Stackoverflow.com/questions/6734128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36545/" ]
``` <?php $s = 'KRS-KRS-454-L'; echo preg_replace('/^(\w+)-(?=\1)/', '', $s); ?> // KRS-454-L ``` This uses a *positive lookahead* `(?=...)` to check for repeated strings. Note that `\w` also contains the underscore. If you want to limit to alphanumeric characters only, use `[a-zA-Z0-9]`. Also, I've anchored with `...
Use this regex `((?:[A-Z-])+)\1{1}` and replaced the matched string by $1. `\1` is used in connection with `{1}` in the above regex. It will look for repeating instance of characters.
2,328,287
User has html-form, then user fills all field and data transferred to PHP script. How do would data send, but not refresh html page?
2010/02/24
[ "https://Stackoverflow.com/questions/2328287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/278221/" ]
`setTimeout` is the answer. ``` $(div).html('<script...> setTimeout(function() { window.location = url; },10); </script>'); ``` Doesn't have this problem. It must have something to do with the way jQuery executes inline scripts (by creating a `script` tag in the `head` element).
You could use `window.location.assign(URL)`.
9,876,732
Let's say I have a table like: ``` Persons FirstName varchar(50) LastName varchar(50) EmailAddress varchar(200) ``` Now, let's say I have a google like search box; in other words just one textbox with a search button. Normally we do something like: ``` declare @searchTerm varchar(50) set @searchTerm = ...
2012/03/26
[ "https://Stackoverflow.com/questions/9876732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2424/" ]
This is a really complex topic that has many subtle performance implications. You really need to read these excellent articles by Erland Sommarskog: [Dynamic Search Conditions in T-SQL](http://www.sommarskog.se/dyn-search.html) [The Curse and Blessings of Dynamic SQL](http://www.sommarskog.se/dynamic_sql.html) Sinc...
You could try something like this: ``` DECLARE @searchTerm VARCHAR(100), @FirstName VARCHAR(100), @LastName VARCHAR(100) SET @searchTerm = 'tom smith' SELECT @FirstName = '%' + SUBSTRING(@searchTerm, 1, CHARINDEX(' ', @searchTerm) - 1) + '%', @LastName = '%' + SUBSTRING(@searchTerm, CHARINDEX(...
3,705,307
From a cucumber feature file when I go to 'Run features' Im getting the error below in the popup box that appears. How do I fix this? --- /Library/Ruby/Site/1.8/rubygems/custom\_require.rb:31:in `gem_original_require': no such file to load -- /Users/evolve/Projects/i9/Tornelo/.bundle/environment (LoadError) from /L...
2010/09/14
[ "https://Stackoverflow.com/questions/3705307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172651/" ]
This has happened to me since I loaded rvm and gone through the steps listed under packages for textmate. Now, when I 'run feature' for a cucumber feature from within textmate I get an error '.bundle/environment no such file to load'. I don't have a .bundle/environment.rb so I created an empty one and the feature gets...
I had the same problem and solved it by following these steps : ``` > mate ~/Library/Application\ Support/TextMate/Bundles/Cucumber.tmbundle/Support/lib/cucumber/mate.rb ``` Comment or Remove line 20 (or whatever line the error message says) : ``` > #require 'spec' ```
20,222,504
I am trying to make a local validation. Every combination you enter in editText1 (for example abc) should be converted to numbers (a=1, b=2, c=3). The text in editText2 should match abc converted to numbers (123). If this is true: start the new activity. else: display a 'login failed' textview. ``` public class Login...
2013/11/26
[ "https://Stackoverflow.com/questions/20222504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2989346/" ]
If you want a 9-length array: ``` Array.apply(null, {length: 9}).map(function() {return 0;}) ``` If you want a X-length array: ``` Array.apply(null, {length: X}).map(function() {return 0;}) ``` If you have an array and want to rewrite its values: ``` var arr=[54,53,6,7,88,76] arr=arr.map(function() {return 0;}) ...
One way could use recursion. ``` function fillArray(l, a) { a = a || []; if (0 < l) { l -= 1; a[l] = 0; return fillArray(l, a); } return a; } ``` I had also posted a more classic option: ``` function fillArray(l) { var a; for (a = []; 0 < l; l-=1, a[l]=0); return a; } ```
29,502,874
The app I'm working on has a credit response object with a Boolean "approved" field. I'm trying to log out this value in Objective C, but since there is no format specifier for Booleans, I have to resort to the following: ``` NSLog("%s", [response approved] ? @"TRUE" : @"FALSE"); ``` While it's not possible, I would...
2015/04/07
[ "https://Stackoverflow.com/questions/29502874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2143275/" ]
What should the formatter display? 0 & 1? TRUE & FALSE? YES & NO? -1 and 1? What about other languages? There's no good consistently right answer so they punted it to the app developer, for whom it'll be a clearer (and still simple) choice.
In C early days, there was no numeric `printf()` specifier for `char`, `short` either as there was little need for it. Now there is `"%hhd"` and `"%hd"`. Any type narrower than `int/unsigned` was promoted. Today, in C, `_Bool` type maybe printed with `"%d"`. ``` #include <stdio.h> int main(void) { _Bool some_bool ...
29,427
As far as I can see, there is no `GL_PIXEL_UNPACK_BUFFER`. Also, the OpenGL ES 2.0 specification (and as far as I know, no iOS device currently supports OpenGL ES > 2.0) states that `glMapBufferOES()` can only use `GL_ARRAY_BUFFER` as a target, yet `glTexImage2D()` and `glTexSubImage2D()` only seem to use PBOs if `GL_P...
2012/05/22
[ "https://gamedev.stackexchange.com/questions/29427", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/11982/" ]
OpenGL ES doesn't have pixel buffer objects. So you can not use them there.
[OpenGL](http://www.opengl.org/registry/) and [OpenGL ES](http://www.khronos.org/registry/gles/), despite the similar names, are two *different* specifications. They may have similarly named functions, but there will be semantic differences between what these functions do. And of course, there will be differences in wh...
12,386
Imagine you have a m x n grid which is initially colored white. you can fill in a cell with black color if and only if there are no immediately neighboring black cells (no black cells to the left/right/top/bottom). If you keep on filling cells you will eventually run out of legal cells to fill. An example configuratio...
2015/04/18
[ "https://puzzling.stackexchange.com/questions/12386", "https://puzzling.stackexchange.com", "https://puzzling.stackexchange.com/users/11592/" ]
This is the *independent domination number* of the grid graph, that is, the smallest subset $S$ of nodes, no two adjacent, for which every node is in $S$ or adjacent to a node in $S$. The square version $m=n$ is in the [OEIS](http://oeis.org/A321684), and the linked paper "Independent Domination of Grids" gives the com...
One fill for larger boards is a pattern like the movement of a knight - I'm on mobile but I'll explain it as well as I can. ``` ..X. X... ...X .X.. ``` This patter repeats in a 4x4 square - for larger boards, it is nearly optimal.
554,713
I'm using Snort 2.9 on windows server 2008 R2 x64, with a very simple configuration that goes like this: ``` # Entire content of Snort.conf: alert tcp any any -> any any (sid:5000000; content:"_secret_"; msg:"TRIGGERED";) # command line: snort.exe -c etc/Snort.conf -l etc/log -A console ``` Using my browser, I send...
2013/11/13
[ "https://serverfault.com/questions/554713", "https://serverfault.com", "https://serverfault.com/users/143159/" ]
After 6 painfull hours of trying everything, I finally fixed it ! Just needed to add `-k none` to the command line. For some reason, in my desktop pc it works without the `-k none` parametre. If someone care to explain what is going on, that would be very helpfull. Thanks.
Sometimes the snaplen (*-P*) might be also an issue. Increase the value (default is the size of the MTU) and you will get a lot of more data.
1,709,833
This is a problem from a real analysis book. The book gives a hint: Consider $g(x)=\arctan f(x)$. However, I don't think it makes any difference. I try to find an injection form $E$ into a countable set. But I've got completely no idea, and wondered if the statement was wrong.
2016/03/23
[ "https://math.stackexchange.com/questions/1709833", "https://math.stackexchange.com", "https://math.stackexchange.com/users/219963/" ]
Hint: Assume that $E = \{x : \lim\_{y\to x} f(y) = \infty\}$ is uncountable. For $n\in \mathbb N,$ let $E\_n = \{x\in E: f(x) < n\}.$ Show that some $E\_{n}$ is uncountable, hence some point of this $E\_{n}$ is a limit point of $E\_n.$
Here is some further commentary: 1. **Does the hint help at all**? (After all, the elegant and brief answer by @zhw did not need it.) Sometimes hints can seem rather oblique. In this case the hint evidently intends the student to reduce the problem to one that is already solved. The composition $ g(x)=\arctan f(x)$ co...
4,127,553
So for this problem I need to use the fact that $\frac {1-r^2}{1-2r\cos\theta+r^2}$=$1+2\sum\_{n=1}^{\infty} r^n\cos n\theta$. I replaced the term in the integral but i ended up getting $\sum\_{n=1}^{\infty} r^n+2$ as my final answer. Im not sure if I got it right and i need to reframe it to get $\frac {2(1+r^2)}{1-r^...
2021/05/05
[ "https://math.stackexchange.com/questions/4127553", "https://math.stackexchange.com", "https://math.stackexchange.com/users/489246/" ]
A much simpler way is to note that $$\int\_{0}^{\pi}\frac{dx}{a+b\cos x} =\frac{\pi} {\sqrt{a^2-b^2}}, a>|b|$$ and differentiate it with respect to $a$ to get $$\int\_{0}^{\pi}\frac{dx}{(a+b\cos x) ^2}=\frac{\pi a} {(a^2-b^2)^{3/2}}$$ Putting $a=1+r^2,b=-2r$ and noting that $$a^2-b^2=(1-r^2)^2$$ we can see that $$\int\...
You have reduced the problem to evaluating $$ \frac{1}{\pi}\int\_{-\pi}^{\pi}\left(1+2\sum\_{n=1}^{\infty}r^n\cos(n\theta)\right)^2d\theta. $$ The terms $1,\cos(\theta),\cos(2\theta),\cdots$ are mutually orthogonal on $[-\pi,\pi]$, which further reduces the above to $$ \frac{1}{\pi}\left(\int\_{-\pi}^{\pi}1d\theta+4\...
8,250,898
I have reached a point in my web application where we are ready to go live and the thought occurred to me to put in some way of catching application errors users hit and forwarding them on to the appropriate support. At the moment the site currently catches any errors and redirects to an error page. It also catches a...
2011/11/24
[ "https://Stackoverflow.com/questions/8250898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155586/" ]
If you're displaying all the information the user needs, why not just log it in a database or send an email to support? That way you don't have to worry the user with the fact that you have bugs. Send them to your "Sorry, but please try that again later" page...
You could take a look at plugging in [UserVoice](http://uservoice.com/). It's great for capturing user feedback and easy to set up.
62,569,356
Yet again JetBrains managed to implement an "ungoogleable" feature. Does anyone know what this "R with pencil" icon means? [![enter image description here](https://i.stack.imgur.com/Bc0VA.png)](https://i.stack.imgur.com/Bc0VA.png)
2020/06/25
[ "https://Stackoverflow.com/questions/62569356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1280511/" ]
If you hover over the icon there is an explanation text: [![enter image description here](https://i.stack.imgur.com/nuLhE.png)](https://i.stack.imgur.com/nuLhE.png) which means that this action will run [Rename](https://www.jetbrains.com/help/go/rename-refactorings.html#invoke-rename-refactoring) refactoring for the c...
I don't know what the "R" exactly stands for, but it's used to **r**eflect [signature changes](https://www.jetbrains.com/help/idea/change-signature.html) and so for **r**efactoring methods.
51,694,629
I've got a query that outputs the contents of an SQL table. At the end of every row, I've got a button, that contains the ID of that specific row: ``` <button name='delButton' type='submit' class='delete' value='".$row["id"]."'>Delete Account</button> ``` So, the problem that I encounter is when I try to use $\_POST...
2018/08/05
[ "https://Stackoverflow.com/questions/51694629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7317593/" ]
If you (as indicated in the comments) don't want to create a function that you need to pass 6 arguments, then you *could* use a lambda like this: ``` const auto do_something = [&] { /* do stuff with captured reference variables */ }; if (conditionA) { // some code here if (conditionB) { // stuff } ...
You can wrap it up into cthulhu loop and use `break`: ``` for(;;) // executed only once { if (conditionA) { //some code here if(conditionB) { // some more code here break; // for(;;) } } //do something break; // for(;;) } ```
31,764
I am wondering when I should use "*des*" and "*les*". I know the grammatical point about using "*articles definis*" but I see different sentences on the Internet which made me confused. Example: > > *Comment confire des légumes ?* > > > *Braiser des légumes.* > > > *Cuisinez les légumes.* > > > *Comment blanch...
2018/09/24
[ "https://french.stackexchange.com/questions/31764", "https://french.stackexchange.com", "https://french.stackexchange.com/users/17645/" ]
"Je mange **des** légumes." means : I eat vegetables. You don't know which are the vegetables. It is "**indéfini**". "Je mange **les** légumes" would be equivalent to : I eat *the* vegetables. You know that you eat these vegetables. It is "**défini**". Example : Je mange des légumes tous les jours. Mais aujourd'hui, ...
This question was already asked a couple of times, [here](https://french.stackexchange.com/questions/13333/when-are-les-des-etc-used-or-not-used?rq=1) and [here](https://french.stackexchange.com/questions/19750/correct-use-of-les-and-des?rq=1) for example, although no answer was accepted. Both *des* and *les* can be u...
663,418
I wish to set up Postfix to use an external relay depending on the destination hostname, ie: * If destination hostname is \*.outlook.com, use relay some\_smtp.example.com * If any other destination hostname, use local relay **What I mean by destination hostname is the hostname obtained from MX record.** If the recipi...
2015/01/29
[ "https://serverfault.com/questions/663418", "https://serverfault.com", "https://serverfault.com/users/147144/" ]
[Arul's answer](https://serverfault.com/a/663435/218590) was perfect for transport based on recipient domain. However, bencaue you refer to MX record hostname instead recipient domain, the answer was non-applicable. One solution is using `check_recipient_mx_access`. Snippet from [official docs](http://www.postfix.org/...
As commented above: "For your case, just put check\_recipient\_mx\_access hash:/etc/postfix/finickydestination in appropriate place smtpd\_\*\_restriction. In that file put the hostname" smtpd\_sender\_restrictions is not the appropriate place, as at the point in the smtp transaction, postfix does not know who the rec...
8,227,809
I use grails with a legacy database, all hibernate classes and their mappings are packaged in a jar file and reside in the grails lib folder. Querying/updating/inserting with GORM works ok. Now I would like to add some mappings, let's say I want to add the mapping: ``` id column:'person_id' ``` Is there any way to d...
2011/11/22
[ "https://Stackoverflow.com/questions/8227809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/868975/" ]
It worked for me on iPad when I listen to `MPMoviePlayerWillExitFullscreenNotification`. ``` [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doneButtonClick:) name:MPMoviePlayerWillExitFullscreenNotificat...
check for a enum inside notification userInfo dictionary ``` NSNumber *reason = [notification.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey]; if ([reason intValue] == MPMovieFinishReasonUserExited) { // done button clicked! } ``` **Selected answer has since integrated my response. Pleas...
45,456,591
I'm using php dir() function to get files from directory and loop through it. ``` $d = dir('path'); while($file = $d->read()) { /* code here */ } ``` But this returns false and gives > > Call to member function read() on null > > > But that directory exists and files are there. Also, Is there any alternati...
2017/08/02
[ "https://Stackoverflow.com/questions/45456591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3719167/" ]
You can try this: ``` $dir = new DirectoryIterator(dirname('path')); foreach ($dir as $fileinfo) { if (!$fileinfo->isDot()) { var_dump($fileinfo->getFilename()); } } ``` Source: [PHP script to loop through all of the files in a directory?](https://stackoverflow.com/questions/4202175/php-script-to-loo...
Please check your file path if your path is right. Then please try this code this may help you. Thanks ``` <?php $myfile = fopen("webdictionary.txt", "r") or die("Unable to open file!"); // Output one character until end-of-file while(!feof($myfile)) { echo fgetc($myfile); } fclose($myfile); ?> ```
12,524,322
I have a java file containing more than one class, out of which one is public. If main method is inside a non-public class. I can't run that java file. Why is that? and there is no compilation error as well. If so, how can I use that main method?
2012/09/21
[ "https://Stackoverflow.com/questions/12524322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/953140/" ]
Have a look at this code: **Super.java** ``` public class Super{ } class Sub{ public static void main(String[] s){ System.out.println("Hello"); } } ``` In order to print `Hello` you can compile and run the program as: ![console output](https://i.stack.imgur.com/1C6by.png) **How this works?** ...
It is a compile-time error if a top level type declaration contains any one of the following access modifiers: protected, private, or static.This [link](http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html#jls-7.6) may be helpful.
28,872,399
in c++ reference i read "Lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence, and iteration in both directions." my doubt is if it is sequential then how it can take constant time to delete and insert a node.Any way we have to traverse sequentially to reach t...
2015/03/05
[ "https://Stackoverflow.com/questions/28872399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3107268/" ]
O(1) referst to the complexity for inserting/erasing nodes provided you *already have a handle (in the form of an iterator) to that node*. Obtaining an iterator to the *i*th element of a list given an iterator to the first one is O(N). This is quite often overlooked when judging the relative merits of `std::list` vs....
Because the list is not sorted. If you look closely, the actual function for putting elements in the list is `list::insert(hint, element)` (<http://www.cplusplus.com/reference/list/list/insert/>). I.e. for every insertion, the place where the element is added is already known, thus constant time. E.g. `list::push_fron...
1,395,361
I am converting some code from C to C++ in MS dev studio under win32. In the old code I was doing some high speed timings using QueryPerformanceCounter() and did a few manipulations on the \_\_int64 values obtained, in particular a minus and a divide. But now under C++ I am forced to use LARGE\_INTEGER because that's w...
2009/09/08
[ "https://Stackoverflow.com/questions/1395361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
LARGE\_INTEGER is a union of a 64-bit integer and a pair of 32-bit integers. If you want to perform 64-bit arithmetic on one you need to select the 64-bit int from inside the union. ``` LARGE_INTEGER a = { 0 }; LARGE_INTEGER b = { 0 }; __int64 c = a.QuadPart - b.QuadPart; ```
`LARGE_INTEGER` is a union, [documented here](https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-large_integer-r1). You probably want a `QuadPart` member.
13,822,353
Windows 7 32 bit, IIS 7.5.760016385 I created a DLL in Visual Basic 6.0 and trying to use it from within classic ASP code: ``` set obj = Server.CreateObject("a.b") ``` I get the following error: > > 006 ASP 0178 > > Server.CreateObject Access Error > > The call to Server.CreateObject failed while checking...
2012/12/11
[ "https://Stackoverflow.com/questions/13822353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1894838/" ]
This page suggests that the problem may be the access rights assigned to the VB runtime. Try assigning everyone read and execute permissions on Msvbvm60.dll. <http://support.microsoft.com/kb/278013>
Another approach that might work, is to install the DLL as DCOM application on dcomcnfg. It will run under different credentials.
332,261
I'm looking for something that's catchy and succinct. 'Exploit' is a good word for 'take advantage of' but it doesn't take into account someone's psychological weaknesses. example sentences: > > "By taking advantage of her substance abuse in order to get sex, he was \_\_\_\_\_\_\_\_\_ her." > > > or > > "She ...
2016/06/12
[ "https://english.stackexchange.com/questions/332261", "https://english.stackexchange.com", "https://english.stackexchange.com/users/-1/" ]
**gaslight** . [Oxford dictionaries](http://www.oxforddictionaries.com/us/definition/american_english/gaslight) > > verb: Manipulate (someone) by psychological means into questioning their own sanity: > > > . [dictionary.com definition](http://www.dictionary.com/browse/gaslight) > > 4. to cause (a person) to...
Exploit seems like the proper word to me.
24,025,423
Let an object contain color and size, and a list like `l = [<'GREEN', 1>, <'BLUE', 1>, <'BLUE', 2>, <'BLUE', 3>, <'RED', 4>, <'RED', 4>, <'GREEN', 5>]` Each element is an instance of the object which contains color and size (not tuples). I've represented them in non-conventional way. I want to eliminate elements fro...
2014/06/03
[ "https://Stackoverflow.com/questions/24025423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/105486/" ]
The cleanest way to iterate through sequence in a context of previous element is [with\_prev](http://funcy.readthedocs.org/en/latest/seqs.html#with_prev) function from [funcy](https://github.com/Suor/funcy) library: ``` from funcy import with_prev [x for x, prev in with_prev(l) if prev and x.color != prev.color] ...
I have tested and confirmed that the following code will work. Partially inspired by the other posts here. ``` l = ["red","red","green","blue","green","green"] k = 1 while k < len(l): if l[k-1]==l[k]: del l[k] k = k + 1 else: k = k + 1 for x in range(len(l)): print l[x] ``` Output: ``` red gree...
70,957,589
I am writing a micro-library instead of using jQuery. I need only 3-4 methods ( for DOM traversal, Adding Eventlisteners etc). So I decided to write them myself instead of bloating the site with jQuery. Here is the snippet from the code: `lib.js` ```js window.twentyFourJS = (function() { let elements; con...
2022/02/02
[ "https://Stackoverflow.com/questions/70957589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1633812/" ]
in your constructor you need to see what you have and handle it in different ways. ``` const Constructor = function(selector) { if (typeof selector === 'string') { elements = document.querySelectorAll(selector); } else { // need some sort of check to see if collection or single element // T...
All you really need to do is make sure your `Constructor` argument can distinguish between a string selector being passed in, and an object. ``` const Constructor = function(selector) { if(typeof selector == "string"){ elements = document.querySelectorAll(selector); this.elements = elements; } else{ ...
151,298
**I was wondering if there was a .NET-compatible CLR that was implemented using the CLI** (common language infrastructure), e.g., using .NET itself, or at least if there were any resources that would help with building one. Basically, something like a .NET program that loads assemblies as MemoryStreams, parses the byt...
2008/09/30
[ "https://Stackoverflow.com/questions/151298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1659/" ]
I am not aware of one, but ideas frm JVM running on JVM should be helpful. * [Jikes RVM](http://jikesrvm.org/) * [Maxine VM](http://maxine.dev.java.net/)
Look at the System.Reflection.Emit namespace, specifically the ILGenerator class. You can emit IL on the fly. <http://msdn.microsoft.com/en-us/library/system.reflection.emit.ilgenerator_members.aspx>
15,258,708
I am trying to write a program that accepts a phone number in the format `XXX-XXX-XXXX` and translates any letters in the entry to their corresponding numbers. Now I have this, and it will allow you to reenter the correct number if its not correct to start, but then it translates the original number entered. how do i...
2013/03/06
[ "https://Stackoverflow.com/questions/15258708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2084066/" ]
If you don't want to use regular expressions: You can use `isalnum` to check if something is a number or letter. You can access the `n`th character in a string using `mystr[n]` so, you could try: ``` def validNumber(phone_number): if len(phone_number) != 12: return False for i in range(12): if ...
1. You should use a regex to match the text. 2. the string module has a `translate` function that will replace most of your logic code example below. note how i cast everything into lowercase to simplify the regex and translation. ``` import string import re RE_phone = re.compile("^[a-z0-9]{3}-[a-z0-9]{3}-[a-z0-9]{4...
313,297
I'm trying to come up with a simple and efficient way to create a smooth surface which intersects a number of given "sample" points. For any X,Y point on the surface, I identify up to 4 sample points in each of the 4 directions (the next higher and lower points on the X, and then the Y axes). Given this point, I want ...
2008/11/24
[ "https://Stackoverflow.com/questions/313297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16050/" ]
You can do this by constructing patches from Catmull-Rom splines. These splines will hit each of the control points and they are continuous in the first derivative (though not the second). I also find them to be extremely easy to work with. The math is straightforward and they behave intuitively with slight changes in ...
Use catmull-rom patches
56,799,028
the script in the loop detects the height of all divs, and then sets the highest value for all to make them div the same in height - specifically, the title. The script reads the height correctly from the first one, but not from the others, so it sets the height value according to the first div. In the chrome debugger ...
2019/06/27
[ "https://Stackoverflow.com/questions/56799028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9263356/" ]
bump, for whoever is having this issue. The problem is still there.I got around it by using this in my styling: ``` mapArea:{ height:'70vh', width:'100%', "& div:first-child ":{ height:'100%', width:'100%', } }, ```
your problem is that child div is position absolute, while the parent has width auto, auto width will adjust to it's relative content width. try to set width: 100% instead of auto on ``` <div style={{gridArea: '2 / 5 / 3 / 6'}}> <MapContainer containerStyle={{width: '100%', height: 'auto'}} /> </div> ``` or to ...
3,751
Why does the Plutus script need be provided in the transaction? My understanding is that a script address is just a hash of the script. In order to spend a UTxO from a script address the spending transaction needs to include the script. The validator will check if the attached script's hash matches the script address ...
2021/09/13
[ "https://cardano.stackexchange.com/questions/3751", "https://cardano.stackexchange.com", "https://cardano.stackexchange.com/users/780/" ]
An update on one part of the question that hasn't been addressable till now > > If the script was stored separately on the address, then a spending > transaction would only need to point to that script instead of > spamming the blockchain with duplicate data. What am I missing here? > > > Well, this is exactly wh...
> > If the script was stored separately on the address, then a spending transaction would only need to point to that script instead of spamming the blockchain with duplicate data. > > > It's true that you could minimalize the size of transactions gossiped around the network by storing the script on-chain, but ther...
28,052,924
I think this image explains it all. I have a subclass of UIView that I've entered into the class field. I'm trying to connect ibOutlets between the storyboard and class implementation. It's not giving me an error, but it's not working either. Is this another xcode bug, or am I expecting this to work in a way that it wo...
2015/01/20
[ "https://Stackoverflow.com/questions/28052924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2471333/" ]
Here is a solution: 1) Type an IBOutlet **by hands** in your header file, *example*: ``` @property (strong, nonatomic) IBOutlet ProgressBarElementView *targetProgressElement; ``` 2) Drag the pin **from the code** to the *element* in document outline zone [![enter image description here](https://i.stack.imgur.com/q...
To overcome XCode stubborness, especially when you need to hook up different enums from `UIControlEvent` than `UIControlEventTouchUpInside`, I'd rather use code directly from within the custom view class: *SWIFT* ``` button.addTarget(self, action:#selector(ClassName.handleRegister(sender:)), ...
14,910,724
if I have this: (I already declared the variables) ``` random1 = new Random(); Console.WriteLine(random1.Next(1, 100)); Console.WriteLine(random1.Next(1, 100)); ``` When I have that, it'll generate a different number for every time I call console.writeline, so this would generate ex. 10, 55 and if you do it again 20...
2013/02/16
[ "https://Stackoverflow.com/questions/14910724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2053323/" ]
What you see is "by design" - i.e. it happens because of how the class is implemented... the algorithm it uses needs a "seed" (kind of a starting state) which in this case is based on the clock... as documented on [MSDN](http://msdn.microsoft.com/en-us/library/system.random.aspx): > > The random number generation sta...
Random number generation works based on a seed value in most of the programming languages. This seed is usually taken from a current time value. So if you declare the two Random objects close to each other, most likely they will obtain the same seed from the CLR. That's why they will generate the same numbers. When y...
14,714,877
I downloaded and extracted Crypto++ in C:\cryptopp. I used Visual Studio Express 2012 to build all the projects inside (as instructed in readme), and everything was built successfully. Then I made a test project in some other folder and added cryptolib as a dependency. After that, I added the include path so I can easi...
2013/02/05
[ "https://Stackoverflow.com/questions/14714877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2007674/" ]
(This is already answered in comments, but since it lacks an actual *answer*, I'm writing this.) This problem arises in newer versions of Visual C++ (the older versions usually just silently linked the program and it would crash and burn at run time.) It means that some of the libraries you are linking with your progr...
I had this problem along with mismatch in ITERATOR\_DEBUG\_LEVEL. As a sunday-evening problem after all seemed ok and good to go, I was put out for some time. Working in de VS2017 IDE (Solution Explorer) I had recently added/copied a sourcefile reference to my project (ctrl-drag) from another project. Looking into prop...
4,139
I've got a somewhat obfuscated javascript file with multiple variables named `a##########`, where `#` stands for a single `0-9` digit. Each such identifier may or may not be unique. I was substituting these manually, using `:%s/<c-r>k/f#/g`, where `k` was the register I put one of these identifiers and `#` was a numbe...
2015/08/02
[ "https://vi.stackexchange.com/questions/4139", "https://vi.stackexchange.com", "https://vi.stackexchange.com/users/1275/" ]
Although I think John's answer is quite good, I thought of a different way to achieve this. It still requires a custom function, but it is a little bit simpler. The idea is to create an incrementer object that keeps track of the individual variable IDs. To do this, we define a dictionary with an incrementer function (...
Many linux distributions offer a Vim with Perl support. If this is the case we can use `:perl perl-command` and `:perldo perl-command`: ``` :perldo $c=31 :perldo s/a(\d{10})/$m{$1} ||= $c++; "f$m{$1}" /ge ``` (untested) The solution presented is in fact very similar to the question... * `:perldo perl-command` exec...
31,390,105
Is it possible to do something only if a Jasmine test fails? Juxtaposed with `afterEach()` which executes after an `it()` regardless of outcome, I'm looking for some way to execute code only after an `it()` has a failed expectation. This question is not Angular-specific, but in my scenario I am testing an Angular serv...
2015/07/13
[ "https://Stackoverflow.com/questions/31390105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3123195/" ]
Here's a hack to re-enable `jasmine.getEnv().currentSpec` in Jasmine 2 (sort of, `result` isn't the full `spec` object, but contains `id`, `description`, `fullName`, `failedExpectations`, and `passedExpectations`): ``` jasmine.getEnv().addReporter({ specStarted(result) { jasmine.getEnv().currentSpec = resu...
I wanted to do something similar on jasmine 2.5.2 (having custom logger object which would print out only when test fails, without having to do it manually). Struggled quite a bit to make it work generically through beforeEach/afterEach, finally I caved in to an uglier solution ``` // logger print on fail function c...
9,675,668
Hey I have this code that sends an email with some data sent by a form: ``` <?php if (isset($_POST['submit'])) { error_reporting(E_NOTICE); function valid_email ($str) { return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE; } if...
2012/03/12
[ "https://Stackoverflow.com/questions/9675668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If this is for a first time java class, my guess is he is looking for these 2 cases: ``` //the one you have, using a precreated array double[] myArray = {1.1, 2.2, 3.3} xMethod(myarray); //and putting it all together xMethod(new double[]{1.1, 2.2, 3.3}); ``` Basically illustrating you can make an array to pass, or ...
static methods are not bound to the construction of the class. The method above can be called either by constructing the class or just by using the namespace: ``` Classname myclass = new Classname(); myclass.xMethod(myarray); ``` or you could just do: ``` Classname.xMethod(myarray); ``` as you see, you don't have...
12,559,254
``` List userProcessedCountCol = new ArrayList(); while (iResultSet1.next()) { afRealTimeIssuance afRealTimeIssuance = new afRealTimeIssuance(); Integer i = 0; afRealTimeIssuance.setSub_channel(iResultSet1.getString(++i))...
2012/09/24
[ "https://Stackoverflow.com/questions/12559254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1142496/" ]
you can act as at two levels here: * Database level * Java level At the database level the only way to manipulate the order of results to be returned is using ''ORDER BY ASC/DESC'' in your sql query. Note, that you can't rely on any other way to get the ordered results from the database. At the java level you can st...
The ResultSet cannot be rearranged manually (only with sql) . What you can rearrange is your data structure that you hold your Objects You can use an ArrayList of your row Objects and insert each row in the **position** you would like. Lets say in your example, in the while loop: ``` userProcessedCountCol.add(index,...
40,226,373
Creating a sub-theme in Drupal 7's `page.tpl.php` and needing to pull the value (plain text) from `field_EXAMPLE` from a custom content type outside of where the rest of the content would normal be. ``` <!-- Adding $title as normal--> <?php print render($title_prefix); ?> <?php if (!empty($title)): ?> ...
2016/10/24
[ "https://Stackoverflow.com/questions/40226373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2887660/" ]
Lets assume that you created a field called `field_thestring` that you want to render for a content type `article`'s page at a location outside of `THEME`'s outside of where page's content renders. Step 1. Copy the theme's page.tpl.php. and rename it `page--article.tpl.php`. Step 2. In `page.var.php`, ``` function ...
You can use a preprocess to add value into $variables passed to template <https://api.drupal.org/api/drupal/includes%21theme.inc/function/template_preprocess_page/7.x> In template.php : ``` MYTHEMENAME_preprocess_page(&variable){ $values = current(field_get_items('node', $variable['node'],'field_machine_name')); ...
203,626
I got a call from my company and I heard as follows: ``` Sorry, we are going to have to let you go now. ``` Can anyone tell me what does this means.
2014/10/21
[ "https://english.stackexchange.com/questions/203626", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63650/" ]
"Let you go" means "fire you". "We have to let you go" implies that they don't like to fire you. But they are in a situation that they have no other choice. By adding "We are going to" they are saying that this situation will happen in [probably close] future.
The phrasing is the grown-ups' equivalent of getting your girlfriend to dump you so that you don't have to dump her. We're *going to have to let you go*; in other words: > > We are no longer able to compel you to stay, so if you were to walk out the door and never come back, we'd simply wring our hands in despair an...
15,274,710
Quick question. I am binning a variable in a number of different ways for exploratory data analysis. Let's say I have a variable called `var` in data.frame `df`. ``` df$var<-c(1,2,8,9,4,5,6,3,6,9,3,4,5,6,7,8,9,2,3,4,6,1,2,3,7,8,9,0) ``` So far, I've employed the following approaches (code below): ``` #Divide into q...
2013/03/07
[ "https://Stackoverflow.com/questions/15274710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1515626/" ]
`cut_number()` from **ggplot2** is designed to cut a numeric vector into intervals containing equal numbers of points. In your case, you might use it like so: ``` library(ggplot2) split(var, cut_number(var, n=3, labels=1:3)) # $`1` # [1] 1 2 3 3 2 3 1 2 3 0 # # $`2` # [1] 4 5 6 6 4 5 6 4 6 # # $`3` # [1] 8 9 9 7 8 ...
This should do it. ``` df$var_bin<- cut(df[['var']], breaks = Size(df$var/10), include.lowest=TRUE, labels=1:10) ```
4,022,887
I recently came across Pytables and find it to be very cool. It is clear that they are superior to a csv format for very large data sets. I am running some simulations using python. The output is not so large, say 200 columns and 2000 rows. If someone has experience with both, can you suggest which format would be mo...
2010/10/26
[ "https://Stackoverflow.com/questions/4022887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/316357/" ]
Have you considered Numpy arrays? PyTables are wonderful when your data is too large to fit in memory, but a 200x2000 matrix of 8 byte floats only requires about 3MB of memory. So I think PyTables may be overkill. You can save numpy arrays to files using `np.savetxt` or `np.savez` (for compression), and can read the...
One big plus for PyTables is the storage of metadata, like variables etc. If you run the simulations more often with different parameters you the store the results as an array entry in the h5 file. We use it to store measurement data + experiment scripts to get the data so it is all self contained. BTW: If you need t...
20,270,871
I have a file with questions and answers on the same line, I want to seperate them and append them to their own empty list but keep getting this error: `builtins.ValueError: need more than 1 value to unpack` ``` questions_list = [] answers_list = [] questions_file=open('qanda.txt','r') for line in questions_file:...
2013/11/28
[ "https://Stackoverflow.com/questions/20270871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3046660/" ]
This is probably because when you're doing the splitting, there is no `:`, so the function just returns one argument, and not 2. This is probably caused by the last line, meaning that you're last line has nothing but empty spaces. Like so: ``` >>> a = ' ' >>> a = a.strip() >>> a '' >>> a.split(':') [''] ``` As you...
The reason why this happens could be a few, as already covered in the other answers. Empty line, or maybe a line only have a question and no colon. If you want to parse the lines even if they don't have the colon (for example if some lines only have the question), you can change your split to the following: ``` questi...
33,139,852
Ok I'm trying to add these columns to that table but it says I have a syntax error, Please let me know whats wrong ``` ALTER TABLE equipomulti ADD marca VARCHAR(45) NULL , serie VARCHAR(45) NULL , modelo VARCHAR(45) NULL , fechaAd DATE NULL , costo DOUBLE NULL , observacion VARCHAR(500) NULL ; ```
2015/10/15
[ "https://Stackoverflow.com/questions/33139852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5315275/" ]
**UPDATE:** Retrofit2.0 has now own [converter-scalars](https://github.com/square/retrofit/tree/master/retrofit-converters/scalars) module for `String` and primitives (and their boxed). ``` com.squareup.retrofit2:converter-scalars ``` --- You can write custom `Converter` and Retrofit repository has a own `String...
Basically you will need to write a custom [Converter](http://square.github.io/retrofit/javadoc/index.html) Something like this ``` public final class StringConverterFactory extends Converter.Factory { public static StringConverterFactory create(){ return new StringConverterFactory(); } @Override public Converte...
15,409,833
I have implemented in app billing on an Android application and although it works ok with the testing constants, it breaks on real products. I have uploaded the application as a draft on Google Play, created and published products, installed the exact same application on the device (included the right base64EncodedPub...
2013/03/14
[ "https://Stackoverflow.com/questions/15409833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1597810/" ]
In the In App Billing documentation there is a section called [Initiate your connection to Google Play](http://developer.android.com/training/in-app-billing/preparing-iab-app.html#Connect). It tells you that you would need a base64 encoded Public Key to instantiate your IabHelper. You can get this code from the Googl...
I had this problem with my subscriptions because I haven't set the "itemType" ``` mHelper.launchPurchaseFlow(this, SKU_INFINITE_GAS, IabHelper.ITEM_TYPE_SUBS, RC_REQUEST, mPurchaseFinishedListener, payload); ```
22,523,900
Assume that I have some div elements like these: ``` <div class="mystyle-10">Padding 10px</div> <div class="mystyle-20">Padding 20px</div> <div class="mystyle-30">Padding 30px</div> ``` Is it possible to create a class or something like : ``` .mystyle-*{padding: *px; margin-left: *px; border: *px solid red; } ``...
2014/03/20
[ "https://Stackoverflow.com/questions/22523900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/566603/" ]
Assuming the above xml is named button\_view.xml ``` View view = LayoutInflater.from(context).inflate(R.layout.button_view); Button button = (Button) view.findViewById(R.id.BtnRating1); ``` This way you can inflate directly from xml
I gave you code how to create a button on dynamic time, you can set all property which you want for this button. ``` Button myButton = new Button(this); myButton.setText("Push Me"); LinearLayout ll = (LinearLayout)findViewById(R.id.BtnRating1); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutP...
42,228,016
I know that this code is not good and maybe it's stupid question but can anybody explain me why it works in this way? I have this simple class ``` public class Customer { public string Name { get; set; } } ``` And I have next method with Action delegate ``` private Customer GetCustomer(Action<Customer> action)...
2017/02/14
[ "https://Stackoverflow.com/questions/42228016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3473079/" ]
`c` in your lambda is only assigning to the parameter, its not assinging it back to `model` in `GetCustomer`.
In your lambda expression, you are just saying that `c` and `model` are pointing to the same reference. And then you are changing the reference of `c`. At the end `model` is still referencing to the previous instance. This is the equivalent code of what you are trying to do: ``` var model = new Customer { Name = "Name...
46,909
There are a few philosophers who still push the “perverted faculty argument” to prove that contraception, homosexual acts and masturbation are immoral. This argument is based on classic natural law, which is itself based on a metaphysics that assumes essentialism and teleology (broadly Aristotelian). Because of that, ...
2017/10/31
[ "https://philosophy.stackexchange.com/questions/46909", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/18903/" ]
There is absolutely no empirical evidence that masturbation, anal, oral sex or homosexual sex diminishes the faculty to procreate. It could even be argued that, by releasing sexual impulse in a contraceptive fashion, it can help people who are already parents to keep their offspring at a sustainable quantity, securing ...
The perverted faculty argument says that it is perverted to use the given faculty in a manner whereby it circumvents its intended end. What Edward Feser fails to explain is that it is not the sex that prevents the conception of children after i get my vasectomy. It's the method of contraception. Further the intended pu...
20,174,542
I couldn't find the ".NET CLR Memory" counter category programmatically (in c#), as in [this](https://stackoverflow.com/q/4705698/738851) question. Running as admin solved the issue. But why do I need to do this? Is there an alternative? I want readonly access, to see GC generation collections inside my app for profi...
2013/11/24
[ "https://Stackoverflow.com/questions/20174542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/738851/" ]
You only need to be in group *Performance Monitor Users*. Simply adding your non admin user to that group should fix the problem.
Performance counters are a security hazard. One of the common attack techniques is to observe the execution of secured code. A very common mistake in such code is it not having constant execution time, taking inappropriate shortcuts when a password is invalid for example. This can greatly reduce the number of brute for...
12,203,272
i am trying to improve my jQuery skills and therefore i write a own lightbox. But there is one thing which drives me crazy. How can i animate a div like the other lightboxes. Starting in the middle and spread out to each side. I am helpless. Is that possible with that special easing properties, which are provided by ...
2012/08/30
[ "https://Stackoverflow.com/questions/12203272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/787999/" ]
You can also animate the top and left position of the div to give the effect of resizing relative to the center of the element. **[jsFiddle example](http://jsfiddle.net/j08691/x5A42/14/)** ``` $('#clickme').click(function() { $('#lightbox').fadeIn(); $('#lightbox').animate({ width: 500, height...
replace this, jquery. Will close your opened div as well. Thanks 'j08691' for the help. `$('#clickme').click(function() { $('#lightbox').fadeIn(); $('#lightbox').animate({ width: 500, height: 250, top:5, left:10 });});` `$('#lightbox').click(function() { $('#lightbox').animate({ width: 0, height: 0, top:0, ...
16,010
I know it is referring to Shanghai, and Baidu has a handy explanation of its origins [here](http://baike.baidu.com/subview/1353406/10221125.htm), but how would you translate it? "The Mystic Capital"? "The Devilish Capital"? In the theme of 帝都 to describe Beijing as the "The Imperial capital" etc.
2015/09/19
[ "https://chinese.stackexchange.com/questions/16010", "https://chinese.stackexchange.com", "https://chinese.stackexchange.com/users/11057/" ]
Why not "Mordor"... I have always believed this is the only correct transl(iter)ation.
Strictly on its own and without any contextual reference, 魔都, can only mean "Devil / Evil City" and calling it a "Metropolis" makes no semantic difference. Since the author 村松梢風, Muramatsu Shōfu, is Japanese, then the Japanese translation for 魔都 should carry the intended meaning; and as I found out, 魔都 is "Mazu" whic...
14,178,814
I have a database with a little over 300 rows. For various reasons I only want to search 21 rows at a time for specific terms and at different starting index points. I am querying for 'banned commercials' in a column called `search_terms`. When I use the query below it searches all 300 rows 'banned commercials' inst...
2013/01/06
[ "https://Stackoverflow.com/questions/14178814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1422657/" ]
Try using this ``` SELECT rating_score FROM archived_videos WHERE search_terms='banned commercials' ORDER BY rating_score DESC LIMIT 21 ``` Limiting it specifying 21 will limit the results to first 21
I take it from your question that you want to search a block of 21 rows, not limit the result set to 21 rows. The LIMIT clause limits the results, not the set of records being searched. To limit records, you need to add something to your where clause. What this is depends on the contents of your table. If you had a seq...
12,349,829
My Sql table is similar like below ``` Code Value ID A 100 1 A 200 2 A 300 3 B 200 1 B 500 2 B 600 3 C 800 1 C 700 2 C 200 3 ``` How I can write query in sql server 2008 to get values in below format. ``` ID A B C 1 100 200 800 2 200 500 ...
2012/09/10
[ "https://Stackoverflow.com/questions/12349829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/597933/" ]
Use PIVOT ``` select ID,[A],[B],[C] from your_table T PIVOT (MAX(Value) FOR Code in ([A],[B],[C]) )P ``` IF the number if Codes are not fixed you could use **dynamic pivot** ``` DECLARE @cols AS NVARCHAR(MAX), @query AS NVARCHAR(MAX) select @cols = STUFF((SELECT distinct ',' + QUOTENAME(Code) ...
The answer is [PIVOT](http://msdn.microsoft.com/en-us/library/ms177410%28v=sql.105%29.aspx) ``` DECLARE @t TABLE (Code varchar(10), Value int, Id int) INSERT INTO @t VALUES ('A',100,1), ('A',200,2), ('A',300,3), ('B',200,1), ...
6,454,631
I know in jQuery, `$(callback)` is the same as `jQuery(callback)` which has the same effect as `$(document).ready()`. How about ``` jQuery(function($) { }); ``` Can some one explain to me what does this kind of function mean? What does it do? what is the difference between this one and `$(callback)`?? what i...
2011/06/23
[ "https://Stackoverflow.com/questions/6454631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/740018/" ]
* `$(function())` is a syntax error. * `$()` creates an empty jQuery object. * `$(document).ready(function() { ... })` executes the given function when the DOM is ready * `$(function() { ... })` is a shortcut for the same thing * `jQuery(function($) { ... })` does so, too, but it also makes `$` available inside the fun...
So I was corrected on this and if you read the first comment it gives some context. ``` jQuery(function() { // Document Ready }); (function($) { // Now with more closure! })(jQuery); ``` I'm not 100% sure but I think this just passes the jQuery object into the closure. I'll do some digging on the google to ...
85,946
I started the game with more city-states than the game can handle and therefore was able to pick up a lot of free labor from city-state settlers who were just standing there doing nothing. I glossed over warnings that I am making the coalition of city states angry at me. Now, right after saving a game I attacked a ci...
2012/09/27
[ "https://gaming.stackexchange.com/questions/85946", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/33608/" ]
There are only three situations where a city state will declare war on an actual civilization: 1. You're too aggresive towards city-states, and many of them band together and declare permanent war against you. 2. They're allied with someone you're at war with. 3. You declare war on them enough times that they alone go...
As far as I know, a single city state will never declare war on you unless they are allied with a larger civilization with whom you are at war.
53,176,287
I want to web scrape this site 'http://mbsweblist.fsco.gov.on.ca/agents.aspx'. I have last names of a list of agents. Upon searching using last name it returns license id which is a hyperlink which takes you to another page with their licensing information such as expiry date. This is the code I have so far. But it on...
2018/11/06
[ "https://Stackoverflow.com/questions/53176287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7798197/" ]
If you're using a native array of arrays of `int`, you can't force-feed it to a function expecting a pointer to a sequence of pointers. All of those hard casts are a clear-and-present indicator you're doing something wrong. Whoever told you `int[N][M]` is synonymous with `int**` was lying; they're not. Most toolchain ...
So, I was thinking about how the 2D array is set in the memory, the col are needed to let the compiler know how many ints (in this case) to skip over between the rows, but in fact A 2D array is simply set as a regular array in the memory, a continuous block of memory. So- if I want to "move" between the rows I can si...
59,172,338
Notepad++ works with Scintilla lexer to recognize switches in language within a .php file somehow. It seems to default to HTML and recognizes `<?php ... ?>`, and `<script type="text/javascript">...</script>` as delimiters for embedded PHP and javascript languages and thus applies the correct syntax highlighting and cod...
2019/12/04
[ "https://Stackoverflow.com/questions/59172338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2318559/" ]
In past I was thinking about something similar, but I gave up, as Notepad++ has no API or configuration for different language in another language format. See search results for `<?php` in the source code: <https://github.com/notepad-plus-plus/notepad-plus-plus/search?l=C%2B%2B&q=%22%3C%3Fphp%22> After a couple of an...
My solution until NotePad++ and/or Scintilla developers come up with an enhancement is to copy the sql-code into a new tab and select SQL as the language. For those who would like to do the same, here is a macro to do that. Paste this into your shortcuts.xml file found in the folder where you set NPP+ to store your co...
5,258
In the workplace environment, I don’t think it is productive to dwell on what happened or keep score on who did what to whom. In English I would summarize my motto as: > > Ever Forward > > > Now I am looking for an appropriate Latin equivalent, i.e., a phrase that conveys: 1. The past is behind me and does not m...
2017/09/16
[ "https://latin.stackexchange.com/questions/5258", "https://latin.stackexchange.com", "https://latin.stackexchange.com/users/1997/" ]
A common motto is *semper prorsum*, "always forward." You can find examples of this [all over Google](https://books.google.com/books?id=G2ghAQAAMAAJ&pg=PA249&dq=%22semper+prorsum%22#v=onepage&q=%22semper%20prorsum%22&f=false), and is used as a way of expressing the necessity of marching forward. "Always forward, never ...
"Duc in altum !" coming from the Holy Scriptures (Luke, 5,4): *dixit (Jesus) ad Simonem duc in altum et laxate retia vestra in capturam* : Launch out into the deep, and let down your nets for a draught.\*
189,183
How do I disable the password lock on my My book 1 TB, I want to so I may use it directly with my xbox 360, since it won't pick it up on my pc list.
2010/09/16
[ "https://superuser.com/questions/189183", "https://superuser.com", "https://superuser.com/users/49469/" ]
Your question is not clear, has the password been set, and you forgot it? <http://community.wdc.com/t5/External-Drives-for-Mac/WD-My-Book-1TB-locked-out/td-p/6860> states the following: > > 1. Unplug and plug in Drive again. > 2. You will be prompted to type in password. > 3. Type five wrong password. > 4. After 5th...
This came to the front page, so I'll reply, but the OP probably wiped it already. See if you had installed anything from a CD **originally** to enable this password set-up. You should summon the same program to seek the option to change the known password to an empty one. If you don't remember the original password, t...
12,319,204
How many times is Reactive Extensions supposed to evaluate its various operators? I have the following test code: ``` var seconds = Observable .Interval(TimeSpan.FromSeconds(5)) .Do(_ => Console.WriteLine("{0} Generated Data", DateTime.Now.ToLongTimeString())); var split = seconds .Do(_ => Console.WriteL...
2012/09/07
[ "https://Stackoverflow.com/questions/12319204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/447885/" ]
Presumably, they choose that approach to allow each subscriber to get its values at the same interval from their initial subscription. Consider how your alternate Interval would work: ``` 0s - First subscriber subscribes 5s - Value: 0 8s - Second subscriber subscribes 10s - Value: 1 15s - Value: 2 17s - Unsubscribe bo...
Although it seems like it might be nice sometimes if sequences were multicasted at every step, if it were that way it wouldn't allow you to have the rich composition that Rx allows for. To think of it another way, `IObservable` is the push-based dual of `IEnumerable`. `IEnumerable` has the property of lazy evaluation...
275,208
I'm using a [Matsusada HV Power supply](https://www.matsusada.com/product/psel/hvps1/handy/000034/) up to 20 kV. The manual mentioned that the ground terminal of the chassis should be connected to earth. And I had a few questions 1. What are the best, or at least acceptable, ways to make this connection. Would it be O...
2016/12/15
[ "https://electronics.stackexchange.com/questions/275208", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/133364/" ]
I agree with @ThePhoton overall. The earth pin in the IEC connector should be an extremely low resistance path to the chassis ground stud. Any other arrangement would be irresponsible, dangerous, and probably illegal. How you connect the supplemental earth depends on your lab setup. A permanent, sealed mechanical bond ...
The Japanese have several (at least two) different mains power distribution systems -- one at 60 Hz and one at 50 Hz. This [wiki page](https://en.wikipedia.org/wiki/Mains_electricity) says the boundary between the two regions contains four back-to-back high-voltage direct-current (HVDC) substations to interconnect thes...
6,406,930
I have read this post: [what happens to NSLog info when running on a device?](https://stackoverflow.com/questions/5318342/what-happens-to-nslog-info-when-running-on-a-device) ...but wondering if NSLog is a problem when distributing the app such as filling up the memory or something? I am only interested to see it when...
2011/06/20
[ "https://Stackoverflow.com/questions/6406930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/418332/" ]
You should remove it. For example if you log contents of a UITableViewCell (in `-tableView:cellForRowAtIndexPath:`), it can make a big difference in performance, especially on slower hardware. Use a macro to keep NSLog output in Debug mode, but remove it from Release mode. An example can be found on the following site...
There only real reason to remove your NSLog entries is to save on memory consumption by running unnecessary code, but unless you're consistenly adding data, it shouldn't be too much of an issue. Furthermore, if a user has an issue such as app crash, etc. NSlogs can be submitted which the dev can read to work out the re...
23,890,361
I need to write a script where one can type their name (via input) and the script has to check if the name has the right format (no numbers, no Capslock, starting with the capital letter). This is what i have so far: ``` import re def inputName(): name = input("Enter your name: ") if re.search('^[A-Z]{1}\w[a-z]+'...
2014/05/27
[ "https://Stackoverflow.com/questions/23890361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3652491/" ]
`\w` matches letters as well as digits and underscores. Also, don't forget to [anchor](http://www.regular-expressions.info/anchors.html) the regex to the end of the string, otherwise it will succeed on a partial match. For example, on `"Ab1"`, the substring `"Ab"` is matched by your regex if you don't use the `$` ancho...
``` import re username = "john" result = re.search(r'.*?(?!.*?(\d|[A-Z]))', username) if result.groups()[0] is None: print "{} passed validation".format(username) ``` The regex: `.*?(?!.*?(\d|[A-Z]))` will match anything as long as it has no digits or capital letters in it, as requested.
36,267,507
I am trying to animate with CSS the a line through on a bit of text, but it's not actually animating, just going from hidden to displayed. Can anyone advise if what I'm trying is actually possible? If not, is there another way to achieve this? HTML: ``` <div> The text in the span <span class="strike">is what I wan...
2016/03/28
[ "https://Stackoverflow.com/questions/36267507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1149614/" ]
You can use a pseudo like this *Note (thanks to [Phlame](https://stackoverflow.com/questions/36267507/is-it-possible-to-animate-a-css-line-through-text-decoration/36267849?noredirect=1#comment114475894_36267849)), this left-to-right animation won't work if the line to strike breaks in to a second line. For that one ne...
Here's a variation on the [accepted](https://stackoverflow.com/a/36267849/8112776) answer, using an image to provide an animated "scribble" strike-through. ```css html { font-family: Helvetica; font-size: 24px; } .strike { position:relative; } .strike::after { content:' '; position:absolute; top:50%;...
1,616,293
Given the following code, how do I use the variable divs created by the first jQuery selector, without rerunning it on the line where I add the class? So, given this: ``` var divs = $("div.searchhit"); ``` // more code here using divs.length divs.removeClass("selected"); $("div.searchhit:eq(0)").addClass("selecte...
2009/10/23
[ "https://Stackoverflow.com/questions/1616293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17891/" ]
Just use the [`eq()` method](http://docs.jquery.com/Traversing/eq#index): ``` divs.eq(0).addClass('selected'); ```
Please read the jQuery documentation. This is well covered. That was a bit terse of me. Here small explanation: `jQuery(query)` is the primary filter which searches from the root of the DOM. Subsequent queries run on the resultant object start on that set. If no expanding operations are performed (say, looking at chi...
8,022,699
I would like to know how can I manually insert some php code inside a cck node (in Drupal). The thing is that I have this stuff: ``` $output .= '<br>'; $mor = _pitch_detalle($cid, $previamente, $luego); if (sizeof($mor) > 0){ $output .= theme('pitch', $mor); } return $output; ``` This stuff shows some information ...
2011/11/05
[ "https://Stackoverflow.com/questions/8022699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/892490/" ]
`$.validator.setDefaults` doesn't work for unobtrusive validation as the validator is initialized internally. To change the settings on forms that use unobtrusive validation you can do the following: ``` var validator = $("form").data("validator"); if (validator) { validator.settings.onkeyup = false; // disable v...
Don't know how to set it to a specific field, but you could try this to disable keyup validation (for all fields): ``` $.validator.setDefaults({ onkeyup: false }) ``` See * [MVC 3 specifying validation trigger for Remote validation](https://stackoverflow.com/questions/4798855/mvc-3-specifying-validation-trigger...
18,046,776
I use a javascript song countdown on my radio website. At every 10 seconds, the countdown lags (skipping 1 one more seconds), because of an ajax call to check if there's a new song: ``` function getcursong(){ var result = null; var scriptUrl = "get_current_song.php"; $.ajax({ url: scriptUrl, type: 'ge...
2013/08/04
[ "https://Stackoverflow.com/questions/18046776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1904386/" ]
I assume that `async: false` is hijacking your countdown function. Do you need it to be false?
``` function () { var result = null; var scriptUrl = "get_current_song.php"; $.ajax({ url: scriptUrl, type: 'get', dataType: 'html', async: true, // NEEDED TO BE TRUE success: function(data) { // on success, I get the data song = $('#song').html(); if (data != song && data !=...
319,306
I've just installed an SSL certificate for our domain, and now when I try to browse to the site using https I get a connection reset error in FF and chrome both locally and from a client. I can still access the site without SSL (using http). If it makes any difference I have another SSL certificate installed for a dif...
2011/10/07
[ "https://serverfault.com/questions/319306", "https://serverfault.com", "https://serverfault.com/users/93735/" ]
Oh god embarrasing. So it turns out that I had set the correct SSL binding but in the binding I had actually forgotten to select the certificate that I had installed. So it was just sitting there as not selected. This was causing a whole bunch of chaos but now my ports all appear open and I can browse the site via IP a...
Sometimes the use of `SelfSSL.exe` will lead to this problem, try to re-run the command `selfssl.exe /N:CN=localhost /K:1024 /V:365 /S:{your site id} /P:443`
7,726,513
I know how to sort an array that has two columns: ``` Arrays.sort(myarray, new Comparator<String[]>() { @Override public int compare(String[] entry1, String[] entry2) { String time1 = entry1[0]; String time2 = entry2[0]; ...
2011/10/11
[ "https://Stackoverflow.com/questions/7726513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/571648/" ]
You have to walk the two arrays until you find an index where the elements differ and the return the comparison of the strings at that index. It is basically the same idea that is used in comparing strings. ``` for(int i=0;i<Math.min(entry1.length,entry2.length);i++){ String x=entry1[i], y=entry2[i]; int diff=x....
I think the easiest way is to use a temporary array of strings since you have array of strings - Sample array: ``` String array[][][] = { { {"Hello", "World"}, {"Apple", "Orange"} }, { {"Zebra", "Cow"}, {"Cat", "Ball"} }, { ...
18,279,238
I want to insert an image in a div, but i have problems: the image overflows outside the div!! O.O (sorry for my english) thats' the code HTML ``` <div class='immagine2'><img src='http://farm4.staticflickr.com/3822/9522792825_c68706706d_o.jpg'></div> ``` and CSS... ``` div.immagine2 { position:relative; ...
2013/08/16
[ "https://Stackoverflow.com/questions/18279238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2659836/" ]
Add the `overflow: hidden` to the following id: ``` div.immagine2 { overflow:hidden; ... } ``` This will effectively prevent any content extending beyond the div from displaying on the page. Hope it helps!!
Add the background-image to your CSS (As a commentor mentioned this is ineffective if you wish to use different images ). ``` background-image: url(../images/picture.jpg) ``` You can play around with numerous background settings in the CSS. ``` background-size: 100%; ``` If you are using px you can specify the...
38,487,479
I have tried to create a sample program using Node.js, following instructions from <https://developers.google.com/google-apps/activity/v1/quickstart/nodejs> I throws an error saying **cannot read property 'client\_secret' of undefined** when trying to run it. Looking for your valuable suggestions. Thanks in advance...
2016/07/20
[ "https://Stackoverflow.com/questions/38487479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4559107/" ]
Since there is no key named "installed", it's parsing it to be `undefined`. In `credentials.json` change the key "web" to "installed". Probably the docs need to change from Google's side. Before ------ [![enter image description here](https://i.stack.imgur.com/H6f20.png)](https://i.stack.imgur.com/H6f20.png) After ...
Your `client_secret.json` file needs to have the line below: ``` "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"] ``` instead of the lines like below: ``` "javascript_origins": [ "http://localhost:8080", "http://localhost:1453", "http://127.0.0.1:1453", "http://localhos...
15,712,567
I have a UINavigationController in my AppDelegate with a RootViewController that has a UITableView. On startup, the status bar changes its color to the color of the navigation bar. When I colored my navigation bar to orange, this is what the status bar is looking like: ![enter image description here](https://i.stack.i...
2013/03/29
[ "https://Stackoverflow.com/questions/15712567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680441/" ]
Set your status-bar-style towards `UIStatusBarStyleBlackOpaque` and you should get a solid black bar. To do that, use `setStatusBarStyle:animated:` on your applications' instance: ``` [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated...
Add this code: ``` [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque; ``` This will make your status bar black again. You should add it **after** changing the color of your navigation bar.
26,514,014
I've tried searching around for an answer, but have not succeeded in doing so. I want to pass the text in one of the UILabel's the cell holds. I am not entirely sure on how to do this. I am trying to pass the content of one of the UILabels into the swipeTableViewCell didTriggerRightUtilityWithIndex function, as I am u...
2014/10/22
[ "https://Stackoverflow.com/questions/26514014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4171026/" ]
Save your [item objectForKey:@"Description"] into an NSMutableArray previously created, if you order your cells with the same order as the nsmutablearray, you could access this value into your wanted function like this: ``` - (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(N...
Do not store information in cell object rather than that use datasource to store information. using index you can get the respective information that was stored in label In your case you are storing description in label which can be later retrieved as follows ``` -(void)swipeableTableViewCell:(SWTableViewCell *)cel...
19,929,267
I was wondering if there's a way to use [Mosh](http://mosh.mit.edu/) on windows without Cygwin? I need to be able to put it on my USB drive and copy it over to a windows computer and be able to Mosh into one of my servers. Otherwise, is there a way to use Cygwin and have it portable? I did get mosh working under win...
2013/11/12
[ "https://Stackoverflow.com/questions/19929267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2683453/" ]
[MobaXTerm](http://mobaxterm.mobatek.net/download-home-edition.html) is portable and supports Mosh. It works quite well. I spent all day using it on a very dodgy connection and it worked like a charm. Just get the most recent version and from the Session menu select Mosh. It did does not support IPv6 (at least in [Ver...
I have noticed that a new version of MobaXterm has been released (version 7.1) and includes an intergrated Mosh session. So, you dot not need anymore need plugin for that. They said that it is "experimental", but I have tested it, and it is working quite well.
21,263,379
I'm using asp.net. I have a table in a repeater. I keep the ID's of the items in the repeater in an hiddenfield in the last column of the table with an edit hyperlink, and when it's clicked the user is redirected to the edit page of the item, which has a url like `/ItemEdit.aspx?ItemID=236` Now, my problem is, instead...
2014/01/21
[ "https://Stackoverflow.com/questions/21263379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2814738/" ]
Thanks to Ardesco and Robbie, I came up with the following solution: ``` private String RequiredSystemNameXpath = "//td[contains(text(),'xxxxx')]"; private WebElement prepareWebElementWithDynamicXpath (String xpathValue, String substitutionValue ) { return driver.findElement(By.xpath(xpathValue.replace("xxxx...
You can't do that, Annotations are constant values stored in the class file. You can't compute them at runtime. See [Can the annotation variables be determined at runtime?](https://stackoverflow.com/questions/5743167/can-the-annotation-variables-be-determined-at-runtime)
1,050,720
It amazes me that JavaScript's Date object does not implement an add function of any kind. I simply want a function that can do this: ``` var now = Date.now(); var fourHoursLater = now.addHours(4); function Date.prototype.addHours(h) { // How do I implement this? } ``` I would simply like some pointers in a d...
2009/06/26
[ "https://Stackoverflow.com/questions/1050720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111934/" ]
If you would like to do it in a more functional way (immutability) I would return a new date object instead of modifying the existing and I wouldn't alter the prototype but create a standalone function. Here is the example: ```js //JS function addHoursToDate(date, hours) { return new Date(new Date(date).setHours(dat...
A little messy, but it works! Given a date format like this: 2019-04-03T15:58 ``` //Get the start date. var start = $("#start_date").val(); //Split the date and time. var startarray = start.split("T"); var date = startarray[0]; var time = startarray[1]; //Split the hours and minutes. var timearray =...
487,196
I'm an illustrator and need some idiom help (obviously visualizing but using existing idioms or metaphors can help). The article I'm illustrating for is about teachers quitting their jobs within 5 years as it's very overwhelming and they're often not prepared enough. There's too much they have to do at once, making lat...
2019/02/25
[ "https://english.stackexchange.com/questions/487196", "https://english.stackexchange.com", "https://english.stackexchange.com/users/337799/" ]
They could be "**pooped out**". It fits your description. <https://idioms.thefreedictionary.com/pooped+out>
I'd say they've been **run ragged**. Gives a nice visual to the situation you've described. *Running someone ragged* is defined by Merriam-Webster as *making someone very tired*. An example in the wild from a horoscope: *If there's one thing in the whole world you need it's peace. Unfortunately a boss, child or lovi...
35,064,187
I'm using bootstrap to make a website for all devices. This website contains a row that is solely devoted to an image carousel. The code for this carousel is below. ``` <div class="row" id="imageCarouselRow"> <div class="col-md-12" id="imageCarouselColumn"> <div id="imageCarousel" class="carousel slide" ...
2016/01/28
[ "https://Stackoverflow.com/questions/35064187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4346886/" ]
Looking at your SQL query: ``` INSERT INTO users(username, password, namn) VALUES :username, :password, :name spelling? -----^ ^------ parentheses ------^ ``` The spelling one is mostly a guess, but at the very least the parentheses are a good idea. So maybe you meant this?: ``` IN...
enclose the variables in single quotes because these are string and strings cannot be directly inserted in database. e.g ``` INSERT INTO talbe_name (col1,col2) VALUES ('string1','string2'); ``` also draw `{}` around variables inside the string in php code e.g ``` <?php $str = "Value={$variable}"; ?> ```
34,290
The classification of finite simple groups, whether it be viewed as finished, or as a work in progress, is (or will be) without doubt an enormous achievement. It clearly sheds a great deal of light on the structure of finite groups. However, as with the classification of simple Lie algebras, one might expect this to ha...
2010/08/02
[ "https://mathoverflow.net/questions/34290", "https://mathoverflow.net", "https://mathoverflow.net/users/9558/" ]
There are all kinds of applications of CFSG within the rest of algebra. I am afraid they are too numerous to list here. Let me mention [Lubotsky and Segal - Subgroup growth](https://books.google.com/books?id=654LRcD4538C) which I personally find very interesting, and which has a number of such results. On the other han...
Maybe it is difficult to say what is strictly "outside" of finite group theory. However, to add to Igor's answers, I can suggest that you look at the work of Bob Guralnick and various collaborators. Among the interesting results which use the classification is the proof by Fried, Guralnick and Saxl in [Schur covers and...
758
I made some sorbet at the weekend, and realised just when we were due to serve that I had forgot to take it out of the freezer to soften, and so it was rock hard. What is the best way to bring it to a usable temperature quickly? We chucked it in the microwave and then hacked it with a spatula, but ended up with a lump...
2010/07/12
[ "https://cooking.stackexchange.com/questions/758", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/210/" ]
Don't. Ice cream is hard. It melts slowly. Instead, focus on scooping. Get the largest spoon you have, or ideally, an ice cream scoop. Fill up a cup with boiling water, or as hot as your faucet will get it. Dip spoon/scoop in the water. Scoop. Dip. Scoop. Shake off excess water as you go. Like a hot spoon through ic...
When you go to the kitchen to get your ice cream, don't tell the guests what you're doing. After you take it out, announce dinner. That way, you can eat dinner while the ice cream defrosts. Check on it when everyone has finished, then tell them you have dessert. Now you can give them ice cream.
5,358,468
> > **Possible Duplicate:** > > [text-overflow:ellipsis in Firefox 4?](https://stackoverflow.com/questions/4927257/text-overflowellipsis-in-firefox-4) > > > I have the same issue mentioned in [Truncating long strings with CSS: feasible yet?](https://stackoverflow.com/questions/802175/truncating-long-strings-wi...
2011/03/18
[ "https://Stackoverflow.com/questions/5358468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/364123/" ]
Blueprint css has default colours for heading tags. (see [screen.css](https://github.com/joshuaclayton/blueprint-css/blob/master/blueprint/screen.css)) You need to specify: ``` #left-sidebar h2, #left-sidebar h4, #right-sidebar h2, #right-sidebar h4 { color: white; } ```
the header tags need their own CSS Class. ``` h2, h4{ color:white; } ``` should do the trick
359,236
For the last month or so, I've been attempting to get jetbrains-toolbox to work. It used to work (and is how I installed IntelliJ IDEA and Gogland.) When I went to update the IDEA I'm currently using Arch. Here are the things I have tried. 1. Loading jetbrains-toolbox from within Sway. 2. Reinstalling jetbrains-too...
2017/04/15
[ "https://unix.stackexchange.com/questions/359236", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/227119/" ]
Just launch with `--disable-seccomp-filter-sandbox` and it should work. I found it in <https://bbs.archlinux.org/viewtopic.php?id=229859>
So I spent about a month struggling with packages and downloads everywhere, with tons of googling, asking around etc., to no avail. I made this post and within about an hour, messing around in my file manager, completely clueless, I somehow managed to fix this. Welp. Sorry... Here's exactly what I did. Hurray for despe...
994,020
I am using visual web developer express 2008 for one of my personal projects. I am looking for a source safe or similar product that is free and that can integrate with visual web developer 2008. Please let me know if you know any products. Thanks, sridhar.
2009/06/14
[ "https://Stackoverflow.com/questions/994020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54429/" ]
As far as I know, extension points allowing for such integration are unavailable in VWD. That's the price for using free Express version... In your place I would use Subversion and Tortoise SVN, which is quite convenient, even though you'll need to manage your source control in Explorer windows, not in VWD. For some t...
There's simply nothing better then **Subversion**. Take a look at the article on how to set it up and integrate with Visual Web Developer Express 2008 [Subversion with Visual Studio 2008](http://incsharp.blogspot.com/2007/11/subversion-visual-studio-2008.html)
33,934,389
I have some trouble with grouping the data by the order number and aggregating the "support columns" while selecting always the "highest" value. ``` ╔═════════════╦══════════════╦════════════════╗ ║ OrderNumber ║ PhoneSupport ║ ServiceSupport ║ ╠═════════════╬══════════════╬════════════════╣ ║ 0000000001 ║ 0020 ...
2015/11/26
[ "https://Stackoverflow.com/questions/33934389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5607537/" ]
Use `GROUP BY`, do `MAX` on the columns you want the "highest" value for. ``` select OrderNumber, max(PhoneSupport), max(ServiceSupport) from tablename group by OrderNumber ```
You can use `Group By` and `Max` and then wrap the query in parent to do `Order By` on aggregate columns. Example shown below. ``` select * from ( select OrderNumber, max(PhoneSupport) as PhoneSupport, max(ServiceSupport) as ServiceSupport from tablename group by OrderNumber) aa Order By aa.PhoneSupport ...
44,402,590
``` func numberOfSections(in collectionView: UICollectionView) -> Int { return 1 } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return interests.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt cellForItemAtindexPath: IndexP...
2017/06/07
[ "https://Stackoverflow.com/questions/44402590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8122887/" ]
Correct your method signature as Swift ``` func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell ``` Objective c ``` - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath; ``...
Change to this: ``` func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCellWithReuseIdentifier(Storyboard.CellIdentifier, forIndexPath:indexPath) as! InterestCollectionViewCell cell.interest = self.inte...
3,170,539
I was given an unconventional combinatorics question I was struggling with. Suppose we have 4 books and 7 different bookshelves. In how many ways the books can be arranged without loss of generality? I can either put all 4 of them on 1 shelf, or either split each one in a different shelf. In a case such as that, how d...
2019/04/01
[ "https://math.stackexchange.com/questions/3170539", "https://math.stackexchange.com", "https://math.stackexchange.com/users/459400/" ]
(Assume all books and shelves identical) So you can have $(4,0,...,0)$ - 7 ways to choose which shelf this is $(3,1,0,...,0)$ - 42 ways to choose the two shelves i.e. 6\*7 $(2,2,0,...,0)$ - 7C2 ways to choose the two shelves (i.e. 6\*7/2) $(2,1,1,0,...,0)$ - 7\*(6C2) $(1,1,1,1,0,...,0)$ - 7C4 Now add all of these...
Each book can be put into $7$ different book shelves. So the total number of ways is $7^4.$
23,355,252
Saw a sweet video on gcloud and wanted to give it a shot but was stymied at the start. I did the setup, downloaded the tools, ran gcloud auth login, all good. Tried to init a project and got an error I'm not sure how to fix. ``` $ gcloud init my-awesome-project-555 Initialized gcloud directory in [/Users/freddy/my-awe...
2014/04/29
[ "https://Stackoverflow.com/questions/23355252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3583700/" ]
The integration between gcloud auth and git only works for git clients version 1.8 and up. Please try updating your git client and try again. We will add a more clear error message for this in a future release. Thanks!
The 403 indicates that you do not own my-awesome-project-555. You can use the cloud console (<https://console.developers.google.com/project>) to create a new project, and use that project ID with 'gcloud init'.
5,658,702
I am trying to write a ruby script that interacts with a PostgreSQL database. I am trying to piece together how to do this from the documentation, but a nice tutorial or sample code would work wonders to decrease the amount of time to get this working. If anyone has a link, some tips or has some code they could share I...
2011/04/14
[ "https://Stackoverflow.com/questions/5658702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/638529/" ]
Please be more specific about what postgresql library you're using. I'm going to assume the 'pg' gem, apart from ActiveRecord. The project source has an html file that might be helpful. Go to <https://bitbucket.org/ged/ruby-pg/src/b477174160c8/doc/postgres.html> Then click "raw" at the upper right side of the html. O...
You only need to require the `pg` gem and establish the connection to the DB: ``` require 'pg' # require 'active_record' # uncomment for not Rails environment ActiveRecord::Base.establish_connection(:adapter => "postgresql", :username => "username", ...
10,194
If I want to make an XML sitemap for my site, do I need to map every forum topic in my forum as a separate URL? If this would help, how do you deal with the hugeness of the sitemap for forums with over 100,000 urls? Or is it just meant to map entry pages to the rest of your content? And can you semantically nest URLS...
2011/03/07
[ "https://webmasters.stackexchange.com/questions/10194", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/5727/" ]
@Tom For a forum I would make sure to filter off (both in analysis and output filters) e.g. user profile pages and similar. Only include real discussion topics/pages. @Gaurav The max URLs per XML sitemap file is 50,000 URLs / 10 MB (but some tools may default to less per sitemap file) You can configure tools like A1 S...
Third party apps basically rely on page crawling for generating sitemaps. They are bound to miss out a good chunk of URL's. I'll suggest that you code up a small script which generates an XML sitemap by iterating over your CMS's database. If you have more than 10,000 URL's, you'll need to generate partial sitemaps and ...
22,765,756
I have an array something like this: ``` [ {id: 5, attr: 99}, {id: 7, attr: null}, {id: 2, attr: 8}, {id: 9, attr: 3}, {id: 4, attr: null} ] ``` What would be the most efficient to put all objects with `attr === null` at the beginning of the array, without changing order of other elements in the ...
2014/03/31
[ "https://Stackoverflow.com/questions/22765756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1008798/" ]
Could used built in filter methods that require two loops or one while loop to find the elements and remove them. ``` var x = [ {id: 5, attr: 99}, {id: 7, attr: null}, {id: 2, attr: 8}, {id: 9, attr: 3}, {id: 4, attr: null} ]; var temp = []; for(var i = x.length-1;i>=0;i--){ if (x[i].attr===nu...
Grab the objects where `attr === null`. ``` var withNull = arr.filter(function (el) { return el.attr === null }); ``` Grab the objects where `attr !== null`. ``` var withVal = arr.filter(function (el) { return el.attr !== null }); ``` Add the 'null array' to the front of the 'values array'. ``` withVal.unshift.a...
34,072,910
There are many different techniques to disable unused variable warnings. Some with void, same with attribute. They all though assume that you know that it is a variable. I have a case of macro that changes its behavior from release and debug, say: ``` #if NDEBUG #define MACRO(X) #else #define MACRO(X) do_something(X)...
2015/12/03
[ "https://Stackoverflow.com/questions/34072910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1870790/" ]
Your divs are getting skewed additionally, as you didn't close the ones before. Close the divs: ``` <div id="para"> <div class="parallelogram-1"></div> <div class="parallelogram-1"></div> <div class="parallelogram-1"></div> </div> ```
You did not close your divs. Also if you wanted them to be side by side, make them inline-block or they will be each block on its own line. HTML: ``` <div id="para"> <div class="parallelogram-1"></div> <div class="parallelogram-1"></div> <div class="parallelogram-1"></div> </div> ``` CSS: ``` .parallelogram-...
6,185,016
I generate my jqgrid from model class which I pass into view. I get constructed and working jqgrid. However, I want to set postData on one view, where I use jqGrid, from script in that view, after I call helper for creating jqgrid, without having to change whole partial view which creates jqgrid. I tried running ```...
2011/05/31
[ "https://Stackoverflow.com/questions/6185016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/408643/" ]
You didn't include the definition of jqGrid in your question and we can't see **the place** where the `setGridParam` is called. First of all you should use `setGridParam` **after** the jqGrid is created, but **before** the request will be sent. If you will change the `postData` **the next** jqGrid request can use the n...
``` $("#grid id").setGridParam({ postData: {data:dataval} }); $("#grid id").trigger('reloadGrid', [{page:1,data:dataval}]);ntn ```
249,953
Often on advertising material, one will see instructions to "quote *(phrase)* for a discount", for example when booking a hotel or other service. [Examples here](https://skillsmatter.com/conferences/6712-droidcon-2015#venue), [here](http://www.theadvisory.co.uk/online-estate-agents.php) [and here](http://www.bath.ac.uk...
2015/06/02
[ "https://english.stackexchange.com/questions/249953", "https://english.stackexchange.com", "https://english.stackexchange.com/users/1572/" ]
If you are booking or purchasing online, there is usually a place to enter a discount code. If you are doing so by phone or in person, they will often ask if you have any discounts. If not, simply say that you have a discount code, say where you found it, and either say it or show the clerk a copy.
In US usage, the phrase *mention [code, term, or phrase] when ordering for a x% discount* is often seen. When filling out an online form, the phrase *enter [code, term, or phrase] in the **Discount Code** box/field* is common.
37,000,416
I know how to redirect/rewrite non-www to www using .htaccess in apache server. But I have no clue, about s3 bucket, and CloudFront. I have hosted the website on an s3 bucket using CloudFront. How do I redirect all <http://example.com/> requests to <http://www.example.com>
2016/05/03
[ "https://Stackoverflow.com/questions/37000416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6285054/" ]
There is a feature in S3 where you can to this. Select a bucket, in **Properties** under **Static Web Hosting** select **Redirect all requests to another host name**. Read more here: <https://aws.amazon.com/blogs/aws/root-domain-website-hosting-for-amazon-s3/> Update from comment: Add a cname in your domain setup for...
1. Create a `www.example.com` S3 bucket and place all the code in this bucket 2. Create a `example.com` S3 bucket and set redirect to `www.example.com` as mentioned in <https://aws.amazon.com/blogs/aws/root-domain-website-hosting-for-amazon-s3/> 3. Create CloudFront and configure with S3 bucket link of `www.example.com...
8,063,287
Hello fellow developers! We are almost finished with developing first phase of our ajax web app. In our app we are using hash fragments like: ``` http://ourdomain.com/#!list=last_ads&order=date ``` I understand google will fetch this url and make a request to the server in this form: ``` http://ourdomain.com/?_esc...
2011/11/09
[ "https://Stackoverflow.com/questions/8063287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484025/" ]
Your forgot QSA directive (everyone missed the point =D ) ``` RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$ RewriteRule ^$ /webroot/crawler.php%1 [QSA,L] ``` By the way your `$1` is well err... useless because it refers to nothing. So this should be: ``` RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$...
If I'm not mistaken. ``` RewriteCond %{QUERY_STRING} ^_escaped_fragment_=(.*)$ RewriteRule ^$ /webroot/crawler.php?%1 [L] ```
44,905,211
I need to set from the main viewmodel a property inside an observable array. I'm using the classic `pre` to debug and display the content of my observable array. By using `types.valueHasMutated()` I can see the applied changes - just only to `vm.types` (which wouldn't be the case otherwise). However, I need to see t...
2017/07/04
[ "https://Stackoverflow.com/questions/44905211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4845566/" ]
I have run this on jfiddle and even when I added a new type, I wasn't getting any update. It seems like there was an issue with the ``` '<ul data-bind="foreach: types">' + ``` I changed it to `'<ul data-bind="foreach: $root.types">' +` <https://jsfiddle.net/fabwoofer/9szbqhj7/1/> Now the type gets added but it ...
You could use this solution given by the user JotaBe: [Refresh observableArray when items are not observables](https://stackoverflow.com/a/28150736/4065876). ``` ko.observableArray.fn.refresh = function (item) { var index = this['indexOf'](item); if (index >= 0) { this.splice(index, 1); this.sp...
8,155,618
> > **Possible Duplicate:** > > [Conditional operator cannot cast implicitly?](https://stackoverflow.com/questions/2215745/conditional-operator-cannot-cast-implicitly) > > [Why does null need an explicit type cast here?](https://stackoverflow.com/questions/2608878/why-does-null-need-an-explicit-type-cast-here) ...
2011/11/16
[ "https://Stackoverflow.com/questions/8155618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1762/" ]
This is a consequence of the confluence of two characteristics of C#. The first is that C# never "magics up" a type for you. If C# must determine a "best" type from a given set of types, it always picks one of the types you gave it. It never says "none of the types you gave me are the best type; since the choices you ...
The problem is that the right hand side of the statement is evaluated without looking at the type of the variable it is assigned to. There's no way the compiler can look at ``` suppressLogging ? new SuppressLogger() : new ConsoleLogger(); ``` and decide what the return type should be, since there's no implicit co...
38,149,745
I've searched a lot but I didn't find any anwser to my issue. I recently discovered JNativeHook and I use it to bring to the foreground an application window when I click on a key, even if the application has not the focus. Everything works good when I use keys like "a" or "f" but what I want is to use the "left-home"...
2016/07/01
[ "https://Stackoverflow.com/questions/38149745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4393495/" ]
Looks like there is *no* “proper” way to do it, but we can try monkey-patching our way around the problem. Here’s the best kludge I could do: ``` from mpl_toolkits.mplot3d import proj3d def make_get_proj(self, rx, ry, rz): ''' Return a variation on :func:`~mpl_toolkit.mplot2d.axes3d.Axes3D.getproj` that m...
Have you tried stretching your canvas in the vertical direction? For instance, ``` plt.figure(figsize=(5,10)) ``` or something similar should give you more space. I am not sure, though, if that will solve your problem.
38,949
I am trying to understand how SSL certificate and signing and the chain of trust works. I know about `root CAs` and that they are used to sign `intermediate CAs` that sign the end certificates that are issued to a website. I also understand how the chain of trust works and that because a ceritifcate signed for `X.com`...
2013/07/15
[ "https://security.stackexchange.com/questions/38949", "https://security.stackexchange.com", "https://security.stackexchange.com/users/28286/" ]
In order to be accepted as an issuer for other certificates, a CA certificate must be marked as such: they must contain a [`Basic Constraints` extension](https://www.rfc-editor.org/rfc/rfc5280#section-4.2.1.9) with the `cA` flag set to `TRUE`. If a client (e.g. a Web browser) sees a purported server certificate chain, ...
> > How long does this chain extend? > > > There is no specified limit, but clients (browsers, mail programs, etc) may have some internal limit as to how many hops they're willing to follow. > > Can't I use X.com to sign a certificate for another domain, say Y.com. If no, why not? If yes, I don't see the purpo...
705,857
I want to do some calendar manipulations in bash - specifically, I want to figure out the last date of a given month (including leap-year, and a preparing a table for a lookup is not a valid solution for me). Supposedly I have the following code: ``` $year=2009 $start_month=2 $end_month=10 for $month in $(seq $start_...
2009/04/01
[ "https://Stackoverflow.com/questions/705857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53538/" ]
Try: `date -d 'yesterday 2009-03-01'` Intuitive I know. Earlier versions of date used to work the POSIX way.
If you don't mind playing with grep/awk/perl, you can take a look at `cal`. ``` $ cal 4 2009 April 2009 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ``` Edit (MarkusQ): To atone for my joke solution below I'll contribute to yours: ``` ...
45,826,243
I have a table in SAS where in one column, the date is stored (e.g. "2005/10"). How do I have to convert this to a SAS data format? Among many other tries, I tried this code: data test; ``` format date YYMMS.; date = input(ObservationMonth, YYMMS.); put date=date9.; run; ```
2017/08/22
[ "https://Stackoverflow.com/questions/45826243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8502463/" ]
One way is to use `substr()` and `mdy()` to extract the date components: ``` data _null_; ObservationMonth ="2005/10"; date =mdy(substr(ObservationMonth,6,2),1,substr(ObservationMonth,1,4)); put date = date9.; run; ``` Another option is to use the `anydtdte` informat (note that results may differ depending on ...
you're fantastic, guys! Thank you so much, with a "set" statement it works fine!