Questions Tagged with #Clistbox

Change the "No file chosen":

I have a button "Choose file" as follows (I am using Jade but it should be the same as Html5): input(type='file', name='videoFile') In the browser this shows a button with a text next to it "No fi..

How to get a key in a JavaScript object by its value?

I have a quite simple JavaScript object, which I use as an associative array. Is there a simple function allowing me to get the key for a value, or do I have to iterate the object and find it out manu..

Change PictureBox's image to image from my resources?

How do I set a PictureBox image to an image from my resources? (I tried this without success: pictuerbox.Image = "img_location";)..

Search for exact match of string in excel row using VBA Macro

How do I search for a string in one particular row in excel? the I have the row index in a long type variable. Dim rowIndex As Long rowIndex = // some value being set here using some code. Now I ne..

ES6 export default with multiple functions referring to each other

in es6 there you can define a module of functions like this export default { foo() { console.log('foo') }, bar() { console.log('bar') }, baz() { foo(); bar() } } the above seems to be ..

How to set up Spark on Windows?

I am trying to setup Apache Spark on Windows. After searching a bit, I understand that the standalone mode is what I want. Which binaries do I download in order to run Apache spark in windows? I see ..

No Persistence provider for EntityManager named

I have my persistence.xml with the same name using TopLink under the META-INF directory. Then, I have my code calling it with: EntityManagerFactory emfdb = Persistence.createEntityManagerFactory("agi..

Where are static variables stored in C and C++?

In what segment (.BSS, .DATA, other) of an executable file are static variables stored so that they don't have name collision? For example: foo.c: bar.c: static int foo = 1; ..

Removing the password from a VBA project

How can I programmatically remove a (known) password from an Excel VBA project? To be clear: I want to remove the password from the VBA Project, not the workbook or any worksheets...

How can I get the concatenation of two lists in Python without modifying either one?

In Python, the only way I can find to concatenate two lists is list.extend, which modifies the first list. Is there any concatenation function that returns its result without modifying its arguments?..

Run-time error '3061'. Too few parameters. Expected 1. (Access 2007)

I have the following 'set recordset' line that I cannot get working. The parameters seem correct according to all available help I can find on the subject. The error displays : "Run-time error '3..

Selecting pandas column by location

I'm simply trying to access named pandas columns by an integer. You can select a row by location using df.ix[3]. But how to select a column by integer? My dataframe: df=pandas.DataFrame({'a':np.r..

Select parent element of known element in Selenium

I have a certain element that I can select with Selenium 1. Unfortunately I need to click the parent element to get the desired behaviour. The element I can easily locate has attribute unselectable, ..

Add a linebreak in an HTML text area

How can i add a line break to the text area in a html page? i use for server side coding...

Send parameter to Bootstrap modal window?

I have a problem, I cannot pass any parameters to a modal window (using Bootstrap 3), I tried using the solution stated in this link, but I cannot make it work: Dynamically load information to Twitte..

Parse Json string in C#

I'm trying to read a Json string in C#, but I'm having trouble figuring out just how to parse the string into C#. Say I have the following Json string [ { "AppName": { "Descri..

Highlight all occurrence of a selected word?

How can I highlight all occurrence of a selected word in GVim, like in Notepad++?..

Securing a password in a properties file

I have a java application that connects to a database. The user name and password for the database are stored in a properties file. What is the common practice to avoid storing the password in clearte..

Calling stored procedure with return value

I am trying to call a stored procedure from my C# windows application. The stored procedure is running on a local instance of SQL Server 2008. I am able to call the stored procedure but I am not able ..

Scroll to the top of the page using JavaScript?

How do I scroll to the top of the page using JavaScript? The scrollbar instantly jumping to the top of the page is desirable too as I'm not looking to achieve smooth scrolling...

Python Requests library redirect new url

I've been looking through the Python Requests documentation but I cannot see any functionality for what I am trying to achieve. In my script I am setting allow_redirects=True. I would like to know ..

How to blur background images in Android

What is the best way to blur background images like the image below? I saw some code and libraries but their are a couple of years old or like BlurBehind library, but it doesn't give the same effect. ..

Removing black dots from li and ul

Im working on a project and im using some ul and li's. But i cant seem to figure out how to remove those pesky black dots that come with those lists. Can any of you help me with this? Edit: i compl..

make sounds (beep) with c++

How to make the hardware beep sound with c++? Thanks..

Dynamically create checkbox with JQuery from text input

In my cms I have a checkbox group for categories. I would like to have a text input below that where the user can input the name of a new category and it will dynamically add a new checkbox with the p..

Highcharts - how to have a chart with dynamic height?

I want to have a chart that resizes with the browser window, but the problem is that the height is fixed to 400px. This JSFiddle example has the same problem. How can I do that? I tried using the cha..

validate a dropdownlist in mvc

//in controller ViewBag.Categories = categoryRepository.GetAllCategories().ToList(); //in view @Html.DropDownList("Cat", new SelectList(ViewBag.Categories,"ID", "CategoryName")) How can I make it ..

Trying Gradle build - "Task 'build' not found in root project"

I just started to read "Pro Spring MVC with web flow" and it comes with a code sample that I want to follow. What I want - I want to build the applications as it's done in the book, using Gradle Wh..

phpMyAdmin Error: The mbstring extension is missing. Please check your PHP configuration

I have a problem running phpMyAdmin. When I try to access phpMyAdmin in my browser, I get the error message: "The mbstring extension is missing. Please check your PHP configuration." I have already s..

Listing all permutations of a string/integer

A common task in programming interviews (not from my experience of interviews though) is to take a string or an integer and list every possible permutation. Is there an example of how this is done an..

The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value

I have the following code in my HomeController: public ActionResult Edit(int id) { var ArticleToEdit = (from m in _db.ArticleSet where m.storyId == id select m).First(); return View(ArticleTo..

Jquery - How to make $.post() use contentType=application/json?

I've noticed that when using $.post() in jquery that the default contentType is application/x-www-form-urlencoded - when my mvc code needs to have contentType=application/json (See this quest..

Just disable scroll not hide it?

I'm trying to disable the html/body scrollbar of the parent while I'm using a lightbox. The main word here is disable. I do not want to hide it with overflow: hidden;. The reason for this is that ove..

SQL Statement with multiple SETs and WHEREs

I am wondering if this is a valid query: UPDATE table SET ID = 111111259 WHERE ID = 2555 AND SET ID = 111111261 WHERE ID = 2724 AND SET ID = 111111263 WHERE ID = 2021 AND SET ID = 111111264 W..

React-router urls don't work when refreshing or writing manually

I'm using React-router and it works fine while I'm clicking on link buttons, but when I refresh my webpage it does not load what I want. For instance, I am in localhost/joblist and everything is fine..

How to define a default value for "input type=text" without using attribute 'value'?

I need to give a default value for input type=text field as follows: <input type="text" size="32" value="" name="fee" /> There is one way to give this default value as I know: <input type..

How do I add a ToolTip to a control?

I would like to display a ToolTip for when the mouse is hovering over a control. How does one create a tooltip in code, but also in the designer?..

How to set the LDFLAGS in CMakeLists.txt?

I set the CFLAGS in CMake by CMAKE_C_FLAGS. Is something like this to set LDFLAGS?..

Starting a shell in the Docker Alpine container

To start an interactive shell for the Ubuntu image we can run: ole@T:~$ docker run -it --rm ubuntu root@1a6721e1fb64:/# ls bin boot dev etc home lib lib64 media mnt opt proc root run sbi..

Convert 4 bytes to int

I'm reading a binary file like this: InputStream in = new FileInputStream( file ); byte[] buffer = new byte[1024]; while( ( ) > -1 ) { int a = // ??? } What I want to do it t..

Decimal values in SQL for dividing results

In SQL, I have col1 and col2. Both are integers. I want to do like: select col1/col2 from tbl1 I get the result 1 where col1=3 and col2=2 The result I want is 1.1 I put round(col1/col2,2). The r..

How to clear all input fields in a specific div with jQuery?

I am trying to use jQuery to do a simple thing: clear the input fields of a group of input field within a div whenever the form loads, or if the user changes a picklist; but I'm having a devil of a ti..

How can I convert string to double in C++?

How can I convert string to double in C++? I want a function that returns 0 when the string is not numerical...

How do I automatically update a timestamp in PostgreSQL

I want the code to be able to automatically update the time stamp when a new row is inserted as I can do in MySQL using CURRENT_TIMESTAMP. How will I be able to achieve this in PostgreSQL? CREATE TA..

Converting NSString to NSDate (and back again)

How would I convert an NSString like "01/02/10" (meaning 1st February 2010) into an NSDate? And how could I turn the NSDate back into a string?..

How to reduce a huge excel file

I have a small and simple file in *.XLS with only one sheet, on this sheet just many cells with small text on number. (file size 24Kb) But I made a lot of changes, copy and paste, extend formula, sav..

Java Date vs Calendar

Could someone please advise the current "best practice" around Date and Calendar types. When writing new code, is it best to always favour Calendar over Date, or are there circumstances where Date is..

Aren't Python strings immutable? Then why does a + " " + b work?

My understanding was that Python strings are immutable. I tried the following code: a = "Dog" b = "eats" c = "treats" print a, b, c # Dog eats treats print a + " " + b + " " + c # Dog eats treats ..

TypeScript and React - children type?

I have a very simple functional component as follows: import * as React from 'react'; export interface AuxProps { children: React.ReactNode } const aux = (props: AuxProps) => props.child..

How to find elements by class

I'm having trouble parsing HTML elements with "class" attribute using Beautifulsoup. The code looks like this soup = BeautifulSoup(sdata) mydivs = soup.findAll('div') for div in mydivs: if (div[..

How do I create a comma delimited string from an ArrayList?

I'm storing an ArrayList of Ids in a processing script that I want to spit out as a comma delimited list for output to the debug log. Is there a way I can get this easily without looping through thing..

How to fix Subversion lock error

How do you fix the Subversion/Subclipse error "Attempted to lock an already-locked dir"? Googling shows people routinely encounter this error, and the only solution I've seen posted is to run Subclip..

HttpContext.Current.Session is null when routing requests

Without routing, HttpContext.Current.Session is there so I know that the StateServer is working. When I route my requests, HttpContext.Current.Session is null in the routed page. I am using .NET 3.5 s..

Jenkins Host key verification failed

I have a problem with jenkins, setting "git", shows the following error: Failed to connect to repository : Command "git ls-remote -h https://[email protected]/person/projectmarket.git HEAD" return..

How to use a filter in a controller?

I have written a filter function which will return data based on the argument you are passing. I want the same functionality in my controller. Is it possible to reuse the filter function in a controll..

How to use responsive background image in css3 in bootstrap

I dont want to use html tag. This is my css. I am using bootstrap 3.0. background:url('images/ip-box.png')no-repeat; background-size:100%; height: 140px; display:block; padding:0 !important; margin:..

How to use struct timeval to get the execution time?

After reading this article about elapsed time, I wrote a simple code to calculate the execution time of a loop: #include <stdio.h> #include <sys/time.h> int main (int argc, char** argv) ..

Django template how to look up a dictionary value with a variable

mydict = {"key1":"value1", "key2":"value2"} The regular way to lookup a dictionary value in a Django template is {{ mydict.key1 }}, {{ mydict.key2 }}. What if the key is a loop variable? ie: {% fo..

How to increase Maximum Upload size in cPanel?

I am using cPanel of my website to increase maximum upload file size for wordpress media uploads. I have used the codes(found out from google) for this purpose wp-config.php, .htaccess but nothing is ..

An example of how to use getopts in bash

I want to call myscript file in this way: $ ./myscript -s 45 -p any_string or $ ./myscript -h #should display help $ ./myscript #should display help My requirements are: getopt here to ge..

How to get date representing the first day of a month?

I need functionality in a script that will enable me to insert dates into a table. What SQL do I need to insert a date of the format 01/08/2010 00:00:00 where the date is the first day of the curr..

Does Android keep the .apk files? if so where?

After android installs an application from the Marketplace, does it keep the .apk file? Is there a standard location where Android would keep such files?..

What is the correct way to start a mongod service on linux / OS X?

I've installed mongodb and have been able to run it, work with it, do simple DB read / write type stuff. Now I'm trying to set up my Mac to run mongod as a service. I get "Command not found" in resp..

What is the difference between '@' and '=' in directive scope in AngularJS?

I've read the AngularJS documentation on the topic carefully, and then fiddled around with a directive. Here's the fiddle. And here are some relevant snippets: From the HTML: <pane bi-title="ti..

How to remove old and unused Docker images

When running Docker for a long time, there are a lot of images in system. How can I remove all unused Docker images at once safety to free up the storage? In addition, I also want to remove images pu..

Smart cast to 'Type' is impossible, because 'variable' is a mutable property that could have been changed by this time

And the Kotlin newbie asks, "why won't the following code compile?": var left: Node? = null fun show() { if (left != null) { queue.add(left) // ERROR HERE } } Smart ca..

How to listen to route changes in react router v4?

I have a couple of buttons that acts as routes. Everytime the route is changed, I want to make sure the button that is active changes. Is there a way to listen to route changes in react router v4?..

Embedding SVG into ReactJS

Is is possible to embed SVG markup into a ReactJS component? render: function() { return ( <span> <svg version="1.1" id="Layer_1" xmlns="" xmln ... ..

How do I set the figure title and axes labels font size in Matplotlib?

I am creating a figure in Matplotlib like this: from matplotlib import pyplot as plt fig = plt.figure() plt.plot(data) fig.suptitle('test title') plt.xlabel('xlabel') plt.ylabel('ylabel') fig.savefi..

How permission can be checked at runtime without throwing SecurityException?

I design a function that may get/set a resource from SD and if not found from sd then take it from Asset and if possible write the asset back to SD This function may check by method invocation if SD i..

Create mysql table directly from CSV file using the CSV Storage engine?

I just learned that MySQL has a native CSV storage engine which stores data in a Comma-Separated-Value file per table. Is it possible to create a table directly from a uploaded CSV file, something li..

What's a decent SFTP command-line client for windows?

Most of the windows SFTP clients (like FileZilla) seem to be GUI-based. I need something I can call from batch files...

Visual Studio Code pylint: Unable to import 'protorpc'

I'm using pylint in Visual Studio Code to develop a Google App Engine (GAE) Cloud Endpoint API in Python. I'm unable to resolve a lint error. I don't know what's causing the error, but at a guess, pyl..

Count number of occurrences of a pattern in a file (even on same line)

When searching for number of occurrences of a string in a file, I generally use: grep pattern file | wc -l However, this only finds one occurrence per line, because of the way grep works. How can I..

How to enable native resolution for apps on iPhone 6 and 6 Plus?

Xcode 6 GM now includes simulators for iPhone 6 and 6 Plus, and by default they run apps in a scaled mode. To enable the new screen size I tried adding [email protected] which seems to do a part of..

ORA-00060: deadlock detected while waiting for resource

I have a series of scripts running in parallel as a nohup on an AIX server hosting oracle 10g. These scripts are written by somebody else and are meant to be executed concurrently. All the scripts are..

java.lang.NoClassDefFoundError: Could not initialize class XXX

public class PropHolder { public static Properties prop; static { //code for loading properties from file } } // Referencing the class somewhere else: Properties prop = PropHolder.prop; ..

How to open existing project in Eclipse

I kind of feel stupid, but I just can't get it to work.... I have an existing Android project copied from my other pc, in the folder c:\projects\trunk\android\emergency (I created that project on ..

How to unzip a file using the command line?

Which commands can be used via the command line to unzip a file? Preferably something built into Windows or open source/free tools...

What are the most common font-sizes for H1-H6 tags

I've always been unsure of where to start as a general best practice baseline. Yes, I know it depends on your design, but what's most common? Here's what I currently have as a starter: h1 { font-size:..

How to pause in C?

I am a beginner of C. I run the C program, but the window closes too fast before I can see anything. How can I pause the window?..

Error: Specified cast is not valid. (SqlManagerUI)

I have a backup from database in SQL Server 2008 R2. When I want to restore this backup to SQL Server, I get this error: "Error: Specified cast is not valid. (SqlManagerUI)" How to I resolve this erro..

Running Facebook application on localhost

I am planning to connect to Facebook chat from my localhost. I will need to get the session key from Facebook. When I give the site URL as localhost:8080 or ip-address:8080 it does not work. I read ..

javascript: detect scroll end

I have a div layer with overflow set to scroll. When scrolled to the bottom of the div, I wanna run a function. ..

What is the opposite of evt.preventDefault();

Once I've fired an evt.preventDefault(), how can I resume default actions again?..

Applying a single font to an entire website with CSS

I want to use a single font named "Algerian" across my whole website. So, I need to change all HTML tags and I don't want to write different code for different tags like: button{font-family:Algerian..

What exactly is \r in C language?

#include <stdio.h> int main() { int countch=0; int countwd=1; printf("Enter your sentence in lowercase: "); char ch='a'; while(ch!='\r') { ch=getche(); if(ch==' ') co..

How to load a text file into a Hive table stored as sequence files

I have a hive table stored as a sequencefile. I need to load a text file into this table. How do I load the data into this table?..

Basic communication between two fragments

I have one activity - MainActivity. Within this activity I have two fragments, both of which I created declaratively within the xml. I am trying to pass the String of text input by the user into Fra..

What is the purpose of wrapping whole Javascript files in anonymous functions like “(function(){ … })()”?

I have been reading a lot of Javascript lately and I have been noticing that the whole file is wrapped like the following in the .js files to be imported. (function() { ... code ... })()..

Does Hibernate create tables in the database automatically

Upon reading this (archived) tutorial, they have not mentioned anything over creating tables in the DB. Does the Hibernate handle it automatically by creating tables and fields once i specify them. He..

Largest and smallest number in an array

This works perfectly...but when I use foreach instead of for this doesn't works. I can't understand for and foreach are same. namespace ConsoleApplication2 { class Program { static vo..

How to append multiple values to a list in Python

I am trying to figure out how to append multiple values to a list in Python. I know there are few methods to do so, such as manually input the values, or put the append operation in a for loop, or the..

How to get all properties values of a JavaScript Object (without knowing the keys)?

If there is a JavaScript object: var objects={...}; Suppose, it has more than 50 properties, without knowing the property names (that's without knowing the 'keys') how to get each property value in a..

Cannot get Kerberos service ticket: KrbException: Server not found in Kerberos database (7)

I'm developing using the GSSAPI, and I have code which works with a vanilla MIT Kerberos 5 server to do some client/server work. I'm now verifying it's functionality against Active Directory and I've ..

How to install SQL Server Management Studio 2012 (SSMS) Express?

I just installed SQL Server 2012 Express, I can connect with database from VS2012RC. Database is working :) I use Win7 SP1 64bit. I download program from page I choose ENU\x64\SQLManagementStudio_x..

AngularJS: Basic example to use authentication in Single Page Application

I am new to AngularJS and gone through their tutorial and got a feel for it. I have a backend for my project ready where each of the REST endpoints needs to be authenticated. What I want to do a.) I..

How is a JavaScript hash map implemented?

I currently work with OpenLayers and have a huge set of data to draw into a vector layer (greater than 100000 vectors). I'm now trying to put all these vectors into a JavaScript hash map to analyze t..

How to pass variable number of arguments to printf/sprintf

I have a class that holds an "error" function that will format some text. I want to accept a variable number of arguments and then format them using printf. Example: class MyClass { public: voi..

How to get jSON response into variable from a jquery script

I am having trouble with my jquery script below, this is a basic stripped down version and even it will not work, I have the php file that the jquery script makes a call to, I have it set to encode a..

ASP.NET page life cycle explanation

I was asked to explain the ASP.NET page life cycle in an interview some time back. I did explain it to him, but he was not satisfied with my answer. Could someone explain the life cycle to me please?..

How can I use NSError in my iPhone App?

I am working on catching errors in my app, and I am looking into using NSError. I am slightly confused about how to use it, and how to populate it. Could someone provide an example on how I populate..

Docker Compose wait for container X before starting Y

I am using rabbitmq and a simple python sample from here together with docker-compose. My problem is that I need to wait for rabbitmq to be fully started. From what I searched so far, I don't know how..

What are named pipes?

What are they and how do they work? Context happens to be SQL Server..

The target ... overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig

I have incorporate SpatialIite into a Xcode project which uses a header file from Proj.4, just one header. Both are Xcode projects and have static targets. I'm trying to migrate from git submodule to..

How to git clone a specific tag

From git-clone(1) Manual Page --branch can also take tags and detaches the HEAD at that commit in the resulting repository. I tried git clone --branch <tag_name> <repo_url> But ..

What is the difference between user and kernel modes in operating systems?

What are the differences between User Mode and Kernel Mode, why and how do you activate either of them, and what are their use cases?..

How to set scope property with ng-init?

I am trying to set the value of a $scope property using ng-init, and I am unable to access that value in the controller's javascript. What am I doing wrong? Here is a fiddle:

OnclientClick and OnClick is not working at the same time?

I have a button like the following, <asp:Button ID="pagerLeftButton" runat="server" OnClientClick="disable(this)" onclick="pager_Left_Click" Text="<" /> When I use my button like that, onc..

How to make sure you don't get WCF Faulted state exception?

I am getting this exception: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state. The WCF service us..

Get Row Index on Rowcommand event

I have an GridView: <asp:TemplateField HeaderText="View Faktor" ShowHeader="False" Visible="True"> <ItemTemplate> <asp:ImageButton ID="imgBtn1" CssClass="SelectRow"..

How to get the Mongo database specified in connection string in C#

I would like to connect to the database specified in the connection string, without specifying it again in GetDatabase. For example, if I have a connection string like this; mongodb://localhost/myd..

With Twitter Bootstrap, how can I customize the h1 text color of one page and leave the other pages to be default?

On my index page, I want the h1 text color to be white and comes with shadow, but I don't want to change the default behavior the h1 on other pages. How can I achieve this?..

Postgres error on insert - ERROR: invalid byte sequence for encoding "UTF8": 0x00

I get the following error when inserting data from mysql into postgres. Do I have to manually remove all null characters from my input data? Is there a way to get postgres to do this for me? ERROR: ..

How to Correctly handle Weak Self in Swift Blocks with Arguments

In my TextViewTableViewCell, I have a variable to keep track of a block and a configure method where the block is passed in and assigned. Here is my TextViewTableViewCell class: // // TextViewTable..

Real mouse position in canvas

I'm trying to draw with the mouse over a HTML5 canvas, but the only way that it seems to work well is if the canvas is in the position 0,0 (upper left corner) if I change the canvas position, for some..

In C can a long printf statement be broken up into multiple lines?

I have the following statement: printf("name: %s\targs: %s\tvalue %d\tarraysize %d\n", sp->name, sp->args, sp->value, sp->arraysize); I want to break it up. I tried the following but i..

PHP pass variable to include

I'm trying to pass a variable into an include file. My host changed PHP version and now whatever solution I try doesn't work. I think I've tried every option I could find. I'm sure it's the simplest ..

How can I strip HTML tags from a string in ASP.NET?

Using ASP.NET, how can I strip the HTML tags from a given string reliably (i.e. not using regex)? I am looking for something like PHP's strip_tags. Example: <ul><li>Hello</li></ul..

Custom Listview Adapter with filter Android

Please am trying to implement a filter on my listview. But whenever the text change, the list disappears.Please Help Here are my codes. The adapter class. package com.talagbe.schymn; import java.ut..

Is there a way to add a gif to a Markdown file?

I want to add this gif to a GitHub flavored markdown file. If it can't be done in GitHub, is it possible to do it in another version of markdown?..

dropping infinite values from dataframes in pandas?

what is the quickest/simplest way to drop nan and inf/-inf values from a pandas DataFrame without resetting mode.use_inf_as_null? I'd like to be able to use the subset and how arguments of dropna, exc..

Change class on mouseover in directive

I am having trouble working out how to get a class to change on a nested directive. This is the outer ng-repeat <div data-courseoverview data-ng-repeat="course in courses | orderBy:sortOrder | fi..

Select first and last row from grouped data

Question Using dplyr, how do I select the top and bottom observations/rows of grouped data in one statement? Data & Example Given a data frame df <- data.frame(id=c(1,1,1,2,2,2,3,3,3), ..

Get full query string in C# ASP.NET

As a PHP programmer I'm used to using $_GET to retrieve the HTTP query string... and if I need the whole string, theres loads of ways to do it. In ASP however, I can't seem to get the query. Here i..

How to select a specific node with LINQ-to-XML

I can select the first customer node and change its company name with the code below. But how do I select customer node where ID=2? XDocument xmldoc = new XDocument( new XDeclaration("1...

Can lambda functions be templated?

In C++11, is there a way to template a lambda function? Or is it inherently too specific to be templated? I understand that I can define a classic templated class/functor instead, but the question is..

Alphabet range in Python

Instead of making a list of alphabet characters like this: alpha = ['a', 'b', 'c', 'd'.........'z'] is there any way that we can group it to a range or something? For example, for numbers it can be..

Referring to a table in LaTeX

How can you refer to a table number such that you get Table 7 for instance? Sample data Table \ref{table:questions} lorem lorem ipsun. \begin{table} \label{table:questions} \begin{tabular}{| p{5cm}..

How can I reorder my divs using only CSS?

Given a template where the HTML cannot be modified because of other requirements, how is it possible to display (rearrange) a div above another div when they are not in that order in the HTML? Both di..

How to read a text file from server using JavaScript?

On the server, there is a text file. Using JavaScript on the client, I want to be able to read this file and process it. The format of the file on the server cannot be changed. How can I get the cont..

mysql error 1364 Field doesn't have a default values

My table looks like create table try ( name varchar(8), CREATED_BY varchar(40) not null); and then I have a trigger to auto populate the CREATED_BY field create trigger autoPopulateAtInsert BEFOR..

PHP regular expressions: No ending delimiter '^' found in

I've been having some trouble with regular expressions. This is my code $pattern = "^([0-9]+)$"; if (preg_match($pattern, $input)) echo "yes"; else echo "nope"; I run it and get: Warni..

Global variables in AngularJS

I have a problem where i'm initialising a variable on the scope in a controller. Then it gets changed in another controller when a user logs in. This variable is used to control things such as the nav..

What is RSS and VSZ in Linux memory management

What are RSS and VSZ in Linux memory management? In a multithreaded environment how can both of these can be managed and tracked?..

How to make a drop down list in yii2?

How to make a dropdown in yii2 using an activeform and a model? Since all the methods has changed in yii2,how it is done in the new one?..

HttpClient won't import in Android Studio

I have a simple class written in Android Studio: package com.mysite.myapp; import org.apache.http.client.HttpClient; public class Whatever { public void headBangingAgainstTheWallExample () { ..

How Do I Convert an Integer to a String in Excel VBA?

How do I convert the integer value "45" into the string value "45" in Excel VBA?..

Android: Proper Way to use onBackPressed() with Toast

I wrote a piece of code that will give the user a prompt asking them to press back again if they would like to exit. I currently have my code working to an extent but I know it is written poorly and I..

How to access global variables

How do I access a variable that was declared/init in my main.go in a different .go package/file? Keeps telling me that the variable is undefined (I know that global variables are bad but this is just ..

accessing a file using [NSBundle mainBundle] pathForResource: ofType:inDirectory:

I have a file paylines.txt added inside the folder named TextFiles which resides inside the Resources folder of my iOS project in Xcode. This is the code I use to access the file: NSString* filePath..

In C# check that filename is *possibly* valid (not that it exists)

Is there a method in the System.IO namespace that checks the validity of a filename? For example, C:\foo\bar would validate and :"~-* would not Or a little trickier, X:\foo\bar would validate is the..

How to register multiple servlets in web.xml in one Spring application

I want to define two servlets in my Spring web.xml - one for the application html/jsp pages, and one for a web service that will be called by an external application. Here is the web.xml: <servle..

How to create Select List for Country and States/province in MVC

Hi I am new to MVC and even asp.. I want to create a form in MVC. With the help of some examples I am able to create TextBoxes, but I now I don't understand how to create Select List./ I tried sear..

Why is "except: pass" a bad programming practice?

I often see comments on other Stack Overflow questions about how the use of except: pass is discouraged. Why is this bad? Sometimes I just don't care what the errors are and I want to just continue wi..

Touch move getting stuck Ignored attempt to cancel a touchmove

I'm messing around with touch events on a touch slider and I keep getting the following error: Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling i..

Split array into chunks

Let's say that I have an Javascript array looking as following: ["Element 1","Element 2","Element 3",...]; // with close to a hundred elements. What approach would be appropriate to chunk (split)..

C++ multiline string literal

Is there any way to have multi-line plain-text, constant literals in C++, à la Perl? Maybe some parsing trick with #includeing a file? I can't think of one, but boy, that would be nice. I know it'll ..

Can grep show only words that match search pattern?

Is there a way to make grep output "words" from files that match the search expression? If I want to find all the instances of, say, "th" in a number of files, I can do: grep "th" * but the output..

PHP cURL custom headers

I'm wondering if/how you can add custom headers to a cURL HTTP request in PHP. I'm trying to emulate how iTunes grabs artwork and it uses these non-standard headers: X-Apple-Tz: 0 X-Apple-Store-Front..

Change the Bootstrap Modal effect

I found this Demo , The demo have a pretty effect, I wonder if any one have way to apply this demos to be easy to use with bootstrap Modal specially the first one (Fade In & Scale)..

Converting newline formatting from Mac to Windows

I need a conversion utility/script that will convert a .sql dump file generated on Mac to one readable on Windows. This is a continuation of a problem I had here. The issue seems to be with newline ..

How to declare a structure in a header that is to be used by multiple files in c?

If I have a source.c file with a struct: struct a { int i; struct b { int j; } }; How can this struct be used in another file (i.e. func.c)? Should I create a new header file,..

Measure string size in Bytes in php

I am doing a real estate feed for a portal and it is telling me the max length of a string should be 20,000 bytes (20kb), but I have never run across this before. How can I measure byte size of a var..

What are file descriptors, explained in simple terms?

What would be a more simplified description of file descriptors compared to Wikipedia's? Why are they required? Say, take shell processes as an example and how does it apply for it? Does a process ta..

Meaning of @classmethod and @staticmethod for beginner?

Could someone explain to me the meaning of @classmethod and @staticmethod in python? I need to know the difference and the meaning. As far as I understand, @classmethod tells a class that it's a met..

How to draw a graph in PHP?

Hey I want to draw a graph(Stdent mark distribution) in my site based on PHP. How can I do this?..

javascript find and remove object in array based on key value

I have been trying several approaches on how to find an object in an array, where ID = var, and if found, remove the object from the array and return the new array of objects. Data: [ {"id":"88"..

Wampserver icon not going green fully, mysql services not starting up?

I'm running an application on localhost, it's been running successfully for at least a year now, but suddenly today wampserver isn't starting up. Whenever I rightclick on the taskbar icon and "start a..

Get a random item from a JavaScript array

var items = Array(523, 3452, 334, 31, ..., 5346); How do I get random item from items?..

Sass calculate percent minus px

I want to be able to do the following: height: 25% - 5px; Obviously when I do that I get the error: Incompatible units: 'px' and '%'. ..

How to customize an end time for a YouTube video?

I'm trying to figure out how I can specify a custom end time for an embedded YouTube video. I know that I can customize the start time by adding &start=30, but I haven't seen anything relating to ..

nodejs mysql Error: Connection lost The server closed the connection

when I use node mysql, an error is appear between 12:00 to 2:00 that the TCP connection is shutdown by the server. This is the full message: Error: Connection lost: The server closed the connection. ..

How to make the background DIV only transparent using CSS

I am using CSS attrubutes : filter: alpha(opacity=90); opacity: .9; to make the DIV transparent, but when I add another DIV inside this DIV it makes it transparent also. I want to make ..

Vue.js unknown custom element

I'm a beginner with Vue.js and I'm trying to create an app that caters my daily tasks and I ran into Vue Components. So below is what I've tried but unfortunately, it gives me this error: vue.js:1..

How do I publish a UDP Port on Docker?

How do I forward a UDP port from my Docker container to the host machine?..

Java Multiple Inheritance

In an attempt to fully understand how to solve Java's multiple inheritance problems I have a classic question that I need clarified. Lets say I have class Animal this has sub classes Bird and Horse a..

Command CompileSwift failed with a nonzero exit code in Xcode 10

Good afternoon, After updating to the latest version of Xcode at the moment (version 10.0) the project is unable to build because it found some errors regarding some "Command CompileSwift failed with..

Artisan, creating tables in database

I am trying to create mysql tables in Laravel 5. I created a file in /project/database/migrations called users.php: [...] public function up() { Schema::create('users', function(Blueprint $table)..

Customizing the template within a Directive

I have a form that is using markup from Bootstrap, like the following: <form class="form-horizontal"> <fieldset> <legend>Legend text</legend> <div class="control-..

Joining two lists together

If I have two lists of type string (or any other type), what is a quick way of joining the two lists? The order should stay the same. Duplicates should be removed (though every item in both links are..

Regex: match everything but specific pattern

I need a regex able to match everything but a string starting with a specific pattern (specifically index.php and what follows, like index.php?id=2342343)..

How to use classes from .jar files?

I read the Java tutorials on Sun for JAR files, but I still can't find a solution for my problem. I need to use a class from a jar file called jtwitter.jar, I downloaded the file, and tried executing ..

X11/Xlib.h not found in Ubuntu

I'm trying to write a rather trivial program using open gl on linux, but at a compile time it says: Compile thumb : egl <= cuberenderer.c In file included from /path/include/egl.h:36, ..

How to prevent a dialog from closing when a button is clicked

I have a dialog with EditText for input. When I click the "yes" button on dialog, it will validate the input and then close the dialog. However, if the input is wrong, I want to remain in the same dia..

Execute Insert command and return inserted Id in Sql

I am inserting some values into a SQL table using C# in MVC 4. Actually, I want to insert values and return the 'ID' of last inserted record. I use the following code. public class MemberBasicData { ..

enable/disable zoom in Android WebView

There are some methods in WebSettings related to zoom: WebSettings.setSupportZoom WebSettings.setBuiltInZoomControls I noticed they work differently on some devices. For example, on my Galaxy S pi..

java.lang.ClassNotFoundException: HttpServletRequest

I just got tomcat 7.0.27. I have kept the time to start tomcat 45sec. Also it was running fine with older version on tomcat. but running it I get the following error : SEVERE: A child container fail..

Convert integer to binary in C#

How to convert an integer number into its binary representation? I'm using this code: String input = "8"; String output = Convert.ToInt32(input, 2).ToString(); But it throws an exception: Coul..

Could not load file or assembly or one of its dependencies. Access is denied. The issue is random, but after it happens once, it continues

I have found plenty of information out there about this error: 'ERROR: Could not load file or assembly '*.dll' or one of its dependencies. Access is denied.’ But i haven't found answer specific to ..

SQL Error: ORA-00936: missing expression

Qns: Item Description and the treatment date of all treatments for any patients named Jessie Stange (ie GivenName is Jessie & FamilyName is Stange) What I wrote: SELECT DISTINCT Description, Da..

An "and" operator for an "if" statement in Bash

I'm trying to create a simple Bash script to check if the website is down and for some reason the "and" operator doesn't work: #!/usr/bin/env bash SUBJECT="$WEBSITE DOWN!" EMAILID..

How to do something to each file in a directory with a batch script

How do you iterate over each file in a directory with a .bat or .cmd file? For simplicity please provide an answer that just echoes the filename or file path...

What is the difference between an expression and a statement in Python?

In Python, what is the difference between expressions and statements?..

How to parseInt in Angular.js

Probably, it is the simplest thing but I couldn't parse a string to Int in angular.. What I am trying to do: <input type="text" ng-model="num1"> <input type="text" ng-model="num2"> Tota..

Permutation of array

For example I have this array: int a[] = new int[]{3,4,6,2,1}; I need list of all permutations such that if one is like this, {3,2,1,4,6}, others must not be the same. I know that if the length of..

Bootstrap 4 responsive tables won't take up 100% width

I am building a web app using Bootstrap 4 and running into some weird issues. I want to utilize Bootstrap's table-responsive class to allow horizontal scrolling of the tables on mobile devices. On ..

Detect Windows version in .net

How can I detect the Windows OS versions in .net? What code can I use?..

No WebApplicationContext found: no ContextLoaderListener registered?

I'm trying to create a simple Spring 3 application and have the following files. Please tell me the reason for this error Below is my web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app..

How to implement the Java comparable interface?

I am not sure how to implement a comparable interface into my abstract class. I have the following example code that I am using to try and get my head around it: public class Animal{ public Stri..

In HTML I can make a checkmark with &#x2713; . Is there a corresponding X-mark?

Is there a corresponding X mark to ✓ (&#x2713;)? What is it?..

How do files get into the External Dependencies in Visual Studio C++?

I wonder why one of my projects has VDSERR.h listed under "External Dependencies" and another hasn't and gives me an "undefined symbol" compiler error about a symbol which is defin..

Bootstrap dropdown not working

I can't make bootstrap dropdown to work. Here is my html for nav: <ul class='nav'> <li class='active'>Home</li> <li class='dropdown'> <a class="dropdown-toggle" da..

Change mysql user password using command line

I'm trying to update the password for a database user using the command line, and it's not working for me. This is the code I'm using: mysql> UPDATE user SET password=PASSWORD($w0rdf1sh) WHERE use..

no such file to load -- rubygems (LoadError)

I recently installed rails in fedora 12. I'm new to linux as well. Everything works fine on Windows 7. But I'm facing lot of problems in linux. Help please! I've installed all the essentials to my kn..

Huge performance difference when using group by vs distinct

I am performing some tests on a HSQLDB server with a table containing 500 000 entries. The table has no indices. There are 5000 distinct business keys. I need a list of them. Naturally I started with ..

Efficient way to remove keys with empty strings from a dict

I have a dict and would like to remove all the keys for which there are empty value strings. metadata = {u'Composite:PreviewImage': u'(Binary data 101973 bytes)', u'EXIF:CFAPattern2': u''..

Difference between innerText, innerHTML and value?

What is the difference between innerHTML, innerText and value in JavaScript?..

Making HTML page zoom by default

I've designed a page, where buttons look good when the browser zoom is at 90%, but by default other users view it at 100/125%+ in their browser which is resulting an overlap in buttons and input forms..

How to lazy load images in ListView in Android

I am using a ListView to display some images and captions associated with those images. I am getting the images from the Internet. Is there a way to lazy load images so while the text displays, the UI..