Questions Tagged with #Doevents

Use of Application.DoEvents()

Can Application.DoEvents() be used in C#? Is this function a way to allow the GUI to catch up with the rest of the app, in much the same way that VB6's DoEvents does?..

Is there an equivalent of CSS max-width that works in HTML emails?

I'm trying to create an HTML email that will display properly in all widely used email clients. I'm wrapping the whole email in a table, and I'd like it to have a width that is up to 98% of the avail..

How to Disable GUI Button in Java

so I have this small piece of code for my GUI: import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import javax.swing.JButton; import javax.swing.JFrame; import javax..

SQL Server SELECT INTO @variable?

I have the following code in one of my Sql (2008) Stored Procs which executes perfectly fine: CREATE PROCEDURE [dbo].[Item_AddItem] @CustomerId uniqueidentifier, @Description nvar..

HTML.HiddenFor value set

@Html.HiddenFor(model => model.title, new { id= "natureOfVisitField", @value = '@Model.title'}) it doesen't work! how to set the value?..


I have the following table but unsure of whether it is possible to pivot this and retain all the labels. RATIO RESULT SCORE GRADE Current Ratio 1.294 60 Good Gearing R..

Python: split a list based on a condition?

What's the best way, both aesthetically and from a performance perspective, to split a list of items into multiple lists based on a conditional? The equivalent of: good = [x for x in mylist if x in g..

How can I get a random number in Kotlin?

A generic method that can return a random integer between 2 parameters like ruby does with rand(0..n). Any suggestion?..

Exception.Message vs Exception.ToString()

I have code that is logging Exception.Message. However, I read an article which states that it's better to use Exception.ToString(). With the latter, you retain more crucial information about the erro..

How to Set Variables in a Laravel Blade Template

I'm reading the Laravel Blade documentation and I can't figure out how to assign variables inside a template for use later. I can't do {{ $old_section = "whatever" }} because that will echo "whatever"..

Can promises have multiple arguments to onFulfilled?

