pid
int64
2.28k
41.1M
label
int64
0
1
text
stringlengths
1
28.3k
15,398,758
0
Having XML Validation / namespace issues using the IBM Processor for XSLT 2.0 <p>I'm receiving the following XML message from a third party vendor. I have no control over the incoming message. I've pared it down to it's simplest form while still producing the error. The XML message:</p> <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Header/&gt; &lt;soap:Body/&gt; &lt;/soap:Envelope&gt; </code></pre> <p>The xsl file I am using is:</p> <pre><code>&lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:import-schema namespace="http://schemas.xmlsoap.org/soap/envelope/" schema-location="http://schemas.xmlsoap.org/soap/envelope/" /&gt; &lt;xsl:template match="/"&gt; &lt;xsl:text&gt;Help&lt;/xsl:text&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>When I try to run the transformation within Eclipse using the IBM processor for XSLT 2.0 with the "Enable Validation" box checked, I get the following error during xml validation:</p> <pre><code>cvc-elt.1.a: Cannot find the declaration of element 'soap:Envelope' </code></pre> <p>Is there any way to make this pass validation even though I have no control over the incoming message? If I did have control over the incoming message I'd do this and it'd work wonderfully:</p> <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Header/&gt; &lt;soap:Body/&gt; &lt;/soap:Envelope&gt; </code></pre>
20,310,467
0
<p>You want to </p> <p><em>If an item is "already" in t2, but NOT in t1 then I would like to avoid executing an INSERT statement.</em></p> <p>So insert should take place on negation of above statement i.e.</p> <p><em>item should not be in t2 and item should be present in t1</em></p> <pre><code>insert into target_table( column list ) select ( column list) from source_table where item not in (select item from t2) and item in (select item from t1) </code></pre> <p><em>what I meant was that if the article is NOT in t2, THEN I want to insert it into t1. Its pretty simple really</em> </p> <pre><code> insert into t1 ( &lt;column list&gt;) select &lt;column list&gt; from source_table where item not in (select item from t2) </code></pre> <p>You can use</p> <pre><code> IF NOT EXISTS (SELECT * FROM t2 WHERE item like '%'+@itemvalue+'%') BEGIN INSERT INTO t1 VALUES (@itemvalue) END </code></pre>
352,969
0
<p>These problems have always been caused by:</p> <ol> <li>Memory Problems</li> <li>Threading Problems</li> </ol> <p>To solve the problem, you should:</p> <ul> <li>Instrument your code (Add log statements)</li> <li>Code Review threading</li> <li>Code Review memory allocation / dereferencing</li> </ul> <p>The code reviews will most likely only happen if it is a priority, or if you have a strong suspicion about which code is shared by the multiple bug reports. If it's a threading issue, then check your thread safety - make sure variables accessable by both threads are protected. If it's a memory issue, then check your allocations and dereferences and especially be suspicious of code that allocates and returns memory, or code that uses memory allocation by someone else who may be releasing it.</p>
8,375,906
0
<p><code>isset()</code> checks if a variable has a value including (False , 0 , or Empty string), but not <code>NULL</code>. Returns TRUE if var exists; FALSE otherwise.</p> <p>On the other hand the <code>empty()</code> function checks if the variable has an empty value empty string , 0, NULL ,or False. Returns FALSE if var has a non-empty and non-zero value.</p> <p>Hope this helped !</p>
39,647,011
0
VBA .Add Cells - Set start Cell location <p>I need this VBA to pull all file names, Link them and place them in column A2 and down in +1 increments</p> <pre><code>Sub GetFileNamesInfolder() Dim FSO As Object Dim Folder As Object Dim File As Object Dim Path As String Dim A As Integer Path = "\\server5\Operations\MainBoard testing central location DO NOT REMOVE or RENAME" Set FSO = CreateObject("Scripting.FileSystemObject") Set Folder = FSO.GetFolder(Path) For Each File In Folder.Files A = A + 1 ActiveSheet.Hyperlinks.Add Cells(A, 1), File.Path, , , File.Name Next End Sub </code></pre> <p>how would you approach this?</p>
2,598,891
0
<p>So, my solution is:</p> <ol> <li>Intercept the onTouch event and calculate whether the page should change to the next or keep on the current</li> <li>Inherit from HorizontalScrollView and override the method computeScroll</li> </ol> <p>The method computeScroll the called to move the list. By default I suppose it's implemented to decelerate with a certain ratio... Since I don't want this motion, I just override it without specifing a body.</p> <p>The code for the event handler is:</p> <pre><code>_scrollView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_UP) { float currentPosition = _scrollView.getScrollX(); float pagesCount = _horizontalBar.getChildCount(); float pageLengthInPx = _horizontalBar.getMeasuredWidth()/pagesCount; float currentPage = currentPosition/pageLengthInPx; Boolean isBehindHalfScreen = currentPage-(int)currentPage &gt; 0.5; float edgePosition = 0; if(isBehindHalfScreen) { edgePosition = (int)(currentPage+1)*pageLengthInPx; } else { edgePosition = (int)currentPage*pageLengthInPx; } _scrollView.scrollTo((int)edgePosition, 0); } return false; } }); </code></pre> <p>And in my inherited HorizontalScrollView</p> <pre><code>@Override public void computeScroll (){ return; } </code></pre>
17,690,658
0
<p>You'll probably need to define a custom MessageContract for this operation. Check out the following link, specifically the section on "Using Arrays Inside Message Contracts" and the MessageHeaderArrayAttribute.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms730255.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms730255.aspx</a></p>
34,800,015
0
<p>So if you only need to check that a new window is open:</p> <pre><code>int oldWindowCount = driver.getWindowHandles().size(); driver.findElement(&lt;By locator for hyperlink here&gt;).click(); int newWindowCount = driver.getWindowHandles().size(); Assert.assertEquals(1, newWindowCount - oldWindowCount); </code></pre> <p>Assuming you have no more than two windows open, if you want to switch between your current window and the new one:</p> <pre><code>String oldWindow = driver.getWindowHandle(); driver.findElement(&lt;By locator for hyperlink here&gt;).click(); for (String handle : driver.getWindowHandles()) { if (!handle.equals(oldWindow)) { driver.switchTo().window(handle); } } </code></pre>
2,090,466
0
<p>Class-Path: ../relative/path_to_/mail.jar</p> <p>EDIT: Note: The relative path should be with reference from the directory where your program is starting.</p>
18,985,990
0
<p>in your controller <code>UsersController</code>, in the <code>update</code> method, add the <code>address: :id</code> to the address permitted attributes. Like this:</p> <pre><code>params.require(:user).permit(:user_name, address_attributes: [:id, :street])) </code></pre>
31,104,469
0
System.Runtime.InteropServices.COMException: This command is not available because no document is open <p>I am using code below -I try to save <code>Word</code> document file as <code>.htm</code>. Can anybody solve this problem?</p> <pre><code>objWord.Documents.Open(ref FileName, ref readOnly, ref missing, ref missing, ref missing, ref missing,ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing,ref missing, ref missing); Document oDoc = objWord.ActiveDocument; oDoc.SaveAs(ref FileToSave, ref fltDocFormat, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); </code></pre>
7,702,412
0
<p>Not using eclipse sorry (but with Ant yes , see <a href="http://www.alittlemadness.com/2010/10/05/android-automated-build-versioning/" rel="nofollow">this</a>) , i know it can be boring to do that . But you don't release everyminute , no?</p> <p><strong>MODIFIED</strong></p> <p>Ant way , the use of <a href="http://ideoplex.com/id/17/using-ant-properties" rel="nofollow">Ant properties</a> </p> <p>Tomorrow i'll try to find more doc about if you need it</p>
16,361,638
0
Scala - weird behaviour with Iterator.toList <p>I am new to Scala and I have a function as follows:</p> <pre><code>def selectSame(messages: BufferedIterator[Int]) = { val head = messages.head messages.takeWhile(_ == head) } </code></pre> <p>Which is selecting from a buffered iterator only the elems matching the head. I am subsequently using this code:</p> <pre><code>val messageStream = List(1,1,1,2,2,3,3) if (!messageStream.isEmpty) { var lastTimeStamp = messageStream.head.timestamp while (!messageStream.isEmpty) { val messages = selectSame(messageStream).toList println(messages) } </code></pre> <p>Upon first execution I am getting (1,1,1) as expected, but then I only get the List(2), like if I lost one element down the line... Probably I am doing sth wrong with the iterators/lists, but I am a bit lost here.</p>
29,529,206
0
<p>I went round in circles on this for ages. The answers are all in validatable as suggested by mrstif above. If you use the validatable module Devise works out of the box (with configuration options) allowing you to update user details without supplying a password so be <strong>very</strong> careful about rolling your own password validations.</p>
8,003,060
0
<p>I'm using a HTC Tmobile G2, and I had the same problem while testing a GeoCoder based feature. A reboot helped, but that's not an acceptable solution when my customers start complaining about this. If this is some kind of cache clearing issue, then I hope a workaround can be put in place programmatically.</p>
2,979,587
0
<p>Here is dirty, but working version of the script I came up with: </p> <pre><code>#!/bin/bash # Generates changelog day by day NEXT=$(date +%F) echo "CHANGELOG" echo ---------------------- git log --no-merges --format="%cd" --date=short | sort -u -r | while read DATE ; do echo echo [$DATE] GIT_PAGER=cat git log --no-merges --format=" * %s" --since=$DATE --until=$NEXT NEXT=$DATE done </code></pre>
22,799,757
0
PROJ4 command for printing to output file <p>I am working with Regional Climate data that were provided in a rotated pole grid format. Using PROJ4 I can convert these coordinates to lat/lon using this command line $ proj -m 57.295779506 +proj=ob_tran +o_proj=latlon +o_lon_p=83 +o_lat_p=42.5 +lon_0=180 I have created an ASCII file with the coordinates of all the grid cells ifile.txt and an empty file for the output ofile.txt</p> <p>When I use $ proj -m 57.295779506 +proj=ob_tran +o_proj=latlon +o_lon_p=83 +o_lat_p=42.5 +lon_0=180 ifile.txt ofile.txt</p> <p>I get the transformed coordinates printing to the screen but not to ofile.txt. Can someone suggest how I can fix my command line? </p> <p>Thank you for your time</p>
11,054,263
0
<pre><code>import re # re.M means match across line boundaries # re.DOTALL means the . wildcard matches \n newlines as well pattern = re.compile('\\\\begin\{figure\}.*?\\\\end\{figure\}', re.M|re.DOTALL) # 'with' is the preferred way of opening files; it # ensures they are always properly closed with open("file1.tex") as inf, open("fileout.tex","w") as outf: for match in pattern.findall(inf.read()): outf.write(match) outf.write("\n\n") </code></pre> <p><strong>Edit:</strong> found the problem - not in the regex, but in the test text I was matching against (I forgot to escape the \b's in it).</p>
19,919,955
0
What is difference between JDK7u45 and Java7u21 <p>I am starting with android development and while setting up Eclipse SDK i got an error that Java Development Kit(JDK) or Java Runtime Environment is missing. I had <code>Java7 update 21</code> installed already. but now I downloaded JDK7u45 from Oracle site. <br> I want to know the difference between <code>Java 7</code> and <code>JDK 7</code> and also if I remove JAVA and install only JDK(as EclipseSDK is giving an error that JDK is missing) then will it make any difference in my desktop environment?</p>
33,336,850
0
Environment variables specified on app.yaml but it's not fetching on main.go <p>I've specified my environment variables in app.yaml and it's being fetched when I'm running it on my local machine but once I have it deployed - it's not fetching it. </p> <p>Here's how I've set it up:</p> <pre><code>application: some-application version: 1 runtime: go api_version: go1 threadsafe: true handlers: - url: /.* script: main.go secure: always env_variables: ENVIRONMENT_VAR1: 'some key' ENVIRONMENT_VAR2: 'some key' ENVIRONMENT_VAR3: 'some key' </code></pre> <p>And I'm using <code>os.Getenv("ENVIRONMENT_VAR1")</code> to retrieve the key and it works when I run it on my local but fails to work when deployed on google app engine. </p>
11,641,252
0
Getting size of styled UIWebView content - Not quite working <p>This seems like a common problem, but I'm unable find an adequate solution. I'm trying to re-size a bunch of UIWebViews to fit their content, but it doesn't seem to work properly. The best solution I've found so far is <a href="http://stackoverflow.com/a/3937599/304786">this answer</a>, but it only appears to work occasionally in my solution. The idea is to re-size the UIWebView in the <code>webViewDidFinishLoad:</code> delegate method. However, this still doesn't get the right size. If I trigger the update at some undefined time <em>after</em> <code>webViewDidFinishLoad:</code>, the content does get sized correctly.</p> <p>I will describe my situation below, and I'll paste relevant source on <a href="https://gist.github.com/3173830" rel="nofollow">Gist</a>. </p> <p><strong>Problem Description</strong></p> <p>I have a situation where I'm getting data from a JSON API and displaying the data in webviews. The API returns an array of objects, and each object has a "content" field with HTML-formatted text. The designers have given a structure which involved a (mostly) hidden view that you swipe up to reveal, which contains a scroll view of all the content, formatted in a very particular way.</p> <p>To implement this, I have three view controllers: The main view controller, the secondary view controller which you swipe up on the main view controller to reveal, and a tertiary view controller that displays one item of html-formatted content from the JSON API results.<br> The secondary view controller contains a UIScrollView and an array of tertiary view controllers. Each tertiary view controller contains a UIWebView to display the HTML-formatted content, and labels for displaying other attributes of the JSON object. Because the tertiary views will be displayed inside a UIScrollView in the secondary view, the tertiary views' UIWebView needs to be re-sized to fit its content and have user interaction disabled in order to prevent a confusing scroll-view-in-scroll-view scenario.</p> <p>The process to get all this to work is as follows: </p> <ol> <li>First, on the Primary controllers ViewDidLoad, load up and display the secondary view and an activity indicator so the UI does not appear to freeze</li> <li>Next, load the data from the JSON API</li> <li>When the data from the API has loaded (notified via a delegate), construct tertiary view controllers, set their attributes from the loaded data and add them to the secondary controller's list.</li> <li>Once that is finished, call the Secondary controller's setup method. This method loops through the list of tertiary controllers and calls their setup methods in turn </li> <li>Each tertiary controller's setup method sets the text for the labels and sets the content for the UIWebView using <code>loadHTMLString:</code> with a pre-defined html file's content, with the content of the JSON object substituted in.</li> <li><strong>On the tertiary controller's <code>webViewDidFinishLoad:</code> delegate method, using the method at <a href="http://stackoverflow.com/a/3937599/304786">this answer</a>, re-size the web view based on the content size.</strong></li> <li>Re-size the tertiary controller's view to fit the web view and position any labels that go underneath the web view</li> <li>The tertiary controller then calls a delegate method to notify the secondary controller that it has finished loading. The secondary controller keeps tabs on which of its tertiary controllers have finished loading.</li> <li>When all tertiary controllers are finished loading, the secondary controller loops through its list and adds the tertiary views to it's UIScrollView's content, adjusting frames and the content height as it goes.</li> </ol>
31,775,813
0
HTML sanitizing for my tinymce editor <p>I already have read a question about this here ... Now I know, that there are many libs, which allow me to sanitize my string...</p> <p><strong>The Problem</strong></p> <p>I use the TinyMCE editor for every text input on my website. Users can use HTML tags like <code>&lt;b&gt;</code>, <code>&lt;li&gt;</code>, <code>&lt;ol&gt;</code>, <code>&lt;p&gt;</code> and so on.</p> <p>I don't want to "allow" cross side scripting on my website, so I need a tool, which can filter the "bad" tags :)</p> <p>I want to use it like <code>$string = sanitize($string)</code>. It doesn't have to be exactly like this, but it should be easy to use ^^</p> <p>I already read about such tools, but I'm not sure which one is the best ...</p> <p>Suggestions would be great :)</p>
29,997,393
0
<p>The reason your progressbar doesn't come back to the same position is this:</p> <pre><code>if (scroll &lt;= 28) { progressbar.style.top = "30px"; } </code></pre> <p>You are telling it that once you scroll, if the distance from the top is less than 28px it should go to 30px from the top while it starts at 0. Even if you start by scrolling 1px down it'll jump to 30px.</p>
18,034,247
0
<p><a href="https://github.com/AutoMapper/AutoMapper" rel="nofollow">AutoMapper</a> is a decent library for such cases, didn't try it in huge lists, give it a try.</p>
37,649,292
0
<p>You can use it this way: <a href="http://www.yiiframework.com/extension/yii2-helpers/" rel="nofollow">http://www.yiiframework.com/extension/yii2-helpers/</a></p> <p>Create a folder <code>/common/helpers/</code>, then create a helper class there and add your static methods.</p> <pre><code>namespace common\helpers; class DateHelper { public static function dt(){ return date('Y-m-d H:i:s'); } } </code></pre> <p>Usage</p> <pre><code>use common\helpers\DateHelper; echo DateHelper::dt(); </code></pre>
3,367,723
0
<p>Because you want to <a href="http://stackoverflow.com/questions/2807241/what-does-the-expression-fail-early-mean-and-when-would-you-want-to-do-so">fail early</a>. The sooner you find out something's wrong, the sooner you can fix it.</p>
2,910,807
0
ModalPopupExtender with thumbnail and full size image <p>let me rewrite my question, I have a Ajax Accordion in my web site, Users can add images, in Accordion,I keep the thumbnail and fullsize image's path in Sql Server table, Users can see the thumbnail, and when they click the thumbnail, I use a ModalPopupExtender that open an asp panel to show the full size image, with progress image or preload bar </p> <p>What is the best way to achieve this?</p> <p>Thanks in advance </p>
36,194,886
0
Rrevisioning of node using workbench moderation module in Drupal 7 <p>Iam working on drupal 7 latest version. I have installed drupal workbench_moderation for node revision. I want to perform some task when admin reverts back the node to any older revision and publish the reverted node draft. Is there any event or hook when the reverted node is published in which i can write my functional code.</p> <p>If there is no hook for the same, then can you suggest any alternate method to perform the above task, i,e performing some task on publishing the reverted node.</p> <p>Regards Sandeep Prabhu</p>
37,261,781
0
<p>The img tag inside "topbar-block" is referencing an image "flag.png" in the same directory as your .html file is. So make sure the image is in the same folder. The code seems correct otherwise.</p>
38,117,524
0
<p>Yes you can, just create the object and call <code>confirm</code> on it :)</p> <p>However, as members will need a password to access their account, it could be nice to email them a link to enter this password, so this link could also confirm the account for you.</p> <p>IMHO, It's a bad practice to send any password by email, a lot of email servers don't implement any secured protocol, better let your users chose it, with a one-time link</p>
15,614,141
0
<p>Without trying it out myself, my first guess would be that the transform on the UIImageView also transforms its frame. One way to solve that, would be to put the UIImageView in another UIView, and put that UIView in the UIScrollView. Your gesture recognizers and the transform would still be on the UIImageView. Make sure the UIView's clipsToBounds property is set to YES.</p>
37,457,491
0
<p>I myself resoled the problem. source code versions of Pango and Glib has to be compatible with each other. I was using Glib-2.48 with Pango-1.40. I changed it with compatible set of these two packages(Glib-2.40 and Pango-1.15) and resolved the issue.</p>
4,800,974
0
<p>OK, don't feel like leaving this open, so my "answer" is this: First, (sorry) Bengie and Hans just don't seem to understand that sure enough, a reentrant lock is malfunctioning. Second, I suspect that this is happening because of my use of reflection; somehow the context information they use to realize that the lock is being re-locked by the same thread is apparently being impacted.</p> <p>I'm going to fix this by changing my code to not hold the lock during the initial call; basically, I won't try to acquire this lock reentrantly.</p> <p>Others who run into this thread should be warned: as far as I can tell, I'm encountering what can only be a .NET bug. And it isn't very hard to provoke, either. </p>
15,429,843
0
<pre><code>$('div.my-button').trigger('click') ; </code></pre>
1,507,321
0
Javascript inheritance implementation question <p>In his sitepoint article about <a href="http://www.sitepoint.com/blogs/2006/01/17/javascript-inheritance/" rel="nofollow noreferrer" title="javascript inheritance">javascript inheritance</a>, Harry Fuecks explains a way of implementing inheritance as follows:</p> <pre><code> function copyPrototype(descendant, parent) { var sConstructor = parent.toString(); var aMatch = sConstructor.match( /\s*function (.*)\(/ ); if ( aMatch != null ) { descendant.prototype[aMatch[1]] = parent; } for (var m in parent.prototype) { descendant.prototype[m] = parent.prototype[m]; } }; </code></pre> <p>While I understand his code, one question comes to mind - why not remove the for loop and simply do this:</p> <pre><code> function copyPrototype(descendant, parent) { var sConstructor = parent.toString(); var aMatch = sConstructor.match( /\s*function (.*)\(/ ); if ( aMatch != null ) { descendant.prototype[aMatch[1]] = parent; } descendant.prototype = parent.prototype; }; </code></pre> <p>Thanks.</p>
38,625,628
0
mysql won't import table as unicode even tho all variables are set to unicode <p>I have just updated my cnf properties to add the following:</p> <pre><code>init_connect = 'SET collation_connection = utf8_unicode_ci; SET NAMES utf8;' character-set-client = utf8 character-set-server = utf8 collation-server = utf8_unicode_ci skip-character-set-client-handshake </code></pre> <p>My system variables after restarting mysql:</p> <pre><code>+----------------------+-----------------+ | Variable_name | Value | +----------------------+-----------------+ | collation_connection | utf8_unicode_ci | | collation_database | utf8_unicode_ci | | collation_server | utf8_unicode_ci | +----------------------+-----------------+ </code></pre> <p>So then I ran the following query to find a table that I knew had been built in utf_general_ci:</p> <pre><code>select t.table_name, c.column_name,round(((data_length + index_length) / 1024 / 1024), 2) 'Size in MB',count(c.column_name), c.character_set_name,c.collation_name from columns c inner join tables t on t.table_schema=c.table_schema and t.table_name=c.table_name where t.table_schema='db' and (c.collation_name like '%general%' or c.character_set_name like '%general%') and (c.column_type like 'varchar%' or c.column_type like 'text') and t.table_collation not like '%latin%' and t.table_name in ('table_name') group by t.table_name, c.column_name; </code></pre> <p>So I took a dump of the table and reimported it into my database, but it stays in utf8_general_ci!!?!?!??</p> <p>Why is this? I know if I run an alter it will change it, but why didn't the dump and load resolve the problem?</p> <p>Additionally, when I run an alter to convert to utf8_unicode_ci, all the columns in the table have "COLLATE utf8_unicode_ci" listed in them.</p>
27,100,924
0
<p>put this code inside click event</p> <pre><code>if(rg1.getCheckedRadioButtonId()!=-1){ int id= rg1.getCheckedRadioButtonId(); View radioButton = rg1.findViewById(id); int radioId = radioGroup.indexOfChild(radioButton); RadioButton btn = (RadioButton) rg1.getChildAt(radioId); String selection = (String) btn.getText(); } </code></pre>
32,787,529
0
Proper design of Java Classes <p>My question is should I make <code>counterbore</code> (a recessed hole in a plate) a property of <code>plate</code> or should <code>counterbore</code> be a property of <code>joint</code> </p> <p>I have the following classes for an engineering analysis program:</p> <pre><code>Plate Bolt Washer Nut Material Coating </code></pre> <p>I then have classes that represent various Joints</p> <pre><code>TappedJoint (a joint were the bolt is threaded into the bottom plate) will have: Plate topPlate Plate bottomPlate Bolt bolt Washer topWasher BoltedJoint Plate topPlate Plate bottomPlate Bolt bolt Nut nut Washer topWasher Washer bottomWasher </code></pre> <p>The counterbore is only applicable on the <code>topPlate</code> but I need to do validation that the user enters a plate thickness greater than the depth of the counterbore. Do I just set counterbore to null in the bottomPlate or is it better to put the counterbore property in the joint class? Or perhaps I should be using some other pattern such as subclasses?</p> <p>Coating and Material I add as property to each part because it would be too verbose to add to a joint i.e.:</p> <pre><code> BoltedJoint Plate topPlate Plate bottomPlate Coating topPlateTopSurface Coating topPlateBottomSurface Coating bottomPlateTopSurface ...etc </code></pre> <p>I can probably get it to work with either scenario but perhaps their is better design?</p>
35,640,059
0
<p>This should works for you:</p> <pre><code>@"-?\d+(?:\.\d+)?" </code></pre> <p>Matchs only the dot only when have digits after it.</p>
29,936,664
0
Which version of oracle should I learn as a beginer? <p>I am beginner in Oracle. I have seen there are many oracle version such as XE, Enterprises, Personal, Liet and so on. I would like to learn Oracle but I am very confuse which oracle version should I learn first?</p>
3,845,138
0
<p>You can't extract it since it's executed right away, but the code exists in <code>Zend_Db_Adapter_Abstract::insert()</code> and possibly overwritten in some of the adapters.</p>
20,021,515
0
<pre><code>if ( SelectedIndex == -1 ) // only the text was changed. </code></pre>
26,638,708
0
<p>Jars that are provided by Tomcat at runtime should be scoped as <code>provided</code> if you need them to compile but expect the Tomcat container to provide them at runtime, e.g.</p> <pre><code> &lt;dependency&gt; &lt;groupId&gt;javax.servlet&lt;/groupId&gt; &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt; &lt;version&gt;3.0.1&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; </code></pre> <p>(version is just something I threw in there... use whatever is appropriate).</p>
678,164
0
DLL versus Assembly <p>what is the difference between DLL and Assembly</p> <hr> <p><strong>Exact duplicate</strong>: <a href="http://stackoverflow.com/questions/674312/difference-between-assembly-and-dll">Difference Between Assembly and DLL</a></p>
31,024,951
0
Getting callback from payment gateway in webview <p>I am using <a href="http://www.atomtech.in/" rel="nofollow">Atom</a> Payment Gateway for payments in my Android app. But this provider doesn't have an SDK for mobile platforms, also I cannot choose another provider because my client has been using Atom PG for their website for a long time.</p> <p>So to make it work, I am now trying to call it in a webview in my app. All goes well until the last step except that I am not able to get the response from the PG upon completion of transaction.</p> <p>As per their documentation:</p> <blockquote> <p>After the completion of the transaction, the response will be posted back to the url provided by the merchant.</p> </blockquote> <p>I already tried setting the <code>return url</code> to my reverse domain name and then setting an <code>intent-filter</code> but that doesn't seem to work.</p> <p>Is there any method by which I can get the <code>response</code> that the PG "posts back" to the return url?</p>
34,328,990
0
<pre><code>public void startNewActivity(Context context, String packageName) { Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName); if (intent != null) { // We found the activity now start the activity intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } else { // Bring user to the market or let them choose an app? intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse("market://details?id=" + packageName)); context.startActivity(intent); } } </code></pre>
15,289,956
0
<p>I took your fiddle and added a new CSS class "snug" to apply for the list of years. Basically "snug" will let the list be as wide as its widest list element. Check it out: <a href="http://jsfiddle.net/2fc3W/1/" rel="nofollow">http://jsfiddle.net/2fc3W/1/</a></p> <pre><code>// the CSS ul#nav ul.snug{ width: auto; } ul#nav ul.snug li a{ display: inline; padding-right: 6px; width: auto; } // the HTML snippet &lt;ul id="nav"&gt; &lt;li&gt;&lt;a href="/ueber_uns.htm"&gt;About Us&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Who We Are&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Our Goals&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Our Team&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Press&lt;/a&gt; &lt;ul class="snug"&gt; &lt;li&gt;&lt;a href="#"&gt;2006&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;2007&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;2008&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Impressum&lt;/a&gt; &lt;/li&gt; &lt;li class="bottom_li"&gt;&lt;a href="#"&gt;&lt;span class="li_hover"&gt;See all&lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; ... </code></pre>
1,368,557
0
<p>There are two fundamentally different approaches to achieve real-time capabilities with Linux.</p> <p>1) Patch the existing kernel with things like the rt-preempt patches. This will eventually lead to a fully preemptive kernel</p> <p>2) Dual kernel approach (like xenomai, RTLinux, RTAI,...)</p> <p>There are lots of gotchas moving from a RTOS to Linux.</p> <p>Maybe you don't really need real-time?</p> <p>I'm talking about real-time Linux in my training: <a href="http://www.reliableembeddedsystems.com/embedded-systems_7.html" rel="nofollow noreferrer">http://www.reliableembeddedsystems.com/embedded-systems_7.html</a></p>
18,231,373
0
<p>You load ckeditor and after you fill the textarea. No way, the ckeditor is loaded. An has not live update. You must change order.</p> <pre><code>&lt;script&gt; function BindData() { $("#input").val('This is CK Editor Demo'); } BindData(); $(document).ready(function () { $("#input").ckeditor(); }); &lt;/script&gt; </code></pre>
16,184,912
0
<p>Try to DisplayMemberPath, it display shortnames. </p> <pre><code>&lt;ComboBox ItemsSource="{Binding Flangs, Mode=OneTime}" SelectedItem="{Binding Flang, Mode=TwoWay}" DisplayMemberPath="ShortNames"/&gt; </code></pre>
1,311,289
0
<p>You can look at the following projects.</p> <ul> <li><a href="http://akuma.kohsuke.org/" rel="nofollow noreferrer">Akuma</a> </li> <li><a href="http://commons.apache.org/daemon/" rel="nofollow noreferrer">Apache Deamon</a></li> </ul>
38,500,580
0
when enabling errors to bigquery I do not receive the bad record number <p>I'm using <a href="https://cloud.google.com/bigquery/bq-command-line-tool" rel="nofollow">bigquery command line tool</a> to upload these records:</p> <pre><code>{name: "a"} {name1: "b"} {name: "c"} </code></pre> <p>.</p> <pre><code>➜ ~ bq load --source_format=NEWLINE_DELIMITED_JSON my_dataset.my_table ./names.json </code></pre> <p>this is the result I get: </p> <pre><code>Upload complete. Waiting on bqjob_r7fc5650eb01d5fd4_000001560878b74e_1 ... (2s) Current status: DONE BigQuery error in load operation: Error processing job 'my_dataset:bqjob...4e_1': JSON table encountered too many errors, giving up. Rows: 2; errors: 1. Failure details: - JSON parsing error in row starting at position 5819 at file: file-00000000. No such field: name1. </code></pre> <p>when I use <code>bq --format=prettyjson show -j &lt;jobId&gt;</code> I get:</p> <pre><code> { "status": { "errorResult": { "location": "file-00000000", "message": "JSON table encountered too many errors, giving up. Rows: 2; errors: 1.", "reason": "invalid" }, "errors": [ { "location": "file-00000000", "message": "JSON table encountered too many errors, giving up. Rows: 2; errors: 1.", "reason": "invalid" }, { "message": "JSON parsing error in row starting at position 5819 at file: file-00000000. No such field: name1.", "reason": "invalid" } ], "state": "DONE" } } </code></pre> <p>As you can see I receive an error which tells me in what line I had an error. : <strong>Rows: 2; errors: 1</strong> </p> <p>Now I'm trying to enable errors by using <a href="https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.load.maxBadRecords" rel="nofollow">max_bad_errors</a></p> <pre><code> ➜ ~ bq load --source_format=NEWLINE_DELIMITED_JSON --max_bad_records=3 my_dataset.my_table ./names.json </code></pre> <p>here is what I receive:</p> <pre><code>Upload complete. Waiting on bqjob_...ce1_1 ... (4s) Current status: DONE Warning encountered during job execution: JSON parsing error in row starting at position 5819 at file: file-00000000. No such field: name1. </code></pre> <p>when I use <code>bq --format=prettyjson show -j &lt;jobId&gt;</code> I get:</p> <pre><code>{ . . . "status": { "errors": [ { "message": "JSON parsing error in row starting at position 5819 at file: file-00000000. No such field: name1.", "reason": "invalid" } ], "state": "DONE" }, } </code></pre> <p>when I check - it actually uploads the good records to the table and ignores the bad record, </p> <p>but now I do not know in what record the error was.</p> <p>Is this a big query bug? can it be fixed so I receive record number also when enabling bad records?</p>
5,333,193
0
<p>Let's say you want to find all permutations of [1, 2, 3, 4]. There are 24 (=4!) of these, so number them 0-23. What we want is a non-recursive way to find the Nth permutation.</p> <p>Let's say we sort the permutations in increasing numerical order. Then:</p> <ul> <li>Permutations 0-5 start with 1</li> <li>Permutations 6-11 start with 2</li> <li>Permutations 12-17 start with 3</li> <li>Permutations 18-23 start with 4</li> </ul> <p>So we can get the first number of permutation N by dividing N by 6 (=3!), and rounding up.</p> <p>How do we get the next number? Look at the second numbers in permutations 0-5:</p> <ul> <li>Permutations 0-1 have second number 2.</li> <li>Permutations 2-3 have second number 3.</li> <li>Permutations 4-5 have second number 4.</li> </ul> <p>We see a similar thing with permutations 6-11:</p> <ul> <li>Permutations 6-7 have second number 1.</li> <li>Permutations 8-9 have second number 3.</li> <li>Permutations 10-11 have second number 4. </li> </ul> <p>In general, take the remainder after dividing by 6 earlier, divide that by 2 (=2!), and round up. That gives you 1, 2, or 3, and the second item is the 1st, 2nd or 3rd item left in the list (after you've taken out the first item).</p> <p>You can keep going in this way. Here's some code that does this:</p> <pre><code>from math import factorial def gen_perms(lst): all_perms = [] # Find the number of permutations. num_perms = factorial(len(lst)) for i in range(num_perms): # Generate the ith permutation. perm = [] remainder = i # Clone the list so we can remove items from it as we # add them to our permutation. items = lst[:] # Pick out each item in turn. for j in range(len(lst) - 1): # Divide the remainder at the previous step by the # next factorial down, to get the item number. divisor = factorial(len(lst) - j - 1) item_num = remainder / divisor # Add the item to the permutation, and remove it # from the list of available items. perm.append(items[item_num]) items.remove(items[item_num]) # Take the remainder for the next step. remainder = remainder % divisor # Only one item left - add it to the permutation. perm.append(items[0]) # Add the permutation to the list. all_perms.append(perm) return all_perms </code></pre>
7,962,522
0
<p>I am not sure but I have a feeling your problem is in the selector you are passing to the button.</p> <p>Try to see if you are using a selector with ":" to a method with out parameters.</p> <p>If you are using selector that looks like this:</p> <pre><code>@selector(method:) </code></pre> <p>Then is is expected that "method" will take parameters:</p> <pre><code>-(IBAction)method:(UIButton)sender{ } </code></pre> <p>if your function is not taking any parameters:</p> <pre><code>-(IBAction)method{ } </code></pre> <p>then your selector should look like that:</p> <pre><code>@selector(method) </code></pre>
2,659,346
0
<p>It has something to do with your link and content. Try the following two links:</p> <pre><code> String path="http://www.ted.com/talks/download/video/8584/talk/761"; String path1="http://commonsware.com/misc/test2.3gp"; Uri uri=Uri.parse(path1); VideoView video=(VideoView)findViewById(R.id.VideoView01); video.setVideoURI(uri); video.start(); </code></pre> <p>Start with "path1", it is a small light weight video stream and then try the "path", it is a higher resolution than "path1", a perfect high resolution for the mobile phone.</p>
28,696,650
0
Windows Phone 8.0 ListBox Out Of Memory Extension <p>Sorry for my english. I'am execute next code: in XAML ...</p> <pre><code>&lt;Button Content="Add More" Width="160" Click="Button_Click_2"/&gt; &lt;ListBox x:Name="list"/&gt; </code></pre> <p>...</p> <p>in CS ...</p> <pre><code> for (int i = 0; i &lt; 20; i++) { list.Items.Add(new Image { Source = new BitmapImage { UriSource = new Uri("http://pravda-team.ru/eng/image/photo/4/7/4/73474.jpeg") } }); } </code></pre> <p>...</p> <p>This code working, but if I click on the button a few times, there is an exception "Out Of Memory Extension" I tried to use Garbage Collector and AutoCaching, but the error persists. I catch this extension on the next screen shot: <img src="https://i.stack.imgur.com/JL3kX.jpg" alt="enter image description here"></p>
687,604
0
<p>Check out <a href="http://www.rssdotnet.com/" rel="nofollow noreferrer">http://www.rssdotnet.com/</a>. It is very good at reading RSS feeds. And Im pretty sure you will be able to add a namespace to the parser so you can get to the value you want</p>
20,930,428
0
Recursive function returns a nan (c++) <p>when i use a while loop, the function returns a correct value, but when I make the function recursive, it returns a nan. For debugging purposes, I cout-ed the value(x) just before returning it and it gives a correct answer, but after returning the value to the calling function, it's a nan. One other thing, the program doesn't take 0 for the coefficients of x. Any attempts result in nan. Below is my code (all of it just to be sure I didn't give insufficient information): </p> <pre><code>// This is my first useful program // to calculate the root (Solution) of exponential // functions up to the fourth degree using // Newton-Raphson method and applying a recursive function #include &lt;iostream&gt; #include &lt;cstdlib&gt; #include &lt;string&gt; using namespace std; // Below is the function fGetRoot's prototype declaration // c4, c3, etc are the coefficients of x in the 4th power, 3rd power // etc, while c is the constant float fGetRoot (float c4, float c3, float c2, float c1, float c); float fPowerFunc(float fPowered, int iPower); float x; // declaring this as global variables so they can be initialized in the calling function int i=10; // and be used in the recursive function without being reinitialized during each recursion int main() { float c4, c3, c2, c1, c; float fRoot; cout &lt;&lt; "Hello, I am a genie for calculating the root of your problems\ up to the fourth power" &lt;&lt; endl; cout &lt;&lt; "Please enter the values of the coefficients of x to the power 4\ , 3, 2, 1 and the constant respectively" &lt;&lt; endl; cout &lt;&lt; "x^4:" &lt;&lt; endl; cin &gt;&gt; c4; cout &lt;&lt; "\n x^3:" &lt;&lt; endl; cin &gt;&gt; c3; cout &lt;&lt; "x^2:" &lt;&lt; endl; cin &gt;&gt; c2; cout &lt;&lt; "\n x:" &lt;&lt; endl; cin &gt;&gt; c1; cout &lt;&lt; "Constant, C:" &lt;&lt; endl; cin &gt;&gt; c; cout &lt;&lt; "\nEnter the initial iteration. Any figure is fine. The closer to the answer, the better" &lt;&lt; endl; cin &gt;&gt; x; i=10; // gets the number of times to iterate. the larger, the more accurate the answer fRoot = fGetRoot(c4, c3, c3, c1, c); cout &lt;&lt;"\nAnd the root is: " &lt;&lt; fRoot &lt;&lt; "\n"; return 0; } // The fGetRoot function float fGetRoot(float c4, float c3, float c2, float c1, float c) { float fTemp1, fTemp2, fTemp3, fTemp4; // the series of lines below are equivalent to the one line below but clearer fTemp1 = c4*fPowerFunc(x,4); cout &lt;&lt; "This is the value of c4*x^4: "&lt;&lt; fTemp1 &lt;&lt; endl; // for debugging purposes fTemp2 = c3*fPowerFunc(x,3); fTemp3 = fTemp2 + fTemp1; fTemp1 = c2*fPowerFunc(x,2); cout &lt;&lt; "This is the value of c2*x^2: "&lt;&lt; fTemp1 &lt;&lt; endl; //for debugging purposes fTemp2 = c1*fPowerFunc(x,1); fTemp4 = fTemp1 + fTemp2 + c; fTemp1 = fTemp3 + fTemp4; fTemp2 = 4*c4*fPowerFunc(x,3); fTemp3 = 3*c3*fPowerFunc(x,2); fTemp4 = fTemp2 + fTemp3 + 2*c2*x; fTemp2 = fTemp4; fTemp3 = fTemp1/fTemp2; fTemp1 = fTemp3; fTemp2 = x - fTemp1; x = fTemp2; i--; // The line below is equivalent to the "fTemp" series of lines... just to be sure //x=x-(c4*fPowerFunc(x,4)+c3*fPowerFunc(x,3)+c2*fPowerFunc(x,2)+c1*fPowerFunc(x,1)+c)/(4*c4*fPowerFunc(x,3)+3*c3*fPowerFunc(x,2)+2*c2*x); cout &lt;&lt; "\nThis is x: " &lt;&lt; x &lt;&lt; endl; i--; if(i==0) return x; x=fGetRoot(c4, c3, c2, c1, c); // Let the recursion begin... } // A simpler approach to the fPowerFunc(). This gets two numbers and powers the left one by the right one. It works right float fPowerFunc(float fPowered, int iPower) { float fConstant=fPowered; while(iPower&gt;0) { fPowered *=fConstant; iPower--; } return fPowered; } </code></pre>
1,567,320
0
How to call an EJB from another EJB? <p>I use jboss-IDE. so, I created a project with many EJB's in the same project. now, I need a functionality exposed by EJB A in EJB B. so, I need to call EJB A in EJB B. How do I do that ?</p> <p>P.S : dealing with EJB 2.</p>
12,565,778
0
Web Role configuation for EF connectionstring <p>I hear a lot of people talking about storing EF connection string in Role configuration settings (.cscfg). EF connection string could only be stored as a plain string there as the "Connection String" option is for storage connection. </p> <p>In my project EF, connection string cannot be a plain string. And putting more strings and combining it to make a proper connection string is not an option at the moment. More over if Microsoft wants us to use database connection string in configuration setting , why is it that there is no option for it in .cscfg?</p> <p>Doesn't it prove that .cscfg is not a replacement for .config?</p>
12,939,388
0
<p>You can use <code>.hide()</code> </p> <pre><code>$('#id').hide(); $('table').hide(); // Hides all the tables $('#identifier-0').show() // Shows the table wit id="identifier-0" </code></pre>
27,848,100
0
Why won't my page expand to the increasing size of an absolutely positioned div? <p>I have a form fixed to the bottom of the page, and an absolutely positioned div above it. Output from the form correctly displays just above the form itself, but when the output fills the page, I cannot scroll up and view it. It seems that the output overflows the <code>body</code> element, and is ignored. </p> <p>I've tried making the output div, called <code>main</code>, positioned relative, but the content does not appear where I want it. </p> <p>My markup in Haml: </p> <pre><code>%body .title-wrapper %h1 .main .form-wrapper %form{:action =&gt; "/", :method =&gt; "post", :id =&gt; 'target'} %input{:type =&gt; "text", :name =&gt; "code", :class =&gt; "input"} </code></pre> <p>my CSS: </p> <pre><code>* { font-family: Menlo, sans-serif; } .main { font-size: 14pt; position: absolute; bottom: 3em; width: 70%; } .title-wrapper { float: right; display: inline-block; height: 100%; width: 20%; } h1 { display: inherit; float: right; position: fixed; } .form-wrapper { width: 97%; position: absolute; bottom: 1em; } .input { width: 100%; height: 2em; font-size: 14pt; } </code></pre> <p>Image: </p> <p><img src="https://i.stack.imgur.com/khuK6.png" alt="my page"></p>
23,999,572
0
<p>You could write your own method, using the code for other packages' methods as a template. </p> <p>But in the short term, it's probably a lot easier to grab the coefficient values from your <code>m.2</code> object. <code>m.2$coefficients</code> contains all the fitting coefficients, labelled as to which term they belong to. You'll then have to write a little function to match the algebraic form of your <code>PIV~(X3*X1)+(X3*X2)+X3+X1+X2+X4+X5</code> formula, with those coefficients applied.</p>
10,694,581
0
<p>That's a vulnerability that exists whenever you have two or processes interop with each other. One of them dies and the other one keeps running, unaware that there will never be another request again from the dead process. In the case of an out-of-process COM server, nobody is going to call IUnknown::Release() to get the object destroyed. COM does not otherwise have a built-in fix for that problem. An in-process server doesn't have this problem, the crashed process takes the server out as well. Which is a problem too, no nice cleanup, but easier to deal with.</p> <p>Getting the server to recover from this is something you'll have to add yourself. You could, say, have the client pass its process ID so that the server can obtain the process handle and detect when the client falls over with WaitForMultipleHandles(). Assuming they both live on the machine, that's certainly not a COM requirement and not something the server can find out.</p>
11,407,624
0
<p>I would recommend you to use a separate forms per button (which contrary to classic WebForms is something that you should not be afraid of in ASP.NET MVC) and of course use submit buttons instead of hyperlink which are the semantically correct element to submit a form:</p> <pre><code>@using (Ajax.BeginForm("Click", new { id = "0" }, new AjaxOptions { UpdateTargetId = "showpage" })) { &lt;button type="submit" value="Link 0" /&gt; } @using (Ajax.BeginForm("Click", new { id = "1" }, new AjaxOptions { UpdateTargetId = "showpage" })) { &lt;button type="submit" value="Link 1" /&gt; } </code></pre> <p>Now inside your <code>Click</code> action you will get the correct id.</p>
13,165,706
0
<p>sorry, can't reproduce your problem, see screenshot (HTC Desire, Android 2.2, Dolphin browser), which looks fine...<br></p> <p><img src="https://i.stack.imgur.com/dlEaW.png" alt="enter image description here"></p>
33,361,695
0
<p>page-break is not enough for internet explorer by own. If u try this, you can see the result. I have same problem but I solved by this way.</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div style="page-break-after: always;"&gt;&lt;/div&gt; &lt;div&gt;&amp;nbsp; &lt;/div&gt;</code></pre> </div> </div> </p>
4,432,741
0
<p>Take a look at this page from the Devise Wiki on GitHub: <a href="https://github.com/plataformatec/devise/wiki/How-To%3a-Customize-user-account-status-validation-when-logging-in" rel="nofollow">https://github.com/plataformatec/devise/wiki/How-To:-Customize-user-account-status-validation-when-logging-in</a></p> <p>I think that will work for what you are talking about.</p>
23,723,300
0
<p>If you create a <strong>nodemon.json</strong> config file in your application folder (e.g. <code>/home/rdteam/workspace/NedvedNodeExpressTest/nodemon.json</code>) with the following JSON it should work without having to modify the Nodemon source files. </p> <pre><code>{ "exec": "/usr/local/bin/node" } </code></pre> <p>This work on OS X, you may need to change the path depending on where you have node installed.</p> <p>Details on Nodemon config files: <a href="https://github.com/remy/nodemon#config-files" rel="nofollow">https://github.com/remy/nodemon#config-files</a></p>
39,439,049
1
how to detect that microphone is on or off in python 3 <p><strong>Its not duplicate</strong></p> <p>I have a python code that uses speech recognition and it has a problem when microphone is off so i want to add a code that closes python if microphone is off and if its not then runs the whole script.</p> <p><strong>for example:</strong></p> <pre><code>import speech_recognition as sr #if microphone is on : r = sr.Recognizer() with sr.Microphone() as source: audio = r.listen(source) try: said = r.recognize_google(audio) print(audio) except sr.UnknownValueError: print('google did not understand what you said') except sr.RequestError as e: print('errpr' + "; {0}".format(e)) #else print('please turn your microphone on and open again') quit() </code></pre> <p>any ideas how to do that?</p> <p><strong>Its not a duplicate question and it's completely a different question</strong></p> <p><a href="http://stackoverflow.com/questions/2797572/how-to-see-if-there-is-one-microphone-active-using-python">In this link</a> : we can detect that microphone is connected to pc or not , i wanna detect that microphone button is on or off.</p> <p>Actually my codes has this error that when my microphone is off and i run the code then i turn that on while code is still running , it will not recognize my voice , so i want to warn user to turn his microphone on then restart program.</p>
17,918,643
0
<p>You should create 4 separate products ( duplicate ) and make each visible only for one store. This can be done in <code>Catalog -&gt; Product -&gt; *choose your product* -&gt; Websites tab</code>. Only then you can have different quantity for each store.</p>
31,474,212
0
<p>A path always contains the core component and the complete address list required to locate the file. It is mainly significant environment variable of Java environment. In other words it represents a path that is hierarchical sequence of directory and file name elements separated by a special partition. A Path can represent a root, a root and a sequence of names .A path is considered to be an empty path if it consists solely of one name element that is empty. For more details you can move to <a href="http://www.resumewritingserviceindianapolis.us/" rel="nofollow">resume writing service Indianapolis</a> from online. </p>
27,652,908
0
Java Ram Usage Inconsistencies <p>I am currently working on a 2D java game which utilizes a linkedhashmap for rendering data at a particular tile. When I serialize the class object which contains this as well as a few other non transient objects used for map rendering the file which is output only has a size of 4kb. To my understanding RAM usage depends upon the size of whatever is being read from, but apparently I am using up a max of 20% of my memory reading from a file that is less than 4kb in size. This leads me to believe that my understanding of how RAM works is wrong or I am missing something that is giving me bad RAM readings.</p> <p><strong>Method of RAM Analysis</strong></p> <pre><code>usedPercent = (double) (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / Runtime.getRuntime().maxMemory(); </code></pre>
19,620,703
0
How to access a textbox text from gridview to a button Onclick event <p>I am having textboxes and buttons in gridview. What I want is that when I click on those buttons the corresponding value in textbox is updated to database, so I need to access the textbox text in OnClick event. How can I do this?</p> <p>Gridview:</p> <pre><code>&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" ForeColor="Black" OnRowDataBound="GridView1_RowDataBound" onselectedindexchanged="GridView1_SelectedIndexChanged"&gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText="Save 1"&gt; &lt;ItemTemplate&gt; &lt;asp:TextBox ID="TextBox1" Width="30px" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="btnSave1" runat="server" Text="Save" OnClick="btnSave1_Click" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText="Save 2"&gt; &lt;ItemTemplate&gt; &lt;asp:TextBox ID="TextBox2" Width="30px" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="btnSave2" runat="server" Text="Save" OnClick="btnSave2_Click" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p>Button Onclick Event:</p> <pre><code>protected void btnSave1_Click(object sender, EventArgs e) { //I want to access TextBox1 here. } </code></pre> <p>Please help me out of this.</p>
10,110,588
0
<p>Answer added to the original post.</p>
3,474,766
0
<p>If you just want to check for their existence and don't need the link, you should use <a href="http://codex.wordpress.org/Function_Reference/get_previous_post" rel="nofollow noreferrer"><code>get_previous_post</code></a> and <a href="http://codex.wordpress.org/Function_Reference/get_next_post" rel="nofollow noreferrer"><code>get_next_post</code>.</a> They don't apply unnecessary formatting that you would ignore if you just use it in an <code>if</code> test. You can still get a link from the post object it returns by passing it to <a href="http://codex.wordpress.org/Function_Reference/get_permalink" rel="nofollow noreferrer"><code>get_permalink</code></a>.</p>
30,459,996
0
<p>To have multiple Xcode instances installed you can put them to different folders for example /Developer5.0.2/Xcode, but to use them in CI or build environment(command line) you need to setup some environment variables during the build. You can have more instructions <a href="https://asile.digitalhusky.com/2015/05/25/multiple-xcode-versions-on-ci-node/" rel="nofollow">here</a>. So it is working not just with beta and fresh release, also it's working for the really old versions, you might need it to use with Marmalade or Unity plugins which is not support the latest Xcode versions yet(some times it's happens).</p>
26,002,748
0
Event listener for dynamically created html <p>I am dynamically generating html, and I want the elements I add to have event listeners. The "board" div is in my html file, and I create the "myDiv" element. This part works.</p> <pre><code>var board = document.getElementById("board"); var myDiv = document.createElement('div'); myDiv.innerHTML="this is my div"; </code></pre> <p>Then I try to add an event listener to the "myDiv" div. I have tried all of the following:</p> <pre><code>myDiv.onclick=function(){alert('click')}; myDiv.addEventListener('click', function(){alert('click')}); myDiv.onclick=myFunction //myFunction just creates an alert like the others </code></pre> <p>Then I append the 'myDiv' element to the board. It shows up on the screen as expected</p> <pre><code>board.appendChild(myDiv); </code></pre> <p>The div elements show up as expected, and when I open the javascript console in chrome it looks like that part is correct. Also, the javascript console says that there is a 'click' event listener attached to the 'myDiv' div, but no alert ever comes up like it should. How can I fix this? Thanks!</p>
9,599,312
0
<p>UIViewControllers may implement didReceiveMemoryWarning that the system calls when your app is on low memory. Framework classes, as core text, are most likely do implement this and act accordingly to save memory. So it is possible that your core text object aims to help your app resolving the low-mem situation with freeing some of its resources that can even cause it to blank its contents. Fix first <em>all</em> memory leaks in your app.</p> <p>On the other hand, all bugs are very difficult to correct if you can't reproduce them. If you suspect that the issue is due to low memory, try to simulate this yourself by allocating huge amount of memory in your application and hope that you can reproduce the erroneous behavior that way.</p>
26,196,251
0
<p>So it turns out the blog post I was quoting is about advanced mode (mode which allows specifying exact ad size via CSS). Even though more than a year ago Google recognized the problem, <strong>the advanced ads are not resizing automatically when screen orientation chages.</strong></p> <p>The AdSense documentation states that responsive ads resize with orientation changes. That's true, but only for default (not advanced ads).</p> <p>The advanced mode allows specifying exact ad sizes with @media CSS rules which is nice. But for me it was possible to achieve almost same thing by wrapping default responsive ads with div container. The container's size can also be specified by CSS @media rules, so I have same result as with advanced ads + I get benefit of ads resizing when screen orientation changes. </p>
38,325,316
0
<p>Starting from KitKat, you have access to a method to get that directory : </p> <pre><code>Context.getExternalFilesDirs() </code></pre> <p>Note that it may return null if the SD card is not mounted or moved during the access. Also, you might need to add these permissions to your manifest file : </p> <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; </code></pre>
1,159,078
0
<p>It will take a lot lot longer if you just sit around asking abstract questions and not actually diving in and doing it. Do you have a deadline or something? How long will it take me to learn the piano? Who cares, I just wanna make some noise. That's how kids learn so fast. They don't care about becoming an expert, or even good. They just like to play.</p> <p>In any case, if you want to learn some interesting things, try some assembler as well. A lot of people really hate it, but that's just because they don't like spending countless hours not accomplishing much. I like it just fine.</p>
31,950,337
0
<p>Well, I'm not sure if parametrisation of CucumberJVM tests on <code>testng.xml</code> level is what you are really looking for. However, if you really need to read parameters from <code>testng.xml</code> file in your CucumberJVM framework, here is a (dirty) solution for you:</p> <ul> <li>make <code>DownloadFeatureRunner</code> extend CustomRunner instead of <code>AbstractTestNGCucumberTests</code></li> <li>include parameter in yout <code>testng.xml</code> file: <code>&lt;parameter name="someParam" value="someValue"/&gt;</code></li> <li><p>and also implement you new parent class:</p> <pre><code>public class CustomRunner implements IHookable { public CustomRunner() { } @Parameters("someParam") @Test( groups = {"cucumber"}, description = "Runs Cucumber Features" ) public void run_cukes(String someParam) throws IOException { System.out.println(someParam); (new TestNGCucumberRunner(this.getClass())).runCukes(); } public void run(IHookCallBack iHookCallBack, ITestResult iTestResult) { iHookCallBack.runTestMethod(iTestResult); } } </code></pre></li> </ul> <p>As you can see, you can access value of the parameter. It's up to you what you want to do with it now.</p>
5,321,234
0
emails sent with "send object" macro sometimes get stuck in Outlook outbox <p>I have an Access 2007 macro that uses the send object command to send emails with an HTML attachment. My problem is that around 20% of these emails get stuck in the Outlook outbox. For some unknown reason, the "delay delivery" checkbox in Outlook is automaticaly checked off to delay the delivery, for these emails. I dont know if this is relevant, but I use the app "Click Yes", in order to automatically authorize Outlook to send the messages. Please advise what I can do in order not to expereince the emails from getting stuck in the Outbox THank you very much, Nathaniel</p>
33,984,100
0
<p>From Android 5.0 (API level 21) you can use vector drawable in your app. You can use new Android Studio tool called: Vector Asset Studio. It handles PNG making for older versions automatically. See link below for a complete explanation:</p> <p><a href="http://developer.android.com/tools/help/vector-asset-studio.html" rel="nofollow">Vector Asset Studio</a></p>
30,987,493
0
<p>These things are called <em>Chips</em>. If you are using angular, then you can look at the demo <a href="https://material.angularjs.org/latest/#/demo/material.components.chips" rel="nofollow">here</a>.</p>
4,291,324
0
<p>The simple, and most likely correct answer is that the last module loaded that exports a given function will be the one whose function is used.</p> <p>When a function (or other symbol) is exported, the symbol table for the receiving package is modified. So if two import functions make changes to the table, the last change is what is preserved.</p> <p>Recall that <code>use Foo;</code> is <em>more or less</em> equivalent to <code>BEGIN { require Foo; Foo-&gt;import if Foo-&gt;can(import); }</code>.</p> <p>Since <code>import</code> is just a subroutine with a special name, the only limitation is the twisted imagination of J. Random Hacker. <code>import</code> can be <strong>any</strong> code. It can do anything or nothing. For example, it could contain logic to make sure no already defined functions are over-written.</p> <p>But, barring any weirdness, the last loaded will be the one in use.</p> <hr> <p>To be 100% technically correct, <code>use Foo;</code> is equivalent to <code>BEGIN { require Foo; Foo-&gt;import; }</code>. </p> <p>Except that this code doesn't work like you might expect. </p> <p><strong>Where the exact code varies from my example.</strong></p> <p>What the above code does is tied up in how method resolution works in Perl.</p> <p>Ordinarily, a call to <code>Foo-&gt;some_sub</code> where <code>some_sub</code> does not exist and an <code>AUTOLOAD</code> function is defined in <code>Foo</code>, <code>some_sub</code> would be handled by the <code>AUTOLOAD</code> function. There is a special case for <code>import</code> that exempts it from <code>AUTOLOAD</code> checks. See <a href="http://perldoc.perl.org/perlsub.html#Autoloading" rel="nofollow">perlsub on Autoloading</a>. </p> <p>After <code>AUTOLOAD</code> has (or really has not) been checked, we check inheritance. The same check for matching functions or an <code>AUTOLOAD</code> function is repeated for each item in the original package's <code>@ISA</code>. This is a recursive process that includes the parent's parents and so forth until the entire inheritance tree is checked--<code>@ISA</code> is checked in left to right, depth first order. All this time the <code>AUTOLOAD</code> exception is in place and it will be skipped for <code>import</code>.</p> <p>Eventually, if no matching method is found, we fall back on <code>UNIVERSAL</code> the universal base class. If the function exists in <code>UNIVERSAL</code>, it is called, otherwise we throw an exception that says the function couldn't be found.</p> <p>So, in the case of our <code>Foo-&gt;import;</code> call, <code>UNIVERSAL::import</code> is called to handle the job. So, what does this function do?</p> <p>In Perl 5.12.2 the code looks like this:</p> <pre><code>sub import { return unless $_[0] eq __PACKAGE__; return unless @_ &gt; 1; require warnings; warnings::warnif( 'deprecated', 'UNIVERSAL-&gt;import is deprecated and will be removed in a future perl', ); goto &amp;Exporter::import; } </code></pre> <p>Note that the first thing the function does is bail out if it wasn't called on <code>UNIVERSAL</code>.</p> <p>Now everything I've said is true, as long as you don't do several things:</p> <ul> <li><p>override the method resolution order. If you do this then method resolution will happen however you have defined it to. Whether we get to UNIVERSAL or not or when is totally up in the air and subject to your whims.</p></li> <li><p>override <code>UNIVERSAL::import</code>. You could monkey patch UNIVERSAL::import to do whatever you want. Again how this will behave is completely subject to your whims.</p></li> </ul> <p>So, the semi-equivalent code I gave above is a just shorthand for what happens. I thought it would be easier to understand, since it does not require knowing as many details of how Perl does things, but it isn't 100% equivalent to what really happens. Doing unexpected things breaks the equivalence. </p> <p><strong>Where my code varies from exact equivalent code</strong></p> <p>Further, my code calls <code>Foo-&gt;can</code> which generally falls back to <code>UNIVERSAL::can</code>. In no place is <code>can</code> called in the normal chain of events. This gets especially hairy when one considers the issues with <code>can</code> in Perl. </p> <ul> <li><code>can</code> may be overridden or reimplemented by any class in the inheritance graph. Which <code>can</code> gets called is subject to method resolution order. All the problems with multiple inheritance apply here.</li> <li><code>can</code> does not see autoloaded functions. Since autoloading doesn't apply to import this may not seem like a big deal. The problem is that it is considered good practice to overload <code>can</code> to take this into account if you use autoloading. So, this compounds the issues above. The best thing to do is to use the non-core module <code>NEXT</code> to enable method redispatch, so that can can be handled by each module in the chain. Unfortunately, this is rarely done.</li> </ul> <p><strong>Conclusion</strong></p> <p>All this is one hell of a lot to chew on.</p> <p>You can accept my shorthand, knowing that in some cases, it is not exactly correct. </p> <p>Or you can accept the actual code, that has its own set of exceptions.</p> <p>Either way, if you break through the surface of either example there are some subtle issues to cope with.</p>
22,240,534
0
<p><a href="http://jsfiddle.net/mE7EQ/" rel="nofollow">http://jsfiddle.net/mE7EQ/</a></p> <p>I wrote one up real quick, if you have any questions about it, let me know!</p> <pre><code>var a = 'This is some [example] text for my javascript [regexp] [lack] of knowledge.' var results = a.match(/\[\w*\]/g); alert(results[0] + ' ' + results[1] + ' ' + results[2]); </code></pre>
1,935,512
0
<p>I need this too...</p> <p>The solution of Multi-Statement table-based function is good but not enough:</p> <pre><code>CREATE FUNCTION myProc (@ID Int) RETURNS @EmployeeList Table ( ID Int , Name nVarChar(50) , Salary Money ) AS BEGIN IF @ID IS NULL BEGIN INSERT INTO @EmployeeList (ID, Name, Salary) SELECT ID, Name, Salary FROM Employee END ELSE BEGIN INSERT INTO @EmployeeList (ID, Name, Salary) SELECT ID, Name, Salary FROM Employee WHERE ID = @ID END RETURN END GO </code></pre> <p>One must <em>d e f i n e</em> a return table so that a predefined field must be returned and not any table like</p> <pre><code>if @tableNum=1 then select * from tableA --(tableA and tableB are completely differnt ) else select * from tableB </code></pre>
6,939,876
0
How to create curved or rounded tabs in Android <p>actually i want to show the curve at the bottom right side of my tabs..so how can it be done..the code i have used..</p> <p>Code for Xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content"/&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"/&gt; &lt;/LinearLayout&gt; &lt;/TabHost&gt; </code></pre> <p>code for second xml</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;!-- When selected, use grey --&gt; &lt;item android:drawable="@drawable/ic_tab_artists_white" android:state_selected="true" android:state_pressed="false" /&gt; &lt;!-- When not selected, use white--&gt; &lt;item android:drawable="@drawable/ic_tab_artists_grey" /&gt; &lt;/selector&gt; </code></pre> <p>code for .java file</p> <pre><code> Resources res = getResources(); final TabHost MainTabHost = getTabHost(); TabHost.TabSpec spec; Intent intent; MainTabHost.getTabWidget().setStripEnabled(false); //call calendar Activity class intent = new Intent().setClass(this, CalendarForm.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); spec = MainTabHost.newTabSpec(res.getString(R.string.text_tabHost1)).setIndicator("Calendar", res.getDrawable(R.drawable.calendar_ic)).setContent(intent); MainTabHost.addTab(spec); //call History Activity class intent = new Intent().setClass(this, HistoryForm.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); spec = MainTabHost.newTabSpec(res.getString(R.string.text_tabHost2)).setIndicator("History", res.getDrawable(R.drawable.calendar_ic)).setContent(intent); MainTabHost.addTab(spec); //call Statistic Activity class intent = new Intent().setClass(this, StatisticForm.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); spec = MainTabHost.newTabSpec(res.getString(R.string.text_tabHost3)).setIndicator("Statistic", res.getDrawable(R.drawable.calendar_ic)).setContent(intent); MainTabHost.addTab(spec); //setbackground Style of tabHost MainTabHost.setCurrentTab(0); MainTabHost.getTabWidget().setWeightSum(3); final TabWidget tabHost=getTabWidget(); MainTabHost.setBackgroundResource(R.drawable.back_image); for (int j = 0; j &lt; MainTabHost.getTabWidget().getChildCount(); j++) { ((TextView)tabHost.getChildAt(j).findViewById(android.R.id.title)).setTextColor(Color.parseColor("#FFFFFF")); ((TextView)tabHost.getChildAt(j).findViewById(android.R.id.title)).setTextSize(16); } </code></pre> <p><img src="https://i.stack.imgur.com/nIfNU.png" alt="enter image description here"></p> <p>this is what i got..here tabs are square now i want my tabs curve at the bottom right side</p>
964,811
0
<p>One of the most useful things we introduced was a project Wiki, an extremely useful dumping ground for all the little titbits of information floating around in peoples head but too trivial to record in a full document.</p>
33,785,570
0
<p>You need to URL encode the values. Try using the encodeURIComponent() method.</p> <p><a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent" rel="nofollow">https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent</a></p>
22,794,996
0
<p>Clients may not directly access artifacts under WEB-INF.</p> <p>Put them in a location directly accessible if you're not streaming them from an app endpoint.</p>
36,431,950
0
<p>There is no official example but check below link.<br> Very good implementation. <a href="https://github.com/roughike/BottomBar" rel="nofollow">https://github.com/roughike/BottomBar</a></p>
39,003,364
0
<p>The issue is in <code>e.target.Id</code>. It should <code>id</code>(lower case) since <code>javascript</code> is a case-sensitive language.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var list = document.querySelector("ul"); list.onclick = function(e) { if(e.target.tagName === "LI") { e.target.classList.toggle("done"); } }; var list2 = document.getElementById("list2"); list2.onclick = function(e) { if(e.target.id === "text") { e.target.classList.toggle("done"); } };</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>.done{ background-color:greenyellow; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ul&gt; &lt;li&gt;One&lt;/li&gt; &lt;li&gt;Two&lt;/li&gt; &lt;li&gt;Three&lt;/li&gt; &lt;/ul&gt; &lt;div id="list2"&gt; &lt;p id="text"&gt;Text&lt;/p&gt; &lt;p id="text"&gt;Text&lt;/p&gt; &lt;p id="text"&gt;Text&lt;/p&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
3,254,755
0
<p>Would be nice to tell us where you're having problems, what you expect and the result you're currently getting. </p>
30,090,608
0
How to add animation to new objects being pushed into DOM in AngularJS? <p>I am trying to add animation to new objects being pushed into an array in a service which the controller is listening to and is then adds it to the view using ng-repeat. How can I add animation instead of having the new object just appear?</p> <p>Here is my code for my view, controller, and service.</p> <p>View:</p> <pre><code>&lt;div&gt; &lt;h3&gt;Add a quote:&lt;/h3&gt; &lt;input type="text" ng-model="newQuote.text" placeholder="Quote..."&gt; &lt;input type="text" ng-model="newQuote.author" placeholder="Author..."&gt; &lt;button ng-click="addQuote()"&gt;Add&lt;/button&gt; &lt;/div&gt; &lt;h1&gt;Quotes&lt;/h1&gt; &lt;div ng-repeat="thisData in someData | filter:searchThis"&gt; &lt;div id="{{thisData.id}}" class="quotes"&gt; &lt;p class="quote"&gt;"{{thisData.text}}"&lt;br&gt;-{{thisData.author}}&lt;/p&gt; &lt;button class="deleteButton" ng-class="{on:state}" ng-click="deleteQuote(thisData.text)"&gt;X&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Controller:</p> <pre><code>$scope.getData = function(){ $scope.someData = dataService.getData() } $scope.getData() $scope.newQuote = {} $scope.addQuote = function(){ dataService.addData($scope.newQuote) $scope.newQuote = "" } </code></pre> <p>Service:</p> <pre><code>var quotes = [ { id: 0, text: 'Life isn\'t about getting and having, it\'s about giving and being.', author: 'Kevin Kruse'}, { id: 1, text: 'Whatever the mind of man can conceive and believe, it can achieve', author: 'Napoleon Hill'}, { id: 2, text: 'Strive not to be a success, but rather to be of value.', author: 'Albert Einstein'}, { id: 3, text: 'Two roads diverged in a wood, and I took the one less traveled by, And that has made all the difference.', author: 'Robert Frost'}, { id: 4, text: 'The most difficult thing is the decision to act, the rest is merely tenacity.', author: 'Amelia Earhart'}, { id: 5, text: 'Life is what happens to you while you\'re busy making other plans.', author: 'John Lennon'}, { id: 6, text: 'What even is a jQuery?', author: 'Tyler S. McGinnis'} ]; this.getData = function(){ return quotes } this.addData = function(someObj){ if (someObj.text &amp;&amp; someObj.author){ quotes.unshift(someObj) } else { return "Error" } } </code></pre>
11,145,629
0
<p>Can you have a counter matrix that increments each time links are reformed between nodes of a graph then base your measures off of that.</p>
30,270,157
0
SemanticException: no valid privileges when querying with a cast on Hive <p>I'm getting a weird error when running any query with a <code>cast</code> as a non-admin. For example:</p> <pre><code>select cast(site_id as decimal) from test_table limit 5; </code></pre> <p>In that example, <code>site_id</code> is a <code>bigint</code>, but the column type and the type it's being cast as make no difference at all. The query runs fine in the absence of a <code>cast</code>, and the admin can run the query without issues as well. </p> <p>This is cdh 4.5.0, Hive 0.10.0.</p>
17,843,882
0
php search result images show across and fill a CSS div <p>I'm using dreamweaver and php to return a list of images based on search critiera. I have used Dreamweaver's repeat function and can get the images to repeat below each other (as below). </p> <pre><code>&lt;table width="100" height="38" border="1"&gt; &lt;?php do { ?&gt; &lt;tr&gt; &lt;td width="38"&gt; &lt;img class='example' src="images/&lt;?php echo $row_getresult['image_name']; ?&gt;.png"/&gt;&lt;br&gt; &lt;/a&gt;&lt;/td&gt;&lt;/tr&gt; &lt;?php } while ($row_getamenityaccommodation = mysql_fetch_assoc($getamenityaccommodation)); ?&gt; &lt;/table&gt; </code></pre> <p>How can I get the images to go across from each other within a CSS Div e.g. float:left; width:45%; so that if there are more images than what would fit in 45%, the images would continue onto a new line?</p> <p>Would somehow 'printing' the array work?</p>