pid
int64 2.28k
41.1M
| label
int64 0
1
| text
stringlengths 1
28.3k
|
---|---|---|
36,219,946 | 0 | |
10,414,320 | 0 | <p>No, the current beta VS11 Express edition only supports creating Metro apps. Whether the RTM edition ever will support old style apps requires a crystal ball. I doubt it.</p> <p>You'll need to use the VS2010 Express edition if you want to create legacy apps.</p> |
28,050,839 | 0 | <p>See:</p> <blockquote> <p><strong>Warning</strong> If a connection opened by fsockopen() wasn't closed by the server, feof() will hang. To workaround this, see below example:</p> </blockquote> <p>On: <a href="http://php.net/feof" rel="nofollow">feof</a></p> <p>The workaround essentially waits <code>default_socket_timeout</code> and then terminates the while-loop.</p> |
2,963,306 | 0 | <p>You might want to take a look at what caused the problem in my case and how I solved it <a href="http://stackoverflow.com/questions/140303/asp-net-unable-to-validate-data/2963301#2963301">here</a>.</p> |
35,761,894 | 0 | <p>You are very confused about python data structures, you can't have keys in lists, you don't need a list of dictionaries with only one key. So assuming what you really want is a dictionary where keys are the portfolio, and value is a dictionary of the sum of <code>buy</code> and <code>sell</code> as separate values:</p> <pre><code>>>> results = {} >>> for t in my_list: ... trans = 'BUY' if t['trans'] > 0 else 'SELL' ... a = results.setdefault(t['portfolio'], {'BUY':0, 'SELL':0}) ... a[trans] += t['trans'] >>> results {'ABC': {'BUY': 0, 'SELL': 0}, 'XYZ': {'BUY': 0, 'SELL': 0}} </code></pre> |
6,571,548 | 0 | I get a SocketTimeoutException in Jsoup: Read timed out <p><br /> I get a SocketTimeoutException when I try to parse a lot of HTML documents using Jsoup.<br />For example, I got a list of links :</p> <pre><code><a href="www.domain.com/url1.html">link1</a> <a href="www.domain.com/url2.html">link2</a> <a href="www.domain.com/url3.html">link3</a> <a href="www.domain.com/url4.html">link4</a> </code></pre> <p>For each link, I parse the document linked to the URL (from the href attribute) to get other pieces of information in those pages.<br />So I can imagine that it takes lot of time, but how to shut off this exception?<br /> Here is the whole stack trace:</p> <pre><code>java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at java.io.BufferedInputStream.fill(Unknown Source) at java.io.BufferedInputStream.read1(Unknown Source) at java.io.BufferedInputStream.read(Unknown Source) at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source) at sun.net.www.http.HttpClient.parseHTTP(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:381) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:364) at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:143) at org.jsoup.helper.HttpConnection.get(HttpConnection.java:132) at app.ForumCrawler.crawl(ForumCrawler.java:50) at Main.main(Main.java:15) </code></pre> <p>Thank you buddies!</p> <p><strong>EDIT:</strong> Hum... Sorry, just found the solution:</p> <pre><code>Jsoup.connect(url).timeout(0).get(); </code></pre> <p>Hope that could be useful for someone else... :)</p> |
12,920,806 | 0 | <p>Yes, you should be able to use Shims with mocking frameworks. </p> |
37,846,521 | 0 | How to track the lifetime of a Drag/Drop operation? <p>I have an application which let's me drag&drop items from a modified <code>QListWidget</code> on to a modified <code>QLabel</code> using <code>startDrag()</code>, <code>dragEnterEvent()</code>, <code>dropEvent()</code>, etc.</p> <p>I now want to not only get notified, when the dragging <strong>starts</strong> but also when it get's <strong>interrupted</strong> (by pressing <code>ESC</code> or dropping somewhere in the void). (My goal is to uncover a hidden widget I can drop items on which hides again as soon as the drag operation gets interrupted.)</p> <p>I crawled the docs but find anything promising - has someone accomplished this already?</p> <p>There is a quite <a href="http://stackoverflow.com/questions/26443890/catching-drag-cancel-event-in-qt">similar question</a> already but it didn't get useful answers and it's two years old - so maybe there are some new trickies introduced by Qt5?</p> |
26,846,968 | 0 | <p>If you think about the overall operation that you are trying to perform, it is really just a Wipe-and-Replace based on what you are passing in. According to your stated rules:</p> <ul> <li>if I send parameter with CrateID = 2 and FruitID = 4, I want it to add another row (<em>assumption is that no rows exist yet for CrateID = 2</em>)</li> <li>if rows already exist for CrateID = 2: delete all records where CrateID = 2 and then add new records I am sending in parameter, don't touch another CrateIDs</li> </ul> <p>Hence, you shouldn't be using <code>MERGE</code> for this. Instead, just do:</p> <pre class="lang-sql prettyprint-override"><code>DELETE fc FROM Fruits_Crates fc WHERE fc.CrateID IN (SELECT DISTINCT tmp.CrateID FROM #FruitCrates tmp); INSERT INTO Fruits_Crates (FruitID, CrateID) SELECT tmp.FruitID, tmp.CrateID FROM FruitCrates tmp; </code></pre> <p>Or, if most of the time the number of items that match exceeds the number of items that will be removed and added, you can take a more targeted approach:</p> <pre class="lang-sql prettyprint-override"><code>CREATE TABLE #FruitCrates (FruitID INT, CrateID INT); CREATE TABLE #Fruits_Crates (FruitID INT, CrateID INT); --DELETE FROM #FruitCrates INSERT INTO #FruitCrates (CrateID, FruitID) VALUES (2, 4); INSERT INTO #FruitCrates (CrateID, FruitID) VALUES (2, 6); INSERT INTO #FruitCrates (CrateID, FruitID) VALUES (3, 26); --DELETE FROM #Fruits_Crates; INSERT INTO #Fruits_Crates (CrateID, FruitID) VALUES (1, 4); INSERT INTO #Fruits_Crates (CrateID, FruitID) VALUES (2, 4); INSERT INTO #Fruits_Crates (CrateID, FruitID) VALUES (2, 8); DELETE fc --SELECT fc.*, '--' AS [--], tmp.* FROM #Fruits_Crates fc LEFT JOIN #FruitCrates tmp ON tmp.CrateID = fc.CrateID AND tmp.FruitID = fc.FruitID WHERE tmp.CrateID IS NULL AND fc.CrateID IN (SELECT DISTINCT tmp2.CrateID FROM #FruitCrates tmp2); INSERT INTO #Fruits_Crates (FruitID, CrateID) SELECT tmp.FruitID, tmp.CrateID FROM #FruitCrates tmp LEFT JOIN #Fruits_Crates fc ON fc.CrateID = tmp.CrateID AND fc.FruitID = tmp.FruitID WHERE fc.CrateID IS NULL; SELECT CrateID, FruitID FROM #Fruits_Crates; </code></pre> <p>Output:</p> <pre class="lang-none prettyprint-override"><code>CrateID FruitID 1 4 2 4 2 6 3 26 </code></pre> <p>Result:</p> <ul> <li>Row with CrateID = 1, FruitID = 4: <strong>left alone</strong></li> <li>Row with CrateID = 2, FruitID = 4: <strong>left alone</strong></li> <li>Row with CrateID = 2, FruitID = 8: <strong>removed</strong></li> <li>Row with CrateID = 2, FruitID = 6: <strong>added</strong></li> <li>Row with CrateID = 3, FruitID = 26: <strong>added</strong></li> </ul> |
35,031,263 | 0 | <p>You can call the <a href="https://github.com/Microsoft/vso-agent-tasks/blob/master/docs/authoring/commands.md" rel="nofollow">task.servariable Logging Command</a>, which sets a variable in the variable service of taskcontext. The first task can set a variable, and following tasks are able to use the variable. The variable is exposed to the following tasks as an environment variable. Example: </p> <pre><code>##vso[task.setvariable variable=testvar;]testvalue </code></pre> |
32,503,536 | 0 | <p>This will replace all occurrence of "str" with "rep" in "src"...</p> <pre><code>void strreplace(char *src, char *str, char *rep) { char *p = strstr(src, str); do { if(p) { char buf[1024]; memset(buf,'\0',strlen(buf)); if(src == p) { strcpy(buf,rep); strcat(buf,p+strlen(str)); } else { strncpy(buf,src,strlen(src) - strlen(p)); strcat(buf,rep); strcat(buf,p+strlen(str)); } memset(src,'\0',strlen(src)); strcpy(src,buf); } }while(p && (p = strstr(src, str))); } </code></pre> |
28,614,897 | 0 | Regex Issue in Siebel application <p>I want to mask DL number when I get an email from auser. I want to use an existing reqular expression in my Siebel application. I have a regex from the existing application like this:</p> <pre><code>([\s.,:])(\d{7,9})([\s.,:]) </code></pre> <p>This expression is masking all the charcters in the DL number. But I want to display only the last 4 digits in the DL number.Could you please help me to complete the functionality?</p> <p>The above expression is masking 7, 8, and 9-digit numbers. I would like to display only the last 4 digits.</p> |
17,047,519 | 0 | <p>Django relations model exposes (and documents) only <em>OneToOneField</em>, <em>ForeignKey</em> and <em>ManyToManyField</em>, which corresponds to the inner</p> <ul> <li><strong>OneToOneField</strong> -> <strong>OneToOneRel</strong></li> <li><strong>ForeignKey</strong> -> <strong>ManyToOneRel</strong></li> <li><strong>ManyToManyField</strong> -> <strong>ManyToManyRel</strong></li> </ul> <p>See source of <em>django.db.models.fields.related</em> for further details.</p> |
40,503,235 | 0 | <p>To take a random (pseudorandom, to be accurate) number, you can use <code>Rnd</code> function. It gives you a value in range form 0 to 1. To get some particular number from range, you can <a href="https://www.techonthenet.com/excel/formulas/rnd.php" rel="nofollow noreferrer">use this solution</a>. So, to get a random number from your range of row 2 to last , you can do for example:</p> <pre><code>Dim LastRow As Long, rRow As Long LastRow = Range("A" & Rows.Count).End(xlUp).Row ' Last row based on column A rRow = Int((LastRow - 2 + 1) * Rnd + 2) </code></pre> <p>Now you need to take this 15 times, and be sure that you wont get the same row multiple times. We can use array, and store row numbers inside. Unfortunately, VBA has no function to check if some particular value is inside. We to do it by looping through the values. </p> <pre><code>Dim LastRow As Long, rRow As Long Dim rowArr(14) As Long Dim found As Boolean LastRow = Range("A" & Rows.Count).End(xlUp).Row For i = 0 To 14 rRow = Int((LastRow - 2 + 1) * Rnd + 2) found = False If i > 0 Then For j = i - 1 To 0 Step -1 If rowArr(j) = rRow Then found = True Next j End If If found Then i = i - 1 Else rowArr(i) = rRow End If Next i </code></pre> <p>No we have to check, if sum of values in random rows are equal to 12, and if not, loop the whole process. The whole thing will look like:</p> <pre><code>Dim LastRow As Long, rRow As Long Dim rowArr(14) As Long Dim found As Boolean, mainCriterium As Boolean Dim sumOfValues As Double mainCriterium = False Do While mainCriterium = False LastRow = Range("A" & Rows.Count).End(xlUp).Row For i = 0 To 14 rRow = Int((LastRow - 2 + 1) * Rnd + 2) found = False If i > 0 Then For j = i - 1 To 0 Step -1 If rowArr(j) = rRow Then found = True Next j End If If found Then i = i - 1 Else rowArr(i) = rRow End If Next i For i = 0 To 14 sumOfValues = sumOfValues + Range("G" & rowArr(i)).Value Next i If sumOfValues = 12 Then mainCriterium = True Loop </code></pre> <p>When loop will end, you gonna have array <code>rowArr</code> containing 15 rows, which sum of values in column G is equal to 12.</p> |
22,087,308 | 0 | Error in Insert a Products wth CSV in magento <p>I have a a csv files for insert a products in magento. but there are problem with inserting a products description. In description cell when the code started it stop the insertion of data. Please give me a solution to solve this problem.</p> |
37,001,358 | 0 | <p>According to <a href="http://facebook.github.io/react/docs/component-api.html#setstate" rel="nofollow">React's setState doc</a>:</p> <blockquote> <p>Performs a shallow merge of nextState into current state</p> </blockquote> <p>This means you should provide a valid <code>nextState</code> object as argument to the method. <code>{info.merchandise.label: "New Label"}</code> is not syntactically correct, that's why you get an error.</p> <blockquote> <p>Treat this.state as if it were immutable.</p> </blockquote> <p>This simply means that if you want to change some property inside the state object, you should not mutate it directly, but replace it with a new object containing the modification instead.</p> <p>In your case, the state object contains several nested objects. If you want to modify a "leaf" object's property, you'll also have to provide new objects for every containing object up the tree (because each of them have a property that changes in the process). Using <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign" rel="nofollow">Object.assign()</a> to create new objects, you could write:</p> <pre><code>// new "leaf" object: const newMerchandise = Object.assign({}, this.state.info.merchandise, {label: "New Label"}); // new "parent" object: const newInfo = Object.assign({}, this.state.info, {merchandise: newMerchandise}); // new state ("parent") object: const newState = Object.assign({}, this.state, {info: newInfo}); // eventually: this.setState(newState); </code></pre> <p>By the way, you'll notice that it's easier to handle the state object when its structure tends to be "flat" rather than "deeply nested".</p> |
5,683,349 | 0 | <p>DSCS have a better story (generally) than centralized systems for offline or slow networks. They tend to be faster, which is really noticable for developers (using TDD) who do lots of check-ins.</p> <p>Centralized systems are somewhat easier to grasp initially and might be a better choice for less experienced developers. DVCSes allow you to create lots of mini-branches and isolate new features while still doing red-gree-refactor checkin on green style of coding. Again this is very powerful but only attractive to fairly savvy development teams.</p> <p>Having a single central repository for support for exclusive locks makes sense if you deal with files that are not mergable like digital assets and non-text documents (PDFs and Word etc) as it prevents you getting yourself into a mess and manually merging.</p> <p>I don't think the number of developers or codebase size plays into it that much, both systems have been show to support large source trees and numbers of committers. However for large code bases and projects DVCS gives a lot of flexibility in quickly creating decentralized remote branches. You can do this with centralized systems but you need to be more deliberate about it which is both good and bad.</p> <p>In short there are some technical aspects to consider but you should also think about the maturity of your team and their current process around SCCS.</p> |
7,719,501 | 0 | DynamicJasper (DJ) is an open source free library that hides the complexity of Jasper Reports. |
30,467,476 | 0 | <p>Not sure that got you right, but something similar I've done with:</p> <pre><code>pager.setClipToPadding(false); pager.setPadding(50, 0, 50, 0); </code></pre> <p><strong>UPD.</strong> </p> <p><a href="https://github.com/JakeWharton/ViewPagerIndicator" rel="nofollow">ViewPager indicator</a></p> <p>In order to scale not visible fragments, try to use <strong>setOnPageChangeListener</strong>, and scale <em>position - 1</em> and <em>position + 1</em> fragment's view. <a href="http://stackoverflow.com/questions/8785221/retrieve-a-fragment-from-a-viewpager">Here</a> how to take reference on fragment from ViewPager.</p> |
4,398,809 | 0 | POSTing JSON to WCF REST Endpoint <p>I'm working on implementing PUT, POST, and DELETE for my service. But every time I try to send some json up to the server, get the error 'Cannot create an abstract class.' I generated my request data by running an instance of my object through a <code>DataContractJsonSerializer</code>, adding the __type field, and wrapping it in {"obj": <em>mydata</em>}. </p> <p>I can run this back through a <code>DataContractJsonSerializer</code> that expects a BaseObj and it works fine:</p> <pre><code> {"__type":"RepositoryItem:http:\/\/objects\/","Insert_date":null,"Modified_date":null,"insert_by":null,"last_modify_user_id":null,"modified_by":null, "external_id":"1234","internal_id":54322,"school_id":45,"type_name":0, "vendor_id":57} </code></pre> <p>My service contract is decorated with a <code>ServiceKnownType</code> attribute with the <code>RepositoryItem</code> and <code>BaseObj</code> included in the list.</p> <p>I'm POSTing using jquery</p> <pre><code> $.ajax({ type: "POST", url: "http://localhost/slnSDK/service.svc/create/repositoryitem.json?t=" + token, data: data, success: function(result) { $("#input").html(result); }, error: function(xhr, result, err) { $("#htmloutput").html(xhr.responseText); }, dataType: "json", contentType: "application/json" }); </code></pre> <p>I have the following endpoint exposed:</p> <pre><code><OperationContract(Action:=Api2Information.Namespace & "createJson")> _ <WebInvoke(Method:="POST", _ BodyStyle:=WebMessageBodyStyle.Bare, _ RequestFormat:=WebMessageFormat.Json, _ responseFormat:=WebMessageFormat.Json, _ UriTemplate:="/create/{objType}.json?t={token}")> _ Function createJson(ByVal objType As String, ByVal obj As BaseObj, ByVal token As String) As Integer </code></pre> <p>And the following objects (IBaseObj was omitted as it can be inferred by its implementor)</p> <pre><code><DataContract(Namespace:="http://objects/")> _ Public Class RepositoryItem : Inherits BaseObj ' members backing properties have been omitted. Public Sub New() ... <DataMember()> _ Public Property type_name() As eType ... ' Override this to expose it as a property on the WebAPI <DataMember()> _ Public Overrides Property internal_id() As Integer? ... <DataMember()> _ Public Property external_id() As String ... <DataMember()> _ Public Property vendor_id() As Integer ... End Class <DataContract(Namespace:="http://objects/")> _ <Serializable()> _ Public MustInherit Class BaseObj : Implements IBaseObj ' members backing properties have been omitted. <DataMember()> _ Public Overridable Property insert_by() As String Implements IBaseObj.Insert_by ... <DataMember()> _ Public Overridable Property Insert_date() As Nullable(Of Date) Implements IBaseObj.Insert_date ... <DataMember()> _ Public Overridable Property modified_by() As String Implements IBaseObj.Modified_by ... <DataMember()> _ Public Overridable Property Modified_date() As Nullable(Of Date) Implements IBaseObj.Modified_date ... <DataMember()> _ Public Overridable Property last_modify_user_id() As Nullable(Of Integer) Implements IBaseObj.Last_modify_user_id ... End Class </code></pre> <p>Fiddler output from POST:</p> <pre><code>POST http://localhost/slnSDK/service.svc/create/repositoryitem.json?t= HTTP/1.1 Host: localhost Connection: keep-alive Referer: http://localhost/apitest.html Content-Length: 265 Origin: http://localhost X-Requested-With: XMLHttpRequest Content-Type: application/json Accept: application/json, text/javascript, */*; q=0.01 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) RockMelt/0.8.36.79 Chrome/7.0.517.44 Safari/534.7 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 Cookie: ASP.NET_SessionId=ywyooz45mi3c4d55h4ld4bec; x=lHOtsYBHvS/fKE7JQWzFTw==; y=XhfNVfYYQynJrIZ/odWFOg== {"obj":{"__type":"RepositoryItem:http:\/\/objects\/","Insert_date":null,"Modified_date":null,"insert_by":null,"last_modify_user_id":null,"modified_by":null, "external_id":"1234","internal_id":54322,"school_id":45,"type_name":0, "vendor_id":57}} </code></pre> <p>Any help you can provide would be great. Thanks!</p> |
3,325,588 | 0 | Mixed mode assembly not loading symbol for native C++ pdbs <p>I am working with mixed mode assemblies in C++/CLI. All managed mode assembled pdb's get loaded when successfully in mixed mode assembly, but native dll's and pdb's are not getting loaded even though the information of native pdb's is shown in the Modules pane (i.e. in VS Debug->Windows->Modules).</p> <p>I am using native dll and calling its exported function in mixed assembly in C++/CLI code. Here, functions get called successfully, but native pdb symbols are not loading and all breakpoints in the native code are shown as hollow circle and tool tips says there are no symbols loaded for this.</p> <p>I have done everything, pdb placed in current directory to where the managed process is launched; deleted all obj and debug folders and recompiled every project at the same time; I even used the ChkMatch utility which shows that the symbols in the Exe and corresponding pdb match.</p> <p>Is there any way to enable breakpoints of native code while calling from managed (C++/LCI Mixed mode) code?</p> <p>Regards,</p> <p>Usman</p> |
13,595,126 | 0 | Php, traffic catcher <p>I'm starting up an image hosting website which also offers pay per view, for example upload an image and it get 1000 views you get $2.00 something along those lines. The only issue I have is that I want to be able to view the traffic per image and what I.P address were used to view the image. </p> <p>So someone accesses my site they upload an image using a file form input field it then returns a link e.g - domain.com/image.png what could I add to my code so that some sort of tracking is added to each new image thats uploaded. </p> <p>I will be greatful for any ideas I get!</p> <p>THANKS </p> |
33,498,036 | 0 | <p>Your compile SDK version must match the support library's major version.</p> <p>Since you are using version 23 of the support library, you need to compile against version 23 of the Android SDK.</p> <pre><code>android { compileSdkVersion 23 buildToolsVersion "23.0.1" } </code></pre> |
32,794,254 | 0 | App Crashes On Calling Webview Loadurl method inside switch <p>my app contains a fragment with a webview and a edit text.i have a navigation drawer with 3 choices and use a switch condition to handle selection,on 3 selections i update the same webview with different html files using the foolowing code ..but my app crashes..</p> <pre><code>@Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments Fragment fragment; switch (position) { case 0: WebView wv = (WebView) findViewById(R.id.webView); wv.loadUrl("file:///android_asset/src/web.html"); //app crashes fragment = getFragmentManager().findFragmentByTag(WebFragment.TAG); if (fragment == null) { fragment = new WebFragment(); } getFragmentManager().beginTransaction().replace(R.id.container, fragment, WebFragment.TAG).commit(); break; case 1: fragment = getFragmentManager().findFragmentByTag(WebFragment.TAG); if (fragment == null) { fragment = new WebFragment(); } getFragmentManager().beginTransaction().replace(R.id.container, fragment, WebFragment.TAG).commit(); break; case 2: fragment = getFragmentManager().findFragmentByTag(WebFragment.TAG); if (fragment == null) { fragment = new WebFragment(); } getFragmentManager().beginTransaction().replace(R.id.container, fragment, WebFragment.TAG).commit(); break; } } </code></pre> <p>my logcat logs <a href="http://pastebin.com/snbzASTq" rel="nofollow">http://pastebin.com/snbzASTq</a></p> <p>please provide a workaround for this</p> |
16,046,353 | 0 | <p>Well I think that an answer for your question exists somewhere in <a href="http://technet.microsoft.com/en-us/library/cc754361%28v=ws.10%29.aspx" rel="nofollow">Microsoft documentation</a>.</p> <p>Active-Directory is a bit more more than a common LDAP Directory like OpenLDAP or Oracle Directory Server Enterprise Edition (formerly SUN Directory Server Enterprise Edition). It's a "<strong>System</strong> Directory". The main difference with a simple Directory is that it's built in with a Microsoft specific "Schema" and a security infrastructure with "Kerberos". So installing AD is the same as promoting a server in a "Domain controler". In other words you can use the AD for your own usage, but his first usage is for the "System" (Domain) security.</p> <p>ADLDS is the most recent name for an old product called ADAM (Active Directory Application Mode). As you can guess, this Directory can be created just for the usage of your own application, you can build the Schema you want, you can install it on a Worksation or a server, it exists version that you can redistribute with your own application.</p> |
12,862,550 | 0 | <p>HA got it. This was strange. Maybe it was a fluke and it just kicked in, but this worked for me:</p> <p>Turns out the test account and the publisher account were tied to the same credit card on checkout. Changing it on the test account fixed it up. Grrrrr.</p> |
33,814,392 | 0 | <p>Following the tip by @Tomasz Kowalczyk using the example xaml <a href="https://forums.xamarin.com/discussion/34798/how-to-add-global-background-color-style" rel="nofollow">from this rather incomplete post</a>:</p> <p>In app.xaml ResourceDictionary put this style:</p> <pre><code><Style x:Key="defaultPageStyle" TargetType="ContentPage"> <Setter Property="BackgroundColor" Value="#f8f8f8"/> </Style> </code></pre> <p>The base class is called <code>BaseContentPage</code></p> <pre><code>public class BaseContentPage : ContentPage { public BaseContentPage() { var style = (Style)Application.Current.Resources["defaultPageStyle"]; Style = style; } } </code></pre> <p>Then to tie it all together in each xaml.cs class:</p> <pre><code>namespace MyNamespace { public partial class MyXamlPage: BaseContentPage </code></pre> <p>And .xaml file</p> <pre><code><local:BaseContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:MyNamespace;assembly=MyNamespace" x:Class="MyNamespace.MyXamlPage" </code></pre> |
19,860,475 | 0 | <p>you can add comma from second emailid onwards. </p> <pre><code>for (int i = 0; i < dataGridView1.Rows.Count; i++) { if(i>0) sendto.text +=","+ dataGridView1.Rows[i].Cells[3].Value.ToString()); else sendto.text = dataGridView1.Rows[i].Cells[3].Value.ToString()); } </code></pre> |
2,762,317 | 0 | <p>The problem was that I was using <%= %> (or even <%: %>) within a tag that had runat="sever". </p> |
2,018,786 | 0 | <p>In C, the <code>sizeof</code> operator does not evaluate its argument. This allows one to write code that looks wrong but is correct. For example, an idiomatic way to call <code>malloc()</code>, given a type <code>T</code> is:</p> <pre><code>#include <stdlib.h> T *data = NULL; data = malloc(sizeof *data); </code></pre> <p>Here, <code>*data</code> is not evaluated when in the <code>sizeof</code> operator (<code>data</code> is <code>NULL</code>, so if it were evaluated, Bad Things would happen!).</p> <p>This allows one to write surprising code, to newcomers anyway. Note that no one in their right minds would actually do this:</p> <pre><code>#include <stdio.h> int main() { int x = 1; size_t sz = sizeof(x++); printf("%d\n", x); return 0; } </code></pre> <p>This prints <code>1</code>, not <code>2</code>, because <code>x</code> never gets incremented.</p> <p>For some <em>real</em> fun/confusion with <code>sizeof</code>:</p> <pre><code>#include <stdio.h> int main(void) { char a[] = "Hello"; size_t s1 = sizeof a; size_t s2 = sizeof ("Hi", a); printf("%zu %zu\n", s1, s2); return 0; } </code></pre> <p>(The confusion is only if one is confused about arrays, pointers, and operators.)</p> |
25,506,723 | 0 | <p>You have <a href="http://en.wikipedia.org/wiki/Object_slicing" rel="nofollow">slicing</a>:</p> <p>You should use <code>std::stack<Z*></code> or <code>std::stack<std::unique_ptr<Z>></code>.</p> |
26,178,773 | 0 | cocos2d-x Simulate click by coordinates <p>Using: cocos2d-x 2.1.1 I have game based on cocos2d-x, I should implement same code to this game which can tap on elements. Now I can receive and send to server all elements from scene coordinates etc...</p> <p>Now I need to click on game scene using coordinates.</p> <p>I tried with create <code>CCLayer</code> over game scene and call <code>ccTouchesBegan</code> function with coordinates, but elements which placed under this <code>CCLayer</code> never receive touch event.</p> <p>Is it possible to simulate click by coordinates without change game source?</p> <p>A lot of thanks</p> |
33,109,530 | 0 | <p>In order to make an ajax request when the session is invalidated you can implement a custom authenticator and override the <code>invalidate</code> method: <a href="http://ember-simple-auth.com/ember-simple-auth-api-docs.html#SimpleAuth-Authenticators-Base-invalidate" rel="nofollow">http://ember-simple-auth.com/ember-simple-auth-api-docs.html#SimpleAuth-Authenticators-Base-invalidate</a></p> |
39,679,706 | 0 | <p>Well I believe the <a href="https://github.com/strongloop/loopback/blob/v2.34.1/common/models/user.json#L37-L96" rel="nofollow">default user acls</a> are still working and they are not overrided. The way loopback decides which ACL entry is effective for the request, is by selecting most specific one that appears later. So loopback has defined this entry:</p> <pre><code>{ "principalType": "ROLE", "principalId": "$everyone", "permission": "ALLOW", "property": "login" } </code></pre> <p>Since it's as specific as it gets, to beat that you have to add this in your model:</p> <pre><code>{ "principalType": "ROLE", "principalId": "$everyone", "permission": "DENY", "property": "login" } </code></pre> <p>There's also another way to remove the default user acls via code but it's not documented.</p> |
37,312,209 | 0 | <p>OK, so I had tried all of your guys suggestions which I had were part of the issue, the final issue turned out to that I needed to add my images to the drawable-xhdpi. Thanks for all your help.</p> |
4,054,833 | 0 | <p>Create an imaginary grid at whatever resolution is suitable for your problem: As coarse grained as possible for good performance but fine-grained enough to find (desirable) gaps between obstacles. Your grid might relate to a quadtree with your obstacle objects as well.</p> <p>Execute A* over the grid. The grid may even be pre-populated with useful information like proximity to static obstacles. Once you have a path along the grid squares, post-process that path into a sequence of waypoints wherever there's an inflection in the path. Then travel along the lines between the waypoints.</p> <p>By the way, you do not need the actual distance (c.f. your mention of Pythagorean theorem): A* works fine with an <em>estimate</em> of the distance. Manhattan distance is a popular choice: <code>|dx| + |dy|</code>. If your grid game allows diagonal movement (or the grid is "fake"), simply <code>max(|dx|, |dy|)</code> is probably sufficient.</p> |
16,051,265 | 0 | <p>Not quite one line, but will work</p> <pre class="lang-none prettyprint-override"><code>$ cat votes.txt Colorado Obama 50 Colorado Romney 20 Colorado Gingrich 30 Florida Obama 60 Florida Romney 20 Florida Gingrich 30 </code></pre> <p>script</p> <pre><code>while read loc can num do if ! [ ${!can} ] then cans+=($can) fi (( $can += num )) done < votes.txt for can in ${cans[*]} do echo $can ${!can} done </code></pre> <p>output</p> <pre class="lang-none prettyprint-override"><code>Obama 110 Romney 40 Gingrich 60 </code></pre> |
3,113,490 | 0 | <p>First solution (seen in CSS-tricks website): use relative positioning like</p> <pre><code>.ratingstar:hover img, .ratingstar:focus img { position: relative; bottom: 3px; } </code></pre> <p>Second solution: play with padding-bottom going from 3 to 0px when margin-bottom goes from 0 to 3px, if your design permits it.<br> edit: It could also be border-top or bottom (same color as your background, if it isn't a gradient or image but a unique color)</p> |
11,131,034 | 0 | <p>You can set option async of ajax to false to wait for the reply from server. Therefore, the code may be like the below.</p> <pre><code>function checkAnswer(question, answer){ result = false; jQuery.ajax({ async: false, url: window.base_url+'ajax/check_answer/'+question+'/'+answer+'/', success: function(data){ result = data.success if (!data.success){ jQuery('.question',base).html(data.message); } } }); return result; } </code></pre> |
17,306,361 | 0 | <p>The CPAN module <a href="https://metacpan.org/module/GSULLIVAN/YAPE-Regex-Explain-4.01/Explain.pm">YAPE::Regex::Explain</a> can be used to parse and explain Perl regexes that you don't understand. Here is the output for your first regex:</p> <pre><code>(?-imsx:^(\d+)_[^,]+,"",(.+)"NR"(.+)"0","","") matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- \d+ digits (0-9) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- _ '_' ---------------------------------------------------------------------- [^,]+ any character except: ',' (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ,"", ',"",' ---------------------------------------------------------------------- ( group and capture to \2: ---------------------------------------------------------------------- .+ any character except \n (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \2 ---------------------------------------------------------------------- "NR" '"NR"' ---------------------------------------------------------------------- ( group and capture to \3: ---------------------------------------------------------------------- .+ any character except \n (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \3 ---------------------------------------------------------------------- "0","","" '"0","",""' ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- </code></pre> <p>You can use the module to parse your second regex as well (I won't dump it here since the explanation will be very long and very redundant.) But if you want to give it a shot, try this:</p> <pre><code>use strict; use warnings; use YAPE::Regex::Explain; my $re = qr/^[^_]+_[^,]+,"([\d\/]+)","[^"]+","[^"]+","[^"]+","[^"]+","[^"]+", "[^"]+","[^"]+","[^"]+","[^"]+","[^"]+","[^"]+","[^"]+",.+/x; print YAPE::Regex::Explain->new( $re )->explain; </code></pre> |
32,394,726 | 0 | AssertionError when unit testing an annotation processor with compile-testing <p>Google's <a href="https://github.com/google/compile-testing" rel="nofollow">compile-testing</a> is a great tool when it comes to unit testing annotation processors. Unfortunately I'm currently facing the following error:</p> <pre><code>java.lang.AssertionError: An expected source declared one or more top-level types that were not present. Expected top-level types: <[test.LocalStorage]> Declared by expected file: <LocalStorageImpl.java> The top-level types that were present are as follows: - [test.LocalStorageImpl] in </SOURCE_OUTPUT/test/LocalStorageImpl.java> </code></pre> <p>My processor generates the implementation of an annotated interface. So the generated code has a dependency to the interface (<code>class LocalStorageImpl implements LocalStorage</code>).</p> <p>When I try to verify the generated code with</p> <pre><code> JavaFileObject source = /* interface definition */ JavaFileObject expected_source = /* the generated implementation */ assertAbout(javaSource()).that(source) .processedWith(new MyProcessor()) .compilesWithoutError() .and() .generatesSources(expectedSource); </code></pre> <p>...the <code>generatesSource</code> causes the error. As the error message states, it cannot resolve the interface definition.</p> <p><strong>So my question is how to compile or write the source file of the interface defined in <code>source</code>, so that it is recognized by <code>generatesSources()</code>?</strong></p> |
25,282,869 | 0 | <p>First check all outlet connection are correct or not.</p> <p>Now change if condition to <code>isFirstResponder()</code></p> <pre><code>func textFieldShouldReturn(textField: UITextField!) -> Bool { if (userNameSignUpTextField.isFirstResponder()){ userNameSignUpTextField.resignFirstResponder() passwordSignUpTextField.becomeFirstResponder() } else if(passwordSignUpTextField.isFirstResponder()) { passwordSignUpTextField.resignFirstResponder() emailSignUpTextField.becomeFirstResponder() } return true } </code></pre> <p>Hope it will help you</p> |
13,161,438 | 0 | Problems signing in with Facebook on some phones <p>I have gotten reports from some people that they cannot log into my app with Facebook. Most of the reports come from users with Samsung phones. I have asked them to reinstall both my app and the Facebook app, and try with and without the Facebook app installed but that does not seem to help. My app is using Single-Sign-On.</p> <p>I have tested with multiple Samsung phones and I have never been able to reproduce this problem. Does anyone know how this could be solved?</p> |
26,842,480 | 0 | <p>You can use this awk using <strong>same regex as provided by OP</strong>:</p> <pre><code>awk -v re='[tsh]*est' '{ i=0; s=$0; while (p=match(s, re)) { p+=RLENGTH; i+=p-1; s=substr(s, p) } print i; }' file 14 15 35 </code></pre> |
17,164,060 | 0 | <p>Second is misleading. Someone who uses your class would expect to get something after executing this method. You should avoid writing such methods if they do not intend to return meaningful values under any circumstances.</p> <p>Even if you overidding class which returns something meaningful you should consider using <a href="http://sourcemaking.com/design_patterns/null_object" rel="nofollow">NullObject</a> design pattern so that you do not broke existing APIs and follow <a href="http://en.wikipedia.org/wiki/Liskov_substitution_principle" rel="nofollow">LSP</a>. Returning null creates redundancies with extra null checking logic and is counterintuitive.</p> |
7,562,388 | 0 | <p>I recommend that you store your data in MySQL in UTF-8 form, rather than try to convince it to take Windows-native UTF-16. If your text is mostly Western, UTF-8 encoding will be more compact, and it will be more likely to work with the C-and-Unix nature of MySQL.</p> <p>There are Visual C++ specific examples in <a href="http://tangentsoft.net/mysql++/" rel="nofollow">MySQL++</a> that show how to do this. See <code>CExampleDlg::ToUTF8()</code> and the functions that call it in <code>examples/vstudio/mfc/mfc_dlg.cpp</code>, for example.</p> <p>There's <a href="http://tangentsoft.net/mysql++/doc/html/userman/unicode.html" rel="nofollow">a chapter</a> in <a href="http://tangentsoft.net/mysql++/doc/html/userman/" rel="nofollow">the MySQL++ user manual</a> that gives the whys and wherefores behind all this.</p> |
20,880,758 | 0 | <p>When you are worried about the backward compatibility, from advance to the older iOS, the best way is to learn about the difference. Try to understand what have come far from iOS 6 & whats new in iOS7. Please refer this optimizing guide <a href="https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/SupportingEarlieriOS.html" rel="nofollow">here</a></p> <p>Also the more precise guide to what you are looking found is well defined here in <a href="https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/AppearanceCustomization.html" rel="nofollow">Apple Docs</a> and <a href="https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/TransitionGuide.pdf" rel="nofollow">here</a>.</p> <p>I am sure once you are setup with all "the stuff" that defines the differences (ios7 & ios6 transition), you will overcome the problems.</p> |
16,004,799 | 0 | <p>Since you're using WordPress, the propper way of doing this is to send a JavaScript variable with <code>wp_localize_script</code> in <code>functions.php</code>:</p> <pre><code>add_action('wp_enqueue_scripts', 'my_frontend_data'); function my_frontend_data() { global $current_user; wp_localize_script('data', 'Data', array( 'userMeta' => get_user_meta($current_user->ID, '_fbpost_status', true), 'templateUrl' => get_template_directory_uri() )); } </code></pre> <p>The above will add a JavaScript <code>Data</code> variable that's accessible in all your pages. Then you can use it in the front-end like so:</p> <pre><code>var ajaxUrl = Data.templateUrl +'/includes/ajaxswitch/'; $('#1').iphoneSwitch(Data.userMeta, function() { $('#ajax').load(ajaxUrl +'on.php'); }, function() { $('#ajax').load(ajaxUrl +'off.php'); }, { switch_on_container_path: Data.templateUrl +'iphone_switch_container_off.png'; }); </code></pre> |
25,415,788 | 0 | static and volatile qualifiers after type <p>Bjarne explains why const can go either before or after a type.</p> <p><a href="http://www.stroustrup.com/bs_faq2.html#constplacement" rel="nofollow">http://www.stroustrup.com/bs_faq2.html#constplacement</a></p> <blockquote> <pre><code>"const T" and "T const" were - and are - (both) allowed and equivalent. [...] </code></pre> <p>Why? When I invented "const" (initially named "readonly" and had a corresponding "writeonly"), I allowed it to go before or after the type because I could do so without ambiguity.</p> </blockquote> <p>My immediate thought was, "Ok, that makes sense, but if that's the reason then why is const special?" Apparently it isn't. Both clang and gcc emit no warnings for the following.</p> <pre><code>int volatile myint; int static myotherint; </code></pre> <p>It makes sense that this would be valid but I've never seen this syntax used or even mentioned as a possibility. Is placing static and volatile qualifiers after a type valid C++?</p> <p><em>How would one determine this from the text of the Standard?</em></p> |
4,572,114 | 0 | <p>That seems like it would be incredibly hard to maintain. I myself love jQuery plugins and always like to push code into a plugin when necessary.</p> <p>This is definitely not the way I develop websites and jQuery, please don't be put off!</p> |
32,802,460 | 0 | Error on `it-1` with set iterator <p>In following code I can not recognize difference between <code>--it</code>, and <code>it-1</code>. Also is <code>words.end()</code> value is out of set range?</p> <pre><code>#include <iostream> #include<set> using namespace std; int main() { set<string> words; words.insert("test"); words.insert("crack"); words.insert("zluffy"); set<string>::iterator it=words.end(); cout<<*(--it)<<endl;//just works fine cout<<*(it-1)<<endl;//Error return 0; } </code></pre> |
4,721,263 | 0 | <p>use <a href="http://api.jquery.com/jQuery.inArray/" rel="nofollow"><code>$.inArray()</code></a></p> |
6,620,991 | 0 | <p><strong>break</strong> is used when you want to exit from loop, while <strong>return</strong> is used to go back to the step where it was called or to stop further execution.</p> |
11,672,983 | 0 | <ol> <li>DownloadFile is just a wrapper around a raw WebRequest; it just processes the result and packages it as a "file" or a byte array.</li> <li><p>It works; but the data that is sent to the local file is still compressed, you'll have to decompress it manually.</p></li> <li><p>You get a default UserAgent. There isn't any particular UserAgent values necessary, unless the site your accessing requires one. But, you'll have to find that out. (Jeff's post suggest Google requires one; but I don't know if that still true)</p></li> </ol> |
36,723,666 | 0 | <p>let's suppose, that your cell is E6:</p> <pre><code>=MID(E6;FIND("LR";E6)+3;(FIND("DT";E6))-((FIND("LR";E6))+3)) </code></pre> <p>Find what those funcions mean and you will understand. Next time you will do it alone.</p> |
22,866,586 | 0 | <p>Any non-zero exit code at the <em>end</em> of your <strong>Execute Windows batch command</strong> build step will result in build step being marked as <code>failure</code>.</p> <p>To have the build step marked as <code>success</code>, you need an exit code of <code>0</code>. I don't know anything about "yslow" or "phantomjs" and why they are giving you exit code of non-zero, but from "batch" side of things, you need only write <code>exit 0</code> at the end of your build step if you want to overwrite the exit code of your <code>phantomjs</code> command.</p> <p>You can then use <strong><a href="https://wiki.jenkins-ci.org/display/JENKINS/Text-finder+Plugin" rel="nofollow">Text Finder plugin</a></strong> to parse the console log and mark build as <code>unstable</code> when certain conditions are met.</p> <p>Reading over this answer, <strong><a href="http://stackoverflow.com/questions/11419284/configuring-yslow-on-jenkins">Configuring yslow on Jenkins</a></strong> looks like you need <a href="https://wiki.jenkins-ci.org/display/JENKINS/TAP+Plugin" rel="nofollow"><strong>TAP plugin</strong></a> to have the functionality of unit testing marking the build as unstable automatically</p> |
83,644 | 0 | <p>I'm wondering what could cause this. Aside from filesystem bugs, it could be caused by a non-ascii chararacter that got through somehow. In that case, use another language with easier string semantics to do the operation.</p> <p>It would be interesting to see what would be the output of this ruby snippet:</p> <pre><code>ruby -e 'puts Dir["msheehan*"].inspect' </code></pre> |
16,968,428 | 0 | <p>I suspect your problem is that you need to set the <code>android:clipChildren</code> attribute on the parent <code>ViewGroup</code>.</p> <p>Quoting the <a href="http://developer.android.com/reference/android/view/ViewGroup.html#attr_android%3aclipChildren" rel="nofollow"><code>ViewGroup</code> documentation for <code>android:clipChildren</code></a>:</p> <blockquote> <p>Defines whether a child is limited to draw inside of its bounds or not. This is useful with animations that scale the size of the children to more than 100% for instance. In such a case, this property should be set to false to allow the children to draw outside of their bounds. The default value of this property is true.</p> </blockquote> <p>So either add <code>android:clipChildren="false"</code> to the XML layout, or call the ViewGroup's <a href="http://developer.android.com/reference/android/view/ViewGroup.html#setClipChildren%28boolean%29" rel="nofollow">setClipChildren</a> method if you are building the interface programatically.</p> |
951,379 | 0 | <p>Use <code>head -c</code> to specify the number of bytes for each file and then compare them.</p> <p>I believe this requires creating at least one temporary file, but would appreciate any comments otherwise :)</p> |
17,906,993 | 0 | <p>As mention in "<a href="http://stackoverflow.com/a/4288660/6309">In git, is there a simple way of introducing an unrelated branch to a repository?</a>", <code>git checkout --orphan</code> "doesn't do exactly what the asker wanted, because it populates the index and the working tree from <code><start_point></code> (since this is, after all, a <code>checkout</code> command)"</p> <p>So a cleaner solution would be to <strong><a href="http://stackoverflow.com/a/1384723/6309">create your new <code>master</code> branch in a new git repo</a></strong>, and then import that branch in your current repo (where <code>master</code> was renamed, and where there is not a <code>master</code> branch yet)</p> <pre><code>$ cd /path/to/repo $ git fetch /path/to/unrelated master:master </code></pre> <p>That way, your <code>master</code> branch starts from a clean history.</p> |
27,384,081 | 0 | <p>Add before <code>RewriteRule</code>:</p> <pre><code>RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f </code></pre> <p>Not rewrite real file or folder</p> |
32,767,829 | 0 | <p>Quick example of drawing the line in the Paint() event, and allowing it to be toggled with a Button:</p> <pre><code>Public Class Form1 Private x1 As Integer = 0 Private y1 As Integer = 0 Private x2 As Integer = 0 Private y2 As Integer = 0 Private DrawLine As Boolean = False Private stift As New Pen(Brushes.Black, 3) Public Sub New() InitializeComponent() x2 = Me.ClientSize.Width y2 = Me.ClientSize.Height End Sub Private Sub Form1_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged x2 = Me.ClientSize.Width y2 = Me.ClientSize.Height Me.Refresh() End Sub Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles MyBase.Paint If DrawLine Then Dim g As Graphics = e.Graphics g.DrawLine(stift, x1, y1, x2, y2) End If End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click DrawLine = Not DrawLine Me.Refresh() End Sub End Class </code></pre> <p>This approach allows you to change the coords from somewhere else and call Refresh() to update the screen. For more than one line, consider using a List() that holds information about the coords, then iterate over that in the Paint() event.</p> |
3,089,021 | 0 | <p>Try restarting the IDE. It fixes a lot of internal errors.</p> <p>If the error keeps occurring after a restart, and everything is still working, you can ignore the error. One of my projects has an internal error due to some resource compiler issue, I suspect, however it still works two years later, even after many modifications and rebuilds.</p> |
31,520,363 | 0 | <p>Yes, you can add tags to the resources that you create using CloudFormation. Here is how you can add tags to the instances that you create:<a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-tagging.html" rel="nofollow">http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-tagging.html</a></p> |
35,963,859 | 0 | <p>Try this:</p> <pre><code>$total = array(); foreach ($data as $key => $row) { $total[$key] = $row['total']; } // this sorts your $data array by `total` in descending order // so the max for `total` is the first element array_multisort($total, SORT_DESC, $data); </code></pre> <p>And now, use <code>$data[0]</code>;</p> |
8,083,701 | 0 | Workaround for lack of CSS feature to "suppress inherited styles" (and backgrounds?) <p>I have a DOM situation that looks like this:</p> <ul> <li><p><strong>A</strong> is an ancestor of <strong>B</strong>, which is in turn an ancestor of <strong>C</strong></p></li> <li><p>Initially, <strong>A</strong> has styles that inherit to <strong>B</strong> and <strong>C</strong></p></li> <li><p>I wish to temporarily highlight <strong>B</strong> by giving it a <em>highlighted</em> class</p> <p>...however...</p></li> <li><p>I want to "escape" the highlighting on <strong>C</strong> so it changes as little as possible</p></li> </ul> <p>It seems <a href="http://stackoverflow.com/questions/1046872/how-can-i-disable-inherited-css-styles">this is not possible</a> within the cascading paradigm of CSS. The only way to "un-apply" a style is to apply an overriding style. My problem is that the highlight code is in a plugin that wants to play well with an arbitrary page's existing CSS...my selectors are like this:</p> <pre><code>/* http://www.maxdesign.com.au/articles/multiple-classes/ */ .highlighted.class1 { background-color: ... background-image: ... ... } .highlighted.class2 { ... } /* ... */ .highlighted.classN { ... } </code></pre> <p>Background is a tricky one...because although it is not an inherited CSS property, changing an ancestor's background can alter a descendant's appearance (if they have transparent backgrounds). So it's an example of something that causes the kind of disruption I'm trying to negate. :-/</p> <p>Are there any instances of how people have suppressed the inheritance of changes in this fashion? Perhaps using tricks such as <a href="http://stackoverflow.com/questions/1004475/jquery-css-plugin-that-returns-computed-style-of-element-to-pseudo-clone-that-el">caching computed styles</a>? I'm looking for any default technique that can be at least a little smarter than a function-level hook that says "hey, the plugin highlighted this node...do what you need to visually compensate."</p> <hr> <p><strong>UPDATE</strong> I have created a basic JsFiddle of this scenario to help make the discussion clearer:</p> <p><a href="http://jsfiddle.net/HostileFork/7ku3g/">http://jsfiddle.net/HostileFork/7ku3g/</a></p> |
15,337,855 | 0 | <p>If you're speaking of HTML5 id, then the requirement is</p> <blockquote> <p>The value must be unique amongst all the IDs in the element’s home subtree and must contain at least one character. The value must not contain any space characters.</p> </blockquote> <p>Which gives this regex :</p> <pre><code>^[\S]+$ </code></pre> <p>If you're speaking of HTML4 (don't see why but well) then I guess it's a duplicate. See <a href="http://stackoverflow.com/questions/14664860/allowed-html-4-01-id-values-regex">Allowed HTML 4.01 id values regex</a></p> |
4,138,556 | 0 | <p>That's a bit broad... the general logic, would be to use the API of whatever you're interfacing with.</p> <p>This would vary depending on what indeed it is you're dealing with - the general logic is going to be <em>completely</em> different for a 3D application compared to a 2D windowing system. Again, if you're dealing with a 2D application is this application full screen, so you only have to consider absolute X,Y values - or is it under a windowing system in which case you care more about X,Y in relation to the window as opposed to the entire screen.</p> |
28,588,354 | 0 | <p>Presumably something like this:</p> <pre><code>#!/bin/bash class=org.gnome.settings-daemon.peripherals.touchpad name=tap-to-click status=$(gsettings get "$class" "$name") status=${status,,} # normalize to lower case; this is a modern bash extension if [[ $status = true ]]; then new_status=false else new_status=true fi gsettings set "$class" "$name" "$new_status" </code></pre> <p>Breaking it down into pieces:</p> <ul> <li><code>#!/bin/bash</code> ensures that the interpreter for this script is bash, enabling extended syntax such as <code>[[ ]]</code>.</li> <li>The syntax <code>$( )</code> is "command substitution"; this runs a command, and substitutes the output of that command. Thus, if the output is <code>true</code>, then <code>status=$(...)</code> becomes <code>status=true</code>.</li> <li>The parameter expansion <code>${name,,}</code> expands the contents of <code>name</code> while converting those contents to all-lowercase, and is only available in newer versions of bash. If you want to support <code>/bin/sh</code> or older releases of bash, consider <code>status=$(printf '%s\n' "$status" | tr '[:upper:]' '[:lower:]')</code> instead, or just remove this line if the output of <code>gsettings get</code> is always lowercase anyhow.</li> <li>The comparison <code>[[ $status = true ]]</code> relies on the bash extension <code>[[ ]]</code> (also available in other modern ksh-derived shells) to avoid the need for quoting. If you wanted it to work with <code>#!/bin/sh</code>, you'd use <code>[ "$status" = true ]</code> instead. (Note that <code>==</code> is allowable inside <code>[[ ]]</code>, but is <strong>not</strong> allowable inside of <code>[ ]</code> on pure POSIX shells; this is why it's best not to be in the habit of using it).</li> </ul> <p>Note that whitespace is important in bash! <code>foo = bar</code>, <code>foo= bar</code> and <code>foo=bar</code> are completely different statements, and all three of them do different things from the other two. Be sure to be cognizant of the differences in copying from this example.</p> |
24,625,037 | 0 | How does Android different between multiple components that have same action and category? <p>I looked up intent filters and found that they will be used when "Android finds the appropriate component to start by comparing the contents of the intent to the intent filters declared in the manifest file of other apps on the device"(<a href="http://developer.android.com/guide/components/intents-filters.html#Building" rel="nofollow">http://developer.android.com/guide/components/intents-filters.html#Building</a>)</p> <p>In my manifest file, I have </p> <pre><code><intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </code></pre> <p>which from reading that guide means that this activity can handle an implicit intent with action of main and category of launcher.</p> <p>However what if i have multiple applications with the same intent filter in the manifest file. I know that some implicit intent will be called with action of main and category of launcher. How does the Android O.S know to choose this application?</p> |
17,610,376 | 0 | <p>Strictly speaking, those declarations are not attributes but namespaces nodes. To get them with XPath, it depends of what version of XPath you use.</p> <p>For XPath 1, use :</p> <pre><code>/*/namespace::* </code></pre> <p>For XPath 2, use : <code>fn:in-scope-prefixes</code> and <code>fn:namespace-uri-for-prefix</code> to get the prefix and the associated namespace uri.</p> |
2,265,485 | 0 | Multiple socket connections <p>I have multiple devices connected to a TCP/Ip port and i want to read all these devices through sockets in .Net how can i do this before this i had a single device connected and it was working fine but now i have multiple devices can anybody help me in listening multiple socket connection?</p> |
9,479,729 | 0 | <p>In the project's properties (right-click on project => Properties => Resource) there is a Text File Encoding section.</p> <p>Did you configure the encoding here? If not, you have two choices : "Inherited from container" (which should be the workspace default, in your case UTF-8) and "Other" which let you choose a specific encoding (ISO-88591)...</p> <p>I just tested that on one of my projects, closed it and reopened it and the ISO88591 encoding is still configured.</p> <p><em>Note that I'm using a plain Eclipse though, not a PDT project. PDT may handle encoding settings differently, but somehow I doubt that (file encoding being a low level functionality it makes sense that all plugins share this behavior).</em></p> |
29,943,083 | 0 | Angular pass dynamic scope to directive <p>I have a directive that takes an attribute value from a an http call like so:</p> <p>Controller</p> <pre><code>app.controller("HomeController", function($scope){ $http.get("/api/source").then(function(res){ $scope.info = res.data }); }); </code></pre> <p>HTML</p> <pre><code><div ng-controller="MainController"> <ng-mydirective data-info="{{info}}"></ng-mydirective> </div> </code></pre> <p>Directive:</p> <pre><code>app.directive("ngMydirective", function(){ return { restrict: "E", templateUrl: "/partials/info.html", link: function(scope, element, attrs){ scope.info = attrs.info; } } }); </code></pre> <p>I'm trying to pass that info variable from the controller, into the directive, through an attribute. It doesn't work because the variable value is initially created from an asynchronous http call, so at the time the directive is created, there is no value.</p> <p>Is there a way to do this?</p> |
18,104,891 | 0 | <p>I have used following code to escape the string value for json. You need to add your '"' to the output of the following code:</p> <pre><code>public static string EscapeStringValue(string value) { const char BACK_SLASH = '\\'; const char SLASH = '/'; const char DBL_QUOTE = '"'; var output = new StringBuilder(value.Length); foreach (char c in value) { switch (c) { case SLASH: output.AppendFormat("{0}{1}", BACK_SLASH, SLASH); break; case BACK_SLASH: output.AppendFormat("{0}{0}", BACK_SLASH); break; case DBL_QUOTE: output.AppendFormat("{0}{1}",BACK_SLASH,DBL_QUOTE); break; default: output.Append(c); break; } } return output.ToString(); } </code></pre> |
1,373,822 | 0 | <p>Try this, if only to be cool xD</p> <pre><code>{ double *to = d; int n=(length+7)/8; switch(length%8){ case 0: do{ *to++ = 0.0; case 7: *to++ = 0.0; case 6: *to++ = 0.0; case 5: *to++ = 0.0; case 4: *to++ = 0.0; case 3: *to++ = 0.0; case 2: *to++ = 0.0; case 1: *to++ = 0.0; }while(--n>0); } } </code></pre> |
15,857,019 | 0 | Hiding table content using Media Queries <p>I Have been using media queries to use responsive CSS and currently I am trying to hide certain table content when viewed on 480px. I created the Class in the CSS called "hideOnSmall" and then added the tag to the Template Field of "Location" but I have not gotten it to actually work so I must be doing something wrong I have looked up ways to do this and all sources led me to this but if anyone can spot anything I missing or if I am doing something wrong. </p> <p>CSS:</p> <pre><code> @media (max-width: 480px) { .nav-collapse { -webkit-transform: translate3d(0, 0, 0); } .page-header h1 small { display: block; line-height: 20px; } input[type="checkbox"], input[type="radio"] { border: 1px solid #ccc; } .form-horizontal .control-label { float: none; width: auto; padding-top: 0; text-align: left; } .form-horizontal .controls { margin-left: 0; } .form-horizontal .control-list { padding-top: 0; } .form-horizontal .form-actions { padding-left: 10px; padding-right: 10px; } .media .pull-left, .media .pull-right { float: none; display: block; margin-bottom: 10px; } .media-object { margin-right: 0; margin-left: 0; } .modal { top: 10px; left: 10px; right: 10px; } .modal-header .close { padding: 10px; margin: -10px; } .carousel-caption { position: static; } .hideOnSmall { display: none !important; } } </code></pre> <p>HTML</p> <pre><code><asp:TemplateField HeaderText="Location" SortExpression="locationName" ItemStyle-CssClass="hideOnSmall"> <EditItemTemplate> <asp:DropDownList ID="DropDownLocations" runat="server" DataSourceID="SqlDSLocations" DataTextField="locationName" DataValueField="locationID" SelectedValue='<%# Bind("locationID") %>'></asp:DropDownList> <asp:SqlDataSource ID="SqlDSLocations" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [locationID], [locationName] FROM [tblLocation]"></asp:SqlDataSource> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("locationName") %>'></asp:TextBox> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("locationName") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> </code></pre> |
30,043,094 | 0 | <p>Per the iterated solutions via comments in the selected answer... </p> <p>In Python 3:</p> <pre><code>max(stats.keys(), key=(lambda k: stats[k])) </code></pre> <p>In Python 2:</p> <pre><code>max(stats.iterkeys(), key=(lambda k: stats[k])) </code></pre> |
20,535,047 | 0 | <p><code>redirect_to</code> will make the browser request a new page(here is your max_channel), and current context will be lost. That's why you cannot update <code>@text</code> in the <code>max_channel</code> page.</p> <p>while <code>render</code> will use current context to render <code>max_channel</code> page.</p> <p>you can get more from <a href="http://guides.rubyonrails.org/layouts_and_rendering.html#using-redirect-to" rel="nofollow">http://guides.rubyonrails.org/layouts_and_rendering.html#using-redirect-to</a>.</p> <p>You can save <code>@text</code> to somewhere(say your <code>sqlite</code>) and retrieve it in the method corresponding to <code>max_channel</code>.</p> |
3,798,094 | 0 | How can avoid people using my code for evil? <p>I'm not sure if this is quite the right place, but it seems like a decent place to ask.</p> <p>My current job involves manual analysis of large data sets (at several levels, each more refined and done by increasingly experienced analysts). About a year ago, I started developing some utilities to track analyst performance by comparing results at earlier levels to final levels. At first, this worked quite well - we used it in-shop as a simple indicator to help focus training efforts and do a better job overall.</p> <p>Recently though, the results have been taken out of context and used in a way I never intended. It seems management (one person in particular) has started using the results of these tools to directly affect EPR's (enlisted performance reports - \ it's an air force thing, but I assume something similar exists in other areas) and similar paperwork. The problem isn't who is using these results, but how. I've made it clear to everyone that the results are, quite simply, error-prone.</p> <p>There are numerous unavoidable obstacles to generating this data, which I have worked to minimize with some nifty heuristics and such. Taken in the proper context, they're a useful tool. Out of context however, as they are now being used, they do more harm than good.</p> <p>The manager(s) in question are taking the results as literal indicators of whether an analyst is performing well or poorly. The results are being averaged and individual scores are being ranked as above (good) or below (bad) average. This is being done with no regard for inherent margins of error and sample bias, with no regard for any sort of proper interpretation. I know of at least one person whose performance rating was marked down for an 'accuracy percentage' less than one percentage point below average (when the typical margin of error from the calculation method alone is around two to three percent).</p> <p>I'm in the process of writing a formal report on the errors present in the system ("Beginner's Guide to Meaningful Statistical Analysis" included), but all signs point to this having no effect.</p> <p>Short of deliberately breaking the tools (a route I'd prefer avoiding but am strongly considering under the circumstances), I'm wondering if anyone here has effectively dealt with similar situations before? Any insight into how to approach this would be greatly appreciated.</p> <p>Update: Thanks for the responses - plenty of good ideas all around.</p> <p>If anyone is curious, I'm moving in the direction of 'refine, educate, and take control of interpretation'. I've started rebuilding my tools to try and negate or track error better and automatically generate any numbers and graphs they could want, with included documentation throughout (while hiding away as obscure references the raw data they currently seem so eager to import to the 'magical' excel sheets).</p> <p>In particular, I'm hopeful that visual representations of error and properly created ranking systems (taking into account error, standard deviations, etc.) will help the situation.</p> |
17,328,580 | 0 | <p><a href="http://www.w3.org/TR/CSS21/colors.html#propdef-color" rel="nofollow">Because the default color value is <code>inherit</code>.</a></p> <p><a href="http://jsfiddle.net/N5qFu/87/" rel="nofollow">http://jsfiddle.net/N5qFu/87/</a></p> |
27,679,058 | 0 | Position smart (dynamic) Admob banner to bottom of iOS screen? <p>I'm creating a smart (dynamic) Admob banner like this</p> <pre><code>bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait origin:CGPointMake(0,0)]; </code></pre> <p>But how do I get it so a smart adMob banner is at the bottom of the screen? I need to know the height of the banner to be able to work out where at the bottom it's y coordinate should be, but I don't see how you do that if it's a smart (dynamically) sized banner?</p> |
20,918,100 | 0 | Perl backticks not capturing output <p>I have the following program snippet</p> <pre><code>my $nfdump_command = "nfdump -M /data/nfsen/profiles-data/live/upstream1 -T -R ${syear}/${smonth}/${sday}/nfcapd.${syear}${smonth}${sday}0000:${eyear}/${emonth}/${eday}/nfcapd.${eyear}${emonth}${eday}2355 -n 100 -s ip/bytes -N -o csv -q | awk 'BEGIN { FS = \",\" } ; { if (NR > 1) print \$5, \$10 }'"; syslog("info", $nfdump_command); my %args; Nfcomm::socket_send_ok ($socket, \%args); my @nfdump_output = `$nfdump_command`; my %domain_name_to_bytes; my %domain_name_to_ip_addresses; syslog("info", Dumper(\@nfdump_output)); foreach my $a_line (@nfdump_output) { syslog("info", "LINE: " . $a_line); } </code></pre> <p>Bug: @nfdump_output is empty. <img src="https://i.stack.imgur.com/WSbkK.png" alt="enter image description here"></p> <p>The $nfdump_command is correct and it printing output when ran individually</p> <p><img src="https://i.stack.imgur.com/nZNZ4.png" alt="enter image description here"></p> |
40,357,057 | 0 | Raspberry Pi 3 PiCamera Still Frame Rate <p>I'm working with a Raspberry Pi 3 that has a ribbon PiCamera. My problem is that I cannot get the still (not video) frame rate to be workable. In my application, the camera acts like a scanner using only a single row of each frame to watch things go by. While the concept is fine, what's killing me is the frame rate which I cannot get above 30 FPS.</p> <p>A perfect solution would be for someone out there taking the raspicam source, stripped it down and tuning it for speed, and bolting it up to OpenCV. Has anyone done this? Did it work?</p> <p>The Ava Group in Spain (<a href="https://www.uco.es/investiga/grupos/ava/node/40" rel="nofollow">https://www.uco.es/investiga/grupos/ava/node/40</a>) took an initial stab at this, but their still frame rate is also limited to 30 FPS.</p> |
41,077,531 | 0 | <p>Just figured out by trail and error. Fix it by adding bottom toolbar.</p> <pre><code> <!-- Bottom Toolbar--> <div class="toolbar"> <div class="toolbar-inner"> <!-- Toolbar links --> <a href="#" class="link">Link 1</a> <a href="#" class="link">Link 2</a> </div> </div> </code></pre> |
14,152,187 | 1 | Is it possible to implement automatic error highlighting for Python? <p>Are there any IDEs for Python that support automatic error highlighting (like the Eclipse IDE for Java?) I think it would be a useful feature for a Python IDE, since it would make it easier to find syntax errors. Even if such an editor did not exist, it still might be possible to implement this by automatically running the Python script every few seconds, and then parsing the console output for error messages.</p> |
13,359,337 | 0 | <p>I had the problem yesterday and after trying out answers in the forum and others but made no headway. My code looked like this.</p> <pre><code>// Open up the file and read the fields on it. var pdfReader = new PdfReader(PATH_TO_PDF); var fs = new FileStream(pdfFilename, FileMode.Create, FileAccess.ReadWrite) var stamper = new PdfStamper(pdfReader, fs); var pdfFields = stamper.AcroFields; //I thought this next line of code I commented out will do it //pdfFields.RenameField("currentFieldName", "newFieldName"); // It did for some fields, but returned false for others. // Then I looked at the AcroFields.RenameField method in itextSharp source and noticed some restrictions. You may want to do the same. // So I replaced that line pdfFields.RenameField(currentFieldName, newFieldName); with these 5 lines AcroFields.Item item = pdfFields.Fields[currentFieldName]; PdfString ss = new PdfString(newFieldName, PdfObject.TEXT_UNICODE); item.WriteToAll(PdfName.T, ss, AcroFields.Item.WRITE_VALUE | AcroFields.Item.WRITE_MERGED); item.MarkUsed(pdfFields, AcroFields.Item.WRITE_VALUE); pdfFields.Fields[newFieldName] = item; </code></pre> <p>And that did the job</p> |
11,621,525 | 1 | How to get the records from the current month in App Engine (Python) Datastore? <p>Given the following entity:</p> <pre><code>class DateTest(db.Model): dateAdded = db.DateTimeProperty() #... </code></pre> <p>What would be the best way to get the records from the current month?</p> |
23,204,618 | 0 | KendoUI Grid Signalr Error <p>I am receiving the error "Maximum call stack size exceeded" while trying to bind Signalr data to the KendoUI grid (v2014.1 416).</p> <p>Here is my current code:</p> <pre><code>var epConnection = $.hubConnection(); var hub = epConnection.createHubProxy("EventsPendingHub"); var hubStart = epConnection.start(); $('#tblEventsPending').kendoGrid({ sortable: true, columns: [ { field: "EventNum" }, { field: "Area" }, { field: "Zone" }, { field: "Priority" }, { field: "Type" }, { field: "TIQ" }, { field: "Location" }, { field: "Apt"} ], dataSource: { type: "signalr", autoSync: true, schema: { model: { id: "EventNum", fields: { "EventNum": { type: "string" }, "Area": { type: "string" }, "Zone": { type: "string" }, "Priority": { type: "string" }, "Type": { type: "string" }, "TIQ": { type: "string" }, "Location": { type: "string" }, "Apt": {type: "string"} } } }, sort: [ { field: "Priority", dir: "desc"}, { field: "TIQ", dir: "desc"} ], transport: { signalr: { promise: hubStart, hub: hub, server: { read: "read", update: "update", destroy: "destroy", create: "create" }, client: { read: "read", update: "update", destroy: "destroy", create: "create" } } } } }); </code></pre> <p>Hub Code:</p> <pre><code>[HubName("EventsPendingHub")] public class EventsPendingHub : Hub { private readonly EventsPending _eventsPending; public EventsPendingHub() : this(EventsPending.Instance) {} public EventsPendingHub(EventsPending eventsPending) { _eventsPending = eventsPending; } public IEnumerable<EventPending> GetAllEventsPending() { return _eventsPending.GetAllEventsPending(); } } </code></pre> <p>Startup.cs:</p> <pre><code>[assembly: OwinStartup(typeof(CADView.Startup))] namespace CADView { public class Startup { public void Configuration(IAppBuilder app) { var hubConfiguration = new HubConfiguration(); hubConfiguration.EnableDetailedErrors = true; app.MapSignalR(hubConfiguration); } } } </code></pre> <p>The error is being thrown at the client by jQuery...the last line from below is repeated 30+ times.</p> <p>Uncaught RangeError: Maximum call stack size exceeded </p> <p>o.extend.isPlainObject jquery-2.1.0.min.js?hash=2258a75c-c461-4821-2436-dfdf3af9bffe:2 o.extend.o.fn.extend jquery-2.1.0.min.js?hash=2258a75c-c461-4821-2436-dfdf3af9bffe:2</p> |
1,368,413 | 0 | <p>The code works fine for me, too. As Justin suggested, you're probably overwriting your extracted data.</p> <p>May I suggest less-redundant code? For example:</p> <pre><code>$urls = array('http://www.wowarmory.com/character-sheet.xml?r=Crushridge&n=Thief', 'http://www.wowarmory.com/character-sheet.xml?r=Ursin&n=Kiona'); $browser = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 YFF3 Firefox/3.0.1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, $browser); foreach ($urls as $url) { curl_setopt($ch, CURLOPT_URL, $url); $result20 = curl_exec($ch); // Extract the values out of the xml here (to separate variables). } curl_close($ch); </code></pre> |
32,797,462 | 0 | <pre><code><table border='1' style='width:100%'> <?php $course = file_get_contents("course.txt"); $line = explode("\n", $course); for($i = 0; $i<count($line); $i++) { $item = explode(";", $line[$i]); {echo" <tr> <td>".$item[0]."</td> <td>".$item[1]."</td> </tr>"; } } ?> </table> </code></pre> |
23,417,314 | 0 | <p>Use a static helper method:</p> <pre><code>public Triangle(Triangle other) { super(clonePoints(other)); } private static Point[] clonePoints(Triangle other) { if (other == null) { // ... } return other.getPoints().clone(); } </code></pre> <p>Also, what I often do is create a more generic helper method as such:</p> <pre><code>public Triangle(Triangle other) { super(neverNull(other).getPoints().clone()); } private static <S extends Shape> S neverNull(S notNull) { if (notNull == null) { // throw a meaningful exception // or return a default value for S if possible / reasonable } return notNull; } </code></pre> |
39,475,451 | 0 | <p>I have found <a href="https://docs.angularjs.org/api/ng/directive/ngSwitch" rel="nofollow"><code>ng-switch</code></a> works the best in this case.</p> <p>You can use it like:</p> <pre><code> <div class="the-parent" ng-switch="row.statusId"> <span class="fa fa-circle-o fw" ng-switch-when="Status.NotSet" style="padding-left: 0.3rem;"></span> <span class="fa fa-unlock fw" ng-switch-when="Status.Clean" style="padding-left: 0.3rem;"></span> <span class="fa fa-wrench fw" ng-switch-when="Status.Dirty" style="padding-left: 0.3rem;"></span> <span class="fa fa-cloud-upload fw" ng-switch-when="Status.Saving" style="padding-left: 0.3rem;"></span> <span class="fa fa-check fw" ng-switch-when="Status.Saved" style="padding-left: 0.3rem;"></span> <span class="fa fa-warning fw" ng-switch-when="Status.SaveError" style="padding-left: 0.3rem;"></span> </div> </code></pre> |
16,132,752 | 0 | How do I alter the value being updated in a ListView? <p>I can't seem to find an answer to this, maybe I'm not using the correct terminology.</p> <p>I have a ListView that is editable, I want it so that if a user clicks on Edit and then Update, that the field is updated with the value from another textbox, not the field they are editing.</p> <p>The reason for this is that I have a Colour Picker that alters the value of a textbox, when they click Update I want this value to be the updated value.</p> <p>I guess I utilise the ItemUpdating event, but I don't have much in the way of code because I'm pretty lost. I have this so far:</p> <pre><code>protected void ListView2ItemUpdating(object sender, ListViewUpdateEventArgs e) { var selectedItem = ListView2.Items[ListView2.EditIndex]; // I have no idea what to put here something = ColourChosen.Value; } </code></pre> <p>Here is an image that I hope will make what I'm trying to do a little more understandable:</p> <p><img src="https://i.stack.imgur.com/QYkMg.png" alt="ListView2"></p> <p>If any one could point me in the right direction of any examples, that would be much appreciated.</p> |
14,936,323 | 0 | <pre><code>ko.applyBindings(new menuView(), document.getElementById('blancos_menu')); </code></pre> <p>replace this with </p> <pre><code>ko.applyBindings(new menuView(),$("#blancos_menu")[0]); </code></pre> <p>and why you using this?</p> <pre><code><span data-bind="text: $root.blancos"></span> <!-- ko foreach: $root.blancos --> </code></pre> <p>you can use </p> <pre><code><ul data-bind="foreach: blancos"> <li data-bind="<ARRAY ELEMENT IN blancos>"></li> </ul> </code></pre> |
29,345,505 | 1 | Unordered cloud point of polygon contour to polygon <p>Dear Stackoverflow community,</p> <p>I have contours of irregular polygons as unordered datapoints (like on the figure here: <a href="http://s16.postimg.org/pum4m0pn9/figure_4.png" rel="nofollow">http://s16.postimg.org/pum4m0pn9/figure_4.png</a>), and I am trying to order them (ie. to create a polygon).</p> <p><img src="http://s16.postimg.org/pum4m0pn9/figure_4.png" /></p> <p>I cannot use the convex hull envelope because of the non convex shape of the polygon. I cannot ase a minimum distance criterion because some points of other parts of the contour lie closer (example: point A has to be joined with B, but is closer to C). I cannot use a clockwise ordering because of the irregular shape of the contour.</p> <p>Do anyone knos a way to implement (preferentially in Python) an algorithm that would reorder the datapoints from a starting point?</p> |
5,043,648 | 0 | <p>SOAP does not have to be over HTTP. It just happens that it is nearly always implemented over HTTP.</p> <p>If you really want to use SOAP you can use a socket, or message queue as well as HTTP. For an example see: <a href="http://msdn.microsoft.com/en-us/library/51f6ye7k.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/51f6ye7k.aspx</a></p> <p>However, I think if you need 100 TPS, SOAP is probably not the right technology to use.</p> |
5,605,470 | 0 | <p>Created by Dr. Martin Porter, <a href="http://snowball.tartarus.org/index.php" rel="nofollow">Snowball</a> is a small string processing language designed for creating stemming algorithms for use in Information Retrieval. It was created partially to provide a canonical implementation of Porter's stemming algorithm, and partially to facilitate the creation of stemmers for languages other than English. </p> <p>A further aim of Porter's was to provide a way of creating and defining stemmers that could readily or automatically be translated into C, Java, or other programming languages. The Snowball compiler translates a Snowball script (a <code>.sbl</code> file) into either a thread-safe ANSI C program or a Java program. For ANSI C, each Snowball script produces a program file and corresponding header file (with <code>.c</code> and <code>.h</code> extensions). </p> <p>The <a href="http://en.wikipedia.org/wiki/Snowball_programming_language" rel="nofollow">name "Snowball"</a> is a tribute to the SNOBOL programming language. </p> |
33,219,633 | 0 | <p>Using the newer version <code>''.format</code> (also remember to specify how many digit after the <code>.</code> you wish to display, this depends on how small is the floating number). See this example:</p> <pre><code>>>> a = -7.1855143557448603e-17 >>> '{:f}'.format(a) '-0.000000' </code></pre> <p>as shown above, default is 6 digits! This is not helpful for our case example, so instead we could use something like this:</p> <pre><code>>>> '{:.20f}'.format(a) '-0.00000000000000007186' </code></pre> |
40,887,193 | 0 | D3.js zoom is not working with mousewheel in safari <p>I'm using D3 v4 to achieve the zoom functionality and everything works perfectly on FireFox, Chrome browsers.</p> <p>Quite different behavior with <code>Safari</code> browser (my version is <code>Version 10.0.1 (12602.2.14.0.7)</code>). Wheel zoom works for <code>g</code> element and doesn't work for <code>svg</code> element. Note: that <code>dbClick</code> zoom works for <code>svg</code> element.</p> <p>I've created simple <a href="https://jsfiddle.net/vbabenko/zq0v1rta/1/" rel="nofollow noreferrer">fiddle example</a> where tried to reproduce the issue. If you try wheel zoom over <code>red rect</code> - it will work, outside of <code>rect</code> - not work, but works for other browsers.</p> <p>I was looking for official examples like <a href="https://bl.ocks.org/mbostock/db6b4335bf1662b413e7968910104f0f" rel="nofollow noreferrer">https://bl.ocks.org/mbostock/db6b4335bf1662b413e7968910104f0f</a> where everything works and I could not find a problem with my example...</p> <p>Here is a zones where zoom works (madness is that left and top zone in the svg has working zoom): <a href="https://i.stack.imgur.com/XNZdv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XNZdv.png" alt="wheel_zoom_working_zones"></a></p> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.