pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
24,128,759
0
<p>It's not actually a Django question but rather a ORM question, you need to understand what and how ORM works (apart from the language and the framework used). Your case yields different results:</p> <p>1 Bridge can Have Many workers (One (bridge) &lt;--* Many (Worker), ForeignKey)</p> <p>1 Bridge can have 1 worker (One (Bridge) &lt;--> One (Worker), One To One field)</p> <p>Many Bridges can have many workers (Many (Bridges) * -- * many (Workers), Many to Many field)</p> <p>If you use a ForeignKey from tools to builders, it means that a worker can have many tools, but each tool is unique to a worker, if you have many to many then any worker can have any tool. If you need tools to belong to many different workers, then you need a many to many relation, if the tools need some specific restrictions (like skills) then again a many to many relation with specific limitations (a through table could hold extra information regarding the association, like worker 1 uses tool 1 every friday, that would be a through table of workers to tools with the middle table holding the day the worker uses the specific tool).</p>
10,485,054
0
How do I get the original SKU of a bundle product in the cart? <p>I need to be able to get the parent ID of a bundled item during checkout to track. If a customer purchased a simple item through a grouped item, I can get the grouped SKU from $item->getOptionByCode('info_buyRequest'). Is there a way to get the bundle SKU of a purchased simple item in a similar manner? info_buyRequest doesn't seem to have this info for a bundled item.</p>
22,000,259
0
iOS xcdatamodel newly added attribute has quotation mark <p>I just migrated my new data model and added a new attribute called "author_mail".However I discover at when I output my records:</p> <pre><code>attachments = "&lt;relationship fault: 0xd2459c0 'attachments'&gt;"; author = nil; "author_mail" = nil; &lt;-- ABNORMAL category1 = World; </code></pre> <p>I set the author_mail to string type but I don't think the author_mail should wrap with quotation mark. I don't know if it related to my migration but it does not output any error. Any clue where should I start look on? I found nothing on the internet. </p> <p>Result I want: </p> <pre><code>attachments = "&lt;relationship fault: 0xd2459c0 'attachments'&gt;"; author = nil; author_mail = nil; category1 = World; </code></pre> <p>Thanks everyone.</p>
37,188,608
0
<p>I think this is the solution for you: <a href="http://stackoverflow.com/questions/9451006/detect-warn-when-back-button-is-pressed">Detect/Warn when back button is pressed</a></p> <p>Let us know if it helps</p>
5,735,763
0
<p>Which version of VS are you using? </p> <p>Not sure what you mean by "registered in any project", but here's a starting point: You can obtain a list of all .h and .cpp files by doing (recursive) directory listings from the root directory. Since the solution and the project files are just .xml files(in later versions of VS at least), you can just use regular expressions to pull out all the referenced .h and .cpp files and then cross reference the list you got doing directory listings with the ones you can parse from project files. In your case your simple directory structure makes the searching a little simpler.</p> <p>If by your second point you mean "included by another source or header" then I guess you have to read all .h and .cpp files and search for #include statements, but this would make the program a little more complex.</p>
3,666,359
0
<p>In addition to Boltclock's answer, there's a difference in how css walks through the DOM, which can have an effect on the processing speed of the stylesheet. For example, Mozilla advises not to use the element before the class: <a href="https://developer.mozilla.org/en/Writing_Efficient_CSS" rel="nofollow noreferrer">https://developer.mozilla.org/en/Writing_Efficient_CSS</a></p> <p>In case of id's I tend to use it anyway though, purely for readability reasons.</p>
18,620,168
0
<p>It looks like the Table View can't be the first child of the view controller's view. Drag it down below another view to fix the issue.</p> <p><img src="https://i.stack.imgur.com/ddkgQ.jpg" alt="enter image description here"></p>
27,177,550
0
Show combobox drop down while editing text <p>When I first load my form the combobox functions as desired:</p> <p><img src="https://i.stack.imgur.com/ff7SV.jpg" alt="enter image description here"></p> <p>Then when I select one of the drop down menu items (via cursor or arrow keys &amp; enter):</p> <p><img src="https://i.stack.imgur.com/Re6B7.jpg" alt="enter image description here"></p> <p>Now if I try to edit the text in the combo box again (via cursor or arrow keys), the drop down menu no longer appears:</p> <p><img src="https://i.stack.imgur.com/fQu9f.jpg" alt="enter image description here"></p> <p>Currently my load form method:</p> <pre><code>Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'connect to RFDB Dim connectionString = My.Settings.RFDBConnectionString Dim connection As New SqlConnection(connectionString) connection.Open() 'Get Versions Table from RFDB Dim versions As DataTable Dim query = "select LocationID, VersionsNum, Description, PlanetExport from Versions inner join VersionsBuild on VersionsBuildID=IDVersionsBuild" versions = QueryRFDB(query, connectionString) 'Fill ComboBox with possible site versions Dim source As New AutoCompleteStringCollection() Dim i As Integer For i = 0 To versions.Rows.Count - 1 Dim siteVersion As String siteVersion = versions.Rows(i)(0) &amp; " V" &amp; versions.Rows(i)(1) &amp; " " &amp; versions.Rows(i)(2) source.Add(siteVersion) Next i Me.ComboBox1.AutoCompleteCustomSource = source Me.ComboBox1.AutoCompleteMode = AutoCompleteMode.Suggest Me.ComboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource 'Fill ListBox with currently flagged site versions For i = 0 To versions.Rows.Count - 1 Dim siteVersion As String siteVersion = versions.Rows(i)(0) &amp; " V" &amp; versions.Rows(i)(1) &amp; " " &amp; versions.Rows(i)(2) If versions.Rows(i)(3) = True Then Me.ListBox1.Items.Add(siteVersion) Next i End Sub 'Returns a data table as the result of the sql query on RFDB Private Function QueryRFDB(ByVal query As String, ByVal connectionString As String) Dim adapter As New SqlDataAdapter(query, connectionString) Dim table As New DataTable adapter.Fill(table) Return table End Function </code></pre> <p>I am thinking it is maybe a settings issue with my combobox? Any help is appreciated. </p>
23,897,168
0
Adjusting z-index of angularjs typeahead directive <p>I am using Angularjs typeahead directive in combination with jquery layout plugin. <a href="http://plnkr.co/edit/rbfSByzsh8wc2f0aaBDA" rel="nofollow">Here</a> is the link to the app I am working on. When I type an address into the input box, the list of autocomplete results get hidden behind the resizer. I have tried changing the z-index property of both the autocomplete list as well as the pane resizer, but nothing seems to be working. What is the best way to solve this?</p> <pre><code>.ui-layout-resizer-open { z-index: 1; } .dropdown-menu { z-index: 2; } </code></pre>
21,681,941
0
Visualize JSF facelets inclusion <p>This is a simple question: is there a tool or method that allows me to visualize from what set of Facelet template files my view is constructed?</p> <p>Background: I find myself constantly searching for popups and reusable chunks I have stashed away in their own little facelets. Now if one is causing issues, I have to go down a hierarchy of includes to figure out which view is actually including the facelet. Right now this means I'm searching all template files for component id strings, then for each of the files that include that string, I search for the filename of that template, then lookup all templates that <code>ui:include</code> that file until I find a file that is not mentioned in an <code>ui:include</code> tag.</p> <p>I imagine that there must be a tool that visualizes this as a tree/forest structure for any given search term. Is there? And if not, how would you go about writing one?</p>
21,889,204
0
<p>It may help to look at it from a different perspective. Your semi-complete solution is focusing on parents elements of your desired data, but you could also use the child or relative path identifiers. </p> <p>I got this XPATH: </p> <pre><code>a/c/following-sibling::node() </code></pre> <p>To return:</p> <pre><code> MARKER other text 1 &lt;b&gt;MARKER other text 2&lt;/b&gt; M &lt;b&gt;ARKE&lt;/b&gt; R &lt;e&gt;other&lt;/e&gt; text 3 </code></pre> <p>And while that isn't in exactly the format you're looking for, it's the correct data, XPATH wasn't really made for formatting your results so there's not much to work with there. </p>
22,113,160
0
<p>It possible you're not making those calls early enough, and the classes that use them have already been loaded and initialized themselves.</p> <p>A good test/quick fix would be to make a separate Main class that only makes those calls, then calls the class you are currently using to start your app.</p> <p>You might even have to call those in a static initializer (not in main), because once you execute main, all the classes it references will be loaded first.</p> <p>You could also use reflection to load and execute your class from Main, that's kind of messy and <em>probably</em> not required.</p>
38,543,015
0
How to copy installed apps along with data to other mobile using sdcard? <p>Suppose I've installed five apps in some mobile. I used them for few days, I would like to copy them to another mobile along with data using sdcard. Means in whatever mobile I put that sdcard, my all apps with the data should work fine. It's like cloning windows os and installing same state os to other, but only a selected apps in my scenario. Is it possible? Ask me you did not get question? Thank you.</p>
39,774,140
0
<p>I was originally using <code>HttpsURLConnection</code> but it wasn't working consistently so I decided to go with <code>HttpClient</code>. It works now.</p>
12,680,134
0
<blockquote> <p>Not sure why it acts like that tho.. The CSS folder is in the same folder as the actual php file.</p> </blockquote> <p>You've linked to it using a relative URI:</p> <pre><code>&lt;link rel="stylesheet" type="text/css" media="all" href="./css/text.css" /&gt; </code></pre> <p>e.g. the <code>./css/text.css</code>, and while the css file may be in the same directory as <code>picture.php</code> file (which I assume is what is generating the content) but the browser is what actually makes the request for the CSS, not the picture.php script. The browser requests this URL <code>http://www.mysite.com/picture/1</code>, and the server internally rewrite the <code>/picture/1</code> to <code>/picture.php?id=1</code>, the browser has no clue that's happened. So it sees the base URI as <code>/picture/</code>. If the browser went directly to the php file: <code>http://www.mysite.com/picture.php?id=1</code>, the base URI would be <code>/</code> and the css would resolve just fine to <code>/./css/text.css</code>. But the <code>/picture/1</code> request has a different base URI so the browser (with no clue that the base is different) blindly attempts to retrieve the css as <code>/picture/./css/text.css</code>, which fails because you have rules that mishandle that URI. Normally you'd just get a 404, but the rules you have after the picture rewrite mishandles the URI and returns a 500 server error.</p> <p>You can either add in your header:</p> <pre><code>&lt;base href="/"&gt; </code></pre> <p>in the content generated by <code>picture.php</code>, or make the URI's absolute:</p> <pre><code>&lt;link rel="stylesheet" type="text/css" media="all" href="/css/text.css" /&gt; </code></pre>
22,140,619
0
Restricting method execution from other class method <p>Somebody asked me this question and I am not able to find out the solution, I have a class <code>A</code> with method <code>a1</code> and <code>a2</code>:</p> <p><code>Class A {a1() a2()}</code>:</p> <p>and a class <code>B</code> with method <code>b1</code> and <code>b2</code>:</p> <p><code>Class B {b1() b2()}</code></p> <p>Considering multithreading environment i want to stop execution of b1 when a1 is called and same applies for b2 and a2. Both the objects are independent. Is this possible? </p>
27,087,932
0
PHP Not sent automatic email on remote server <p>I wrote codes that should send auto email using PEAR. every thing is OK on my local MAC OS system but not working on windows based remote server. here is my codes:</p> <pre><code>&lt;?php require_once('../config/connection.php'); include_once("Mail.php"); $id=$_GET['id']; if(isset($_POST['update-visa-status-btn'])){ $status=$_POST['status']; mysqli_query($con,"UPDATE `visa` SET `status`='$status' WHERE `id`='$id'"); $visa=mysqli_query($con,"SELECT * FROM `visa` WHERE `id`='$id'"); $row_visa=mysqli_fetch_assoc($visa); $user_id=$row_visa['userid']; $user_info=mysqli_query($con,"SELECT * FROM `user` WHERE `id`='$user_id'"); $row_user_info=mysqli_fetch_assoc($user_info); $From = "..."; $To="..."; $Subject = "..."; $Message = ' &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;!-- SOME HTML CODES THAT MAKES HTML EMAIL BODY --&gt; &lt;/body&gt; &lt;/html&gt;'; $Host = "..."; $Username = "..."; $Password = "..."; $content_type="text/html"; $Headers = array ('From' =&gt; $From, 'To' =&gt; $To, 'Subject' =&gt; $Subject, 'content-type' =&gt; $content_type); $SMTP = Mail::factory('smtp', array ('host' =&gt; $Host, 'auth' =&gt; true, 'username' =&gt; $Username, 'password' =&gt; $Password)); $mail = $SMTP-&gt;send($To, $Headers, $Message); if (PEAR::isError($mail)){ echo($mail-&gt;getMessage()); } else { echo("Email Message sent!"); }} ?&gt; </code></pre> <p>On remote server none of messages success or error not shown &amp; no email sent but on local, every thing works like a charm.Thank you for your help.</p>
13,242,813
0
can't get stdout to a variable <p>it seems silly... I don't know what I am doing wrong....</p> <p>I need to change the .txt files encoding to utf-8. here the script:</p> <pre><code>#!/bin/bash for NOME_ARQ in *.txt do ##1 - verify file encoding and store in CODIFICACAO CODIFICACAO=$(file --mime-encoding "$NOME_ARQ" | cut -d" " -f2) ##2 - convert to utf-8 iconv -f "$CODIFICACAO" -t utf-8 "$NOME_ARQ" -o temp01.txt done </code></pre> <p>Have tried several ways for the ##1, but always get the following error:</p> <pre><code>sc-sini2csv: line 5: sintax error near `token' unexpected `CODIFICACAO=$(file --mime-encoding "$NOME_ARQ" | cut -d" " -f2)' sc-sini2csv: line 5: `CODIFICACAO=$(file --mime-encoding "$NOME_ARQ" | cut -d" " -f2)' </code></pre> <p>We see from the error, that the problem occur when assigning the variable $CODIFICACAO</p> <p>As far as I've looked around there are 2 ways of assigning the STDOUT to a variable:</p> <p>1- using backtick:</p> <pre><code>CODIFICACAO=`file --mime-encoding "$NOME_ARQ" | cut -d" " -f2` </code></pre> <p>or</p> <p>2- using $():</p> <pre><code>CODIFICACAO=$(file --mime-encoding "$NOME_ARQ" | cut -d" " -f2) </code></pre> <p>Both of them will give the same error. </p> <p>As I wrote, it seems silly, but I'm stucked on this error..... any hel will be much appreciated !!! </p> <p>PS: using $() or backticks directly from terminal (outside a bash script) will work.... but i need it into a shell script.</p> <p>In time: I'm using ubuntu with bash shell</p> <p>Thanks in advance !!! Silvio</p>
14,096,455
0
How can I create a directed graph of strings in JavaScript? <p>I am trying to create a directed graph data structure in JavaScript. I want each node in the graph to be doubly-linked, so that I can obtain a list of links that each node points to, as well as the links that point to that node. Each node is an array with 3 elements, like so: <code>[["node that links to node a"], "node a", ["node that node a links to"]]</code></p> <pre><code>//The functions linkNodes and unlinkNodes should add and remove nodes links from the directed graph, respectively. var nodes = new Object(); function linkNodes(a, b){ //a should be a string, and b should be a string as well //create the node a, if it doesn't exist yet //create the node b, if it doesn't exist yet //link the node a to the node b } function unlinkNodes(){ //unlink the nodes a and b, if a and b exist //create the node a, if it doesn't exist yet } function getNode(string){ //get the node that corresponds to the string //if the string doesn't exist, then return false } </code></pre> <p>jsfiddle: <a href="http://jsfiddle.net/NTKZ9/1/" rel="nofollow">http://jsfiddle.net/NTKZ9/1/</a>​</p> <p>Is there a more concise way to implement a directed graph in JavaScript, besides the one that I've proposed here?</p>
13,564,819
0
<p>Placemarker tokens are defined in the preceding paragraph (6.10.3.2):</p> <blockquote> <p>If, in the replacement list of a function-like macro, a parameter is immediately preceded or followed by a <code>##</code> preprocessing token, the parameter is replaced by the corresponding argument’s preprocessing token sequence; however, if an argument consists of no preprocessing tokens, the parameter is replaced by a <em>placemarker</em> preprocessing token instead.<sup>145)</sup></p> </blockquote> <p>And the footnote:</p> <blockquote> <p>145) Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that exist only within translation phase 4.</p> </blockquote> <p>And the last line you quoted doesn't say "undefined behaviour", it says "the behavior is undefined". I'm not sure what kind of answer you're looking for here. It says so because the authors of the standard decided so.</p>
39,831,789
0
<p>not sure url is str or other types</p> <p>you can do like this:</p> <pre><code>"https" in str(df.url[len(df)-1]) </code></pre> <p>or </p> <pre><code>str(df.ix[len(df)-1].url).__contains__("https") </code></pre>
5,016,960
0
<p>Try</p> <pre><code>$('#Table tr:hidden').length </code></pre> <p><a href="http://api.jquery.com/hidden-selector/" rel="nofollow"><strong>:hidden selector</strong></a></p>
9,853,179
0
<p>Per @datenwolf's answer, you simply can't send more than 64k in a single UDP datagram, as that limit is implicit in the two-byte length field in the protocol.</p> <p>Furthermore, it's not actually a good idea to send even that much at once. You should limit your packets to the MTU on the path between the two ends (typically in the region of 1500 bytes or less) so that you don't get <em>fragmentation</em> in the IP layer.</p> <p>Fragmentation is bad - ok?</p>
14,607,934
0
<p>Use <code>.ToString()</code>:</p> <pre><code>Year = int.Parse(bindingContext.ValueProvider.GetValue("Year").AttemptedValue ?? now.Year.ToString()); </code></pre> <p>Both variables need to be of the same type.</p>
11,777,477
0
Disable control in CommandItemTemplate for RadGrid in different browser <p>I am trying to disable the anchor control inside CommandItemTemplate of the radgrid. It is working fine in the IE browser but not in other browsers like chrome, firefox... Can anyone help me on this?</p> <p>Code:</p> <pre><code> HtmlAnchor ExportLink = new HtmlAnchor(); GridItem[] items = this.rgCycles.MasterTableView.GetItems(GridItemType.CommandItem); ExportLink.Disabled = true; </code></pre> <p>HTML:</p> <pre><code> &lt;CommandItemTemplate&gt; &lt;asp:Image ID="AddRecord" runat="server" ImageUrl="~/_layouts/images/RMS/Pb - Add New.png" AlternateText="Add Record" /&gt; &lt;a href="#" target="_blank" onclick="return ShowExportAppraisalDialog();" runat="server" id="Export"&gt; &lt;asp:Image ID="ExportPortfolio" runat="server" ImageUrl="~/ExportIcon.png" AlternateText="Export Portfolio" Height="16px" Width="16px" /&gt; Export &lt;/a&gt; &lt;/CommandItemTemplate&gt; </code></pre>
30,398,320
0
<p>If you see <code>(lldb)</code> in the console you've most likely hit a breakpoint. If you haven't added a breakpoint there yourself there might be an exception breakpoint in your project, catching all uncaught exceptions.</p> <p>Try clicking on the "play" looking button above the console, that should continue the execution (or at least help you with what the crash was).</p>
38,834,833
0
<p>The second will work fine, so long as the directory to be deleted does not contain any subdirectories. To clean out subdirectories, a recursive function is the best way, which is why in the first code sample the function <code>deleteFilesAndDirectory()</code> calls itself.</p>
7,418,620
0
Multiple ajax request state? <p>I'm writing a script that need that executes some paralleled ajax requests. I'm using an ajax array but i want to execute some code(make some tags visible) when all the requests are complete. here's the code hope u can help me.</p> <pre><code>function Update_All(){ var loading = document.getElementById("loading_image"); var actualizacion_completa = document.getElementById("actualizacion_completa"); loading.style.display = ""; actualizacion_completa.style.display = "none"; var i=1; var ajax= new Array(20);//objetoAjax(); var limit = 1; var ready = 1; for (i=1;i&lt;=20;i++) { var index = i-1; ajax[index] = objetoAjax(); var voatencion = document.getElementById("idatencionf"+i); var vohoras = document.getElementById("vhorasf"+i); var vtarifa = document.getElementById("tarifaclientef"+i); var voexonerado = document.getElementById("vexoneradof"+i); var voaprobado = document.getElementById("vaprobadof"+i); var campo = document.getElementById("f"+i+"c1"); if(typeof(campo) != 'undefined' &amp;&amp; campo != null){ var valor = 1; if(campo.innerHTML=="Si") valor = 2; ajax[index].open("GET","update.php?atencion="+voatencion+"&amp;opc="+5+"&amp;valor="+valor+"&amp;exonerado="+voexonerado.value+"&amp;tarifa="+vtarifa.value+"&amp;horas="+vohoras.value); ajax[index].send(null); limit = i; ajax[index].onreadystatechange=function() { if (ajax[index].readyState==4 &amp;&amp; ajax[index].status == 200) { ready++; if(ready == limit){ loading.style.display = "none"; actualizacion_completa.style.display = ""; } } } } else{ break; } } } </code></pre> <p>the problem is ready never gets equal to limit.</p> <p>PS: srry about the spanish variable's names;</p>
22,064,188
0
if/else won't go into else <p>I wrote an if/else statement for a login page, I already used it before in other pages and it works. It doesn't seem to work now however. The if part works, but it won't get to the else part. (I shortened the code normally the if will do a lot more but because that's already working I only focus on the else part here). Thanks in advance!</p> <pre><code> $error = false; if (**isset**($_POST['username']) &amp;&amp; **isset**($_POST['password'])) { $username = $_POST['username']; $password = $_POST['password']; } else { $error = true; } if(!$error){ echo 'it worked'; } else { echo 'not all fields are filled in'; } </code></pre> <p>Maybe I should tell you that it's not the bottom else but it's the top one which doesn't work. Because if I change $error to true it works. It just doesn't get into the else which changes error to true. </p>
30,922,485
0
using String.startswith() with a unicode string <p>I am trying to trim a string scraped from an HTML page using BeautifulSoup. It starts with </p> <pre><code>&amp;#160;–&amp;#160; </code></pre> <p>in the html page. I am trying the following code:</p> <pre><code>if thestring.startswith(unichr(160) + '-' + unichr(160)): print "found starting sequence" thestring= thestring[3:] </code></pre> <p>However, I the <code>if</code> condition is not being triggered (as confirmed by the fact that my print statement is not happening). How do I set up that condition?</p> <p>(Also in some cases, thestring is initially only those 3 characters, in which case I want thestring to end up as the empty string -- will this do it or will I need to separately test for that case?)</p>
35,479,798
0
AngularJS can't fetch more than 4 records <p><em>The following code is for an AngularJS code to read data from a .txt file and echo out on the webpage. It works just fine for the entered records in the .txt file, but upon increasing the number of records above 4, the code fails to work. What could be wrong?</em></p> <p><em>Index.html</em></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Angular JS Includes&lt;/title&gt; &lt;style&gt; table, th , td { border: 1px solid grey; border-collapse: collapse; padding: 5px; } table tr:nth-child(odd) { background-color: #f2f2f2; } table tr:nth-child(even) { background-color: #ffffff; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;AngularJS Sample Application&lt;/h2&gt; &lt;div ng-app="" ng-controller="studentController"&gt; &lt;table&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Roll No&lt;/th&gt; &lt;th&gt;Percentage&lt;/th&gt; &lt;/tr&gt; &lt;tr ng-repeat="student in students"&gt; &lt;td&gt;{{ student.Name }}&lt;/td&gt; &lt;td&gt;{{ student.RollNo }}&lt;/td&gt; &lt;td&gt;{{ student.Percentage }}&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;script&gt; function studentController($scope,$http) { var url="data.txt"; $http.get(url).success( function(response) { $scope.students = response; }); } &lt;/script&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"&gt;&lt;/script&gt; &lt;/body&gt; </code></pre> <p><em>Data.txt</em></p> <pre><code>[ { "Name" : "Collin James", "RollNo" : 101, "Percentage" : "81.5%" }, { "Name" : "Michael Ross", "RollNo" : 201, "Percentage" : "70%" }, { "Name" : "Robert Flare", "RollNo" : 191, "Percentage" : "75%" }, { "Name" : "Julian Joe", "RollNo" : 111, "Percentage" : "77%" } ] </code></pre>
37,002,717
0
<p>From your android device you should not put <code>localhost/###.#.#.#:##</code>, but instead just your server address and port like <code>###.#.#.#:##</code>, for example <code>192.168.1.12:80</code>. Because you are not running any server on your android app.</p>
8,066,458
0
How to assign a value of base page element from child page's Page_Load? <p>I'm probably not the first who has this problem, but I can't find such question and solution for it. </p> <p>I have a base .aspx page and child page which inherits from the base page. From child's <code>Page_Load</code> method I call a method on a base page like <code>base.SetLiteral(value)</code> which acceses a literal defined in the base page. I get a NullReferenceException, as the literal is null.</p> <p>It probably has to do with page lifecycle as base page's controls are not instansiated at that point yet.</p> <p>How can I do it?</p> <p>EDIT</p> <p>Here is a stack trace of the exception. Doesn't say anything to me.</p> <pre><code>System.NullReferenceException was unhandled by user code Message=Object reference not set to an instance of an object. Source=PageInheritance StackTrace: at PageInheritance.BasePage.SetLiteral(String value) in D:\crap-projects\PageInheritance\BasePage.aspx.cs:line 17 at PageInheritance.Page1.Page_Load(Object sender, EventArgs e) in D:\crap-projects\PageInheritance\Page1.aspx.cs:line 13 at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) InnerException: </code></pre>
22,549,045
0
<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break">break</a> is to break out of a loop like for, while, switch etc which you don't have here, you need to use <code>return</code> to break the execution flow of the current function and return to the caller.</p> <pre><code>function loop() { if (isPlaying) { jet1.draw(); drawAllEnemies(); requestAnimFrame(loop); if (game == 1) { return } } } </code></pre> <p>Note: This does not cover the logic behind the if condition or when to return from the method, for that we need to have more context regarding the <code>drawAllEnemies</code> and <code>requestAnimFrame</code> method as well as how <code>game</code> value is updated</p>
5,475,979
0
Dynamically generating a function name based on a variable <p>What I want is to create a function whose name will come from the content of one of my variables.</p> <p>Example :</p> <pre><code>var myFunctionName = "tryAgain";` [tryAgain] | | | function myFunctionName() { alert('Try Again !'); }; </code></pre>
22,713,161
0
<p>Seems like you are using an image from a URL that has not set correct Access-Control-Allow-Origin header and hence the issue.. You can fetch that image from your server and get it from your server to avoid CORS issues..</p>
15,447,316
0
<p>Validation doesn't work with knockout bindings....</p> <p>You have to duplicate the validation in client side. The faster way is using knockout validation plugin, but it is slow when you have a lot of data..</p> <p><a href="https://github.com/ericmbarnard/Knockout-Validation" rel="nofollow">https://github.com/ericmbarnard/Knockout-Validation</a></p> <p>Or you can just use jquery validation.</p>
37,118,922
0
Translating cURL into Swift NSURLSession <p>I am working with the Twilio API to perform a lookup with a phone number. I have an SID &amp; API token, and the example call gives me this cURL command:</p> <pre><code>curl -XGET "https://lookups.twilio.com/v1/PhoneNumbers/4192240117?Type=carrier&amp;Type=caller-name" -u "{AccountSid}:{AuthToken}" </code></pre> <p>However, I'm not sure how to translate that into a valid URL when creating my NSURLSession. </p> <p>Does the <code>AccountSID</code> &amp; <code>AuthToken</code> token go into the header of the request, or are they parameters to the request?</p> <p>I have tried adding them as both, using the awesome Paw app, to see if I could get it working, but I have not been able to. </p> <p>I have tried searching Google for what the <code>-u</code> command is in cURL, so I added the <code>username</code> &amp; <code>password</code> fields in the request header with the appropriate key, but no luck. </p> <p>Can anyone explain where I need to put <code>AccountSID</code> &amp; <code>AuthToken</code> in the URL to successfully make the request?</p>
2,681,257
0
<p>yes, this is all possible, if you could give us an example of what you want, maybe with a screenshot or something, then we can help you with some code examples</p>
32,087,202
0
<p>Go to your module or extension folder then /Block/Adminhtml/Blog/Grid.php. Open this Grid.php file and search the function <code>protected function _prepareCollection()</code> and add the following code under this function before <code>return parent::_prepareColumns();</code>.</p> <pre><code>$this-&gt;addExportType('*/*/exportCsv', Mage::helper('blog')-&gt;__('CSV')); $this-&gt;addExportType('*/*/exportXml', Mage::helper('blog')-&gt;__('XML')); </code></pre> <p>After add this code it may be looks like that: Next, in this extension or module folder go to /controllers/Adminhtml/ and open the controller file and add the following code under the class (add the code bottom of the page before last '}') </p> <pre><code>public function exportCsvAction() { $fileName = 'blog.csv'; $content = $this-&gt;getLayout()-&gt;createBlock('[your-module-name]/adminhtml_[your-module-name]_grid') -&gt;getCsv(); $this-&gt;_sendUploadResponse($fileName, $content); } public function exportXmlAction() { $fileName = 'blog.xml'; $content = $this-&gt;getLayout()-&gt;createBlock('[your-module-name]/adminhtml_[your-module-name]_grid') -&gt;getXml(); $this-&gt;_sendUploadResponse($fileName, $content); } protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') { $response = $this-&gt;getResponse(); $response-&gt;setHeader('HTTP/1.1 200 OK',''); $response-&gt;setHeader('Pragma', 'public', true); $response-&gt;setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true); $response-&gt;setHeader('Content-Disposition', 'attachment; filename='.$fileName); $response-&gt;setHeader('Last-Modified', date('r')); $response-&gt;setHeader('Accept-Ranges', 'bytes'); $response-&gt;setHeader('Content-Length', strlen($content)); $response-&gt;setHeader('Content-type', $contentType); $response-&gt;setBody($content); $response-&gt;sendResponse(); die; } </code></pre> <p>Now replace the [your-module-name] text with your extension or module name and save then check.</p> <p><strong>* Please like if this post help you!*</strong></p>
32,608,267
0
<p>You're not using the Java API, except for the call to <code>parseSMTLIB2String</code>. This function does not execute any SMT commands and there is no function that would do that for you. <code>parseSMTLIB2String</code> exists exclusively to parse assertions, it will ignore everything else. For this particular problem, I recommend to simply pass the problem file to <code>z3.exe</code> either as a command line argument or via stdin (use <code>-in</code> option). This produces</p> <pre><code>unsat (x1 x3) </code></pre> <p>If the intent is to use the Java API for other things at a later point, see the <a href="https://github.com/Z3Prover/z3/blob/master/examples/java/JavaExample.java#L2078" rel="nofollow">Java API unsat core example</a>.</p>
40,273,994
0
SVG- how to define reference/anchor points <p>Is it possible to define some kind of <strong>anchor/reference point</strong> inside an SVG? Ideally as an attribute, probably custom, as I haven't found some built in. A possible application of such an attribute would be very similar to the one of text-anchor: <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor" rel="nofollow">text-anchor</a></p> <p>My main purpose is to be able to place one SVG on top of another, just like placing text at a specific point of an SVG. The idea is that the <strong>anchors</strong> of each SVG should <strong>match</strong> inside a global co-ordination system for simplicity).</p> <p>Thanks for any info!</p> <p><em>similar question</em>: <a href="https://stackoverflow.com/questions/19728471/rects-equivalent-to-texts-text-anchor-presentation-attribute">transform-translate</a></p>
17,458,681
0
Laravel 4 - how to use a unique validation rule / unique columns with soft deletes? <p>Assume, you are trying to create a new user, with a User model ( using soft deletes ) having a unique rule for it's email address, but there exists a trashed user within the database.</p> <p>When trying to validate the new user's data, you will get a validation error, because of the existing email.</p> <p>I made some kind of extra validation within my Controllers, but wouldn't it be nice to have it all within the Model?</p> <p>Would you suggest creating a custom validation rule?</p> <p>As I haven't found a clean solution now, I am interessted in how others solved this problem.</p>
27,330,748
0
<p><code>WebClient.resCode</code> is a non-nullable <code>Int</code> so it is 0 by default hence the problem would be either the request not being sent or the response not being read. </p> <p>As you are obviously writing the request, the problem should the latter. Try calling <a href="http://fantom.org/doc/web/WebClient#readRes" rel="nofollow">WebClient.readRes()</a> before <code>resStr</code>.</p> <blockquote> <p>This readRes()</p> <p>Read the response status line and response headers. This method may be called after the request has been written via writeReq and reqOut. Once this method completes the response status and headers are available. If there is a response body, it is available for reading via resIn. Throw IOErr if there is a network or protocol error. Return this.</p> </blockquote> <p>Try this:</p> <pre><code>echo(spreadsheet_inputer.readRes.resStr) </code></pre> <p>I suspect the following line will also cause you problems:</p> <pre><code>spreadsheet_inputer.reqOut.writeXml(xml_test.writeToStr).close </code></pre> <p>becasue <code>writeXml()</code> escapes the string to be XML safe, whereas you'll want to just print the string. Try this:</p> <pre><code>spreadsheet_inputer.reqOut.writeChars(xml_test.writeToStr).close </code></pre>
23,343,432
0
<p>Problem solved! The problem was that the work order number did not exist. It is a very misleading error but once an existing work order was tested, it fetched the work order with no issues.</p>
32,152,775
0
<pre class="lang-scala prettyprint-override"><code>import scala.collection._ import scala.collection.JavaConversions._ val myMap: mutable.Map[K,V] = ??? val unmodifiable: mutable.Map[K,V] = java.util.Collections.unmodifiableMap[K,V](myMap) val newMap = unmodifiable.asInstanceOf[scala.collection.Map[K,V]] </code></pre> <p>You can cast <code>newMap</code> to a <code>mutable.Map</code>, but modifications will throw <code>UnsupportedOperationException</code>.</p> <p>In my case, the maps may be small enough that <code>toMap</code> may be faster and use less memory.</p>
15,726,639
0
Android : Using Handler but still meet NetworkOnMainThreadException <p>I do some network thing, and I understand I cannot do it on main thread. So, I put it into Handler. Here is my code:</p> <pre><code>handler = new Handler(); handler.postDelayed(new OrderTask(this, url), 10 * 1000); // periodically run every 10 seconds. </code></pre> <p>And here is my Runnable class:</p> <pre><code>public class OrderTask implements Runnable { OrderFragment fragment; String url; public OrderTask(OrderFragment fragment, String url) { this.fragment = fragment; this.url = url; } @Override public void run() { synchronized (fragment.orders) { fragment.orders = Order.loadServerOrders(url); // network code here } fragment.adapter.notifyDataSetChanged(); } } </code></pre> <p>But when It runs, it wll throw exception : <code>NetworkOnMainThread</code> at line <code>loadSeverOrder</code>. I cannot explain why. Please help me figure this.</p> <p>Thanks :)</p>
36,041,654
0
<p>I think you want to submit the form when the input is clicked so:</p> <pre><code>var input = document.querySelector('input'), form = document.querySelector('form'); input.addEventListener('click', function(){ form.submit(); }); </code></pre>
39,173,741
0
Is A1 found between values B and C, where B is the start number and C is the end number, regardless of row? Excel <p>Is A1 found between values B and C, where B is the start number and C is the end number, regardless of row? In excel. </p> <p><a href="https://i.stack.imgur.com/N547W.png" rel="nofollow noreferrer">screenshot</a></p> <p><a href="https://i.stack.imgur.com/N547W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N547W.png" alt="enter image description here"></a></p> <p>I am trying to figure if the transcription start site coordinate in A, is found within a gene (start coordinate is in B and end coordinate is in C). If so, write "yes", if not, write "no".</p>
34,391,650
0
<p>you should do </p> <pre><code>public List&lt;DataLstViewEmail&gt; GetRows() { </code></pre> <p>instead of </p> <pre><code>public IEnumerable&lt;object&gt; GetRows() { </code></pre>
6,769,550
0
AJAX FilteredTextBoxExtender allow carriage return <p>I have a multi-line text box that I am using an AJAX FilteredTextBoxExtender to limit the user input to only numbers. I'd like to also allow the user to add a new line by using the enter key. I've searched and haven't found anything that works. Does anyone know how to do this?</p> <p>Thanks in advance!</p> <p>Here's my code for reference:</p> <pre><code>&lt;asp:TextBox ID="txtEIDEntryBox" runat="server" CssClass="PrettyEntryBox" TextMode="MultiLine" Height="300px" Width="100px"&gt;&lt;/asp:TextBox&gt; &lt;ajaxToolkit:FilteredTextBoxExtender ID="ftbeEID" runat="server" TargetControlID="txtEIDEntryBox" FilterType="Custom" ValidChars="0123456789"&gt;&lt;/ajaxToolkit:FilteredTextBoxExtender&gt; </code></pre>
24,104,117
0
<p>That usually happens when trying to use a model that was trained for a different tagger version. Make sure you are using the models distributed with the 3.3.1 tagger.</p> <p>I faced the same problem once. Then I realized that the jar version I was using was from 3.3.1 release. And the model was from 3.2.0. I removed the 3.2.0 model files and replaced them with 3.3.1.</p> <p>Hope this helps.</p>
39,294
0
<p>For me, " <em>business logic</em> " makes up all the entities that represent data applicable to the problem domain, as well as the logic that decides on "what do do with the data"..</p> <p>So it should really consist of "data transport" (not access) and "data manipulation".. Actually data access (stuff hitting the DB) should be in a different layer, as should presentation code.</p>
14,474,895
0
How to encode method parameters using HadoopRpcRequestProto request field in Hadoop <p>The Hadoop RPC engine uses Protocol Buffer to encode/decodes the bytes from the wire.</p> <p>I am trying to invoke a method on a Hadoop Server using the HadoopRpcRequestProto</p> <pre><code>HadoopRpcRequestProto rpcReHadoopRpcRequestProtoquest; HadoopRpcRequestProto.Builder builder = HadoopRpcRequestProto.newBuilder(); builder.setMethodName("foo"); </code></pre> <p>So if my "foo" method takes two parameters, foo(String name, int num);</p> <p>How do I encode the parameters and set them to the HadoopRpcRequestProto's request field?</p> <p>TIA</p>
12,752,213
0
C++ linking the required DLL with the application <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4702732/the-program-cant-start-because-libgcc-s-dw2-1-dll-is-missing">The program can&#39;t start because libgcc_s_dw2-1.dll is missing</a><br> <a href="http://stackoverflow.com/questions/4984612/program-cant-find-libgcc-s-dw2-1-dll">Program can&#39;t find libgcc_s_dw2-1.dll</a> </p> </blockquote> <p>So im using the MinGw C++ Compiler(g++) and i created the simplest application which just prints "Hello World". Now i want to build this application not in debug mode, and to run it on another computer. I searched the net about this and i came across a post in which somebody used PEDUMP to see what DLL's did the program need, i used that and the simple Hello World just needs the Kernel32.dll(which obviously is located in the system32) and the libgcc_s_dw2-1.dll which i believe is of the MinGw compiler. Now how do i link the libgcc_s_dw2-1.dll to my application? Also is it linked inside(binded) the application(exe) or is it separated(not sure how linking works) and if its separated how do i tell the program in which directory to see for that particular dll? Hope i was clear because im not sure how to explain it.</p> <pre><code>#include&lt;iostream&gt; using namespace std; int main() { cout &lt;&lt; "Hello"; } </code></pre> <p>`Here is the code @jarekczek</p>
20,280,272
0
How to connect multiple xml files <p>My app needs different screens and each screen should be connected with each other. For example there are 5 screens, the main screen, 4 other screens connected to the main screen. The main screen contains 4 buttons to goto other screens and the other screens has a button to go back to the main screen. The problem is i cant get the ids of other screens. And do i need to create 4 .java files for the new screens?</p> <p>This is the code for connecting main screen to others:</p> <pre><code>LayoutInflater inflater; View one; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.total_assets); inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); one = inflater.inflate(R.layout.total_assets,null); Button home = (Button) findViewById(R.id.goback); home.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub setContentView(R.layout.activity_acc_soft); } }); </code></pre> <p>total_assets is the second screen and actinity_acc_soft is the main screen.</p> <p>(plz help newbie to android)</p>
21,852,526
0
How to convert an ASP.NET/PushSharp project to Azure to send push notifications? <p>I've been using ASP.NET and PushSharp to send push notifications to my iOS app clients with the simple following code (after certificate configurations etc):</p> <pre><code>//ASP.NET + PushSharp AppleNotification notification = new AppleNotification(PushToken).WithAlert(message); broker.QueueNotification&lt;AppleNotification&gt;(notification); </code></pre> <p>This worked perfectly on isolated hosts running classic IIS/ASP.NET but now I'm moving towards Windows Azure. When I try this code on Windows Azure, notifications sometimes fail to send, and restarting the website (Standard mode) helps. However, since this is an unreliable approach I've decided to move to Azure's Notification Hub service. I've created the hub, uploaded my certificates, started coding but I couldn't find the equivalent of my previous code. I don't need to broadcast messages to all users, I need to send a push notification to a single device, given that I have the push token. I've looked at <a href="http://stackoverflow.com/questions/21323712/windows-azure-servicebus-push-notifications-apns-architecture">Windows Azure ServiceBus Push Notifications APNS Architecture</a> but the link provided at the answer is extremely confusing and I couldn't understand it. How can I, simply push a message to a push token on Windows Azure? Do I have to use notification hub? (I don't use a VM) Any simple approach is welcome, pure ASP.NET/PushSharp-based approach is preferred as I don't need to change my whole codebase.</p>
22,242,913
0
<p>Write only one function &amp; call it on both event.</p> <pre><code>$( "#target" ).keypress(function() { </code></pre> <p>funABC(); });</p> <pre><code> $( "#target" ).click(function() { </code></pre> <p>funABC(); });</p> <pre><code>function funABC(){alert("DONE");} </code></pre> <p>One more shortcut :</p> <pre><code> $( "#target" ).click(function() { $( "#target" ).keypress(); }); $( "#target" ).keypress(function() { funABC(); }); </code></pre>
15,730,635
0
Jquery Ajax requests not working on IE 10 (due to cache) <p>I would like to begin with this. I am fed up with IE. I have the code below:</p> <pre><code>$(function () { $("#cal").on('click', "#forward", function () { $.ajax({ url: "Home/Calendar?target=forward", type: "GET", success: function (result) { $("#cal").html(result); } }); }); }); $(function () { $("#cal").on('click', "#backwards", function () { $.ajax({ url: "Home/Calendar?target=backwards", type: "GET", success: function (result) { $("#cal").html(result); } }); }); }); </code></pre> <p>It is an ajax call to a controller action in an C# MVC application. It just goes back and forth a calendar's months replacing the html. Now I know that you need to reattach the event due to the <code>html()</code> call and that is why I use <code>on()</code> with JQuery 1.7. I have used <code>delegate()</code> as well. In FF, Chrome it works as intended. In IE 10 it does not. I am at a loss. I knew that IE had issues with delegate in IE8 and with JQuery &lt; 1.5 but this is not the case. </p> <p>Does anyone know how to solve this?</p>
6,427,893
0
<p>Ok, you have some serious issues here. Orders have mulitple items, invoices have multiple orders and payments may apply to mulitple orders and invoices. Orders may appear on multiple invoices (if they don't pay right aways which is common).</p> <p>So what you need are linking tables. You should start with an ORDERINVOICE table which has both the order id and the invoice ID. Then an ORDERPAYMENT table with paymentid and Order id. </p> <p>You also need to consider that in an ordering situation, you must record the details of the order as it occurred at the time. That means that while you should have the user_id to link to the current user, you should record the user's name, billing address and shipping addres as it was at the time of the order. You will need this information later to deal with any questions on the order. Further you need to ensure that you store the details of the order in a separate table called ORDERDETAILS which store the indivdual line items, the price at the time of the order and the name of the item ordered. You will need this for accounting reasons. You do not under any cuircumstances want to rely on a join to a product table to figure out the price of an order in the past. This will cause your finanacial records to be inaccurate.</p>
21,359,209
0
How to pass the asp.Identity object to a second register page <p>I am building a much more advanced registration process which consists of 3 pages, the first page is a form that grabs a username(email form) and a password with confirmation. The button click on this page creates the user in an unverified state in the db and redirects to the page where the profile is created. Once the create profile button is clicked and the profile is created in the db the redirect takes you to the Credit Card info page where the form is filled out, the credit card is verified and then that info is written to a table in the database.</p> <p>I have disabled the loggedin user display in the header so that I can use the registrants First and Last name which arent entered until the Credit Card page. Since the identityUser is required for the sign on and thus to populate the loggedin user control, how can I pass this object from page to page? </p> <p><strong>Code where original template was logging in the user</strong>: (Note:I commented out the sign in code)</p> <pre><code> Protected Sub CreateUser_Click(sender As Object, e As EventArgs) Dim userName As String = UserNameCtrl.Text Dim manager = New UserManager() Dim newuser = New IdentityUser() With {.UserName = userName} manager.UserValidator = New UserValidator(Of IdentityUser)(manager) With {.AllowOnlyAlphanumericUserNames = False} Dim result = manager.Create(newuser, Password.Text) If result.Succeeded Then Session("email") = newuser.UserName Session("userid") = newuser.Id.ToString() 'uncomment the code below if you want the auto sign in to occur 'IdentityHelper.SignIn(manager, newuser, isPersistent:=False) IdentityHelper.RedirectToReturnUrl(Page.ResolveUrl("~/Account/CreateProfile.aspx?Guid=" &amp; newuser.Id.ToString()), Response) Else ErrorMessage.Text = Encoder.HtmlEncode(result.Errors.FirstOrDefault()) End If End Sub </code></pre> <p>I now call this routine to sign in the user once the third page of the registration process is completed. (Session("userid") is the new registrants generated userid)</p> <pre><code> Private Sub SignInUserOnFormCompletion() Dim manager = New UserManager() manager.UserValidator = New UserValidator(Of IdentityUser)(manager) With {.AllowOnlyAlphanumericUserNames = False} Dim newuser = New IdentityUser() With {.Id = Session("userid").ToString()} IdentityHelper.SignIn(manager, newuser, isPersistent:=False) End Sub </code></pre> <p>The problem is the above doesnt work as the newuser somehow has different credentials. How can I pass the original newuser from the first page to the third page where I can use it in the SignInUserOnFormCompletion subroutine? Do I create a cookie and pass it around that way? This is a new topic for me so I'm not familiar with the proper methods to accomplish this.</p>
36,301,394
0
<p>you can check if <code>bufferredWriter</code> not equal to null</p> <pre><code>if(bufferredWriter!=null) { bufferredWriter.close(); } </code></pre> <p>If you are using java7 or more then you need not to worry about closing the BufferredWriter </p> <p>JDK 7 onwards you can make you of try with resource </p> <p>for example</p> <pre><code>try(BufferredWriter bufferedWriter=new BufferredWriter()) { //your code } catch(Exception e) { } </code></pre>
6,472,847
0
<blockquote> <p>Then I began thinking: wouldn't it be useful if the default value of that business object was a null object instead of a null reference?</p> </blockquote> <p>It sounds like your project would benefit from using an IOC container that could inject a <code>NullBusinessObject</code> instance by default that does whatever you want it to do as default behavior. C# itself doesn't offer anything built in that you could override in this regard.</p>
4,367,142
0
<p>yes it is absolutely possible. u need to handle pickerView delegate method </p> <pre><code>- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view </code></pre> <p>here you simply return custom view(could be anything UIImage UILabel)</p> <p>and set userInteractionEnable property to no for customize view..</p>
8,903,090
0
<p>You can get the extensions for all links in a document like this:</p> <pre><code>var endings = []; var links = document.getElementsByTagName("a"); var matches; for (var i = 0; i &lt; links.length; i++) { if (links[i].href) { matches = links[i].href.match(/\.([^\.]+)$/); if (matches) { endings.push(matches[1]); } } } // the array endings contains a list of all link extensions </code></pre> <p>Here's a working version of the code: <a href="http://jsfiddle.net/jfriend00/XHKaT/" rel="nofollow">http://jsfiddle.net/jfriend00/XHKaT/</a></p> <p>The regular expression here matches a period followed by one or more non-period characters at the end of the string. The parenthesized grouping allows us to extra just the extension without the period which accomplishes the result you outlined.</p>
33,612,787
0
<p>Try this:</p> <pre><code>Sub Macro1(colindex As Integer) ' ' Macro1 Macro ' 'make our ranges variable and based on the input column Dim range_alpha As Range, range_beta As Range Set range_alpha = ActiveSheet.Range(ActiveSheet.Cells(18, colindex), ActiveSheet.Cells(20, colindex)) Set range_beta = ActiveSheet.Range(ActiveSheet.Cells(18, colindex + 1), ActiveSheet.Cells(20, colindex + 1)) range_alpha.Select range_alpha.Select Selection.Copy range_beta.Select Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks:=False, Transpose:=False range_beta.Select Application.CutCopyMode = False Selection.Copy range_alpha.Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False Range("M18:M20").Select End Sub Sub Macro1_BySelection() '' use this sub to call Macro 1 if you want to select a column first Macro1 Selection.Column End Sub Sub Macro1_ByProbe() '' use this sub to call Macro 1 for the first empty column found Dim tst As String Dim colindex As Integer colindex = 1 tst = ActiveSheet.Cells(18, colindex).Value Do While tst &lt;&gt; "" colindex = colindex + 1 tst = ActiveSheet.Cells(18, colindex).Value Loop Macro1 colindex End Sub Sub Macro1_ByR3uk() Dim LastCol As Integer LastCol = ActiveSheet.Cells(18, ActiveSheet.Columns.Count).End(xlToLeft).Column Macro1 LastCol + 1 End Sub </code></pre> <p>Your initial function has been tweaked to act not on the fixed range of "Lxx" but to accept a number as column index.</p> <p>The two other macro's offer two distinct ways of determining which range to use:</p> <ul> <li><code>Macro1_BySelection()</code> uses the cell that is selected when the macro is called.</li> <li><code>Macro1_ByProbe()</code> tests to find the first empty column.</li> <li>EDIT: I liked R3uk's way of finding the last used column better than mine, used his technique for <code>macro1_ByR3uk()</code> (we learn every day :-) )</li> </ul>
13,643,742
0
<p>Look with this post's answer to do it in CSS : <a href="http://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css">Change an input&#39;s HTML5 placeholder color with CSS</a></p> <p>Then, you can include the <strong>CSS</strong> rule with <strong>javascript</strong>.</p> <p>And you just have to use pseudo-class <code>:hover</code> for the <em>mouseover</em>.</p> <p>Just like that :</p> <p><strong>CSS</strong></p> <pre><code>input.formInvalid::-webkit-input-placeholder { color: red; } </code></pre> <p><strong>Javascript</strong></p> <pre><code>document.getElementById("yourElementId").className += " formInvalid"; //add the class .formInvalid to your element </code></pre>
23,630,360
0
<p><a href="http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions140.htm" rel="nofollow">RPAD</a> should work</p> <pre><code>select RPAD('*', rank, '*') from soldiers; </code></pre> <p>But this kind of formatting is also easily done client-side (if you have an application between you and the database and are not just using an SQL prompt directly).</p>
977,317
0
<p>What you want to do requires two blits: one to mask out the portions of the destination bitmap (using pixelwise AND), and then a second one to pixelwise OR the colors from the overlay onto the destination.</p> <p>Do do this manually, you need to make a monochrome mask from your overlay bitmap, with white in the transparent parts and black in the opaque parts. AND the mask with the destination, then OR the color data from your original overlay.</p> <p><code>screen AND mask OR overlay</code></p> <p>And if this is for full-screen stuff, you may want to do the composition in an off-screen bitmap to avoid flicker.</p> <p>Peter Ruderman's suggestion to use TransparentBlt is probably a good one, though I've never tried it myself.</p>
30,154,654
0
Eclipse does not recognize static web content under src/main/resources/static <p>I am working on a Spring boot web project. I have an index.html file under <code>src/main/webapp</code>, and a .js file under <code>src/main/resources/static/js</code>.<p> Eclipse is complaining on the <code>&lt;script&gt;&lt;/script&gt;</code> inclusion inside the index.html file: Undefined Javascript file. The above is also the case for css files under <code>src/main/resources/static/css</code>.<p> In addition, I'm using wro to generate unified angularjs-bootstrap js and css files, which are generated under <code>target\generated-resources\static</code> and Eclipse cannot find them either. <p>Is there any way to configure Eclipse to include the above directories?</p>
14,068,798
0
How to optimize this css code? <p>I am a css newbie. I just draw a basic HTML page with following code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Hey&lt;/title&gt; &lt;link href="style.css" rel="stylesheet" type="text/css"&gt; &lt;/head&gt; &lt;body&gt; &lt;header class="top-menu"&gt;&lt;/header&gt; &lt;div class="container"&gt; &lt;div class="left-side"&gt;&lt;/div&gt; &lt;div class="main-content"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="foot"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Here is style.css:</p> <pre><code>.top-menu{ position: fixed; top: 0; left: 70px; right: 70px; height: 50px; background-color: #000000; } .container{ margin: 70px 70px 20px 70px; display: inline-block; width: 91%; } .left-side { width: 30ex; min-height: 30ex; float: left; background-color: blue; } .main-content { width: 80ex; float: right; background-color: red; min-height: 100ex; } .foot { background-color: green; height: 5ex; width: 91%; margin-left: 10ex; } </code></pre> <p>The purpose is straightforward.But the css looks crap.even some problems.I want to ask some questions:</p> <p>1.The left and right margin of container is 70px, and the same to top-menu, but from chrome page view,why does it not aligned?</p> <p>2.Why does it appear horizontal scroll bar when I set 'container''s width to 100 percent (same as foot part)?</p> <p>3.If I don't set container's display to 'inline-block', why does the foot part flying to the air? (even I set it to 'block')</p> <p>4.Could you guys give me a better css style code?</p>
39,413,916
0
JMSCS0002 from Spring JMS and IBM Websphere MQ <p>I've seen a question or two on Stack overflow regarding this error but I'm still unable to solve it, so I thought I would pose my own question.</p> <p>Here's my issue:</p> <p>I'm using Spring and Spring's JMSTemplate to do some messaging and queue work. I'm trying to read from a queue. I'm not 100% positive if my logic is correct in my code, but anytime I try to run my app I am greeted with this exception (I've included only the last section):</p> <pre><code>Caused by: com.ibm.msg.client.commonservices.CSIException: JMSCS0002 at com.ibm.msg.client.commonservices.workqueue.PIWorkQueueManager.enqueueItem(PIWorkQueueManager.java:67) at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.enqueue(WorkQueueManager.java:225) at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.enqueue(WorkQueueManager.java:194) at com.ibm.msg.client.wmq.common.internal.WMQThreadPool.enqueue(WMQThreadPool.java:91) </code></pre> <p>Now I'm fairly certain this has nothing to do with my code because no matter how much I change my logic, if I try calling any of the methods made available by <code>JMSTemplate</code>, I receive this exception. After doing some research (based on the other stack overflow answers) I assume it has something to do with the way my classpath is setup. Here is a link to those questions:</p> <p><a href="http://stackoverflow.com/questions/18639212/mqseries-csiexception-jmscs0002-but-classpath-looks-ok-for-commonservices">One</a> and <a href="http://stackoverflow.com/questions/36849774/ibm-mq-ffdc-csiexception-jmscs0002-when-i-try-to-run-from-console">Two</a> </p> <p>In addition to this, here's some info I found on IBM's <a href="http://www.ibm.com/support/knowledgecenter/SSFKSJ_7.1.0/com.ibm.mq.doc/jm10330_.htm" rel="nofollow">site</a>:</p> <blockquote> <p>To compile and run WebSphere MQ classes for JMS applications, use the CLASSPATH setting for your platform as shown in Table 1.</p> <p>CLASSPATH=MQ_INSTALLATION_PATH\java\lib\com.ibm.mqjms.jar; MQ_INSTALLATION_PATH\tools\jms;</p> </blockquote> <p>I have tried this however and It still seems to be failing me. Here's what I have added in my .bat file for my application that I run:</p> <p><code>c:\java\jre6\bin\javaw -cp "C:\ussco\wmsflgint\mqs\mqjms-7.5.0.0.jar; C:\ussco\wmsflgint\mqs\mq-7.5.0.0.jar; C:\ussco\wmsflgint\mqs\headers-1.4.2.jar; C:\ussco\wmsflgint\mqs\jmqi-7.5.0.0.jar;" -Xmx256M ....</code> (there's more on the end but I don't feel it's relevant)</p> <p>Am I not adding this correctly? </p> <p>Thanks</p>
34,288,499
0
Reading multiple text records from an NFC tag <p>In my application, I have three text fields which are then written to an NFC tag by tapping the Write button. I've followed the Android Developers site to develop this application. And following is the function that writes the data to the tag.</p> <p><strong>Code</strong><br></p> <pre><code>private void write(String uname,String locid,String secid,Tag tag)throws IOException, FormatException{ NdefRecord[] records={NdefRecord.createTextRecord("",uname),NdefRecord.createTextRecord("",locid),NdefRecord.createTextRecord("",secid),NdefRecord.createApplicationRecord("com.testprojects.gcdev")}; NdefMessage message=new NdefMessage(records); Ndef ndef=Ndef.get(tag); ndef.connect(); ndef.writeNdefMessage(message); ndef.close(); } </code></pre> <p>Now I want to read the records from the NFC tag in another activity. Which method should I use to read the content from the tag.</p> <p><strong>Note:</strong> I'm leaving the languageCode part empty in the createTextRecord() method because I don't know what should be passed and in <a href="https://developer.android.com/reference/android/nfc/NdefRecord.html#createTextRecord" rel="nofollow">Android Developer site</a>, it says "If locale is empty or null, the language code of the current default locale will be used." So if you know what languageCode should be passed, do let me know.</p>
35,711,832
0
<p>Judging from your quote it seems to me you want to do something like this (<a href="http://sqlfiddle.com/#!9/742b39/1/0" rel="nofollow">SQLfiddle</a>):</p> <pre><code>SELECT m.info1, m.info2, COUNT(DISTINCT CONCAT(m.key1, ' ', m.key2)) key_count, GROUP_CONCAT(DISTINCT CONCAT(m.key1, ' ', m.key2) ORDER BY m.key1, m.key2) key_pairs, COUNT(DISTINCT p.serial) serial_count, GROUP_CONCAT(DISTINCT p.serial ORDER BY p.serial) serials, COUNT(DISTINCT p.product_data) data_count, GROUP_CONCAT(DISTINCT p.product_data ORDER BY p.product_data) product_data FROM main_info m INNER JOIN product1 p ON p.key1 = m.key1 AND p.key2 = m.key2 WHERE p.serial &lt; 10 GROUP BY m.info1, m.info2 </code></pre> <p>Count distinct values and list them, is this correct? You can't just group by info1, info2 and also have columns for key1 or key2 in the result (e.g. min(key1) or max(key2) would work). I adjusted this in the query above, although it is quite different from your result it might be what you actually need, maybe with a few changes.</p>
35,297,472
0
<pre><code>static private XmlNode makeXPath(XmlDocument doc, string xpath) { return makeXPath(doc, doc as XmlNode, xpath); } static private XmlNode makeXPath(XmlDocument doc, XmlNode parent, string xpath) { // grab the next node name in the xpath; or return parent if empty string[] partsOfXPath = xpath.Trim('/').Split('/'); string nextNodeInXPath = partsOfXPath.First(); if (string.IsNullOrEmpty(nextNodeInXPath)) return parent; // get or create the node from the name XmlNode node = parent.SelectSingleNode(nextNodeInXPath); if (node == null) node = parent.AppendChild(doc.CreateElement(nextNodeInXPath)); // rejoin the remainder of the array as an xpath expression and recurse string rest = String.Join("/", partsOfXPath.Skip(1).ToArray()); return makeXPath(doc, node, rest); } static void Main(string[] args) { XmlDocument doc = new XmlDocument(); doc.LoadXml("&lt;feed /&gt;"); makeXPath(doc, "/feed/entry/data"); XmlElement contentElement = (XmlElement)makeXPath(doc,"/feed/entry/content"); contentElement.SetAttribute("source", ""); Console.WriteLine(doc.OuterXml); } </code></pre>
21,608,440
0
<p>Can't you do:</p> <pre><code>Set typeAMems = errorSet.findAll { it.type == 'A' }.lineNumber Set typeBMems = errorSet.findAll { it.type == 'B' }.lineNumber </code></pre>
38,135,493
0
<p>See the <a href="https://wiki.jenkins-ci.org/display/JENKINS/ArtifactDeployer+Plugin" rel="nofollow">ArtifactDeployer Plugin</a>:</p> <blockquote> <p>ArtifactDeployer plugin enables you to archive build artifacts to any remote locations such as to a separate file server.</p> <p>...</p> <p>ArtifactDeployer is a complete alternative to the built-in Jenkins feature "Archiving artefacts' and it is aimed at providing an uniform deployment mechanism.</p> </blockquote> <p>Add it to your project's config with <em><strong>Post-build Actions</strong></em> → <kbd><em>Add post-build action</em></kbd> → <em>[ArtifactDeployer] - Deploy the artifacts from build workspace to remote locations</em>.</p> <p>or the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Flexible+Publish+Plugin" rel="nofollow">Flexible Publish Plugin</a>:</p> <blockquote> <pre><code>... [Send build artifacts over SSH] ... </code></pre> </blockquote> <p>Add it to your project's config with <em><strong>Post-build Actions</strong></em> → <kbd><em>Add post-build action</em></kbd> → <em>Flexible publish</em>.</p> <p>or an idea I haven't tried myself yet, so no guarantees:</p> <p>Configure your live server to be Jenkins slave node, create a project that is bound to this slave and use the <a href="https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin" rel="nofollow">Copy Artifact Plugin</a> therein:</p> <blockquote> <p>Adds a build step to copy artifacts from another project.</p> </blockquote> <p>Add it to this project's config with <em><strong>Build</strong></em> → <kbd><em>Add build step</em></kbd> → <em>Copy artifacts from another project</em>.</p>
15,269,010
0
SELECT * from 2 different non related tables in PHP/MySQL <p>I have the following code...</p> <pre><code>&lt;?php $sql = "SELECT tickets.company, tickets.datetime, tickets.ticketnumber, customer_notes.customer, customer_notes.timestamp, customer_notes.notes FROM tickets, customer_notes WHERE tickets.company = '".$_GET["seq"]."' AND customer_notes.customer = '".$_GET["seq"]."' GROUP BY customer_notes.customer, tickets.company "; $rs=mysql_query($sql,$conn) or die(mysql_error()); echo '&lt;table width="100%" border="0" cellspacing="5" cellpadding="5"&gt;'; while($result=mysql_fetch_array($rs)) { echo '&lt;tr&gt; &lt;td&gt;'.$result["timestamp"].'&lt;/td&gt; &lt;td&gt;'.$result["notes"].'&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;'.$result["datetime"].'&lt;/td&gt; &lt;td&gt;'.$result["ticketnumber"].'&lt;/td&gt; &lt;/tr&gt;'; } echo '&lt;/table&gt;'; ?&gt; </code></pre> <p>The tickets table and customer_notes table have no reference at all - they are totally separate.</p> <p>The tickets table is for support ticket when customer log issues they are having and then the customer_notes table is for when customers phone up, everything that is spoken about over the phone is logged in this table.</p> <p>I am trying to make it display data from the tickets table and the customer notes table in datetime order.</p> <p>so if a ticket was created, then a note added, then another note added, then a ticket they will display in datetime order using the above code however it is not displaying it correctly</p>
38,255,539
0
PHP microtime - microseconds format <p>If PHP's <code>microtime()</code> function were to be executed at a point in time where the resulting microseconds are <strong>zero</strong>, what format does it result in?</p> <p><strong>Would it look like this?</strong></p> <p><code>0.00 1467926279?</code></p> <p><strong>Or this?</strong></p> <p><code>0 1467926279</code></p> <p><a href="http://php.net/manual/en/function.microtime.php" rel="nofollow">The manual</a> doesn't provide a numerical format, just it's format in English: </p> <blockquote> <p>By default, microtime() returns a string in the form "msec sec"</p> </blockquote>
603,864
0
<p>Multicast traffic is no different than regular UDP except for the IP address. Take a look at the standard <a href="http://docs.python.org/library/socket.html" rel="nofollow noreferrer">socket library</a>. You may be able to find something that builds on socket and is easier to use.</p>
17,524,030
0
<p>here is very simple solution with a short css display:table</p> <pre><code>&lt;div id="main" class="_dt-no-rows"&gt; &lt;div id="aside" contenteditable="true"&gt; Aside &lt;br&gt; Here's the aside content &lt;/div&gt; &lt;div id="content" contenteditable="true"&gt; Content &lt;br&gt; geht's pellentesque wurscht elementum semper tellus s'guelt Pfourtz !. gal hopla &lt;br&gt; TIP : Just clic on this block to add/remove some text &lt;/div&gt; &lt;/div&gt; </code></pre> <p>here is css</p> <pre><code>#main { display: table; width: 100%; } #aside, #content { display: table-cell; padding: 5px; } #aside { background: none repeat scroll 0 0 #333333; width: 250px; } #content { background: none repeat scroll 0 0 #E69B00; } </code></pre> <p>its look like this </p> <p><img src="https://i.stack.imgur.com/eBmDK.png" alt="enter image description here"></p>
10,107,942
0
<p>Instead of <code>bzero</code>, you can just use</p> <pre><code>memset(buf, 0, 1025); </code></pre>
965,705
0
<p>Rather than hacking something up yourself, how about checking out the <a href="http://cherne.net/brian/resources/jquery.hoverIntent.html" rel="nofollow noreferrer">hoverIntent plugin</a>? </p>
8,929,512
0
Why is this Ajax conditional dialog not working? <p>Why is this code not working?</p> <p>In the meantime (trying to make it work) i have changed it a dosen time, but i can't find the solution.</p> <p>Anyone has an idea? I have no errors in console.</p> <p>First of all, it check's if a dialog needs to be opened.</p> <p>This is the workflow:</p> <p>If DialogRequired => Dialog.Click = OK --> execute an ajax call If DialogRequired => Dialog.Click = Cancel --> do nothing If Dialog NOT Required => execute an ajax call</p> <pre><code>$(function () { $("a.orderlink").unbind(); $("a.orderlink").bind("click", function () { var ProductID = $(this).parent().attr("data-productid"); var Ammount = $(this).parent().parent().find("input#ammount").val(); $.ajax({ type: "post", url: $(this).attr("href").replace("AddToCart", "ExistsInCart"), data: { ProductId: $(this).parent().attr("data-productid") }, succes: function (data) { if (data == 1) { $("#ProductExistsInOrder").dialog({ autoOpen: true, height: 170, width: 400, modal: true, buttons: { "OK": function () { /*acties om toe te voegen $.ajax()*/ $.ajax({ type: "post", url: $(this).attr("href"), data: { ProductId: ProductID, Ammount: Ammount }, succes: function () { $("#AddProductNotification").text("U heeft net een product toegevoegd. Herlaad de pagina om uw winkelwagentje te bekijken"); } }); setTimeout("location.reload(true);", 100); $(this).dialog("close"); location.reload(true); // return false; }, "Annuleer": function () { $(this).dialog("close"); // return false; } } }); } else { $.ajax({ type: "post", url: $(this).attr("href"), data: { ProductId: ProductID, Ammount: Ammount }, succes: function () { $("#AddProductNotification").text("U heeft net een product toegevoegd. Herlaad de pagina om uw winkelwagentje te bekijken"); } }); }; // $("#AddProductNotification").text("U heeft net een product toegevoegd. Herlaad de pagina om uw winkelwagentje te bekijken"); }, error: function (XMLHeeptRequest, textStatus, errorThrown) { alert(textStatus); alert(errorThrown); } }); // alert("end"); // AddToCart(this); return false; }); // return false; }); // ProductId: $(orderlinkObject).parent().attr("data-productid"), Ammount: $(orderlinkObject).parent().parent().find("input#ammount").val() </code></pre> <p></p> <p>This is how it goes:</p> <ul> <li>Gets called (=ok) : /Cart/ExistsInCart with parameter: product ID and returns true in jSon</li> <li>But the dialog isn't called and i can't seem to update it with firebug.</li> </ul>
20,120,845
0
Unity - Share Intent <p>We are developing an app in which after taking a screenshot users will be able to share it on social networks, (Facebook, Twitter, Instagram,.. etc). </p> <p>We want to create an Intent, that displays the social installed apps in the device in order to choose one of them and post the picture.</p> <p>We readed this:</p> <p><a href="http://developer.android.com/training/sharing/send.html#send-binary-content" rel="nofollow">http://developer.android.com/training/sharing/send.html#send-binary-content</a> <a href="http://forum.unity3d.com/threads/160723-Android-Intent-problem" rel="nofollow">http://forum.unity3d.com/threads/160723-Android-Intent-problem</a></p> <p>But we need some help. Does anyone achieve sharing data using this way in Unity? Are there any pluguin to do that? (Android, or Android&amp;iOS).</p> <p>If someone could share his experience about this, all the information will be very appreciated.</p> <p>Thanks.</p>
15,633,593
0
<p>you can go to the end of the line with TAB. </p> <p>Write "this.d", type TAB complete to </p> <pre><code>this.doSomething </code></pre> <p>type "(" obtain </p> <pre><code>this.doSomething() </code></pre> <p>then write "someS" and TAB complete to </p> <pre><code>this.doSomething(someString) </code></pre> <p>cursor is between "g" and ")". Type TAB again and cursor go after ")". Complete with ";"</p> <pre><code>this.doSomething(someString); </code></pre> <p>So, you have type "this.d TAB (someS TAB TAB ;"</p> <p>There is no way to do what you exactly want, but with TAB you can save much typing.</p>
33,239,992
0
<p>You didnt close the image tag. use it like this</p> <pre><code>echo '&lt;img height="300" width="300" src="data:image;base64,'.$row['image'].'" /&gt;'; </code></pre>
32,707,593
0
<p>You need to use <code>clearInterval</code></p> <pre><code>var timer = setInterval(function,10000); .... .... clearInterval(timer); </code></pre>
37,559,462
0
<p>Another way to do it simpler using jquery.</p> <p>sample: </p> <pre><code>function add(product_id){ // the code to add the product //updating the div, here I just change the text inside the div. //You can do anything with jquery, like change style, border etc. $("#added_"+product_id).html('the product was added to list'); } </code></pre> <p>Where product_id is the javascript var and$("#added_"+product_id) is a div id concatenated with product_id, the var from function add. </p> <p>Best Regards!</p>
14,768,438
0
<p>Sure you can create a slot that is connected to a "double click" signal and call your model instance <em>setHeaderData</em> //if you overridden that function in your own model type you need to emit headerDataChanged signal, see <a href="http://doc.qt.digia.com/qt/qabstractitemmodel.html#setHeaderData" rel="nofollow">here</a></p>
8,874,998
0
<p>Generally what I would do in your situation is try to just get the plain text our of your HTML and then do the search. This could probably be accomplished with the HtmlAgilityPack, but there is also <a href="http://www.codeproject.com/KB/HTML/HTML_to_Plain_Text.aspx" rel="nofollow">a CodeProject project</a> that does exactly this with a bunch of ugly RegEx searches. I haven't used it so I don't know if it will fix breaks in new lines in the HTML but it might be worth a shot.</p>
7,877,699
0
how twitter changed the get question mark on the url <p>i wonder how twitter did their URL like this</p> <blockquote> <p><a href="https://twitter.com/#!/twitter" rel="nofollow">https://twitter.com/#!/twitter</a></p> </blockquote> <p>is it a unique method via ruby or it's something i can do with .htaccess and php because as far as i know this # sign is used to send user to a certain block on the page</p> <p>also is it possible to use other tags for example &amp; or % or $ etc.</p> <p>thanks in advance </p>
8,373,400
0
<p>The code should be like the following:</p> <pre><code>$columns = array(/*Data*/); $columns1 = array(/*Data1*/); echo json_encode(array($columns,$columns1)); </code></pre> <p>in jQuery use</p> <pre><code>var columns_array=jQuery.parseJSON(response); columns=columns_array[0]; columns1=columns_array[1]; </code></pre>
15,866,199
0
C standard: L prefix and octal/hexadecimal escape sequences <p>I didn't find an explanation in the C standard how do aforementioned escape sequences in wide strings are processed.</p> <p>For example:</p> <pre><code>wchar_t *txt1 = L"\x03A9"; wchar_t *txt2 = L"\xA9\x03"; </code></pre> <p>Are these somehow processed (like prefixing each byte with \x00 byte) or stored in memory exactly the same way as they are declared here?</p> <p>Also, how does L prefix operate according to the standard?</p> <p><strong>EDIT:</strong></p> <p>Let's consider txt2. How it would be stored in memory? \xA9\x00\x03\x00 or \xA9\x03 as it was written? Same goes to \x03A9. Would this be considered as a wide character or as 2 separate bytes which would be made into two wide characters?</p> <p><strong>EDIT2:</strong></p> <p>Standard says:</p> <p>The hexadecimal digits that follow the backslash and the letter x in a hexadecimal escape sequence are taken to be part of the construction of a single character for an integer character constant or of a single wide character for a wide character constant. The numerical value of the hexadecimal integer so formed specifies the value of the desired character or wide character.</p> <p>Now, we have a char literal:</p> <pre><code>wchar_t txt = L'\xFE\xFF'; </code></pre> <p>It consists of 2 hex escape sequences, therefore it should be treated as two wide characters. If these are two wide characters they can't fit into one wchar_t space (yet it compiles in MSVC) and in my case this sequence is treated as the following:</p> <pre><code>wchar_t foo = L'\xFFFE'; </code></pre> <p>which is the only hex escape sequence and therefore the only wide char.</p> <p><strong>EDIT3:</strong></p> <p>Conclusions: each oct/hex sequence is treated as a separate value ( wchar_t *txt2 = L"\xA9\x03"; consists of 3 elements). wchar_t txt = L'\xFE\xFF'; is not portable - implementation defined feature, one should use wchar_t txt = L'\xFFFE';</p>
18,488,423
0
<p>Something like this may do the trick</p> <pre><code>NHSession.QueryOver&lt;Customer&gt;() .Where( Restrictions.Eq( Projections.SqlFunction("length", NHibernateUtil.String, Projections.Property&lt;Customer&gt;(x =&gt; x.RegistryCode)), 8 ) ) </code></pre>
24,361,668
0
<p>Your script filter is slow on big data and doesn't use benefits of "indexing". Did you think about parent/child instead of nested? If you use parent/child - you could use aggregations natively and use calculate sum.</p>
24,756,185
0
<p>Set Perl to paragraph mode, prepend <code>\</code> to newlines:</p> <pre><code>perl -p00le 's/\n/ \\\n/g' </code></pre> <p>Output:</p> <pre><code>aa bb \ ccc aa \ bb \ abc def \ gh </code></pre> <p>This takes advantage of some <a href="http://perldoc.perl.org/perlrun.html" rel="nofollow">Perl flags</a>:</p> <blockquote> <p><strong>-00</strong> The special value 00 will cause Perl to slurp files in paragraph mode.</p> <p><strong>-l</strong> enables automatic line-ending processing. It has two separate effects. First, it automatically chomps $/ (the input record separator) when used with -n or -p. Second, it assigns $\ (the output record separator) to have the value of octnum so that any print statements will have that separator added back on.</p> </blockquote> <p>Here is what Deparse makes of it:</p> <pre><code>perl -MO=Deparse -p00le 's/\n/ \\\n/g' BEGIN { $/ = ""; $\ = "\n\n"; } LINE: while (defined($_ = &lt;ARGV&gt;)) { chomp $_; s/\n/ \\\n/g; } continue { print $_; } </code></pre>
39,681,801
0
<p>you can add a helper method <code>get</code> to your class:</p> <pre><code>... A &lt;- R6::R6Class( "A", private = list( private_print = function(){print("Ola")} ), public = list( get = function(name=NULL){ # recursion if( length(name)&gt;1 ){ tmp &lt;- lapply(name, self$get) names(tmp) &lt;- name return(tmp) } if(is.null(name)){ self$message("no input, returning NULL") return(NULL) } # self if(name=="self"){ return(self) } # in self if( name %in% names(self) ){ return(base::get(name, envir=self)) } # private or in private if( exists("private") ){ if(name=="private"){ return(private) }else if(name %in% names(private) ){ return(base::get(name, envir=private)) } } # else self$message("name not found") return(NULL) } ) ) ... </code></pre> <p>Than use it like this:</p> <pre><code>a &lt;- A$new() a$get("private_print")() ## [1] "Ola" </code></pre>
28,435,017
0
<p>Why not use the shorthand method .click? </p> <p><a href="http://api.jquery.com/click/" rel="nofollow">http://api.jquery.com/click/</a></p> <p>Then, try the following:</p> <pre><code>$(".showornot", $(this).parent()).slideToggle(400); </code></pre> <p>Working proof: <a href="http://jsfiddle.net/dg2z67hx/3/" rel="nofollow">http://jsfiddle.net/dg2z67hx/3/</a></p> <p>What I am doing in this fiddle is selecting the element with the class .showornot INSIDE the button's parent element.</p> <p>Please note that <strong>you are missing a starting div tag from the code you posted</strong>, I presume it's the one classed as 'network-container', that makes it a little harder for people to answer.</p>
12,534,273
0
<p>Typing javac at the command line is not a viable or scalable way to build java code. While you could use -cp to javac to add the required dependencies to this compilation, you'd be far better served by learning ant or maven.</p>