I'm following the spec here and I'm not sure whether it allows onFulfilled to be called with multiple arguments. For example: promise = new Promise(function(onFulfilled, onRejected){ onFulfilled..

"Connect failed: Access denied for user 'root'@'localhost' (using password: YES)" from php function

I wrote some function used by a php webpage, in order to interact with a mysql database. When I test them on my server I get this error: "Connect failed: Access denied for user 'root'@'localhost' (us..

Does C have a "foreach" loop construct?

Almost all languages have a foreach loop or something similar. Does C have one? Can you post some example code?..

How do you get/set media volume (not ringtone volume) in Android?

Is there a way to get/set media volume? I have tried the following: AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); int currentVolume = audio.getStreamVolume(AudioManager..

Javascript "Cannot read property 'length' of undefined" when checking a variable's length

I'm building a node scraper that uses cheerio to parse the DOM. This is more or a vanilla javascript question though. At one part of my scrape, I'm loading some content into a variable, then checking ..

What is the difference between an abstract function and a virtual function?

What is the difference between an abstract function and a virtual function? In which cases is it recommended to use virtual or abstract? Which one is the best approach? ..

Multiple github accounts on the same computer?

Trying to work on both my actual "work" repos, and my personal repos on git hub, from my computer. The work account was set up first, and everything works flawlessly. My personal account, ho..

How can I make a float top with CSS?

I know that CSS only supports left and right values for the float property, but is there a technique to implement a floating top? I will try to explain. I have the following code: <div style="floa..

Compile/run assembler in Linux?

I'm fairly new to Linux (Ubuntu 10.04) and a total novice to assembler. I was following some tutorials and I couldn't find anything specific to Linux. So, my question is, what is a good package to com..

How to return JSon object

I am using a jQuery plugin that need a JSON object with following structure(I will be retrieving the values from database): { results: [ { id: "1", value: "ABC", info: "ABC" }, { id: "2", val..

Binary search (bisection) in Python

Is there a library function that performs binary search on a list/tuple and return the position of the item if found and 'False' (-1, None, etc.) if not? I found the functions bisect_left/right in th..

zsh compinit: insecure directories

What does it mean and how can I fix it? zsh compinit: insecure directories, run compaudit for list. Ignore insecure directories and continue [y] or abort compinit [n]? Running the compaudit returns..

Egit rejected non-fast-forward

I am getting this message while pushing to github repository. Can you tell me step by step procedure to fix it? I pushed only once and it was successful. But, when I updated a project and tried to p..

Error in Eclipse: "The project cannot be built until build path errors are resolved"

I am a computer science student learning Java, so I do some work at home and at college on a mixture of Linux and Windows. I have a problem after copying a new project into the Eclipse workspace. The ..

How to declare a Fixed length Array in TypeScript

At the risk of demonstrating my lack of knowledge surrounding TypeScript types - I have the following question. When you make a type declaration for an array like this... position: Array<number&g..

XPath with multiple conditions

What XPath can I use to select any category with a name attribute specified and any child node author with the value specified. I've tried different variations of the path below with no success: //q..

Update UI from Thread in Android

I want to update my UI from a Thread which updates a Progressbar. Unfortunately, when updating the progressbar's drawable from the "runnable" the progressbar disappears! Changing the progressbars's d..

Serial Port (RS -232) Connection in C++

I have done serial port RS-232 connection in C++ using 16-bit compiler (I was using Turbo C++ IDE). It included header file bios.h which contain all the required functions for reading values from the ..

How do I set ANDROID_SDK_HOME environment variable?

I'm working with Eclipse on Windows 7, x64. I'm getting an error when running ADT bundle of android development: Error: Error parsing the AVDs Unable to get the Android SDK home directory. Make sure ..

Laravel 5: Display HTML with Blade

I have a string returned to one of my views, like this: $text = '<p><strong>Lorem</strong> ipsum dolor <img src="images/test.jpg"></p>' I'm trying to display it with B..

how to assign a block of html code to a javascript variable

what is the syntax to store a block of html code to a javascript variable? <div class='saved' > <div >test.test</div> <div class='remove'>[Remove]</div></div> I ..

Regular expression to return text between parenthesis

u'abcde(date=\'2/xc2/xb2\',time=\'/case/test.png\')' All I need is the contents inside the parenthesis...

What's default HTML/CSS link color?

I need its code representation, like #FFFFFF...

How can I do GUI programming in C?

I want to do Graphics programming in C. I had searched a lot about the compiler that provides a rich set of functions for doing GUI programming in C, but I couldn't find anything. Basically I want to..

Unix command to find lines common in two files

I'm sure I once found a unix command which could print the common lines from two or more files, does anyone know its name? It was much simpler than diff...

[Vue warn]: Cannot find element

I'm using Vuejs. This is my markup: <body> <div id="main"> <div id="mainActivity" v-component="{{currentActivity}}" class="activity"></div> </div> </body> ..

Setting Authorization Header of HttpClient

I have an HttpClient that I am using for a REST API. However I am having trouble setting up the Authorization header. I need to set the header to the token I received from doing my OAuth request. I sa..

Submit Button Image

I want to use a Submit Button Image instead of the standard Button. I searched on Google and SO and got a few different ways. Which is the right way of using an Image as a Submit Button ? Also i wo..

Proper use of the IDisposable interface

I know from reading the Microsoft documentation that the "primary" use of the IDisposable interface is to clean up unmanaged resources. To me, "unmanaged" means things like database connections, sock..

HTML if image is not found

I have an image in a HTML page: <img src="smiley.gif" alt="Smiley face" width="32" height="32" /> If the image is not found on the server it shows an ugly blank square. I want to make it so ..

React Native fixed footer

I try to create react native app that looks like existing web app. I have a fixed footer at bottom of window. Do anyone have idea how this can be achieved with react native? in existing app it's simp..

Capture HTML Canvas as gif/jpg/png/pdf?

Is it possible to capture or print what's displayed in an html canvas as an image or pdf? I'd like to generate an image via canvas, and be able to generate a png from that image...

How to add click event to a iframe with JQuery

I have an iframe on a page, coming from a 3rd party (an ad). I'd like to fire a click event when that iframe is clicked in (to record some in-house stats). Something like: $('#iframe_id').click(funct..

How to parse/format dates with LocalDateTime? (Java 8)

Java 8 added a new java.time API for working with dates and times (JSR 310). I have date and time as string (e.g. "2014-04-08 12:30"). How can I obtain a LocalDateTime instance from the given string?..

Is there something like Codecademy for Java

Does anyone know of a site like Codecademy that focuses on teaching programming with Java? ( uses guided lessons in JavaScript, HTML and CSS, and Python)..

Get full path without filename from path that includes filename

Is there anything built into System.IO.Path that gives me just the filepath? For example, if I have a string @"c:\webserver\public\myCompany\configs\promo.xml", is there any BCL method that wi..

Get properties of a class

Is there a way to get properties names of class in TypeScript? In the example, I would like to 'describe' the class A or any class and get an array of its properties (maybe only public ones?), is it ..

Building executable jar with maven?

I am trying to generate an executable jar for a small home project called "logmanager" using maven, just like this: How can I create an executable JAR with dependencies using Maven? I added the snip..

Bootstrap how to get text to vertical align in a div container

What is the best/proper way to vertically align the text in the middle of its column? The image height is statically set in the CSS. I have tried setting an outer div to display: table and an inner d..

Removing duplicate elements from an array in Swift

I might have an array that looks like the following: [1, 4, 2, 2, 6, 24, 15, 2, 60, 15, 6] Or, really, any sequence of like-typed portions of data. What I want to do is ensure that there is only one o..

How to change UIPickerView height

Is it possible to change the height of UIPickerView? Some applications seem to have shorter PickerViews but setting a smaller frame doesn't seem to work and the frame is locked in Interface Builder...

What are the correct version numbers for C#?

What are the correct version numbers for C#? What came out when? Why can't I find any answers about C# 3.5? This question is primarily to aid those who are searching for an answer using an incorrect ..

How to get current user who's accessing an ASP.NET application?

To get the current logged in user at the system I use this code: string opl = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); I work on an ASP.NET application where I need t..

Generating HTML email body in C#

Is there a better way to generate HTML email in C# (for sending via System.Net.Mail), than using a Stringbuilder to do the following: string userName = "John Doe"; StringBuilder mailBody = new String..

Excel VBA Run Time Error '424' object required

I am totally new in VBA and coding in general, am trying to get data from cells from the same workbook (get framework path ...) and then to start application (QTP) and run tests. I am getting this er..

Performing a query on a result from another query?

I have a the query: SELECT availables.bookdate AS Date, DATEDIFF(now(),availables.updated_at) as Age FROM availables INNER JOIN rooms ON WHERE availables.bookdate BETWEEN ..

Could not find 3.2.25 4.0.30 4.1.32 4.2.40 4.2.42 4.3.23 4.4.52 5.0.77 5.0.89 5.2.08 6.1.11 6.1.71 6.5.87

referencing the play-services via gradle stopped working for me - boiled it down - even the sample I used as a reference in the first place stopped working:

Generate random numbers uniformly over an entire range

I need to generate random numbers within a specified interval, [max;min]. Also, the random numbers should be uniformly distributed over the interval, not located to a particular point. Currenly I am..

Set the maximum character length of a UITextField

How can I set the maximum amount of characters in a UITextField on the iPhone SDK when I load up a UIView?..

Passing ArrayList from servlet to JSP

I am trying to pass ArrayList which contains object from servlet to JSP. But Servlet file: request.setAttribute("servletName", categoryList); //categorylist is an arraylist contains object of ..

How can I convert a string to boolean in JavaScript?

Can I convert a string representing a boolean value (e.g., 'true', 'false') into a intrinsic type in JavaScript? I have a hidden form in HTML that is updated based upon a user's selection within a li..

How do I get an object's unqualified (short) class name?

How do I check the class of an object within the PHP name spaced environment without specifying the full namespaced class. For example suppose I had an object library/Entity/Contract/Name. The fo..

How do I recursively delete a directory and its entire contents (files + sub dirs) in PHP?

How do I delete a directory and its entire contents (files and subdirectories) in PHP?..

anchor jumping by using javascript

I have a question that will be found very often. The problem is that nowhere can be found an explicit solution. I have two problems regarding anchors. The main goal should be to get a nice clean url..

MongoDB Data directory /data/db not found

When I try to run Mongod in terminal I got this message : 2015-05-14T17:33:04.554+0700 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 2015-..

What is the difference between private and protected members of C++ classes?

What is the difference between private and protected members in C++ classes? I understand from best practice conventions that variables and functions which are not called outside the class should be m..

How to get difference between two rows for a column field?

I have a table like this: rowInt Value 2 23 3 45 17 10 9 0 .... The column rowInt values are integer but not in a sequence with same increament. I can use the following sql ..

Build Android Studio app via command line

I want to build an Android Studio app (the Gradle build system), but I want to do this via the command line...

Combine two columns and add into one new column

In PostgreSQL, I want to use an SQL statement to combine two columns and create a new column from them. I'm thinking about using concat(...), but is there a better way? What's the best way to do this..

Saving numpy array to txt file row wise

I have an numpy array of form a = [1,2,3] which I want to save to a .txt file such that the file looks like: 1 2 3 If I use numpy.savetxt then I get a file like: 1 2 3 There should be a easy ..

How to know the git username and email saved during configuration?

While configuring git I ran these two commands: git config --global "My Name" git config --global "[email protected]" However, I doubt whether I made a typo or not. So, is t..

Select a Dictionary<T1, T2> with LINQ

I have used the "select" keyword and extension method to return an IEnumerable<T> with LINQ, but I have a need to return a generic Dictionary<T1, T2> and can't figure it out. The example ..

Key Listeners in python?

Is there a way to do key listeners in python without a huge bloated module such as pygame? An example would be, when I pressed the a key it would print to the console The a key was pressed! It..

jquery find element by specific class when element has multiple classes

So I am working on something that wasn't well thought out in the build from the backend team. That leaves me with a document full of divs. What I am doing is rolling back from the element I need to ..

Reversing a String with Recursion in Java

Here is some Java code to reverse a string recursively. Could someone provide an explanation of how it works? public static String reverse(String str) { if ((null == str) || (str.length() <..

Convert date yyyyMMdd to system.datetime format

Possible Duplicate: how to convert date from yyyyMMdd format to mm-dd-yyyy fomrat I have a string which contains date in yyyyMMdd format. I want to convert that date into system date format..

When should I use UNSIGNED and SIGNED INT in MySQL?

When should I use UNSIGNED and SIGNED INT in MySQL ? What is better to use or this is just personal prefernce ? Because I've seen it used like this; id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT and..

How do I return a proper success/error message for JQuery .ajax() using PHP?

I keep getting the error alert. There is nothing wrong with the MYSQL part, the query gets executed and I can see the email addresses in the db. The client side: <script type="text/javascript">..

Sum a list of numbers in Python

I have a list of numbers such as [1,2,3,4,5...], and I want to calculate (1+2)/2 and for the second, (2+3)/2 and the third, (3+4)/2, and so on. How can I do that? I would like to sum the first number..

SQL Server: Maximum character length of object names

What is the maximum character length of object name (e.g. constraint, column) in SQL Server 2008? ..

What causes a TCP/IP reset (RST) flag to be sent?

I'm trying to figure out why my app's TCP/IP connection keeps hiccuping every 10 minutes (exactly, within 1-2 seconds). I ran Wireshark and discovered that after 10 minutes of inactivity the other en..

How to get value of selected radio button?

I want to get the selected value from a group of radio buttons. Here's my HTML: <div id="rates"> <input type="radio" id="r1" name="rate" value="..

Where does Visual Studio look for C++ header files?

I checked out a copy of a C++ application from SourceForge (HoboCopy, if you're curious) and tried to compile it. Visual Studio tells me that it can't find a particular header file. I found the file ..

In Javascript, how do I check if an array has duplicate values?

Possible Duplicate: Easiest way to find duplicate values in a javascript array How do I check if an array has duplicate values? If some elements in the array are the same, then return true..

Custom Python list sorting

I was refactoring some old code of mine and came across of this: alist.sort(cmp_items) def cmp_items(a, b): if > return 1 elif == return 0 el..

How does one convert a HashMap to a List in Java?

In Java, how does one get the values of a HashMap returned as a List?..

Difference between Inheritance and Composition

Are Composition and Inheritance the same? If I want to implement the composition pattern, how can I do that in Java?..

How to debug "ImagePullBackOff"?

All of a sudden, I cannot deploy some images which could be deployed before. I got the following pod status: [root@webdev2 origin]# oc get pods NAME READY STATUS ..

Add JVM options in Tomcat

How can I add jvm(Java virtual machine) options in Apache Tomcat 6? Is there a administration console in tomcat? I tried http://localhost:8080/admin but I could not get anything out of it. I want to..

How to get full width in body element

How would I be able to get a website to auto-fit in the page? It's a landscape design which needs no scrolling...

At least one JAR was scanned for TLDs yet contained no TLDs

I keep getting this on tomcat 7.30 (eclipse juno) At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanne..

ES6 modules in the browser: Uncaught SyntaxError: Unexpected token import

I'm new to ES6 (ECMAScript 6), and I'd like to use its module system in the browser. I read ES6 is supported by Firefox and Chrome, but I'm getting the following error using export Uncaught SyntaxErr..

Check if cookie exists else set cookie to Expire in 10 days

Here is what I'm looking to do (pseudo-code): Imagine the name of the cookie in the example is "visited" and it contains nothing. if visited exists then alert("hello again"); else create visited - s..

Tomcat request timeout

In my web application there are some requests which last longer than 20 seconds. But in some situations the code can lead to infinite loop or something similar which slows down the server. I want to..

CSS Display an Image Resized and Cropped

I want to show an image from an URL with a certain width and height even if it has a different size ratio. So I want to resize (maintaining the ratio) and then cut the image to the size I want. I ca..

How to convert enum names to string in c

Is there a possibility to convert enumerator names to string in C?..

What's the difference between a web site and a web application?

I'm stumped trying to come up to a difference between a website and a web application for myself. As I see it, a web site points to a specific page and a web application is more of some sort of 'porta..

Rules for C++ string literals escape character

What are the rules for the escape character \ in string literals? Is there a list of all the characters that are escaped? In particular, when I use \ in a string literal in gedit, and follow it by an..

Subtracting two lists in Python

In Python, How can one subtract two non-unique, unordered lists? Say we have a = [0,1,2,1,0] and b = [0, 1, 1] I'd like to do something like c = a - b and have c be [2, 0] or [0, 2] order doesn't matt..

Selenium using Java - The path to the driver executable must be set by the webdriver.gecko.driver system property

I am trying to launch Mozilla but still I am getting this error: Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.dr..

How to get 2 digit year w/ Javascript?

I am trying to find some javascript code that will write the current date in this format: mmddyy Everything I have found uses 4 digit years and I need 2 digit...

How do you comment an MS-access Query?

How does one add a comment to an MS Access Query, to provide a description of what it does? Once added, how can one retrieve such comments programmatically?..

How can I read SMS messages from the device programmatically in Android?

I want to retrieve the SMS messages from the device and display them?..

Batch file to move files to another directory

I hope that you can help me with this one. It might have been asked multiple times already (I know that), but for some reason, I just can't have it working. I want to move some files from the "files"..

How to tell if a string is not defined in a Bash shell script

If I want to check for the null string I would do [ -z $mystr ] but what if I want to check whether the variable has been defined at all? Or is there no distinction in Bash scripting?..

Completely uninstall PostgreSQL 9.0.4 from Mac OSX Lion?

This question may look like a duplicate of: How to uninstall postgresql on my Mac (running Snow Leopard) however, there are two major differences. I'm running Lion and I'm trying to uninstall PostgreS..

function to remove duplicate characters in a string

The following code is trying to remove any duplicate characters in a string. I'm not sure if the code is right. Can anybody help me work with the code (i.e whats actually happening when there is a mat..

Capturing a form submit with jquery and .submit

I'm attempting to use jQuery to capture a submit event and then send the form elements formatted as JSON to a PHP page. I'm having issues capturing the submit though, I started with a .click() event b..

bootstrap 3 wrap text content within div for horizontal alignment

My post title here could be misleading. first have a look at HTML i have currently: As you can see, each column's text content overflows to next column. Secondly, each of them is not horizontal alig..

Comparing two hashmaps for equal values and same key sets?

How can I best compare two HashMaps, if I want to find out if none of them contains different keys than the other, and if the values of that keys match each other. Map<objA, objB> mapA = new Ha..

How to set thymeleaf th:field value from other variable

I have a simple text input field where i have to set default value from one object and save its final value in other. The following code is not working. <div th:object="${form}"> <input ..

Parsing time string in Python

I have a date time string that I don't know how to parse it in Python. The string is like this: Tue May 08 15:14:45 +0800 2012 I tried datetime.strptime("Tue May 08 15:14:45 +0800 2012","%a %b %..

g++ ld: symbol(s) not found for architecture x86_64

I'm trying to compile the Sam Hare's Struck code. I'm using mac OSX10.9, opencv 2.4.6 and Eigen 2.0.17. Eigen and opencv headers are stored in /opt/local/include while opencv dylib in /opt/local/lib..

Can we convert a byte array into an InputStream in Java?

Can we convert a byte array into an InputStream in Java? I have been looking on the internet but couldn't find it. I have a method that has an InputStream as argument. The InputStream cph I have is ..

python list in sql query as parameter

I have a python list, say l l = [1,5,8] I want to write a sql query to get the data for all the elements of the list, say select name from students where id = |IN THE LIST l| How do I accomplish..

How to split() a delimited string to a List<String>

I had this code: String[] lineElements; . . . try { using (StreamReader sr = new StreamReader("TestFile.txt")) { String line; while ((li..

How to write a link like <a href="#id"> which link to the same page in PHP?

like in HTML, I could write <a href="#id"> which could link to the place where I make a <a id="id"> . but it seems that it does not work in PHP. How to do that? the original code is from ..

How to use subList()

I have a JSF page which displays list of Glassfish log files. I use lazy loading for pagination. I keep the list of the log files names into Java List. private List<directoryListObj> dataList =..

Setting up redirect in web.config file

I'm trying to redirect some unfriendly urls with more descriptive ones. These urls end in .aspx?cid=3916 with the last digits being different for each category name page. I want it to instead redirect..

Clicking at coordinates without identifying element

As part of my Selenium test for a login function, I would like to click a button by identifying its coordinates and instructing Selenium to click at those coordinates. This would be done without ident..

go get results in 'terminal prompts disabled' error for github private repo

I created the private repo examplesite/myprivaterepo using the Github UI from my browser. Then I went to my go directory (on the desktop) and cloned it: $ cd $GOPATH $ go get

Quick unix command to display specific lines in the middle of a file?

Trying to debug an issue with a server and my only log file is a 20GB log file (with no timestamps even! Why do people use System.out.println() as logging? In production?!) Using grep, I've found an ..

Get the current script file name

If I have PHP script, how can I get the filename from inside that script? Also, given the name of a script of the form jquery.js.php, how can I extract just the "jquery.js" part?..

The calling thread cannot access this object because a different thread owns it

My code is as below public CountryStandards() { InitializeComponent(); try { FillPageControls(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Coun..

How to change xampp localhost to another folder ( outside xampp folder)?

How can I change my default xampp localhost c:xampp/htdoc to another folder i.e. c:/alan? When I use the IP address I should be able to view my website file in C:/alan. Thanks for helping me...

Update records in table from CTE

I have the following CTE that will give me the DocTotal for the entire invoice. ;WITH CTE_DocTotal AS ( SELECT SUM(Sale + VAT) AS DocTotal FROM PEDI_InvoiceDetail GROUP BY InvoiceNumber ..

How do I check if file exists in jQuery or pure JavaScript?

How do I check if a file on my server exists in jQuery or pure JavaScript?..

How can I get a resource content from a static context?

I want to read strings from an xml file before I do much of anything else like setText on widgets, so how can I do that without an activity object to call getResources() on?..

React proptype array with shape

Is there a built-in way to use proptypes to ensure that an array of objects being passed to a component is actually an array of objects of a specific shape? Maybe something like this? annotationRang..

How do you return a JSON object from a Java Servlet

How do you return a JSON object form a Java servlet. Previously when doing AJAX with a servlet I have returned a string. Is there a JSON object type that needs to be used, or do you just return a Str..

Updating state on props change in React Form

I am having trouble with a React form and managing the state properly. I have a time input field in a form (in a modal). The initial value is set as a state variable in getInitialState, and is passed ..

Polymorphism: Why use "List list = new ArrayList" instead of "ArrayList list = new ArrayList"?

Possible Duplicate: Why should the interface for a Java class be prefered? When should I use List<Object> list = new ArrayList<Object>(); ArrayList inherits from List, so if..

Oracle 10g: Extract data (select) from XML (CLOB Type)

I'm new in Oracle and I've - maybe trivial - a problem in a select. (I'm using Oracle 10g Express Edition). I've a DB with a field CLOB: mytab.xml This column have an XML like this: <?xml version..

Running Google Maps v2 on the Android emulator

I've tried to implement Google Maps v2 in my Android application, but unfortunately instead of maps I get this message: Is it possible to run these maps on the Android emulator (Platform 4.2)?..

react-native - Fit Image in containing View, not the whole screen size

I'm trying to fit images in their containing views so that I can have a seamless grid of images. The problem is that resizeMode='contain' seems to fit to the width of the screen or at least some highe..

How to get coordinates of an svg element?

I am using d3 to draw a line from a relative svg position and hence want to access the coordinates of the element itself. I tried something like this (where "this" refers to the element) .attr("x1",..

Is there a W3C valid way to disable autocomplete in a HTML form?

When using the xhtml1-transitional.dtd doctype, collecting a credit card number with the following HTML <input type="text" id="cardNumber" name="cardNumber" autocomplete='off'/> will flag a w..

How do I display the current value of an Android Preference in the Preference summary?

This must come up very often. When the user is editing preferences in an Android app, I'd like them to be able to see the currently set value of the preference in the Preference summary. Example: if..

Creating a copy of an object in C#

Please have a look at the code below (excerpt from a C# book): public class MyClass { public int val; } public struct myStruct { public int val; } public class Program { private static ..

C++ IDE for Macs

I teach a C++ course using Visual Studio. One of my students has a Mac and was looking for an IDE to use on his machine. What would be good to recommend?..

Outline effect to text

Are there any ways in CSS to give outlines to text with different colors ? I want to highlight some parts of my text to make it more intuitive - like the names, links, etc. Changing the link colors et..

How to analyze information from a Java core dump?

If a process crashes and leaves a core dump or I create one with gcore then how can I analyze it? I'd like to be able to use jmap, jstack, jstat etc and also to see values of all variables. This w..

Difference between pre-increment and post-increment in a loop?

Is there a difference in ++i and i++ in a for loop? Is it simply a syntax thing?..

Detect If Browser Tab Has Focus

Is there a reliable cross-browser way to detect that a tab has focus. The scenario is that we have an application that polls regularly for stock prices, and if the page doesn't have focus we could st..

Removing elements by class name?

I have the below code to find elements with their class name: // Get the element by their class name var cur_columns = document.getElementsByClassName('column'); // Now remove them for (var i = 0; ..

Asp Net Web API 2.1 get client IP address

Hello I need get client IP that request some method in web api, I have tried to use this code from here but it always returns server local IP, how to get in correct way ? HttpContext.Current.Request..

Height of status bar in Android

What's the height of the status bar in Android? Is it always the same? From my measurements it seems that it's 25dp, but I'm not sure if it has the same height on all platforms. (I want to know this..

rake assets:precompile RAILS_ENV=production not working as required

I am trying to precompile assets using the command rake assets:precompile RAILS_ENV=production, but I always get the error below. ** Invoke assets:precompile (first_time) ** Execute assets:precom..

install cx_oracle for python

Am on Debian 5, I've been trying to install cx_oracle module for python without any success. First, I installed oracle-xe-client and its dependency (followed tutorial in the following link here). Th..

"A namespace cannot directly contain members such as fields or methods"

I am trying to use this code for NET.reflector using Reflexil. I am trying to replace code with this: if(Input.GetKeyDown(KeyCode.Keypad5)) { int i = 0; Character localPlayer = PlayerClient.GetLocal..

How do I obtain a list of all schemas in a Sql Server database

I want to retrieve a list of all schemas in a given Sql Server database. Using the ADO.NET schema retrieval API I get a list of all collections but there is no collection for 'Schemas'. I could traver..

How to test that no exception is thrown?

I know that one way to do it would be: @Test public void foo() { try { // execute code that you expect not to throw Exceptions. } catch(Exception e) { fail("Should not have thro..

how to use concatenate a fixed string and a variable in Python

I want to include file name 'main.txt' in the subject for that I am passing file name from command line. but getting error in doing so python main.txt #running python with argument msg['..

angularjs: allows only numbers to be typed into a text box

In angularjs is there any functionality available that allows only numbers to be typed into a text box like..

Finding all positions of substring in a larger string in C#

I have a large string I need to parse, and I need to find all the instances of extract"(me,i-have lots. of]punctuation, and store the index of each to a list. So say this piece of string was in the ..

how to always round up to the next integer

i am trying to find total pages in building a pager on a website (so i want the result to be an integer. i get a list of records and i want to split into 10 per page (the page count) when i do this:..

Regular expression negative lookahead

In my home directory I have a folder drupal-6.14 that contains the Drupal platform. From this directory I use the following command: find drupal-6.14 -type f -iname '*' | grep -P 'drupal-6.14/(?!sit..

text box input height

I made the size of the box bigger. it look bigger int the dream weaver design view but does not seem to work in the browsers. <input type="text" **height="60%"** name=" item" align="left" /> ..

Correlation heatmap

I want to represent correlation matrix using a heatmap. There is something called correlogram in R, but I don't think there's such a thing in Python. How can I do this? The values go from -1 to 1, fo..

How to Convert Excel Numeric Cell Value into Words

I am working with Microsoft Excel 2007 and I have one Numeric Column in my Sheet. Is there any solution that I can convert it's Words equivalent? I am attaching Excel Sheet's Screen Shot. ..

Editable 'Select' element

I would like to have a select element in the form but besides the options in the dropdown, it would be useful to be able to edit it and add new option but not with another input text, I need all in on..

How to prevent page from reloading after form submit - JQuery

I am working on a website for my app development class and I have the weirdest issue. I am using a bit of JQuery to send form data to a php page called 'process.php, and then upload it to my DB. The..

Stack smashing detected

I am executing my a.out file. After execution the program runs for some time then exits with the message: **** stack smashing detected ***: ./a.out terminated* *======= Backtrace: =========* */lib/tl..

How to override a JavaScript function

I'm trying to override a built in parseFloat function in JavaScript. How would I go about doing that?..

How to compare the contents of two string objects in PowerShell

In PowerShell I have an array of string objects, and I have an object that contains string objects. In Java you can do a .equals(aObject) to test if the string values match, whereas doing a == test if..

How to POST JSON request using Apache HttpClient?

I have something like the following: final String url = ""; final HttpClient httpClient = new HttpClient(); final PostMethod postMethod = new PostMethod(url); postMethod.addRequest..

Iterate over the lines of a string

I have a multi-line string defined like this: foo = """ this is a multi-line string. """ This string we used as test-input for a parser I am writing. The parser-function receives a file-object as ..

How do I specify different layouts for portrait and landscape orientations?

I've seen references to being able to specify two separate layout xml files for an activity, one for Portrait and one for Landscape. I've not been to find any information on how to do that though. H..

Getting the size of an array in an object

I would like some help with getting the size of an array inside an object: var st = { "itema":{...},"itemb":[{"id":"s01","cd":"c01","dd":"d01",....}{"id":"s02","cd":"c02","dd":"d02",....}]} How wo..

How to pad a string with leading zeros in Python 3

I'm trying to make length = 001 in Python 3 but whenever I try to print it out it truncates the value without the leading zeros (length = 1). How would I stop this happening without having to cast len..

Does a TCP socket connection have a "keep alive"?

I have heard of HTTP keep-alive but for now I want to open a socket connection with a remote server. Now will this socket connection remain open forever or is there a timeout limit associated with it ..

Use HTML5 to resize an image before upload

I have found a few different posts and even questions on stackoverflow answering this question. I am basically implementing this same thing as this post. So here is my issue. When I upload the photo,..

Search and replace in bash using regular expressions

I've seen this example: hello=ho02123ware38384you443d34o3434ingtod38384day echo ${hello//[0-9]/} Which follows this syntax: ${variable//pattern/replacement} Unfortunately the pattern field doesn't..

Meaning of Open hashing and Closed hashing

Open Hashing (Separate Chaining): In open hashing, keys are stored in linked lists attached to cells of a hash table. Closed Hashing (Open Addressing): In closed hashing, all keys are stored..

How to make asynchronous HTTP requests in PHP

Is there a way in PHP to make asynchronous HTTP calls? I don't care about the response, I just want to do something like file_get_contents(), but not wait for the request to finish before executing th..

MySQLi count(*) always returns 1

I'm trying to count the number of rows in a table and thought that this was the correct way to do that: $result = $db->query("SELECT COUNT(*) FROM `table`;"); $count = $result->num_rows; But ..

Escape a string in SQL Server so that it is safe to use in LIKE expression

How do I escape a string in SQL Server's stored procedure so that it is safe to use in LIKE expression. Suppose I have an NVARCHAR variable like so: declare @myString NVARCHAR(100); And I want to ..

How to Concatenate Numbers and Strings to Format Numbers in T-SQL?

I have the following function ALTER FUNCTION [dbo].[ActualWeightDIMS] ( -- Add the parameters for the function here @ActualWeight int, @Actual_Dims_Lenght int, @Actual_Dims_Width int..

How to exclude records with certain values in sql select

How do I only select the stores that don't have client 5? StoreId ClientId ------- --------- 1 4 1 5 2 5 2 6 2 7 3 ..

What's the difference between implementation and compile in Gradle?

After updating to Android Studio 3.0 and creating a new project, I noticed that in build.gradle there is a new way to add new dependencies instead of compile there is implementation and instead of tes..

How do I encode URI parameter values?

I want to send a URI as the value of a query/matrix parameter. Before I can append it to an existing URI, I need to encode it according to RFC 2396. For example, given the input:

How to check if the string is empty?

Does Python have something like an empty string variable where you can do: if myString == string.empty: Regardless, what's the most elegant way to check for empty string values? I find hard coding ..

Querying data by joining two tables in two database on different servers

There are two tables in two different databases on different servers, I need to join them so as to make few queries. What options do I have? What should I do?..

@JsonProperty annotation on field as well as getter/setter

I have inherited a certain bit code that has the @JsonProperty annotation on getter/setters. The purpose is so that when the object is serialized using the Jackson library, the fields have that specif..

Show history of a file?

Possible Duplicate: View the change history of a file using Git versioning Sometimes I want to step through the history of a particular file. In the past I used P4V and this was very quick ..

convert json ipython notebook(.ipynb) to .py file

How do you convert an IPython notebook file (json with .ipynb extension) into a regular .py module?..

Override back button to act like home button

On pressing the back button, I'd like my application to go into the stopped state, rather than the destroyed state. In the Android docs it states: ...not all activities have the behavior that the..

Changing Fonts Size in Matlab Plots

I want to change Font Size for xlabel, ylabel, axis size, legend font size a.k.a everything at once, is this possible? By default, font is Helvetica 10. Is there way to change this? I want to ..

Start and stop a timer PHP

I need some information regarding starting and stopping a timer in PHP. I need to measure the elapsed time from the start of my .exe program (I'm using exec() function in my php script) until it compl..


Normally whats the reason to get java.lang.ClassCastException ..? I get the following error in my application java.lang.ClassCastException: [Lcom.rsa.authagent.authapi.realmstat.AUTHw ..

HTML5 - mp4 video does not play in IE9

I have an mp4 video that I want to play in IE9 using HTML5 <video> tag. I added the MIME type to IIS 7 so if I browse http://localhost/video.mp4 it plays in both Chrome and IE9 but not in HTML5,..

Pandas conditional creation of a series/dataframe column

I have a dataframe along the lines of the below: Type Set 1 A Z 2 B Z 3 B X 4 C Y I want to add another column to the dataframe (o..

Doctrine and LIKE query

I have entity for Doctrine: <?php /** * @Entity * @Table(name="orders") */ class Orders { /** @Id @Column(name="OID",type="integer") @GeneratedValue */ private $id; /** @Column(name..

How to determine the installed webpack version

Especially during the transition from webpack v1 to v2, it would be important to programmatically determine what webpack version is installed, but I cannot seem to find the appropriate API...

How to convert java.util.Date to java.sql.Date?

I am trying to use a java.util.Date as input and then creating a query with it - so I need a java.sql.Date. I was surprised to find that it couldn't do the conversion implicitly or explicitly - but..

python: urllib2 how to send cookie with urlopen request

I am trying to use urllib2 to open url and to send specific cookie text to the server. E.g. I want to open site Solve chess problems, with a specific cookie, e.g. search=1. How do I do it? I am tryi..

.prop() vs .attr()

So jQuery 1.6 has the new function prop(). $(selector).click(function(){ //instead of: this.getAttribute('style'); //do i use: $(this).prop('style'); //or: $(this).attr('style..

How to display text in pygame?

I can't figure out to display text in pygame. I know I can't use print like in regular python IDLE but i dont know how import pygame, sys from pygame.locals import * BLACK = ( 0, 0, 0) WHITE = (25..

Mongoose and multiple database in single node.js project

I'm doing a Node.js project that contains sub projects. One sub project will have one Mongodb database and Mongoose will be use for wrapping and querying db. But the problem is Mongoose doesn't all..

Java: Identifier expected

What's the issue here? class UserInput { public void name() { System.out.println("This is a test."); } } public class MyClass { UserInput input = new UserInput();; } This ..

decompiling DEX into Java sourcecode

How can one decompile Android DEX (VM bytecode) files into corresponding Java sourcecode?..