Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
38,334,776
Fatal error: use of unimplemented initializer in custom navigationcontroller
<p>I'm creating a custom navigation controller. I have something like this:</p> <pre><code>public class CustomNavigationController: UINavigationController { // MARK: - Life Cycle override init(rootViewController: UIViewController) { super.init(rootViewController: rootViewController) delegate = self } required public init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) delegate = self } } </code></pre> <p>I wanted to test this out so I created a CustomNavigationController like this:</p> <pre><code>CustomNavigationController(rootViewController: ViewController()) </code></pre> <p>When I run the app I get this:</p> <pre><code>fatal error: use of unimplemented initializer 'init(nibName:bundle:)' for class 'TestApp.CustomNavigationController' </code></pre> <p>I don't see the problem, can anyone help me out?</p>
<ios><swift2>
2016-07-12 16:47:23
HQ
38,335,000
JUnit Test + Eclipse
I am not familiar with Junit testing at all. How would I go about creating a junit test for this code? I am using Eclipse and have already set up the test file. @WebServlet("/version") public class TypeCheck extends HttpServlet { /** * */ private static final long serialVersionUID = 987654321; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { BufferedReader read = null; InputStream is = this.getClass().getClassLoader().getResourceAsStream("/version.txt"); try { read = new BufferedReader(new InputStreamReader(is)); response.getWriter().write(read.readLine()); } catch (IOException e) { e.printStackTrace(); } finally { if (read != null) { try { read.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
<java><junit>
2016-07-12 17:00:57
LQ_EDIT
38,335,377
Install Python Package From Private Bitbucket Repo
<p>I created a Python 3.5 package for work, which is in a private Bitbucket repo and I can easily pull the code and do a "python .\setup.py install" to have it install, but I want to try to eliminate the step of having to pull the code and have multiple copies on my machine and at the same time make it easier for my coworkers to install/update the package. Is it possible to use git bash or cmd (we are all on Windows) to install the package and ask for credentials in the process?</p>
<python-3.x><package><bitbucket><private>
2016-07-12 17:25:06
HQ
38,335,756
Unreachable Code detected c# beginner
<p>Hi I'm new to C# and could do with anybody's help on how to discover what the problem is here. I keep getting an error saying that unreachable code was detected under the line '_parcelService' at the bottom.</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ABC.Data; using ABC.Services; using ABC.Services.Service; namespace ABC.Controllers { public class AdminController : Controller { private ParcelService _parcelService; public AdminController() { _parcelService = new ParcelService(); } // GET: Admin public ActionResult Index() { return View(); } [HttpGet] public ActionResult AddParcel() { return View(); } [HttpPost] public ActionResult AddParcel(ParcelDetail parcel) { return View(); { _parcelService.AddParcel(parcel); return RedirectToAction("Parcels", new { TrackingID = parcel.TrackingID, controller = "Parcel" }); } } } } </code></pre>
<c#>
2016-07-12 17:46:37
LQ_CLOSE
38,336,738
What is the easiest way for a beginner to get their CSS to link to their HTML in atom?
I am very new to coding, but have the basics down for the most part. I recently downloaded Atom and created very simple HTML and CSS files. I used the standard link method (as shown in the code), but cannot seem to get my css to link. My only install thus far has been webBoxio/atom-html-preview. ((HTML)) <!DOCTYPE HTML> <HTML> <body> <link rel="stylesheet" type="text/css" href="mine.css"> <h1>test</h1> <p>test</p> </body> </HTML> ((CSS)) h1, p { font-style: Sans-Serif ; }
<html><css>
2016-07-12 18:49:11
LQ_EDIT
38,337,666
c preprocessor passing multiple arguments as one
<p>The C preprocessor is passing multiple arguments as if they were a single argument. I feel pretty sure the problem is how we are calling the <code>untouchable</code> macro, but every attempt we have made to alter the <code>first</code> macro has failed to produce the desired result. Here is a complete code sample with comments that explain what happens and what we want to happen:</p> <pre><code>//this can be changed, but it must remain a #define to be of any use to us #define first a,b,c // v all code below this line cannot be altered (it's outside of our control) #define untouchable(name, c1, c2, c3) \ wchar_t name[] = \ { \ quote(c1), \ quote(c2), \ quote(c3) \ } #define quote(c) L#@c // ^ all code above this line cannot be altered (it's outside of our control) int _tmain(int argc, _TCHAR* argv[]) { static untouchable(mrNess, first); // the line above is precompiled to: // static wchar_t mrNess[] = { L'a,b,c', L, L }; // whereas we want: // static wchar_t mrNess[] = { L'a', L'b', L'c' }; return 0; } </code></pre> <p>We are compiling in Windows under VisualStudio.</p>
<c><macros><c-preprocessor>
2016-07-12 19:45:56
HQ
38,337,709
Select prices the last 5 rows of the table
i would like to know how could i get the last 5 rows and only show the prices that has the same value. Here is an example of my Table IDPRICES | PRICES <br/> 39 | 500 <br/> 38 | 300 <br/> 37 | 100 <br/> 36 | 200 <br/> 35 | 500 now i only want to show the values rows 35 and 39 Here is an example of my Query select idprices, prices from test.prices order by idprices desc limit 5 ;
<mysql>
2016-07-12 19:48:43
LQ_EDIT
38,337,997
d3.js v4 d3.layout.tree has been removed?
<p>After upgrading to d3.js v4.1.1, this line:</p> <pre><code>d3.layout.tree() </code></pre> <p>produces an error:</p> <pre><code>Cannot read property 'tree' of undefined </code></pre> <p>It seems like the tree layout has been removed from v4? <a href="https://github.com/d3/d3/blob/master/API.md" rel="noreferrer">https://github.com/d3/d3/blob/master/API.md</a></p> <p>The examples still use the v3 API: <a href="http://bl.ocks.org/mbostock/1093025" rel="noreferrer">http://bl.ocks.org/mbostock/1093025</a></p> <p>Is the layout really gone or has it been renamed?</p>
<d3.js>
2016-07-12 20:06:55
HQ
38,338,378
Angular CLI route
<p>When executing command:</p> <pre><code>ng generate route someName </code></pre> <p>I am getting error like this:</p> <blockquote> <p>Could not start watchman; falling back to NodeWatcher for file system events. Visit <a href="http://ember-cli.com/user-guide/#watchman" rel="noreferrer">http://ember-cli.com/user-guide/#watchman</a> for more info. Due to changes in the router, route generation has been temporarily disabled. You can find more information about the new router here: <a href="http://victorsavkin.com/post/145672529346/angular-router" rel="noreferrer">http://victorsavkin.com/post/145672529346/angular-router</a></p> </blockquote> <p>Provided links are not helpful</p>
<routes><angular-cli>
2016-07-12 20:31:59
HQ
38,339,396
What is an array, what is the difference between array and objects and when and why use an array?
<p>Hello I have a few questions: Why is an array? Why is the difference between array and object? Why and when I need to use an array? Thanks for helping :);)</p>
<javascript><arrays><javascript-objects>
2016-07-12 21:47:32
LQ_CLOSE
38,340,054
React-Virtualized Autosizer calculates height as 0 for VirtualScroll
<p>Where AutoSizer's width gives me an appropriate value, I'm consistently getting an Autosizer height of 0, which causes the VirtualScroll component not to display. However, if i use the disableHeight prop and provide VirtualScroll with a fixed value for height (i.e. 200px), VirtualScroll displays rows as expected. Can anyone see whats wrong?</p> <p>Ultimately, the Autosizer is meant to live inside a Material-ui Dialog component, but I have also tried simply rendering the autosizer into a div. Same issue.</p> <pre><code>render() { return ( &lt;Dialog modal={false} open={this.state.open} onRequestClose={this.handleClose} contentStyle={pageOptionsDialog.body} &gt; &lt;div&gt; &lt;AutoSizer&gt; {({ width, height }) =&gt; ( &lt;VirtualScroll id="virtualScroll" onRowsRendered={this.props.loadNextPage} rowRenderer={this.rowRenderer} height={height} rowCount={this.props.rowCount} rowHeight={30} width={width} /&gt; )} &lt;/AutoSizer&gt; &lt;/div&gt; &lt;/dialog&gt; )} </code></pre>
<javascript><material-ui><react-virtualized>
2016-07-12 22:48:42
HQ
38,340,292
VS2015 pubxml: how to exclude or eliminate the <PublishDatabaseSettings> section
<p>I need to exclude database related settings from the Web Deploy publishing. I tried to delete the section in the pubxml file, but it comes back when I create a deployment package.</p> <p>Is there any way way to exclude database related settings from the Web Deploy publishing?</p>
<visual-studio-2015><web-deployment><publishing><pubxml>
2016-07-12 23:17:32
HQ
38,340,474
Single letter words in camelCase, what is a standard for handling these?
<p>I'm trying to group together an object's vertex X components in a vector, like structure of array style. </p> <p>Naturally this is the way.</p> <pre><code>Vec xComponents; or Vec xVals; or simply Vec x; </code></pre> <p>However sometimes I want to specify in the id what x components belong to, I think about doing this.</p> <pre><code>Vec objXComponents; </code></pre> <p>However, the two capitals next to each other seem to break a rule about camel case, and may make it slightly less readable.</p> <p>What should I do for this case? I know you may say just cull the components post-fix and use <code>objX</code>, and while I think that's OK for this case I would like a general solution / standard.</p> <p>I tried finding if microsoft has a standard for this but I cant find it on their <a href="https://msdn.microsoft.com/en-us/library/ms229043.aspx" rel="noreferrer">style guidlines</a>.</p>
<c#><coding-style><camelcasing>
2016-07-12 23:39:33
HQ
38,340,500
Export multiple classes in ES6 modules
<p>I'm trying to create a module that exports multiple ES6 classes. Let's say I have the following directory structure:</p> <pre><code>my/ └── module/ ├── Foo.js ├── Bar.js └── index.js </code></pre> <p><code>Foo.js</code> and <code>Bar.js</code> each export a default ES6 class:</p> <pre><code>// Foo.js export default class Foo { // class definition } // Bar.js export default class Bar { // class definition } </code></pre> <p>I currently have my <code>index.js</code> set up like this:</p> <pre><code>import Foo from './Foo'; import Bar from './Bar'; export default { Foo, Bar, } </code></pre> <p>However, I am unable to import. I want to be able to do this, but the classes aren't found:</p> <pre><code>import {Foo, Bar} from 'my/module'; </code></pre> <p>What is the correct way to export multiple classes in an ES6 module?</p>
<javascript><module><export><ecmascript-6><babel>
2016-07-12 23:43:21
HQ
38,340,782
best practice to iterate through array of arrays & create another array [Android]
i have an Array of Arrays such as Arraylist<myObjec> subArray = {item1_1,item1_2, item1_3}<br></br> Arraylist<myObjec> subArray = {item2_1,item2_2, item2_3, item2_4} Arraylist<myObjec> mainArray = {subArray_1,subArray_2} i want to create the newArray to be something like that: newArray = {item1_1, item1_2, item2_1, item2_2, item1_3, item2_3, item2_4} So i want to take a segment of item say get from every subArray 2 item and go back through array of Arrays till i finish. what would be the best practices to approach this result?
<java><arraylist>
2016-07-13 00:19:16
LQ_EDIT
38,340,873
weblogic 12c with richfaces 4.0.0 - For <rich:fileupload> Deployment Failed
Issue when I try to deploy in to weblogic 12C Steps that I followed, JSTL - 1.2 JSF - 1.2 richfaces-rich-4.5.17.Final richfaces-a4j-4.5.17.Final richfaces-core-4.5.17.Final Also I included, guava-18.0.jar cssparser-0.9.19.jar sac-1.3.jar annotations-4.0.0.Final.jar Deployment was successful, but when I tried to upload a file using <rich:fileupload> I got the following error, **The JSF implementation 1.0.0.0_2-1-5 does not support the RichFaces ExtendedPartialViewContext. Please upgrade to at least Mojarra 2.1.28 or 2.2.6** Then I upgrade JSF1.2 to jsf-api-2.1.28 and jsf-impl-2.1.28 with Richfaces 4.5.17 When I try to file upload received, javax.servlet.ServletException: IO Error parsing multipart request at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:352) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:75) at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:343) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:75) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:302) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:367) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:75) at com.singtel.eshop.filter.SignOnFilter.doFilter(SignOnFilter.java:150) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:75) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:75) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3288) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2091) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1512) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221) Caused by: org.ajax4jsf.exception.FileUploadException: IO Error parsing multipart request at org.ajax4jsf.request.MultipartRequest.parseRequest(MultipartRequest.java:388) at org.richfaces.component.FileUploadPhaselistener.beforePhase(FileUploadPhaselistener.java:63) at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99) at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) ... 29 more Found The JSF default version of 12.1.1 WLS server is lower than 2.1.28 JSF version, so I changed JSF version to jsf-api-2.0.0 and jsf-impl-2.0.0 and changed RichFaces version from 4.5.17 to richfaces-core-api-4.0.0.Final, richfaces-core-impl-4.0.0.Final, richfaces-components-ui-4.0.0.Final, richfaces-components-api-4.0.0.Final. Deployment Failed <Critical error during deployment: com.sun.faces.config.ConfigurationException: The tag named remove from namespace http://java.sun.com/jsf/facelets has a null handler-class defined at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processHandlerClass(FaceletTaglibConfigProcessor.java:415) at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:371) at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:314) at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:263) at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:362) Truncated. see log file for complete stacktrace > <Jul 12, 2016 6:29:19 PM SGT> <Warning> <HTTP> <BEA-101162> <User defined listener com.sun.faces.config.ConfigureListener failed: java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: The tag named remove from namespace http://java.sun.com/jsf/facelets has a null handler-class defined. java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: The tag named remove from namespace http://java.sun.com/jsf/facelets has a null handler-class defined at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292) at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:582) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) Truncated. see log file for complete stacktrace Caused By: com.sun.faces.config.ConfigurationException: The tag named remove from namespace http://java.sun.com/jsf/facelets has a null handler-class defined at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processHandlerClass(FaceletTaglibConfigProcessor.java:415) at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:371) at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:314) at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:263) at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:362) Truncated. see log file for complete stacktrace I changed web.xml header to <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> **Please advice for fileupload in weblogic 12c using RichFaces**
<file-upload><richfaces><weblogic12c>
2016-07-13 00:31:34
LQ_EDIT
38,341,205
Can't initalize a vector with a variable int
I was under the impression that vector could be created using a variable integer. I got this impression from the second answer here: http://stackoverflow.com/questions/14459248/how-to-create-an-array-when-the-size-is-a-variable-not-a-constant However I still get the "constant int" error message for the code below: #include <vector> size_t ports_specified = std::count(Ports.begin(), Ports.end(), '+'); const int num_ports = static_cast<int>(ports_specified++); std::vector<string> port_info[num_ports]; Any ideas?
<c++><string><vector><integer><constants>
2016-07-13 01:22:43
LQ_EDIT
38,341,282
How to detect if App has gone in or out of App Standyby Mode ( Android M+)
<p>If the device is in DOZE IDLE or IDLE_MAINTENANCE mode, these events can be received if we register a broadcast receiver for "<strong>android.os.action.DEVICE_IDLE_MODE_CHANGED</strong>". But this receiver is not working when making App to go into <strong>App Standby</strong> using adb commands. Is is possible that we can programmatically check whether the app has gone in or exited from the App Standby mode for devices running on Marshmallow and above?</p> <p>adb commands used to make App go into App Standby</p> <pre><code>adb shell dumpsys battery unplug adb shell am set-inactive {Package name} true </code></pre> <p>and to exit</p> <pre><code>adb shell am set-inactive {Package name} false </code></pre>
<android><android-6.0-marshmallow><android-doze><android-doze-and-standby><android-appstandby>
2016-07-13 01:31:04
HQ
38,342,247
How to remove Chart Copyright?
<p>Look here : <a href="https://jsfiddle.net/oscar11/4qdan7k7/5/" rel="nofollow">https://jsfiddle.net/oscar11/4qdan7k7/5/</a></p> <p>How to remove the words <code>JS chart by amCharts</code>?</p>
<javascript><jquery><charts>
2016-07-13 03:34:19
LQ_CLOSE
38,342,525
I don't really understand. What does "nearest larger" means (Ruby)
: I am working on this question, but I still don't understand what exactly this question asks for? I don't know why expected output for ([2,3,4,8], 2) is equal to 3 Maybe 3 is the nearest number to 2?? or some other number in the array? I don't understand all the outputs below Please help me! Thank you so much This is the question and outputs below: # Write a function, `nearest_larger(arr, i)` which takes an array and an # index. The function should return another index, `j`: this should # satisfy: # # (a) `arr[i] < arr[j]`, AND # (b) there is no `j2` closer to `i` than `j` where `arr[i] < arr[j2]`. # # In case of ties (see example below), choose the earliest (left-most) # of the two indices. If no number in `arr` is larger than `arr[i]`, # return `nil`. # # Difficulty: 2/5 def nearest_larger(arr, idx) end puts("Tests for #nearest_larger") puts("===============================================") puts "nearest_larger([2,3,4,8], 2) == 3: " + (nearest_larger([2,3,4,8], 2) == 3).to_s puts "nearest_larger([2,8,4,3], 2) == 1: " + (nearest_larger([2,8,4,3], 2) == 1).to_s puts "nearest_larger([2,6,4,8], 2) == 1: " + (nearest_larger([2,6,4,8], 2) == 1).to_s puts "nearest_larger([2,6,4,6], 2) == 1: " + (nearest_larger([2,6,4,6], 2) == 1).to_s puts "nearest_larger([8,2,4,3], 2) == 0: " + (nearest_larger([8,2,4,3], 2) == 0).to_s puts "nearest_larger([2,4,3,8], 1) == 3: " + (nearest_larger([2,4,3,8], 1) == 3).to_s puts "nearest_larger([2, 6, 4, 8], 3) == nil: "+ (nearest_larger([2, 6, 4, 8], 3) == nil).to_s puts "nearest_larger([2, 6, 9, 4, 8], 3) == 2: "+ (nearest_larger([2, 6, 9, 4, 8], 3) == 2).to_s puts("===============================================")
<ruby>
2016-07-13 04:06:56
LQ_EDIT
38,342,747
How to search as a dictionary in C#
<p>I'm try to find the search term in my term collection.</p> <p>array of term collection :</p> <pre><code>[0] "windows" [1] "dual sim" [2] "32 gb" [3] "Intel i5" </code></pre> <p>Now I search bellow term</p> <pre><code>search term= "32 gb" return -&gt; 2 (position of array) search term ="android 32 gb" return -&gt; 2 (position of array) search term ="android mobile 32 gb" return -&gt; 2 (position of array) search term= "32 GB" return -&gt; 2 (position of array) search term= "32gb" return -&gt; not match search term= "dual sim 32" return -&gt; 1 (position of array) </code></pre> <p>So how can do like this in C# .net Can any search library or search dictionary provide this feature</p> <p>Please advise/suggestion for same </p> <p>Thanks! </p>
<c#><dictionary><levenshtein-distance><fuzzy-search>
2016-07-13 04:37:23
LQ_CLOSE
38,342,919
My pl sql code is not working:
This is my code: CREATE OR REPLACE PROCEDURE log(repname in varchar2) AS PACKAGE_NAME VARCHAR2,START_TIME DATE, END_TIME DATE,STATUS; BEGIN SELECT PACKAGE_NAME ,PRCS_START_TIME ,PRCS_END_TIME,STATUS FROM CONTCL_OWNER.PROCESSLOG WHERE PACKAGE_NAME LIKE REPNAME ORDER BY PRCS_START_TIME WHERE ROW_NUMBER <=7; END; its giving me these errors:
<oracle><plsql>
2016-07-13 04:55:22
LQ_EDIT
38,344,220
Job Scheduler not running on Android N
<p>Job Scheduler is working as expected on Android Marshmallow and Lollipop devices, but it is not running and Nexus 5x (Android N Preview). </p> <p>Code for scheduling the job</p> <pre><code> ComponentName componentName = new ComponentName(MainActivity.this, TestJobService.class.getName()); JobInfo.Builder builder; builder = new JobInfo.Builder(JOB_ID, componentName); builder.setPeriodic(5000); JobInfo jobInfo; jobScheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE); jobInfo = builder.build(); int jobId = jobScheduler.schedule(jobInfo); </code></pre> <p>Service is defined in manifest as:</p> <pre><code>&lt;service android:name=".TestJobService" android:permission="android.permission.BIND_JOB_SERVICE" /&gt; </code></pre> <p>Is any one having this issue on Android N (Preview)?</p>
<android><android-jobscheduler><android-7.0-nougat>
2016-07-13 06:35:06
HQ
38,344,643
C3JS - Cannot read property 'category10' of undefined
<p>I tried this c3.js code from jsfiddle (<a href="https://jsfiddle.net/varunoberoi/mcd6ucge">https://jsfiddle.net/varunoberoi/mcd6ucge</a>) but it doesn't seem to work in my localhost.</p> <p>I'm using uniserver as my server. I copy-paste everything but it's not working. </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;!-- CSS --&gt; &lt;link href="css/c3.css" rel="stylesheet" type="text/css" /&gt; &lt;!-- JAVASCRIPT --&gt; &lt;script src="js/d3.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/c3.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; window.onload=function(){ var chart = c3.generate({ data: { columns: [ ['data1', 300, 350, 300, 0, 0, 0], ['data2', 130, 100, 140, 200, 150, 50] ], types: { data1: 'area', data2: 'area-spline' } }, axis: { y: { padding: {bottom: 0}, min: 0 }, x: { padding: {left: 0}, min: 0, show: false } } }); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="chart"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>What I got when I check the Developer Tools' console is this:</p> <pre><code>c3.js:5783 Uncaught TypeError: Cannot read property 'category10' of undefined </code></pre> <p>I tried different versions of c3.js but nothing. It's weird because it's working in jsfiddle and not in my local.</p>
<javascript><d3.js><graph><charts><c3.js>
2016-07-13 06:58:37
HQ
38,345,372
Why is an emoji string length 2?
<p>I am trying to understand how emojis work and the other thing is how does any textarea in my browser handle a seemingly 2 chars represented as one?</p> <p>For example:</p> <pre><code>"👍".length // -&gt; 2 </code></pre> <p>More examples here: <a href="https://jsbin.com/zazexenigi/edit?js,console" rel="noreferrer">https://jsbin.com/zazexenigi/edit?js,console</a></p>
<javascript><utf-8><emoji>
2016-07-13 07:36:14
HQ
38,345,665
java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile
<p>Below is the error I am getting while migrating yo Java 8 with API Level 24 Looks like it's from lombok pre-processor. Any help appreciated Error:/MyApp.native.android/AndroidApp/src/main/java/com/cba/MyApp/android/view/fragment/ProfileDetails/tabs/Profile.java:21: The import lombok cannot be resolved</p> <pre><code>FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':AndroidApp:compileMyAppDebugJavaWithJack'. &gt; java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile * Try: Run with --info or --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':AndroidApp:compileMyAppDebugJavaWithJack'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.execution.taskgraph.ParallelTaskPlanExecutor.process(ParallelTaskPlanExecutor.java:47) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) Caused by: java.lang.RuntimeException: java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile at com.android.builder.tasks.Job.awaitRethrowExceptions(Job.java:79) at com.android.build.gradle.tasks.JackTask.compile(JackTask.java:133) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) ... 68 more Caused by: java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile at com.android.build.gradle.tasks.JackTask$1.run(JackTask.java:120) at com.android.builder.tasks.Job.runTask(Job.java:51) at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41) at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223) Caused by: com.android.jack.api.v01.CompilationException: Failed to compile at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:109) at com.android.builder.core.AndroidBuilder.convertByteCodeUsingJackApis(AndroidBuilder.java:1931) at com.android.build.gradle.tasks.JackTask.doMinification(JackTask.java:148) at com.android.build.gradle.tasks.JackTask.access$000(JackTask.java:73) at com.android.build.gradle.tasks.JackTask$1.run(JackTask.java:112) ... 3 more Caused by: com.android.jack.frontend.FrontendCompilationException: Failed to compile at com.android.jack.Jack.buildSession(Jack.java:978) at com.android.jack.Jack.run(Jack.java:496) at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:102) ... 7 more BUILD FAILED com.android.jack.api.v01.CompilationException: Failed to compile at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:109) at com.android.builder.core.AndroidBuilder.convertByteCodeUsingJackApis(AndroidBuilder.java:1931) at com.android.build.gradle.tasks.JackTask.doMinification(JackTask.java:148) at com.android.build.gradle.tasks.JackTask.access$000(JackTask.java:73) at com.android.build.gradle.tasks.JackTask$1.run(JackTask.java:112) at com.android.builder.tasks.Job.runTask(Job.java:51) at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41) at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223) at java.lang.Thread.run(Thread.java:745) Caused by: com.android.jack.frontend.FrontendCompilationException: Failed to compile at com.android.jack.Jack.buildSession(Jack.java:978) at com.android.jack.Jack.run(Jack.java:496) at com.android.jack.api.v01.impl.Api01ConfigImpl$Api01CompilationTaskImpl.run(Api01ConfigImpl.java:102) ... 8 more Warning: Exception while processing task java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile :AndroidApp:compileMyAppDebugJavaWithJack FAILED </code></pre>
<android><android-ndk><android-gradle-plugin><build.gradle><android-sdk-tools>
2016-07-13 07:51:50
HQ
38,345,894
R: source_gist not working
<p>I am trying to use <code>source_gist</code> from the <code>devtools</code> package but I am encountering an error:</p> <pre><code>&gt; library(devtools) &gt; source_gist("524eade46135f6348140") Error in r_files[[which]] : invalid subscript type 'closure' </code></pre> <p>Thanks for any advice.</p>
<r><devtools>
2016-07-13 08:03:23
HQ
38,345,937
Object.assign vs $.extend
<p>Given that I am using an immutable object, I want to <strong>clone</strong> or <strong>copy</strong> an object in order to make changes.</p> <p>Now I have always been using javascript's native <code>Object.assign</code> but stumbled upon the JQuery <code>$.extend</code>.</p> <p>I was wondering what is the better way to do this and what exactly the difference is between both? Looking at the documentation I cannot seem to really find a mentionable difference concerning why to choose either one.</p>
<javascript><jquery>
2016-07-13 08:05:40
HQ
38,346,062
Run triggered Azure WebJob from Code
<p>I created a console application upload as Azure trigger Webjob. It is working fine when I run it from Azure Portal. I want to run this from my C# code. I don't want to use Queue or service bus. I just want to trigger it when user perform a specific action in my web app. </p> <p>After searching I got a solution to trigger job from a scheduled <a href="http://blog.davidebbo.com/2015/05/scheduled-webjob.html" rel="noreferrer">http://blog.davidebbo.com/2015/05/scheduled-webjob.html</a></p> <p>Any idea how to run from code? </p>
<c#><azure><azure-webjobs>
2016-07-13 08:11:40
HQ
38,346,529
How can I change the default compiler of linux mint 18.0 from version 5.3.1 to a version below 4.0?
I need to compile a special program (i.e. configuring, making, and making install processes of nest) by an old version of g++ such as 3.3 or 3.4. however, I don't have such versions in my package manager. I downloaded g++-3.0-3.0.4-7_alpha-deb, but I don't know if it is the true version for linux, or how can I install it and set as the default compiler. I will appreciate if any one informs me of its possible dangers to my linux (as I read in Google). Quick reply is appreciated.
<linux><g++>
2016-07-13 08:34:44
LQ_EDIT
38,347,723
Android Emulator Seems to Record Audio at 96khz
<p>My app is recording audio from phone's microphones and does some real time processing on it. It's working fine on physical devices, but acts "funny" in emulator. It records something, but I'm not quite sure what it is it's recording. </p> <p><strong>It appears that on emulator the audio samples are being read at about double the rate as on actual devices.</strong> In the app I have a visual progress widget (a horizontally moving recording head), which moves about twice as fast in emulator. </p> <p>Here is the recording loop:</p> <pre><code>int FREQUENCY = 44100; int BLOCKSIZE = 110; int bufferSize = AudioRecord.getMinBufferSize(FREQUENCY, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT) * 10; AudioRecord audioRecord = new AudioRecord(MediaRecorder.AudioSource.CAMCORDER, FREQUENCY, AudioFormat.CHANNEL_IN_STEREO, AudioFormat.ENCODING_PCM_16BIT, bufferSize); short[] signal = new short[BLOCKSIZE * 2]; // Times two for stereo audioRecord.startRecording(); while (!isCancelled()) { int bufferReadResult = audioRecord.read(signal, 0, BLOCKSIZE * 2); if (bufferReadResult != BLOCKSIZE * 2) throw new RuntimeException("Recorded less than BLOCKSIZE x 2 samples:" + bufferReadResult); // process the `signal` array here } audioRecord.stop(); audioRecord.release(); </code></pre> <p>The audio source is set to "CAMCORDER" and it records in stereo. The idea is, if the phone has multiple microphones, the app will process data from both and use whichever has better SNR. But I have the same problems if recording mono from <code>AudioSource.MIC</code>. It reads audio data in a <code>while</code> loop, I am assuming that <code>audioRecord.read()</code> is a blocking call and will not let me read same data twice.</p> <p>The recorded data looks OK – the record buffer contains 16-bit PCM samples for two channels. The loop just seems to be running at twice the speed as on real devices. Which leads me to think that maybe the emulator is using a higher sampling rate than the specified 44100Hz. If I query the sample rate with <code>audioRecord.getSampleRate()</code> it returns the correct value. </p> <p>Also there are some interesting audio related messages in logcat while recording:</p> <pre><code>07-13 12:22:02.282 1187 1531 D AudioFlinger: mixer(0xf44c0000) throttle end: throttle time(154) (...) 07-13 12:22:02.373 1187 1817 E audio_hw_generic: Error opening input stream format 1, channel_mask 0010, sample_rate 16000 07-13 12:22:02.373 1187 3036 I AudioFlinger: AudioFlinger's thread 0xf3bc0000 ready to run 07-13 12:22:02.403 1187 3036 W AudioFlinger: RecordThread: buffer overflow (...) 07-13 12:22:24.792 1187 3036 W AudioFlinger: RecordThread: buffer overflow 07-13 12:22:30.677 1187 3036 W AudioFlinger: RecordThread: buffer overflow 07-13 12:22:37.722 1187 3036 W AudioFlinger: RecordThread: buffer overflow </code></pre> <p>I'm using up-to-date Android Studio and Android SDK, and I have tried emulator images running API levels 21-24. My dev environment is Ubuntu 16.04</p> <p>Has anybody experienced something similar? Am I doing something wrong in my recording loop? </p>
<android><android-emulator><audiorecord>
2016-07-13 09:28:55
HQ
38,347,734
Typescript 2.0 @types not automatically referenced
<p>using TS 2.0 Beta I can't get the new @types working. somewhere in my code:</p> <pre><code>import * as angular from 'angular'; </code></pre> <p>TS 2.0 @types:</p> <pre><code>npm install --save @types/angular tsc </code></pre> <p>the compiler doesn't find the d.ts files though: Error:(1, 26) TS2307: Cannot find module 'angular'.</p> <p>no issues with current (old) method of using the typings tool and global (before ambient) dependencies.</p> <p>I expected the d.ts lookup to work automatically with 2.0 as described here:</p> <p><a href="https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/">https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/</a></p> <p>perhaps I am missing something?</p>
<typescript>
2016-07-13 09:29:30
HQ
38,348,074
Group by columns and summarize a column into a list
<p>I have a dataframe like this: </p> <pre><code>sample_df&lt;-data.frame( client=c('John', 'John','Mary','Mary'), date=c('2016-07-13','2016-07-13','2016-07-13','2016-07-13'), cluster=c('A','B','A','A')) #sample data frame client date cluster 1 John 2016-07-13 A 2 John 2016-07-13 B 3 Mary 2016-07-13 A 4 Mary 2016-07-13 A </code></pre> <p>I would like to transform it into different format, which will be like:</p> <pre><code>#ideal data frame client date cluster 1 John 2016-07-13 c('A,'B') 2 Mary 2016-07-13 A </code></pre> <p>For the 'cluster' column, it will be a list if some client is belong to different cluster on the same date.</p> <p>I thought I can do it with dplyr package with commend as below</p> <pre><code>library(dplyr) ideal_df&lt;-sample %&gt;% group_by(client, date) %&gt;% summarize( #some anonymous function) </code></pre> <p>However, I don't know how to write the anonymous function in this situation. Is there a way to transform the data into the ideal format?</p>
<r><group-by><dplyr>
2016-07-13 09:44:15
HQ
38,348,222
Check if a date is greater than specified date vb.net
I want to check if a date is greater than a specified date using vb.net. The same thing i got working in the following : http://stackoverflow.com/questions/38344471/check-if-a-date-is-greater-than-specified-date/38344660?noredirect=1#comment64104240_38344660 but the above is using javascript. I did it using javascript as : var Jun16 = new Date('JUN-2016') var SelectedDate=new Date("<% =session("month")%>" + "-" + "<% =session("yrs")%>") if(SelectedDate.getTime() > Jun16.getTime()) { grossinc=parseInt("<% =rset1("othermontize_benefit") %>") + parseInt("<% =rset1("basic") %>") + parseInt("<% =rset1("house") %>") + parseInt("<% =rset1("utility") %>") } else { grossinc=parseInt("<% =rset1("gross") %>") + parseInt("<% =rset1("bonus") %>") + parseInt("<% =rset1("arrears") %>") + parseInt("<% =rset1("ot") %>") } How can I get the same in Vb script. Thanks.
<vbscript><asp-classic>
2016-07-13 09:51:36
LQ_EDIT
38,348,986
How to make print something in columns?
<p>I'm trying to make a yahtzee, and I have problem with my printing, I need to get what I'm supposed to print into nice looking columns: I want it to look something like this:</p> <pre><code>Name Joakim Anders Bonus 0 0 Ones 0 0 Twos 1 1 </code></pre> <p>Is there a way to make it look like this (with nice columns)? I found another thread about this but it was pretty old and I'm using python3 currently.</p>
<python>
2016-07-13 10:24:16
LQ_CLOSE
38,350,463
Showing json content in HTML
Hi I am new to javascript and i need to show this json into a div on a html page, i can't use jquery can anyone help please. var data = { "music": [ { "id": 1, "artist": "Oasis", "album": "Definitely Maybe", "year": "1997" }, ] }
<javascript><json>
2016-07-13 11:29:44
LQ_EDIT
38,350,805
Hello guys, i'm getting this error while submitting a simple form. i honestly don't know what is
Someone could point me where the error this. package mvc.controller; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import mvc.bean.PollBean; import mvc.dao.PollDAO; @WebServlet("/pollControll") public class PollController extends HttpServlet { private static final long serialVersionUID = 1L; private PollDAO pd; public PollController() { pd = new PollDAO(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getParameter("action"); if (action.equalsIgnoreCase("SelectALL")) { request.setAttribute("polls", pd.SelectAll()); } response.getWriter().append("Served at: ").append(request.getContextPath()); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getParameter("action"); if (action.equalsIgnoreCase(("insert"))) { PollDAO pp = new PollDAO(); PollBean p = new PollBean(); int note = Integer.parseInt(request.getParameter("note")); String email = request.getParameter("email"); p.setNote(note); p.setEmail(email); pp.insert(p); RequestDispatcher direct = request.getRequestDispatcher("/home.jsp"); direct.forward(request, response); } else if (action.equalsIgnoreCase("ResetALL")) { PollBean p = new PollBean(); pd.ResetALL(p); } else if (action.equalsIgnoreCase("Activated")) { PollBean p = new PollBean(); pd.Activated(p); RequestDispatcher direct = request.getRequestDispatcher("/PollAdmin.jsp"); direct.forward(request, response); } else if (action.equalsIgnoreCase("Deactivated")) { PollBean p = new PollBean(); pd.Deactivated(p); RequestDispatcher direct = request.getRequestDispatcher("/PollAdmin.jsp"); direct.forward(request, response); } doGet(request, response); } } Servlet.service() for servlet [mvc.controller.PollController] in context with path [/Enquete_eduCAPES] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: java.time.temporal.TemporalField at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1858) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701) at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:320) at org.postgresql.Driver.makeConnection(Driver.java:406) at org.postgresql.Driver.connect(Driver.java:274) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at mvc.util.ConexaoDAO.getConnection(ConexaoDAO.java:29) at mvc.dao.PollDAO.insert(PollDAO.java:40) at mvc.controller.PollController.doPost(PollController.java:60) at javax.servlet.http.HttpServlet.service(HttpServlet.java:650) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)
<java><servlets>
2016-07-13 11:44:00
LQ_EDIT
38,351,477
Can not run service on Windows - Visual Studio 2015
When I start "F5" in a project in Visual Studio 2015, the program show me the message: "Can not you start the service from the command line or in the debugger. The windows service must be installed 's First (using installutil.exe ) and then started with ServerExplorer , the administrative tool for Windows Services or the NET START command" How can I resolve these?
<c#><service>
2016-07-13 12:15:31
LQ_EDIT
38,351,906
How to extract .tar.gz file
I want to extract an archive named kdiff3.tar.gz. Using tar -xzvf filename.tar.gz doesn't extract the file. it is gives this error: gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error exit delayed from previous errors file kdiff3.tar.gz gives this message: kdiff3.tar.gz: HTML document, ASCII text It would be great, if someone could help.
<linux><ubuntu-15.10>
2016-07-13 12:35:11
LQ_EDIT
38,352,148
Get Image from the Gallery and Show in ImageView
<p>I need to get an image from the gallery on a button click and show it into the imageview.</p> <p>I am doing it in the following way:</p> <pre><code> btn_image_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getImageFromAlbum(); } }); </code></pre> <p>The method Definition is as:</p> <pre><code> private void getImageFromAlbum(){ try{ Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); }catch(Exception exp){ Log.i("Error",exp.toString()); } } </code></pre> <p>The activity result method is</p> <pre><code> @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); try { bmp = getBitmapFromUri(selectedImage); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } image_view.setImageBitmap(bmp); //to know about the selected image width and height Toast.makeText(MainActivity.this, image_view.getDrawable().getIntrinsicWidth()+" &amp; "+image_view.getDrawable().getIntrinsicHeight(), Toast.LENGTH_SHORT).show(); } } </code></pre> <hr> <h2>The Problem</h2> <p>The problem I am facing is when the image resolution is high suppose that if the image size is of 5mp to 13mp. It won't loads up and show up into the image view.</p> <p>But the images with the low width and height are successfully loading into the image view!</p> <p>Can somebody tell me any issues with the code and what I am doing wrong? I just want to import the camera images from the gallery and show them in the image view!</p>
<android><android-intent><imageview><android-gallery>
2016-07-13 12:45:19
HQ
38,352,378
java.util.ConcurrentModificationException in Android
<p>I am writing a piece of code which displays in an expandable list using information from an AsyncTask and a pre defined HashMap. But it is throwing <strong>java.util.ConcurrentModificationException</strong>. My code is as follows:</p> <p>AsnycTask</p> <pre><code>private class BackTask extends AsyncTask&lt;Void, Void, Void&gt; { ProgressDialog pd; ArrayList&lt;String&gt; name; ArrayList&lt;Integer&gt; quantity; Map&lt;String, Map&lt;String, Integer&gt;&gt; cart_names1 = new HashMap&lt;String, Map&lt;String, Integer&gt;&gt;(); public BackTask(ArrayList&lt;String&gt; name, ArrayList&lt;Integer&gt; quantity) { this.name = name; this.quantity = quantity; } protected void onPreExecute() { super.onPreExecute(); pd = new ProgressDialog(ha); pd.setTitle("Retrieving data"); pd.setMessage("Please wait."); pd.setCancelable(true); pd.setIndeterminate(true); pd.show(); } protected Void doInBackground(Void... arg0) { InputStream is = null; String result = ""; try { String link = "http://chutte.co.nf/get_item_prices.php?"; for (int b = 0; b &lt; name.size(); b++) { link += "names[]" + "=" + name.get(b) + "&amp;"; } for (int a = 0; a &lt; quantity.size(); a++) { link += "quantities[]" + "=" + quantity.get(a); if (a != quantity.size() - 1) { link += "&amp;"; } } Log.e("ERROR", link); URL url = new URL(link); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); is = urlConnection.getInputStream(); } catch (Exception e) { if (pd != null) pd.dismiss(); Log.e("ERROR", e.getMessage()); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder builder = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { builder.append(line + "\n"); } is.close(); result = builder.toString(); } catch (Exception e) { Log.e("ERROR", "Error converting result " + e.toString()); } try { result = result.substring(result.indexOf("[")); JSONArray jsonArray = new JSONArray(result); for (int i = 0; i &lt; jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); Map&lt;String, Integer&gt; temmap = new HashMap&lt;&gt;(); String temname = jsonObject.getString("Name"); temmap.put("First", jsonObject.getInt("First")); temmap.put("Second", jsonObject.getInt("Second")); temmap.put("Third", jsonObject.getInt("Third")); Log.e("ERROR", temmap.get("First").toString()); cart_names1.put(temname, temmap); } strhold2.clear(); strhold2.add("First"); strhold2.add("Second"); strhold2.add("Third"); String[] strhold1 = new String[strhold2.size()]; for (int i56 = 0; i56 &lt; strhold2.size(); i56++) { strhold1[i56] = strhold2.get(i56); } System.out.println(cart_names1); Log.e("ERROR", Integer.toString(cart_names1.size()) + "IN LATEST"); if (cart_names1.size() &gt; 1) { System.out.println(cart_names1.size()); System.out.println(strhold2.size()); Combination.printCombination(cart_names1, strhold1, strhold2.size(), cart_names1.size(), 2); ArrayList&lt;String&gt; wrong = Permutation.getlist(); System.out.println(wrong + "this is final"); setalldata(wrong); System.out.println(wrong); couldthis.clear(); couldthis.addAll(wrong); } else { Single_Permutation.getpermute(cart_names1); System.out.println(Single_Permutation.singlelist); couldthis.clear(); couldthis.addAll(Single_Permutation.singlelist); setalldata(Single_Permutation.singlelist); Log.e("ERROR", "thisis the list 1" + getdataformap()); } } catch (Exception e) { Log.e("ERROR", "Error pasting data " + e.toString()); } return null; } @Override protected void onPostExecute(Void result) { /*SetMap setMap = new SetMap(getdataformap()); setMap.execute();*/ if (pd != null){ pd.dismiss();} ListFragment.addtolist(getdataformap()); Log.e("ERROR", "This is putmap i" + getdataformap()); SetMap setMap =new SetMap(getdataformap()); setMap.execute(); } } } </code></pre> <p>Fragment(with expandable list)</p> <pre><code>public static class ListFragment extends Fragment { /** * The fragment argument representing the section number for this * fragment. */ public static ExpandableListView expandablelistview; public static CustomExpandableListAdapter expandableadapter; public static HashMap&lt;Fitems, List&lt;Fnitems&gt;&gt; datapforput = new HashMap&lt;&gt;(); public static List&lt;Fitems&gt; mainforput = new ArrayList&lt;&gt;(); public static View view; public static Context getha; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); view = inflater.inflate(R.layout.activity_listfragment, container, false); //doddata(); expandablelistview = (ExpandableListView) view.findViewById(R.id.expandableListView); expandableadapter = new CustomExpandableListAdapter(((Result) getActivity()).getha(), mainforput, datapforput); expandablelistview.setAdapter(expandableadapter); getha = ((Result) getActivity()).getha(); return view; } @Override public void onStart() { super.onStart(); Permutation.finallist = new ArrayList&lt;&gt;(); Single_Permutation.singlelist = new ArrayList&lt;&gt;(); /* doddata(); expandablelistview = (ExpandableListView) view.findViewById(R.id.expandableListView); expandableadapter = new CustomExpandableListAdapter(((Result)getActivity()).getha(),mainforput,datapforput); expandablelistview.setAdapter(expandableadapter);*/ } /** * Returns a new instance of this fragment for the given section * number. */ public static void doddata() { Fitems fitems1 = new Fitems(); Fitems fitems2 = new Fitems(); Fnitems fnitems1 = new Fnitems(); Fnitems fnitems2 = new Fnitems(); Fnitems fnitems3 = new Fnitems(); Fnitems fnitems4 = new Fnitems(); fitems1.setName("AAA"); fitems2.setName("BBB"); fnitems1.setName("AAAa"); fnitems2.setName("AAAb"); fnitems3.setName("BBBa"); fnitems4.setName("BBBb"); List&lt;Fnitems&gt; listfnitem1 = new ArrayList&lt;&gt;(); List&lt;Fnitems&gt; listfnitem2 = new ArrayList&lt;&gt;(); listfnitem1.add(fnitems1); listfnitem1.add(fnitems2); listfnitem2.add(fnitems3); listfnitem2.add(fnitems4); datapforput.put(fitems1, listfnitem1); datapforput.put(fitems2, listfnitem2); mainforput.add(fitems1); mainforput.add(fitems2); //Log.e("ERROR", "thisis the list for god's sake " + Result.couldthis+datapforput.toString()); if (Result.couldthis.size() &gt; 0) { for (int i = 0; i &lt; (Result.couldthis).size(); i++) { for (Map.Entry&lt;Fitems, List&lt;Fnitems&gt;&gt; entry : datapforput.entrySet()) { if (Result.couldthis.get(i).equals(entry.getKey().getName())){ Fnitems fnitems5 = new Fnitems(); fnitems5.setName(Search_multiple.cart_records.get(i).getName()); entry.getValue().add(fnitems5); }else { Fitems fitems3 = new Fitems(); fitems3.setName(Result.couldthis.get(i)); Fnitems fnitems5 = new Fnitems(); fnitems5.setName(Search_multiple.cart_records.get(i).getName()); List&lt;Fnitems&gt; listfnitem3 = new ArrayList&lt;&gt;(); listfnitem3.add(fnitems5); datapforput.put(fitems3, listfnitem3); mainforput.add(fitems3); } } } } } public static ListFragment newInstance() { ListFragment fragment = new ListFragment(); Log.e("ERROR", "man .... " + fragment.getTag()); return fragment; } public static void addtolist(ArrayList&lt;String&gt; dataforputting) { // Log.e("ERROR", "thisis the list 3" + (dataforputting)); //if (expandableadapter != null){ expandableadapter.clear();//} //Log.e("INFO", "This is mainforput" + mainforput + "This is dataforput" + datapforput); doddata(); //Log.e("INFO", "This is mainforput" + mainforput + "This is dataforput" + datapforput); expandableadapter = new CustomExpandableListAdapter(getha, mainforput, datapforput); expandablelistview.setAdapter(expandableadapter); } } </code></pre> <p>Stack</p> <pre><code>07-13 18:16:11.955 17339-17339/nf.co.riaah.chutte E/ERROR: Inside populate Second 07-13 18:16:11.986 17339-17339/nf.co.riaah.chutte E/AndroidRuntime: FATAL EXCEPTION: main Process: nf.co.riaah.chutte, PID: 17339 java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:787) at java.util.HashMap$EntryIterator.next(HashMap.java:824) at java.util.HashMap$EntryIterator.next(HashMap.java:822) at nf.co.riaah.chutte.Result$ListFragment.doddata(Result.java:199) at nf.co.riaah.chutte.Result$ListFragment.addtolist(Result.java:230) at nf.co.riaah.chutte.Result$SetMap.onPostExecute(Result.java:1049) at nf.co.riaah.chutte.Result$SetMap.onPostExecute(Result.java:967) at android.os.AsyncTask.finish(AsyncTask.java:636) at android.os.AsyncTask.access$500(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:653) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:139) at android.app.ActivityThread.main(ActivityThread.java:5298) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745) </code></pre>
<java><android>
2016-07-13 12:54:36
LQ_CLOSE
38,352,779
Java '+' operator between Arithmetic Add & String concatenation?
<p>As we know<br> Java '+' operator is used for both </p> <ul> <li>Arithmetic Add</li> <li>String concatenation</li> </ul> <p>Need to know exactly expected behavior and applied rule when i used both together<br> When i try following java code </p> <pre><code>System.out.println("3" + 3 + 3); // print 333 String concatenation ONLY System.out.println(3 + "3" + 3); // print 333 String concatenation OLNY System.out.println(3 + 3 + "3"); // print 63 Arithmetic Add &amp; String concatenation </code></pre>
<java><string><concatenation><add>
2016-07-13 13:13:06
HQ
38,354,056
Python Error str' object is not callable
My code is: I don't understand how I am getting this error please can someone help import time import os import xlwt from datetime import datetime num = 0 def default(): global num global model global partnum global serialnum global countryorigin time.sleep(1) print ("Model: ") model = input() print () print ("Part number: ") partnum = input() print() print ("Serial Number: ") serialnum = input() print () print ("Country of origin: ") countryorigin = input() print ("Thanks") num = num+1 xlwt() def xlwt(): print ("Do you want to write to excel?") excel = input() if excel == "y" or "yes": excel() else: print ("Bye") sys.exit() def excel(): print ("Enter a spreadsheet name") name = input() wb = xlwt.Workbook() ws = wb.add_sheet(name) ws.write(0,0,"Model") ws.write(0,1,"Part Number") ws.write(0,2,"Serial Number") ws.write(0,3,"Country Of Origin") ws.write(num,0,model) ws.write(num,1,partnum) ws.write(num,2,serialnum) ws.write(num,3,countryorigin) ws.save(name) def custom(): print() def main(): print ("Welcome") print () print ("The deafult catagories are: Model, Part Number, Serial Number," "country of origin") time.sleep(1) print() dorc() def dorc(): print ("Would you like to use the default or custom?") dorc = input () if dorc == "default": default() elif dorc == "custom": custom() else: print ("Invalid input") dorc() main()
<python><python-3.x>
2016-07-13 14:09:22
LQ_EDIT
38,354,923
When is 'this' captured in a lambda?
<p>I have a function in a class that defines a lambda and stores it in a local static variable:</p> <pre><code>class A { public: void call_print() { static auto const print_func = [this] { print(); }; print_func(); }; virtual void print() { std::cout &lt;&lt; "A::print()\n"; } }; class B : public A { public: virtual void print() override { std::cout &lt;&lt; "B::print()\n"; } }; </code></pre> <p>I also execute the following test:</p> <pre><code>int main() { A a; B b; a.call_print(); b.call_print(); } </code></pre> <p>(<a href="http://coliru.stacked-crooked.com/a/2fe9b4702bb01d02">Live Sample</a>)</p> <p>What I expect to be printed is:</p> <pre><code>A::print() B::print() </code></pre> <p>But what I really get is:</p> <pre><code>A::print() A::print() </code></pre> <p>(Same object address is also printed with each)</p> <p>I suspect this is due to the <code>this</code> capture. I assumed that it would capture the value of <code>this</code> when it is called, however it seems to be captured the moment the lambda is defined.</p> <p>Could someone explain the semantics of lambda captures? When do they actually get provided to the function? Is it the same for all capture types, or is <code>this</code> a special case? Removing <code>static</code> fixes the problem, however in my production code I'm actually storing the lambda in a slightly-heavier object which represents a slot to which I insert into a signal later.</p>
<c++><c++11><lambda>
2016-07-13 14:45:22
HQ
38,355,151
How to send an SMS with custom sender ID with Amazon SNS and Python and boto3
<p>The <a href="http://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html#sms_publish_sdk">documentation</a> suggests to use message attributes for that but I can't seem to figure out what attribute name to use.</p> <p>This works so far:</p> <pre><code>sns = boto3.client('sns', region_name='eu-west-1') sns.publish( PhoneNumber='+491701234567', Message='hi there', MessageAttributes={ 'AWS.SNS.SMS.SenderID': { 'DataType': 'String', 'StringValue': 'MySenderID' } } ) </code></pre> <p>The SMS is delivered but with some (random?) value in the sender id field. So it seems my setting of message attributes is silently ignored. What is the correct way to set a custom sender id?</p>
<python><amazon-web-services><sms><amazon-sns><boto3>
2016-07-13 14:54:27
HQ
38,355,418
Where is the default output folder for dotnet restore?
<p>I tried to create a simple .net core using commandline </p> <pre><code>dotnew new </code></pre> <p>in a certain folder called netcoreExample and I could see that there are two files created which are program.cs and project.json. Then I add Microsoft.EntityFrameworkCore to dependencies entry in project.json</p> <p>When I try to run the command</p> <pre><code>dotnet restore </code></pre> <p>it shows the package is restores successfully. However, when I inspect the folder where I run dotnet restore from, I didn't see the "packages" folder which is usually created when with the old C# projects running Nuget restore.</p> <p>I wonder where the dotnet restore output all of the dependencies to.</p>
<.net-core>
2016-07-13 15:05:37
HQ
38,355,444
Create Image Dynamically / CSS to Canvas?
<p>I would like to create an image dynamically in Javascript that needs to fit two requirements.</p> <ol> <li>It needs a colored background (say #fff) and be of a specific size (say 800x300)</li> <li>I need to be able to then place another image on it and position it (hopefully with CSS-esque type rules like width:150px; height:80px; left: 30px; top:30px; transform: rotate(7deg);" etc etc.</li> </ol> <p>Is there a library you're aware of that does that sort of function?</p>
<javascript><jquery>
2016-07-13 15:06:48
LQ_CLOSE
38,356,014
XCode, Swift, Adapt to all devices
I am a newbie in Swift world. I am trying to design a screen like below. I can do this design for several devices for example IPhone 5 and 5S. This means that my application runs properly on IPhone 5 and 5S. But when I try to run it on IPhone 6 or 6S, my design is broken and disrupted. How can I do a common design for all devices. I am sorry for this question but I need this. Thanks for help. [![enter image description here][1]][1] [1]: http://i.stack.imgur.com/1Wp5Q.jpg
<ios><iphone><user-interface><autolayout>
2016-07-13 15:33:10
LQ_EDIT
38,356,100
How to identify groups of three identical numbers in a list
<p>I have a simple list where: </p> <pre><code>a = [1,1,1,0,0,1,0,1,1,0,1,1,1] </code></pre> <p>I am trying to find a way to determine when three ones appear adjacent to each other. So the output would say that there are two instances of this, based on the list above. The other posts I've read seem to use itertools.groupby(), but I'm not familiar with it so I was wondering if there is another way? </p>
<python><list>
2016-07-13 15:37:26
LQ_CLOSE
38,356,283
Instagram. Given a User_id, how do i find the username?
<p>I have a list of thousands of instagram user-ids. How do i get their Instagram usernames/handles? </p> <p>Thanks</p>
<instagram><instagram-api>
2016-07-13 15:45:42
HQ
38,357,018
How to decode Base64 URL safe?
<p>I need to decode a value from Base64 URL safe, what is best approach to do that? </p> <p>I didn't find any good solution over the web, and I also have no code which I built myself. </p>
<java><url><encoding><base64>
2016-07-13 16:23:01
LQ_CLOSE
38,357,137
Bootstrap col-md-offset-* not working
<p>I'm trying to add Bootstrap offset class in my code to achieve diagonal alignment like this:</p> <p><a href="https://i.stack.imgur.com/FHTgp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FHTgp.png" alt="Image "></a></p> <p>But I don't know what offset should I use. I've tried couple of offsets to achieve this but no use.Text is covering whole jumbotron.Here is my code</p> <p>Html:</p> <pre><code>&lt;div class="jumbotron"&gt; &lt;div class="container"&gt; &lt;div class="row"&gt; &lt;div&gt; &lt;h2 class="col-md-4 col-md-offset-4"&gt;Browse.&lt;/h2&gt; &lt;h2 class="col-md-4 col-md-offset-4"&gt;create.&lt;/h2&gt; &lt;h2 class="col-md-4 col-md-offset-4"&gt;share.&lt;/h2&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>.jumbotron { height: 500px; width: 100%; background-image: url(img/bg.jpg); background-size: cover; background-position: center; } .jumbotron h2 { color: white; font-size: 60px; } .jumbotron h2:first-child { margin: 120px 0 0; } </code></pre> <p>Please guide me.Thank you in advance.</p>
<html><css><twitter-bootstrap>
2016-07-13 16:30:34
HQ
38,357,368
Is React Native's LayoutAnimation supported on Android?
<p>I do not see <a href="https://facebook.github.io/react-native/docs/layoutanimation.html" rel="noreferrer">anything in the documentation</a> referring to lack of support for Android. I'm using a simple preset animation:</p> <p><code>LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);</code></p> <p>It works in iOS, but in Android it makes the transition without any spring animation.</p>
<react-native><react-native-android>
2016-07-13 16:42:33
HQ
38,357,811
numpy difference between flat and ravel()
<p>What is the difference between the following?</p> <pre><code>&gt;&gt;&gt; import numpy as np &gt;&gt;&gt; arr = np.array([[[ 0, 1, 2], ... [ 10, 12, 13]], ... [[100, 101, 102], ... [110, 112, 113]]]) &gt;&gt;&gt; arr array([[[ 0, 1, 2], [ 10, 12, 13]], [[100, 101, 102], [110, 112, 113]]]) &gt;&gt;&gt; arr.ravel() array([ 0, 1, 2, 10, 12, 13, 100, 101, 102, 110, 112, 113]) &gt;&gt;&gt; arr.ravel()[0] = -1 &gt;&gt;&gt; arr array([[[ -1, 1, 2], [ 10, 12, 13]], [[100, 101, 102], [110, 112, 113]]]) &gt;&gt;&gt; list(arr.flat) [-1, 1, 2, 10, 12, 13, 100, 101, 102, 110, 112, 113] &gt;&gt;&gt; arr.flat[0] = 99 &gt;&gt;&gt; arr array([[[ 99, 1, 2], [ 10, 12, 13]], [[100, 101, 102], [110, 112, 113]]]) </code></pre> <p>Other than the fact that <code>flat</code> returns an iterator instead of a list, they appear to be the same, since they both alter the original array in place (this is in contrast to <code>flatten()</code>, which returns a copy of the array). So, is there any other significant difference between <code>flat</code> and <code>ravel()</code>? If not, when would it be useful to use one instead of the other?</p>
<python><numpy>
2016-07-13 17:07:26
HQ
38,358,789
How to center nav using CSS/HTML?
<p>I am looking for help to center my navigation bar on my website <a href="http://www.meridianridgect.com/" rel="nofollow">Meridian Ridge</a> <br><br> I've looked at quite a few of these questions that asked this already and tried what they were saying such as using display:inline &amp; margin: 0 auto but nothing I do seems to work</p>
<html><css><nav>
2016-07-13 18:02:40
LQ_CLOSE
38,358,815
TypeError: search.valueChanges.debounceTime is not a function
<p>I am just learning angular2. At the time of applying something at input changes, I am getting the error.</p> <p>app.ts:</p> <pre><code>export class AppComponent { form: ControlGroup; constructor(fb: FormBuilder) { this.form = fb.group({ search: [] }); var search = this.form.find('search'); search.valueChanges .debounceTime(400) .map(str =&gt; (&lt;string&gt;str).replace(' ','‐')) .subscribe(x =&gt; console.log(x)); }; } </code></pre> <p>Error:</p> <p><a href="https://i.stack.imgur.com/N5Enw.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/N5Enw.jpg" alt="enter image description here"></a></p> <p>How to solve this? Am I missing something?</p> <p><a href="http://plnkr.co/edit/MQIQvFYAvsPv9Pu8xZap?p=preview" rel="noreferrer">Plunker Demo</a></p> <p><strong>N.B.</strong> I cannot produce anything at plunker as I am writing angular2 first time at plunker now. I have written only my app.ts code at plunker. I have showed the screenshot of error from my local pc. I will be grateful too if you tell me the way of running angular2 project at plunker.</p>
<typescript><angular><rxjs><angular2-forms>
2016-07-13 18:03:51
HQ
38,360,146
Accessing a PHP Website Source Code
<p>I'm a PHP beginner. I usually use ASP.NET C# using Visual Studio just developing my own practice unpublished websites.</p> <p>I have recently be asked to assist with a website using PHP and MySQL. I have been given the following details to access the code:</p> <p>host: www.hostname.xx username: xxxx password: xxxx</p> <p>I visited the host site, there is no Log In feature. I downloaded a Platform called WampDeveloper to check if there is a feature to allow you to log in to a server host, but was unsuccessful. It seems to just allow me to create a new website (this may not be the case).</p> <p>I'm embarrassed to ask, but can anyone offer any suggestions as to how I can use these log in details to view the site source code. Also, if there is a better Platform for PHP can you let me know, I've downloaded WordPress too.</p>
<php><mysql><host>
2016-07-13 19:27:06
LQ_CLOSE
38,360,478
In MVP is onClick responsibility of View or Presenter?
<p>In the MVP pattern who is responsible to handle clicks on the UI?<br> E.g. the non-MVP approach would be something like: </p> <pre><code>counterButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { totalClicks++; counterTextView.setText("Total clicks so far: "+totalClicks); } }); </code></pre> <p>Using MVP is the <code>onClick</code> the responsibility of the <code>Presenter</code>? Or the <code>View</code> can handle that?<br> Can someone please clarify this?</p>
<java><android><mvp>
2016-07-13 19:48:43
HQ
38,360,689
Javascript Substring missing characters?
I am trying to use substring to differentiate between data in java script. The raw data I am pulling is: 0.! 3.0011632! 0.01! 2.9417362! The code I am using is var lastPosition = 0; var count = 0; //This code will continue looking for ! until it reaches three occurances while (count <3) { console.log(lastPosition); console.log(contents.indexOf("!",lastPosition+1)); console.log(contents.substr(lastPosition+1, contents.indexOf("!",lastPosition+1))); lastPosition = contents.indexOf("!",lastPosition+1); count++; } The problem is the output I am getting is: 0 //start 3 //end 0.! //# 3 //start 14 //end 3.0011632! //# 14 //start 23 //end 0.01! 2.9417362! //# As you can see its not properly locating the ! at the third cycle. This continues with more data and it eventually starts missing more and more !'s. Can anyone tell me what I'm doing wrong here?
<javascript><string><substring>
2016-07-13 20:00:42
LQ_EDIT
38,360,946
React Intl FormattedNumber with the currency symbol before, not after
<p>I am using FormattedNumber from React Intl in a big React project that has the capability for many different languages.</p> <p>Here is a Currency component I made so that I can easily insert a formatted currency into my views:</p> <pre><code>import {FormattedNumber} from 'react-intl'; const Currency = (props) =&gt; { const currency = props.currency; const minimum = props.minimumFractionDigits || 2; const maximum = props.maximumFractionDigits || 2; return &lt;FormattedNumber value={props.amount} style="currency" currency={currency} minimumFractionDigits={minimum} maximumFractionDigits={maximum} /&gt;; }; export default Currency; </code></pre> <p>The component works great. And, it works as expected. In English - when <code>currency</code> is <code>GBP</code> - an amount is formatted as such:</p> <pre><code>£4.00 </code></pre> <p>In German - when <code>currency</code> is <code>EUR</code> - it's formatted as such:</p> <pre><code>4,00€ </code></pre> <p>However, I need to format the amount differently in a particular case. So, what I'm looking for is the Euro coming before the amount, like so:</p> <pre><code>€4,00 </code></pre> <p>Is this possible with FormattedNumber? I don't want to have to manually reformat the formatted number if I can avoid it.</p>
<reactjs><internationalization>
2016-07-13 20:15:16
HQ
38,362,217
How to run TensorFlow on an AWS cluster?
<p>I'm trying to run distributed tensorflow on an EMR/EC2 cluster but I don't know how to specify different instances in the cluster to run parts of the code. </p> <p>In the documentation, they've used <code>tf.device("/gpu:0")</code> to specify a gpu. But what if I have a master CPU and 5 different slave GPU instances running in an EMR cluster and I want to specify those GPUs to run some code? I can't input <code>tf.device()</code> with the public DNS names of the instances because it throws an error saying the name cannot be resolved.</p>
<python><amazon-web-services><amazon-ec2><tensorflow>
2016-07-13 21:44:22
HQ
38,362,354
Looking for example code of a JavaFx TableView with only one Button inside a column?
<p>What I am trying to create is a scrollable all button GUI layout. I was able to achieve this with 4 different ListViews but I didn't like the four scroll bars attached to the list views. The number of buttons will be figured out at run-time because it will depend on the number of entries in a database. I Think a TableView will be better for my situation.</p> <p><a href="https://i.stack.imgur.com/Neo1J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Neo1J.png" alt="enter image description here"></a></p>
<java><button><javafx><tableview>
2016-07-13 21:54:49
LQ_CLOSE
38,363,054
how to make spectrum color button/ color picker button
<p>I need to build a button that will display color spectrum onclick, and by clicking on a spot inside the color spectum, the spot color will be picked and the text color will change according to the picked color.</p> <p>This is kind of what I need</p> <p><a href="https://i.stack.imgur.com/HdPGj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HdPGj.jpg" alt="enter image description here"></a></p> <p>Thanks in advance</p> <p>p.s Spectrum color area need to accessible with keyboard as well.</p>
<javascript><jquery><html>
2016-07-13 22:58:12
LQ_CLOSE
38,363,086
What is the difference between createMock and getMockBuilder in phpUnit?
<p>For the love of my life I can't figure out the difference between <code>createMock($type)</code> and <code>getMockBuilder($type)</code></p> <p>I am going through the original documentation and there is just a one liner which I didn't understand.</p> <blockquote> <p>... you can use the getMockBuilder($type) method to customize the test double generation using a fluent interface.</p> </blockquote> <p>If you can provide me an example, I would be grateful. Thanks. </p>
<php><phpunit>
2016-07-13 23:01:26
HQ
38,364,360
C# DateTime TryParse dont check correct if string is time format
Im using datetime.tryparse(value, out datetime) to check a string have date. But i have a problem. If value is time format (ex: 14:25:26) then datetime.tryparse is true. Not good Please help me check string to date?
<c#><asp.net><datetime><tryparse>
2016-07-14 02:01:51
LQ_EDIT
38,365,444
new to android studio...advice to become developer in shorter way
<h1>Development for android</h1> <p>i'm new to android development,any one help me the best way to become developer in shorter way specially i'm web for more than 9 years. what is the best reference?courses and so on</p>
<android>
2016-07-14 04:22:42
LQ_CLOSE
38,366,579
give id in decimal sql
I have a table name content_details and want to print id in decimal like this: <pre>id contents 1.1 vegetarian 1.2 non-vegetarian</pre> I have used this query to <pre> `ALTER TABLE content_details ADD COLUMN id decimal(4,2)` then used this to save data in column <br> `ALTER TABLE content_details ADD id_sub = 1.1000 WHERE contents_details= 'vegetarian'` But getting error
<mysql><sql>
2016-07-14 06:03:40
LQ_EDIT
38,367,505
Parse error: syntax error, unexpected '[' google-api-php-client-2.0.1-PHP5_4/vendor/react/promise/src/functions.php on line 15
<p>I am trying to add data on google calendar by PHP. Parse error: syntax error, unexpected '[' google-api-php-client-2.0.1-PHP5_4/vendor/react/promise/src/functions.php on line 15</p>
<php>
2016-07-14 07:00:17
LQ_CLOSE
38,368,184
Mysql selected set to multiple array
<pre><code>$info = array ( while($row = mysqli_fetch_array($retval, MYSQL_ASSOC)) { array($row["id"],$row["name"],$row["mname"],$row["sdate"],$row["fdate"],$row["bphoto"],$row["sphoto"], $row["text"],$row["one"],$row["two"],$row["three"],$row["four"],$row["five"],$row["six"],$row["seven"], $row["eight"],$row["nine"],$row["imdb"],$row["sztrailer"],$row["etrailer"]), } ); </code></pre> <p>Its Didn't worked. Please help me guys no i have more idea. (Sorry i have very bad english skill)</p> <pre><code>Parse error: syntax error, unexpected 'while' (T_WHILE), expecting ')' in .../Themes/default/sorozat.template.php on line 21 </code></pre> <p>Thanks.</p>
<php><mysql><arrays><variables>
2016-07-14 07:34:48
LQ_CLOSE
38,368,382
Implement a function using sizeof
<p>I am new in C programming and using a specific library. I need to use this function:</p> <pre><code>le_result_t le_ecall_ExportMsd ( le_ecall_CallRef_t ecallRef, uint8_t * msdPtr, size_t * msdNumElementsPtr ) </code></pre> <p>Where the parameters:</p> <pre><code>[in] ecallRef eCall reference [out] msdPtr the encoded MSD [in,out] msdNumElementsPtr </code></pre> <p>In order to get que encoded MSD I developed this code (a little bit simplified):</p> <pre><code>static le_ecall_CallRef_t LastTestECallRef = NULL; uint8_t msd[] = NULL; void StarteCall (void) { le_ecall_ExportMsd(LastTestECallRef, msd, sizeof(msd)); } </code></pre> <p>Sizeof is returning size_t and I need size_t * so I am getting the following error:</p> <pre><code>expected 'size_t *' but argument is of type 'unsigned int' </code></pre> <p>I would be gratefull if somebody could help me. </p>
<c>
2016-07-14 07:46:05
LQ_CLOSE
38,368,696
how does AngularJS display image?
n I'm using Http-server and AnglarJS. below is the folder structure. [![enter image description here][1]][1] [1]: http://i.stack.imgur.com/QtF4H.png in <code>search.html</code> i want to display <code>abc.png</code> I declared img tag and did what i usually do with HTML. `<img src="../img/abc.png" >` And I received an error <code>GET http://localhost:8000/img/abc.png 404 (Not Found) </code> Then i declared img tag like this `<img src="/website/img/abc.png" />` And it work well. It surprised me. So how does AngularJS display image?
<html><css><angularjs>
2016-07-14 08:03:53
LQ_EDIT
38,368,929
I got a PHP syntax error and I don't know what I did wrong?
<p>I was trying to make a page so I put a post on a specific page on Wordpress and I ended up getting a syntax error. Below is the code I used.</p> <pre><code> &lt;?php /* Template Name: blog */ global $more; $more = 0; query_posts('cat=29'); if(have_posts()) : while(have_posts()) : the_post(); ?&gt; &lt;/p&gt; &lt;p&gt; &lt;a href=&amp;amp;quot;&lt;?php the_permalink(); ?&gt;&amp;amp;quot;&gt;&lt;?php the_title( '&lt;/p&gt; &lt;h3&gt;', &lt;/h3&gt; &lt;p&gt;' ); ?&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt; &lt;?php endwhile; &lt;endif; wp_reset_query(); ?&gt; </code></pre>
<php><wordpress>
2016-07-14 08:16:21
LQ_CLOSE
38,369,332
About ListBox limit item
<p><strong><em>Hello everyone,I am new here, can I ask a question:</em></strong></p> <ul> <li><p>Let's say I have a ListBox (with more than 5k items of all English words ). and a richTextBox.</p></li> <li><p>And a ListBox usually load every items, right? How can I change my ListBox to just load/pick a few (maybe 10 items) from the data?</p></li> </ul> <p><strong><em>EXAMPLE:</em></strong></p> <p>**When a user type a word, I dont want my ListBox to load every thing starting with the word my user input. I just want my ListBox to load just a few item.(More to like a word prediction software) **</p> <p><strong>Please give an answer that is not too complicated, since I am a beginner.</strong></p> <p>Thanks, Teik Fai.</p>
<c#><wpf><visual-studio><listbox>
2016-07-14 08:36:24
LQ_CLOSE
38,371,155
Is there a flexible method in Rails to convert string to XXX
Thanks to view this question, actually **XXX** is not real XXX, I just don't know how to call it. What I wanna know is : `string = "id: 2"` How can I use `User.where(string)` Thanks to talented friends, hope useful answer! BTW, pls let me know how to call the **XXX** :)
<ruby-on-rails><ruby>
2016-07-14 09:59:02
LQ_EDIT
38,372,736
Layout custom listview in android
<p>How Can I layout my custom listview exactly below? thanks</p> <p><a href="https://i.stack.imgur.com/FPh4q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FPh4q.png" alt="enter image description here"></a></p>
<android>
2016-07-14 11:16:10
LQ_CLOSE
38,374,055
Store a values from HTML input into a php variable using javascript
<pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html" /&gt; &lt;meta name="author" content="gencyolcu" /&gt; &lt;title&gt;Untitled 8&lt;/title&gt; &lt;/head&gt; &lt;body&gt; Date:&lt;br /&gt; &lt;input type="date" id="sdate"/&gt;&lt;br /&gt; &lt;button onclick="fun()"&gt;Click me&lt;/button&gt; &lt;script&gt; var js_x =document.getElementById('sdate'); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php echo $php_x; ?&gt; </code></pre> <p>I want to use the date to fetch data using php. How can I store the value I get from the date input tag in the php variable ?</p>
<javascript><php><html>
2016-07-14 12:21:34
LQ_CLOSE
38,374,221
How To add new namespace in C#
I am creating MVC project behind i am using C# code. i have `CloudConfigurationManager` in using read db value . its showing red Error . i have searched google i need to add namespace. `using Microsoft.Azure;` i have added that also but again Getting Error Like this type or namespace 'Azure' does not exist in the namespace 'microsoft' (are you missing an assembly reference?) showing like this how to fix this issue how can i add namespace Azure?
<c#><visual-studio><azure><namespaces>
2016-07-14 12:29:15
LQ_EDIT
38,374,230
Method to display all numbers between 2 whole provided android
<p>android code to display all numbers between 2 input from edittext</p> <p>first edittext has starting number(min) and other has end number(max)..</p> <p>Conditions.. Each multiple of 3, you need to display "H" instead of the number, .. each multiple of 5, you must display "S" instead of the number. and other numbers are display as it is...</p> <p>please help thank you in advance..</p>
<java><android>
2016-07-14 12:29:48
LQ_CLOSE
38,375,056
i developed the app in android.which was run in lollipop device but crash on kitkat device.i am new to android.Please help me for find the solution?
apply plugin: 'com.android.application' android { compileSdkVersion 19 buildToolsVersion '21.1.1' defaultConfig { applicationId "com.example.itsoft37.kitkat" minSdkVersion 11 targetSdkVersion 19 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:19.1.0' } i am new to android.please help me for find the solution the error shows unfortunately stopped on device..
<android>
2016-07-14 13:04:37
LQ_EDIT
38,375,167
ı can't get match string with regex in nodejs
I have a string like this : <ns2:NewsPaper unitid="112234"> . I need just this part : unitid="112234" . I write a piece of code. But it returns null. Here is my code : var value = "<ns2:NewsPaper unitid="112234">"; let abc = /NewsPaper>(\*)</.exec(value); console.log(abc); It returns null. Why ?
<regex><node.js><exec>
2016-07-14 13:09:55
LQ_EDIT
38,376,687
how to concat a variable to a regex in C#
<p>I am trying to concat a variable to a regen in c# but it is not working</p> <pre><code>string color_id = "sdsdssd"; Match variations = Regex.Match (data, @""+color_id+"_[^\""]*\""\W\,\""sizes\""\:\s*\W.*?businessCatalogItemId"":\"")", RegexOptions.IgnoreCase);@""+color_id+"_[^\""]*\""\W\,\""sizes\""\:\s*\W.*?businessCatalogItemId"":\"")"; </code></pre> <p>But the above is not working</p> <p>How to concat a variable at starting element to regex in c#</p>
<c#><regex><concat>
2016-07-14 14:18:35
LQ_CLOSE
38,377,882
Produce a function that receives the die value and the total number of rolls and prints a single line of the histogram based on the values passed.
"You will need to call the function once per possible die value." I'm a programming noob and have spent about seven hours trying to figure this out. My code is just a conglomeration of ideas and hopes that I'm headed in the right direction. I desperately need help and want to understand this stuff. I've scoured the message boards for my specific issue in vain. Please assist... I realize my code is spitting out the result for every possible roll. When I need a program that I.E. when someone chooses to roll 50 times and designates 2 as the die value they desire to single out. The histogram would display how many times 2 was randomly rolled out of 50 rolls as asterisks on a single line of histogram. My code thus far: import random def dice_sum(rolls): results = 0 dice_sum = 0 for i in range(0, rolls): results = random.randint(1, 6) print("Die %d rolled %d." % (i+1, results)) dice_sum += results print("Total of %d dice rolls is: %d" % (rolls, dice_sum)) return dice_sum def hist_gram(): hist_gram='*' dievalue= int(input('Which specific value between 1 and 6 are you requesting? [enter a #]')) # get user input rolls = int(input('How many times would you like to roll the 6 sided die? [enter a #]')) dievalue= int(input('Which specific value between 1 and 6 are you requesting? [enter a #]')) # pass input values to function and print result result = dice_sum(rolls=rolls) print(result)
<python>
2016-07-14 15:10:01
LQ_EDIT
38,380,175
linux - created duplicate root user, cant login anymore.. what do i do?
<p>i became over zealous and ran the command here</p> <p><a href="http://www.shellhacks.com/en/HowTo-Create-USER-with-ROOT-Privileges-in-Linux" rel="nofollow">http://www.shellhacks.com/en/HowTo-Create-USER-with-ROOT-Privileges-in-Linux</a></p> <pre><code>useradd -ou 0 -g 0 john passwd john </code></pre> <p>now i try to connect the way i usually do</p> <pre><code>ssh -i yok.pem root@staging.yok.com -vv </code></pre> <p>and I'm getting</p> <pre><code>debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 21: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to staging.yok.com [23.23.77.124] port 22. debug1: Connection established. debug1: key_load_public: No such file or directory debug1: identity file yok.pem type -1 debug1: key_load_public: No such file or directory debug1: identity file yok.pem-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.9 </code></pre> <p>i luckily still have one connection to the server open.. i checked my ~/.ssh folder and the files all have 600 permissions.</p> <p>what do i need to do here im stuck :(</p>
<linux><unix><ssh>
2016-07-14 17:04:25
LQ_CLOSE
38,380,404
Get unreadable string in c#
I get this string from the network $A grQ05Ah@‘)���ÿÿûÿÿ����°#~À‚¡U But in fact this string is this format : *HQ,XXXXXX,41,4#V1,time,A,**Lat**,N/S,**Lng**,W/E,000.00,000,date,FFFFFBFF,432,35,32448,334 How can i convert the string to standard format in c# ? I convert data to byte as you can see : 24-41-20-20-67-72-51-30-35-41-68-40-91-29-3F-3F-3F-FF-FF-FB-FF-FF-3F-3F-3F-3F-B0-23-7E-C0-82-A1-55
<string><binary><gps><hex><decoding>
2016-07-14 17:18:02
LQ_EDIT
38,380,521
How to sort an array of dictionaries
<p>I have an array of dictionaries that looks like the following:</p> <pre><code>locationArray [{ annotation = "&lt;MKPointAnnotation: 0x7fb75a782380&gt;"; country = Canada; latitude = "71.47385399229037"; longitude = "-96.81064609999999"; }, { annotation = "&lt;MKPointAnnotation: 0x7fb75f01f6c0&gt;"; country = Mexico; latitude = "23.94480686844645"; longitude = "-102.55803745"; }, { annotation = "&lt;MKPointAnnotation: 0x7fb75f0e6360&gt;"; country = "United States of America"; latitude = "37.99472997055178"; longitude = "-95.85629150000001"; }] </code></pre> <p>I would like sort on longitude.</p>
<arrays><swift><dictionary>
2016-07-14 17:25:25
LQ_CLOSE
38,380,969
select checkbox text not changing
BElow is my code. The text is not changing when i select the checkbox. The text for the checkbox should change but it is not. IDK <html> <head> <title>OX</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script type="text/javascript"> $('#checkbox1').on('change', function () { window.alert(5 + 6); if ($('#checkbox1').is(':checked')) { window.alert(5 + 6); $("#description").html("Your Checked 1"); } else { $("#description").html("No check"); } }); </script> </head> <body> <input type="checkbox" value="0" id="checkbox1" name=""/> Answer one <br/></input> <span id="description"> Hi Your Text will come here </span> </body> </html>
<javascript><jquery><html><checkbox>
2016-07-14 17:51:06
LQ_EDIT
38,381,417
Javascript doesn't update form select with option
I have a small problem, I have 4 separate drop downs, I want to add an option to the drop down using javascript, on my working code (php constructs the dropdowns initially with value from MySQL) question_type and question_subtype work, however option_type option_subtype do not. However, it works fine on jsfiddle. https://jsfiddle.net/aeqsdzpk/2/ There are no errors when I look at the console. Two are working just fine, <select name="question_type" id="question_type"> <option value="1">1</option> <option value="2">2 </option> <option value="3">3</option> <option value="4">4</option> </select> <select name="question_subtype" id="question_subtype"> <option value="A">A</option> <option value="B">B </option> <option value="C">C</option> <option value="D">D</option> </select> <select name="option_type[]" id="option_type"> <option value="opt-1">opt1</option> <option value="opt-2">opt2 </option> <option value="opt-3">opt3</option> <option value="opt-4">opt4</option> </select> <select name="option_subtype[]" id="option_subtype"> <option value="optA">optA</option> <option value="optB">optB </option> <option value="optC">optC</option> <option value="optD">optD</option> </select> The Javascript I'm using is here: function addOption() { var opt = document.getElementById('options').value, new_option = document.getElementById('new_option').value, option = document.createElement("option"), x = document.getElementById(opt); alert(opt); option.text = new_option; x.add(option); document.getElementById('options').style.display='none'; document.getElementById('new_option').value=''; }
<javascript><quirks-mode>
2016-07-14 18:17:15
LQ_EDIT
38,385,361
Database Denormalization?
<p>Just to provide some context, I am working on a realtime chat application using Pusher(Websocket Service over cloud), where each messaged is logged in my server before it is pushed to the websocket server which in turn pushes the data to the client.So I am using a MySQL for storing the messages.</p> <p>So one such table is my messages, which has the following fields <code>id,chat_payload,message_time,user_id,room_id</code>.</p> <p>For populating the initial chatroom I would need to retrieve the message history, wherein each message object would include the <code>username,useravatar,chat_payload,timestamp</code>.But the <code>useravatar,username</code> is stored in <code>users, user_meta</code> tables respectively.So fetching the data on the run using joins clearly seems expensive since <code>user_meta</code> table grows very <a href="https://codex.wordpress.org/Database_Description" rel="nofollow">fast</a>.And clearly storing username,useravatar in <code>messages</code> table doesn't seem right as it would pose updation problems.</p> <p>So considering the above scenario could anyone please suggest an appropriate DB/Application Design for the same? </p>
<mysql><database-design><livechat><application-design><denormalized>
2016-07-14 22:41:35
LQ_CLOSE
38,385,940
What's the syntax error in this simple mysql query ?
create table table1(date DATE PRIMARY KEY, open float(10,6), high float(10,6), low float(10,6), close float(10,6), volume INT(10), adj_close float(10,6);
<mysql>
2016-07-14 23:55:25
LQ_EDIT
38,386,082
Is it possible to write javascript in a php heredoc syntax?
I'm trying to put javascript coding in a heredoc syntax and I want it to be printed out with the php print_r method. Is it possible to do that? PHP <?php function printR($val){ echo "<pre>"; print_r($val); echo "</pre>"; } $str = <<<EOT var msg = "Hello my name is "; var name = "Jermaine Forbes"; function writeIt(m,n){ console.log(m+n); } writeIt(msg,name); EOT; printR($str); ?>
<javascript><php><heredoc>
2016-07-15 00:17:19
LQ_EDIT
38,387,541
What is the use case and advantage of Anonymous class in java?
<p>What i know about Anonymous class is when you have any class or interface , and only someof your code need to implement or override some class or interface Anonymously ,it increases the readability of program . But i am Little bit confused suppose in future you need to implement same interface for different class , so in that case you have to refactor you previous class , so is there any other advanrage of Anonymous class ?(Is it improves performance ?)</p>
<java><java-8>
2016-07-15 03:44:50
LQ_CLOSE
38,387,646
Concise, universal A* search in C#
<p>I was looking for an A* search implementation in C#. Eventually wrote my own. Because it's universal, I hope it will be useful for others.</p>
<c#><a-star>
2016-07-15 03:59:29
LQ_CLOSE
38,387,880
How to create a banner in wordpress without help of plugin
<p>I am very new to WordPress, and i want to create my own custom banner in WordPress without plugin help. I tried to search many times but can't able to resolve my problem, please anyone help me.. Thanks in advance</p>
<php><wordpress><phpmyadmin>
2016-07-15 04:30:05
LQ_CLOSE
38,388,032
Android app licensing - any current tutorials on this?
I am hoping somebody can point me in the right direction on this one. I have been reading for a few days now on the developer site, various posts on stackoverflow, etc., and am really struggling to piece all of this together. The Google documentation seems to have some gaps, or I'm simply missing the boat. I have attempted to follow the Google docs on this a few times and keep running in to issues. The most recent is that after going through the steps of downloading the market libraries via the SDK manager and then creating the new library module, I feel I'm missing the piece that will allow my app to see the modules. Specifically, I am guessing there is a dependency that needs to be added to gradle, but I have found no such reference in any of the documentation. If that's not the case, then I have no idea why my imports are not being found. Certainly this feature must work and work well, so I am hoping somebody can point me to a current/decent tutorial or functional sample application that I can view the code on. I did review the sample application that is part of the sdk and as far as the code within the MainActivity goes, that is all fine and good. My main issue is that I can't seem to get my application to be aware of these libraries to move forward with the implementation of the methods to perform the validation how I need. Any direction would be greatly appreciated. Thank you!
<android>
2016-07-15 04:48:33
LQ_EDIT
38,388,048
Count records with today's timestamp mysql php
Here is my PHP code it is working in localhost but when i am uploading on server it is not working it taking 1 day before data from database. If any one have answer please reply it is very urgent. Thanks in advance. <?php require_once('connection.php'); $id=$_SESSION['SESS_MEMBER_ID']; $query = mysql_query("select count(*) as Unread3 from s_daily_reporting where (mem_id='$id')&&(entry_time >= DATE_SUB(CURRENT_DATE(), INTERVAL 0 DAY))"); $data2= mysql_fetch_array($query); echo $sum=8-$data2['Unread3']; ?>
<php><mysql>
2016-07-15 04:50:03
LQ_EDIT
38,388,202
Is there any front-end architecture specifically well suited for building sites with sitecore?
<p>Brand new to sitecore, don't have a solid grasp of what the site we are building looks like functionality wise, but curious to get opinions, pros and cons, articles that might have helped others, and the like. I've heard angular isn't too well suited to interact with sitecore, also read about reactJS.net being well suited.</p> <p>Specifically, does anyone have experience to share on prebuild tools; css preprocessors; and javascript frameworks, templating tools, or libraries that have integrated well into sitecore, or ones that have integrated very poorly?</p> <p>I hope this isn't too broad, I guess in my wild dream I'm imagining someone with extensive experience with sitecore itching to share their vast knowledge on their front end architecture...</p>
<javascript><architecture><content-management-system><sitecore><frontend>
2016-07-15 05:05:17
LQ_CLOSE
38,388,981
Can i make a opening text for website for the amount of time given?
<p>I want to make a website having a opening text that will appear for 5seconds without having to make a new page. Can i do that without making a new page and just use some scripts or something cuz i dont want to make a new page.</p>
<html>
2016-07-15 06:10:32
LQ_CLOSE
38,389,665
autoComplete TextField in iOS using Objective C
I want to implement autoComplete TextField in my app using Objective C, I have a SQLite table in my app, so i want to search names of user by their initial and display while user types in textField. Please help me.
<ios><objective-c><autocomplete><uitextfield>
2016-07-15 06:54:07
LQ_EDIT
38,392,488
How to split a string variable into n variables in R
<p>In R I need to split a string variable of a dataframe into n variables separated by "->" without knowing in advance the number of new variables to create</p>
<r><split>
2016-07-15 09:24:16
LQ_CLOSE
38,392,538
hi and cheers my broS
in c# how can i repeat a code that i write in a form key down event each time i press that key i mean i want to re run that code each time i press the key i think this can be so simple for u cause i am beginner thanks this code is what i already tried if (e.KeyCode == Keys.Down) { textBox1.TabStop = true; dataGridView1.Focus(); label1.Text = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); }
<c#><events><methods><keydown>
2016-07-15 09:26:27
LQ_EDIT