Questions Tagged with #Dynamic text

jQuery append text inside of an existing paragraph tag

I am trying to add additional text to the end of a paragraph using jQuery. My thought was to produce a structure like this: Judging by my answers I will clarify. I need to create this structure first..

How to analyse the heap dump using jmap in java

I am creating heap dump using below command: jmap -dump:file=DumpFile.txt <process-id> I have opened the generated file - DumpFile.txt but it is not in readable format. So please let me know ..

Save file Javascript with file name

I'm working on a text editor in pure Javascript. I'd like it so that when the user clicks the 'Save' button, the editor downloads the file. I've already got this partly working: uriContent = "data:ap..

What is the difference between LATERAL and a subquery in PostgreSQL?

Since Postgres came out with the ability to do LATERAL joins, I've been reading up on it, since I currently do complex data dumps for my team with lots of inefficient subqueries that make the overall ..

How do I parse a URL query parameters, in Javascript?

Possible Duplicate: Use the get paramater of the url in javascript How can I get query string values in JavaScript? In Javascript, how can I get the parameters of a URL string (not the cu..

How to check if matching text is found in a string in Lua?

I need to make a conditional that is true if a particular matching text is found at least once in a string of text, e.g.: str = "This is some text containing the word tiger." if string.match(str, "ti..

Extract file name from path, no matter what the os/path format

Which Python library can I use to extract filenames from paths, no matter what the operating system or path format could be? For example, I'd like all of these paths to return me c: a/b/c/ a/b/c \a\..

Remove the legend on a matplotlib figure

To add a legend to a matplotlib plot, one simply runs legend(). How to remove a legend from a plot? (The closest I came to this is to run legend([]) in order to empty the legend from data. But that ..

Getting time elapsed in Objective-C

I need to get the time elapsed between two events, for example, the appearance of a UIView and the user's first reaction. How can I achieve it in Objective-C?..

How to do exponential and logarithmic curve fitting in Python? I found only polynomial fitting

I have a set of data and I want to compare which line describes it best (polynomials of different orders, exponential or logarithmic). I use Python and Numpy and for polynomial fitting there is a fun..

Removing body margin in CSS

I'm new to web development, and met a problem when removing margin of body. There's space between the very top of the browser and "logo" text. And my code is here on jsbin. Is body { margin: 0;} w..

Get latest from Git branch

I cloned something from git repository, and switched branch git clone ssh://11.21.3.12:23211/dir1/dir2 dir git branch branch1 I did some modification in my local, and committed it. And somebody els..

How can I check if an array contains a specific value in php?

I have a PHP variable of type Array and I would like find out if it contains a specific value and let the user know that it is there. This is my array: Array ( [0] => kitchen [1] => bedroom [2]..

How to use Chrome's network debugger with redirects

The Chrome network debugger gives me a great view of all the HTTP resources loaded for a page. But it clears the list whenever a new top-level HTML page is loaded. This makes it very difficult to deb..

Entity Framework code-first: migration fails with update-database, forces unneccessary(?) add-migration

I have a funny effect using migration (EF 5.0) and code-first: I created some models with GUID primary keys. (BTW: It is important for me, that SQL Server uses NEWSEQUENTIALID(), which seems to be th..

Bash mkdir and subfolders

Why I can't do something like this? mkdir folder/subfolder/ in order to achive this I have to do: mkdir folder cd folder mkdir subfolder Is there a better way to do it?..

How do I add a Font Awesome icon to input field?

How do I use the search icon included in Font Awesome for input? I have a search feature on my site (based on PHPmotion), that I want to use for the search. Here's the code: <div id="search-bar"..

Remove characters from NSString?

NSString *myString = @"A B C D E F G"; I want to remove the spaces, so the new string would be "ABCDEFG"...

Error on renaming database in SQL Server 2008 R2

I am using this query to rename the database: ALTER DATABASE BOSEVIKRAM MODIFY NAME = [BOSEVIKRAM_Deleted] But it shows an error when excuting: Msg 5030, Level 16, State 2, Line 1 The databas..

How do you convert a C++ string to an int?

Possible Duplicate: How to parse a string to an int in C++? How do you convert a C++ string to an int? Assume you are expecting the string to have actual numbers in it ("1", "345", "38944"..

String or binary data would be truncated. The statement has been terminated

I have met some problem with the SQL server, this is the function I created: ALTER FUNCTION [dbo].[testing1](@price int) RETURNS @trackingItems1 TABLE ( item nvarchar NULL, warehouse n..

Returning a file to View/Download in ASP.NET MVC

I'm encountering a problem sending files stored in a database back to the user in ASP.NET MVC. What I want is a view listing two links, one to view the file and let the mimetype sent to the browser de..

jQuery or JavaScript auto click

How can I auto click on the link on page load? I have been trying for ages but id does not work. <link rel="stylesheet" type="text/css" href="leightbox.css" /> <script type="text/javascript"..

Responsive image align center bootstrap 3

I do a catalog using Bootstrap 3. When displayed on tablets, the product images look ugly because of their small size (500x500) and a width of 767 pixels in the browser. I want to put the image in the..

Best way to check function arguments?

I'm looking for an efficient way to check variables of a Python function. For example, I'd like to check arguments type and value. Is there a module for this? Or should I use something like decorators..

jQuery - find child with a specific class

I am trying to write code to search all children for a div that has a specific class. The DIV does not have an ID. Here is the HTML I will be using. <div class="outerBUBGDiv"> <div class="..

How to change the scrollbar color using css

My jsfiddle is here I trying to change the color of the scrollbar but here it is not working. Css: .flexcroll { scrollbar-face-color: #367CD2; scrollbar-shadow-color: #FFFFFF; scrol..

Bootstrap tooltips not working

I'm going mad here. I've got the following HTML: <a href="#" rel="tooltip" title="A nice tooltip">test</a> And the Bootstrap style tooltip refuses to display, just a normal tooltip. ..

How to substring in jquery

How can I use jquery on the client side to substring "nameGorge" and remove "name" so it outputs just "Gorge"? var name = "nameGorge"; //output Gorge ..

How to monitor network calls made from iOS Simulator

I am trying to monitor calls from an app to my server just like Firebug does. I could not find a way to see that in iOS Simulator or in xCode. Is there a way to do that without sniffing all the traff..

Email address validation using ASP.NET MVC data type attributes

I have some problems with the validation of a Email. In my Model: [Required(ErrorMessage = "Field can't be empty")] [DataType(DataType.EmailAddress, ErrorMessage = "E-mail is not valid")] public str..

How to change the status bar background color and text color on iOS 7?

My current application runs on iOS 5 and 6. The navigation bar is having an orange color and the status bar is having a black background color with white text color. However, when I run the same app..

Disable building workspace process in Eclipse

What is Eclipse doing when building workspace process is running? Can i disable it because it is taking a long time to complete and i dont know if it is necessary. Thank you..

How do I get a file's last modified time in Perl?

Suppose I have a filehandle $fh. I can check its existence with -e $fh or its file size with -s $fh or a slew of additional information about the file. How can I get its last modified time stamp?..

Unable to get provider com.google.firebase.provider.FirebaseInitProvider

I am testing the new Crash tool: https://firebase.google.com/docs/crash/ After going through the steps, the app launches and it crashes saying: 05-18 17:28:18.870 28743 28743 E AndroidRuntime: java...

How to fix corrupted git repository?

I tried cloning my repository which I keep on my Ubuntu one folder to a new machine and I got this: christopher@christopher-laptop:~/source/personal$ git clone ~/Ubuntu\ One\ Side\ Work/projects.git/..

How to conditionally take action if FINDSTR fails to find a string

I have a batch file as follows; CD C:\MyFolder findstr /c:"stringToCheck" fileToCheck.bat IF NOT XCOPY "C:\OtherFolder\fileToCheck.bat" "C:\MyFolder" /s /y I am getting an error ("C:\OtherFolder\fi..

font-family is inherit. How to find out the font-family in chrome developer pane?

In the Chrome's developer pane, I can see these css settings of an element. As far as I can see, every single font-family value is inherit. How can I find what is the actual value of the font fam..

Check substring exists in a string in C

I'm trying to check whether a string contains a substring in C like: char *sent = "this is my sample example"; char *word = "sample"; if (/* sentence contains word */) { /* .. */ } What is some..

jQuery val is undefined?

I have this code: <input type="hidden" id="editorTitle" name="title" value="home"> <textarea name="text" id="editorText"></textarea> But when i write $('#editorTitle').val() and $..

Where should I put the CSS and Javascript code in an HTML webpage?

While designing a webpage, where should I put the following code? <link rel=stylesheet type="text/css" href="css/layout.css"> Should I put it in the <head> or should I put it in the <..

In Python, how do I index a list with another list?

I would like to index a list with another list like this L = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'] Idx = [0, 3, 7] T = L[ Idx ] and T should end up being a list containing ['a', 'd', 'h']. Is t..

PHP, pass array through POST

Which is the most secure way to send an array through POST? foreach ($id as $array) { <input type="hidden" name="prova[]" value="<?php echo $array; ?>"/> } <input type="submit" name="s..

Rename Oracle Table or View

What is the syntax to rename a table or view in Oracle? ..

Resize font-size according to div size

It is made of 9 boxes, with the middle on has text it in. I've made it so the boxes so they will resize with the screen resize so it will remain in the same place all the time. The text, however, doe..

How to do date/time comparison

Is there any options in doing date comparison in Go? I have to sort data based on date and time - independently. So I might allow an object that occurs within a range of dates so long as it also occur..

How to write character & in android strings.xml

I wrote the following in the strings.xml file: <string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string> I got the following error: The reference to entity "Dr..

Repeat a task with a time delay?

I have a variable in my code say it is "status". I want to display some text in the application depending on this variable value. This has to be done with a specific time delay. It's like, Check ..

How to display Woocommerce product price by ID number on a custom page?

I'm trying to display a price of a product in Woocommerce, on a custom page. There is a short code for that, but it gives product price and also adds an "Add to cart button", I don't want the button, ..

POSTing JSON to URL via WebClient in C#

I have some JavaScript code that I need to convert to C#. My JavaScript code POSTs some JSON to a web service that's been created. This JavaScript code works fine and looks like the following: var vm..

Initialize 2D array

I am trying to initialize a 2D array, in which the type of each element is char. So far, I can only initialize this array in the follow way. public class ticTacToe { private char[][] table; publi..

CAML query with nested ANDs and ORs for multiple fields

I am working on proof-of-concept code to dynamically generate CAML based on keywords provided to a highly-specific search web service that I am writing. I am not using the SharePoint-provided search w..

Dynamically add data to a javascript map

Is there a way I can dynamically add data to a map in javascript. A map.put(key,value)? I am using the yui libraries for javascript, but didn't see anything there to support this. ..

Spring @Transactional read-only propagation

I'm experimenting with using the command pattern to allow my web layer to work with Hibernate entities within the context of a single transaction (thus avoiding lazy loading exceptions). I am, however..

Return different type of data from a method in java?

public static void main(String args[]) { myMethod(); // i am calling static method from main() } . public static ? myMethod(){ // ? = what should be the return type return value;// is Stri..

Reading integers from binary file in Python

I'm trying to read a BMP file in Python. I know the first two bytes indicate the BMP firm. The next 4 bytes are the file size. When I execute: fin = open("hi.bmp", "rb") firm = fin.read(2) file_si..

IIS7 URL Redirection from root to sub directory

I am using Windows Server 2008 with IIS7. I need to redirect the users who come to www.mysite.com to wwww.mysite.com/menu_1/MainScreen.aspx. Here is the file structure I have for the projects: -Sites..

Kill detached screen session

I learned from somewhere a detached screen can be killed by screen -X -S [session # you want to kill] kill where [session # you want to kill] can be gotten from screen -ls But this doesn't work...

Difference between System.DateTime.Now and System.DateTime.Today

Can anyone explain the difference between System.DateTime.Now and System.DateTime.Today in C#.NET? Pros and cons of each if possible...

The endpoint reference (EPR) for the Operation not found is

I have been struggling with the following error the last couple of days can you please help! I generated my server and client code using the wsdl2java tool from a wsdl 2.0 file. When invoking the web..

How to set background image in Java?

I am developing a simple platform game using Java using BlueJ as the IDE. Right now I have player/enemy sprites, platforms and other items in the game drawn using polygons and simple shapes. Eventuall..

JSON Array iteration in Android/Java

I am building an android app that needs to download and synchronise with an online database, I am sending my query from the app to a php page which returns the relevant rows from a database in JSON fo..

How can I programmatically invoke an onclick() event from a anchor tag while keeping the ‘this’ reference in the onclick function?

The following doesn't work... (at least not in Firefox: document.getElementById('linkid').click() is not a function) <script type="text/javascript"> function doOnClick() { document...

jQuery add text to span within a div

<div id="tagscloud"> <span></span> </div> How would I do to add some text within the span like code below ? <span>**tag cloud**</span> Edit: actually the..

Angular2 multiple router-outlet in the same template

Is it possible to have multiple router-outlet in the same template? If yes then how to configure the routes? I am using angular2 beta...

Change form size at runtime in C#

How can I change window form size at runtime? I saw examples, but every one requires Form.Size property. This property can be set like here: http://msdn.microsoft.com/en-us/library/25w4thew.aspx#Y456..

Any way to return PHP `json_encode` with encode UTF-8 and not Unicode?

Any way to return PHP json_encode with encode UTF-8 and not Unicode? $arr=array('a'=>'á'); echo json_encode($arr); mb_internal_encoding('UTF-8');and $arr=array_map('utf8_encode',$arr); does not..

Django - "no module named django.core.management"

I get the following error when trying to run Django from the command line. File manage.py, line 8, in <module>      from django.core.management import execute_from_command_line ImportError:..

How to see the values of a table variable at debug time in T-SQL?

Can we see the values (rows and cells) in a table valued variable in SQL Server Management Studio (SSMS) during debug time? If yes, how? ..

SQL query to select dates between two dates

I have a start_date and end_date. I want to get the list of dates in between these two dates. Can anyone help me pointing the mistake in my query. select Date,TotalAllowance from Calculation where ..

Jquery - animate height toggle

I have a 10px bar along the top of the screen that, when clicked, I want it to animate to a height of 40px and then if clicked again, animate back down to 10px. I tried changing the id of the div, but..

In Linux, how to tell how much memory processes are using?

I think I may have a memory leak in my LAMP application (memory gets used up, swap starts getting used, etc.). If I could see how much memory the various processes are using, it might help me resolve ..

How to center HTML5 Videos?

I'm just messing around with some HTML5, and I was trying to center a video on the page. For some reason I can't get it to center. I've tried to add a class to the video tag itself, and I've wrapped t..

Getting the Facebook like/share count for a given URL

I'm using the Facebook API to get the like/share count for given URLs. The strange thing is that it seems to be quite inconsistent in returning results. For example, this page returns results: https..

How do I diff the same file between two different commits on the same branch?

In Git, how could I compare the same file between two different commits (not contiguous) on the same branch (master for example)? I'm searching for a compare feature like the one in Visual SourceSafe..

How to format LocalDate to string?

I have a LocalDate variable called date,when I print it displays 1988-05-05 I need to convert this to be printed as 05.May 1988.How to do this?..

iPhone: How to get current milliseconds?

What is the best way to get the current system time milliseconds?..

Spark : how to run spark file from spark shell

I am using CDH 5.2. I am able to use spark-shell to run the commands. How can I run the file(file.spark) which contain spark commands. Is there any way to run/compile the scala programs in CDH 5..

GridView Hide Column by code

I want to hide ID column in my GridView, I knew the code GridView1.Columns[0].Visible = false; but the surprise was that my count property for my GridView columns is 0 !!! while I can see data in ..

Regular expression to match any character being repeated more than 10 times

I'm looking for a simple regular expression to match the same character being repeated more than 10 or so times. So for example, if I have a document littered with horizontal lines: =================..

Add Legend to Seaborn point plot

I am plotting multiple dataframes as point plot using seaborn. Also I am plotting all the dataframes on the same axis. How would I add legend to the plot ? My code takes each of the dataframe and p..

A cron job for rails: best practices?

What's the best way to run scheduled tasks in a Rails environment? Script/runner? Rake? I would like to run the task every few minutes...

Custom CSS Scrollbar for Firefox

I want to customize a scrollbar with CSS. I use this WebKit CSS code, which works well for Safari and Chrome: ::-webkit-scrollbar { width: 15px; height: 15px; } ::-webkit-scrollbar-track-pi..

Android Studio doesn't start, fails saying components not installed

I have installed Latest version of Android studio from Google. After launching it, it tries to download some packages. After a while it shows the following error. The following SDK components wer..

NodeJS / Express: what is "app.use"?

In the docs for the NodeJS express module, the example code has app.use(...). What is the use function and where is it defined?..

What is the maximum characters for the NVARCHAR(MAX)?

I have declared a column of type NVARCHAR(MAX) in SQL Server 2008, what would be its exact maximum characters having the MAX as the length?..

Kill a Process by Looking up the Port being used by it from a .BAT

In Windows what can look for port 8080 and try to kill the process it is using through a .BAT file?..

How to scroll to top of long ScrollView layout?

For part of my app, the user is presented with a list of names and is asked to group them as they see fit. (Note, the ListView code was copied verbatim from the Android Views tutorial. I haven't ye..

Tomcat - maxThreads vs maxConnections

In Tomcat server.xml what is maxThreads versus maxConnections I understand that maxConnections is the number of connections open to the server And maxThreads is the maximum number of request process..

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() <..

JavaScript to scroll long page to DIV

I have a link on a long HTML page. When I click it, I wish a div on another part of the page to be visible in the window by scrolling into view. A bit like EnsureVisible in other languages. I've ch..

Best practice for using assert?

Is there a performance or code maintenance issue with using assert as part of the standard code instead of using it just for debugging purposes? Is assert x >= 0, 'x is less than zero' better ..

How can I get the behavior of GNU's readlink -f on a Mac?

On Linux, the readlink utility accepts an option -f that follows additional links. This doesn't seem to work on Mac and possibly BSD based systems. What would the equivalent be? Here's some debug inf..

Fluid or fixed grid system, in responsive design, based on Twitter Bootstrap

I'm getting confused about the various options in the twitter bootstrap grid, and how they go together. To begin with, you can have an ordinary fixed container, or a container-fluid. Then either o..

How to find children of nodes using BeautifulSoup

I want to get all the <a> tags which are children of <li>: <div> <li class="test"> <a>link1</a> <ul> <li> <a>link2<..

Java rounding up to an int using Math.ceil

int total = (int) Math.ceil(157/32); Why does it still return 4? 157/32 = 4.90625, I need to round up, I've looked around and this seems to be the right method. I tried total as double type, but ge..

Could not load file or assembly '***.dll' or one of its dependencies

I have this dll that I created a long time ago and use to connect to the db of a specific software that I develop for. I have had no issues for well over 4 years and countless applications with this d..

Chain-calling parent initialisers in python

Consider this - a base class A, class B inheriting from A, class C inheriting from B. What is a generic way to call a parent class initialiser in an initialiser? If this still sounds too vague, here's..

Multiprocessing vs Threading Python

I am trying to understand the advantages of multiprocessing over threading. I know that multiprocessing gets around the Global Interpreter Lock, but what other advantages are there, and can threading ..

How to draw a graph in LaTeX?

First of all, let me say I'm using LyX, though I have no problem using ERT. Secondly, what is the most simplest way to draw a simple graph like this in Latex? I've seen some documents with graphs and..

How to redirect output of an already running process

Normally I would start a command like longcommand &; I know you can redirect it by doing something like longcommand > /dev/null; for instance to get rid of the output or longcommand 2&g..

ObservableCollection Doesn't support AddRange method, so I get notified for each item added, besides what about INotifyCollectionChanging?

I want to be able to add a range and get updated for the entire bulk. I also want to be able to cancel the action before it's done (i.e. collection changing besides the 'changed'). Related Q Which..

How to format number of decimal places in wpf using style/template?

I am writing a WPF program and I am trying to figure out a way to format data in a TextBox through some repeatable method like a style or template. I have a lot of TextBoxes (95 to be exact) and each ..

Match exact string

What is the regular expression (in JavaScript if it matters) to only match if the text is an exact match? That is, there should be no extra characters at other end of the string. For example, if I'm ..

Convert this string to datetime

Possible Duplicate: PHP: Convert uncommon date format to timestamp in most efficient manner possible? How to convert this string to datetime format? 06/Oct/2011:19:00:02 I tried this but i..

Java: Reading a file into an array

I have a file (called "number.txt") which I want to read to an array in Java. How exactly do I go ahead and do this? It is a straight-forward "1-dimensional" file, containing 100 numbers. The problem..

How to filter an array of objects based on values in an inner array with jq?

Given this input: [ { "Id": "cb94e7a42732b598ad18a8f27454a886c1aa8bbba6167646d8f064cd86191e2b", "Names": [ "condescending_jones", "loving_hoover" ] }, { "Id": "186db..

Go to particular revision

I cloned a git repository of a certain project. Can I turn the files to the initial state and when I review the files go to revision 2, 3, 4 ... most recent? I'd like to have an overview of how the pr..

Redeploy alternatives to JRebel

JRebel allows for newly compiled code to be redeployed without restarting the application. I am wondering if there are any alternative (free?). The FAQ page answers this question, but I am sure it'..

How to add a recyclerView inside another recyclerView

I'm planning to develop an app that shows some dynamic data inside a recyclerCardView. So i decided add a recyclerView called CheckBoxRecyclerView inside my main recyclerView. This is my code for my a..

How do I give PHP write access to a directory?

I'm trying to use PHP to create a file, but it isn't working. I am assuming this is because it doesn't have write access (it's always been the problem before). I tried to test if this was the problem ..

php refresh current page?

I have a page which, If a variable is set(in a session) it will do an action, then it unsets the session. Now it has to refresh itself. This is where i am stuck. Is there a way to get the exact ur..

.gitignore after commit

I have a git repository hosted on Github. After committing many files, I am realizing that I need to create .gitignore and exclude .exe, .obj files. However, will it automatically remove these commit..

Twitter Bootstrap - how to center elements horizontally or vertically

is there any way to center html elements vertically or horizontally inside the main parents?..

Array.Add vs +=

I've found some interesting behaviour in PowerShell Arrays, namely, if I declare an array as: $array = @() And then try to add items to it using the $array.Add("item") method, I receive the followi..

What does localhost:8080 mean?

What is the difference between localhost/web vs. localhost:8080/web?..

Installing and Running MongoDB on OSX

If someone can provide some insights here I would GREATLY appreciate it. I am new to MongoDB, and (relatively) new to the command line. I had a express/node.js app running on MongoDB locally succe..

PHP Fatal error: Uncaught exception 'Exception'

I'm playing around with exceptions in PHP. For example, I have a script that reads a $_GET request and loads a file; If the file doesn't exists, an new exception should be thrown: if ( file_exists( $..

How to view transaction logs in SQL Server 2008

I need to view the transaction logs of a database on SQL Server 2008 in order to find a delete transaction and hopefully roll it back. Unfortunately I have no clue where to start, and I'm finding it ..

How to run Java program in command prompt

I created a Java project to call a Web service. It has one Main java file and another class file. I have used some jar files for HTTP client. In Eclipse it runs fine. I need to run the Java program in..

Login to Microsoft SQL Server Error: 18456

I am getting this error while trying to connect to the SQL Server. Microsoft SQL Server Error: 18456 Can anybody tell me what the error code means?..

SQL Server: Importing database from .mdf?

I have an .mdf file on my local box. I have SQL Server 2008 Express and SQL Management Studio 2008 Express installed on my local box. How in the world do I import this .mdf file as a new database in..

Getting error: ISO C++ forbids declaration of with no type

I'm getting the following errors: ISO C++ forbids declaration of ttTreeInsert with no type ISO C++ forbids declaration of ttTreeDelete with no type ISO C++ forbids declaration of ttTreePrint with no ..

Unexpected token }

I have a script to open a model window.. Chrome gives me "Uncaught SyntaxError: Unexpected token }" on a line that doesn't even have a closing curly brace. Here is the portion of the script that has ..

How to write an ArrayList of Strings into a text file?

I want to write an ArrayList<String> into a text file. The ArrayList is created with the code: ArrayList arr = new ArrayList(); StringTokenizer st = new StringTokenizer( line, ":Mode set..

Make div (height) occupy parent remaining height

http://jsfiddle.net/S8g4E/ I have a container div with two children. The first child has a given height. How can I make the second child to occupy the "free space" of the container div without giving..

The relationship could not be changed because one or more of the foreign-key properties is non-nullable

I am getting this error when I GetById() on an entity and then set the collection of child entities to my new list which comes from the MVC view. The operation failed: The relationship could not..

How do I clear all options in a dropdown box?

My code works in IE but breaks in Safari, Firefox, and Opera. (big surprise) document.getElementById("DropList").options.length=0; After searching, I've learned that it's the length=0 that it doesn..

JSON library for C#

Does Microsoft provide any library to work with JSON in C#? If not, what open source library do you recommend?..

Use of for_each on map elements

I have a map where I'd like to perform a call on every data type object member function. I yet know how to do this on any sequence but, is it possible to do it on an associative container? The closes..

Interface/enum listing standard mime-type constants

I am looking among the standard libraries (like apache commons, jax, jboss, javax) for an interface or enum that lists the values of all the standard mime-type (aka content-type). This interface shou..

How to deploy correctly when using Composer's develop / production switch?

Composer has the option to load several dependencies only while being in development, so the tools will not be installed in production (on the live server). This is (in theory) very handy for scripts ..

Best way to log POST data in Apache?

Imagine you have a site API that accepts data in the form of GET requests with parameters, or as POST requests (say, with standard url-encoded, &-separated POST data). If you want to log and anal..

Determine if two rectangles overlap each other?

I am trying to write a C++ program that takes the following inputs from the user to construct rectangles (between 2 and 5): height, width, x-pos, y-pos. All of these rectangles will exist parallel to ..

AngularJS directive does not update on scope variable changes

I've tried to write a small directive, to wrap its contents with another template file. This code: <layout name="Default">My cool content</layout> Should have this output: <div cla..

What's a standard way to do a no-op in python?

I often find myself writing if / elif / else constructs in python, and I want to include options which can occur, but for which the corresponding action is to do nothing. I realise I could just exclud..

Remove Elements from a HashSet while Iterating

So, if I try to remove elements from a Java HashSet while iterating, I get a ConcurrentModificationException. What is the best way to remove a subset of the elements from a HashSet as in the followin..

memory error in python

Traceback (most recent call last): File "/run-1341144766-1067082874/solution.py", line 27, in main() File "/run-1341144766-1067082874/solution.py", line 11, in main if len(s[i:j+1]) > 0: MemoryErr..

SQL Server - Adding a string to a text column (concat equivalent)

How do you add a string to a column in SQL Server? UPDATE [myTable] SET [myText]=' '+[myText] That doesn't work: The data types varchar and text are incompatible in the add operator. You woul..

php, mysql - Too many connections to database error

Good day to all. I have an odd error. I have created a chat that works like this: questions/answers are inserted into a db every 2 seconds an ajax request is sent to a php script that fetch the new..

How to use the toString method in Java?

Can anybody explain to me the concept of the toString() method, defined in the Object class? How is it used, and what is its purpose?..

How do I iterate through lines in an external file with shell?

Possible Duplicate: Looping through the content of a file in Bash? I have one file with a list of names. I need to loop through all names in this file from an external file with a shell sc..

How do I include image files in Django templates?

I'm new to Django and I'm trying to learn it through a simple project I'm developing called 'dubliners' and an app called 'book'. The directory structure is like this: dubliners/book/ [includes mode..

What is the difference between Java RMI and RPC?

What is the actual difference between Java RMI and RPC? I have read in some places that RMI uses Objects?..

Parsing JSON using Json.net

I'm trying to parse some JSON using the JSon.Net library. The documentation seems a little sparse and I'm confused as to how to accomplish what I need. Here is the format for the JSON I need to pars..

In PowerShell, how can I test if a variable holds a numeric value?

In PowerShell, how can I test if a variable holds a numeric value? Currently, I'm trying to do it like this, but it always seems to return false. add-type -Language CSharpVersion3 @' public clas..

Is it possible to change the content HTML5 alert messages?

Is it possible to control HTML5 alert messages? when adding 'required' to an input field. because I want it to be specific and I don't want it's language to depend on the browsers. <input id="ans..

Concat strings by & and + in VB.Net

Is there any difference between & and + operators while concatenating string? if yes, then what is difference? And if No, then why below code generating exception? Example: Dim s, s1, t As S..

How do I fix an "Invalid license data. Reinstall is required." error in Visual C# 2010 Express?

I've tried to install Visual C# 2010 Express edition onto my PC, but whenever I try to run it, I get a error message. Invalid license data. Reinstall is required. I've already tried reinstalling..

Webpack.config how to just copy the index.html to the dist folder

I am trying to automate assets going into /dist. I have the following config.js: module.exports = { context: __dirname + "/lib", entry: { main: [ "./baa.ts" ] ..

Using await outside of an async function

I was attempting to chain two async functions together, because the first had a conditional return parameter that caused the second to either run, or exit the module. However, I've found odd behavior ..

How to import an existing directory into Eclipse?

I am on a mac, but I don't think it will make a difference. I have a directory that I want to fully import/add into Eclipse. What I did is this: Right click import General → Existing Projects ..

How to programmatically tell if a Bluetooth device is connected?

I understand how to get a list of paired devices but how can I tell if they are connected? It must be possible since I see them listed in my phone's Bluetooth device list and it states their connect..

How can I read an input string of unknown length?

If I don't know how long the word is, I cannot write char m[6];, The length of the word is maybe ten or twenty long. How can I use scanf to get input from the keyboard? #include <stdio.h> int m..

What's the foolproof way to tell which version(s) of .NET are installed on a production Windows Server?

This question is not so much programming related as it is deployment related. I find myself conversing a lot with the group in my company whose job it is to maintain our production Windows servers an..

How can I run multiple npm scripts in parallel?

In my package.json I have these two scripts: "scripts": { "start-watch": "nodemon run-babel index.js", "wp-server": "webpack-dev-server", } I have to run these 2 scripts in parallel eve..

jQuery - add additional parameters on submit (NOT ajax)

Using jQuery's 'submit' - is there a way to pass additional parameters to a form? I am NOT looking to do this with Ajax - this is normal, refresh-typical form submission. $('#submit').click(function ..

Python Dictionary Comprehension

Is it possible to create a dictionary comprehension in Python (for the keys)? Without list comprehensions, you can use something like this: l = [] for n in range(1, 11): l.append(n) We can sho..

How to select only date from a DATETIME field in MySQL?

I have a table in the MySQL database that is set up with DATETIME. I need to SELECT in this table only by DATE and excluding the time. How do I SELECT in this table by only date and bypassing the time..

Push commits to another branch

Is it possible to commit and push changes from one branch to another. Assume I commited changes in BRANCH1 and want to push them to BRANCH2. From BRANCH1, is it valid to do: git push origin **BRANC..

npm throws error without sudo

I just installed node and npm through the package on nodejs.org and whenever I try to search or install something with npm it throws the following error, unless I sudo the command. I have a feeling t..

Colorplot of 2D array matplotlib

So, I thought this was going to be really simple, but I've been having a lot of difficult finding exactly what I'm looking for in a comprehensible example. Basically I want to make phase plots, so as..

How do you see the entire command history in interactive Python?

I'm working on the default python interpreter on Mac OS X, and I Cmd+K (cleared) my earlier commands. I can go through them one by one using the arrow keys. But is there an option like the --history o..

Excluding files/directories from Gulp task

I have a gulp rjs task that concatenates and uglifies all my custom .JS files (any non vendor libraries). What i am trying to do, is exclude some files/directories from this task (controllers and dir..

How to split strings over multiple lines in Bash?

How can i split my long string constant over multiple lines? I realize that you can do this: echo "continuation \ lines" >continuation lines However, if you have indented code, it doesn'..

Vue is not defined

I am trying to build a demo app with Vue.js. What I am getting is an odd error that Vue is not defined. <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> ..

How to disable scientific notation?

I have a dataframe with a column of p-values and I want to make a selection on these p-values. > pvalues_anova [1] 9.693919e-01 9.781728e-01 9.918415e-01 9.716883e-01 1.667183e-02 [6] 9.952762e-0..

Headers and client library minor version mismatch

In PHP I'm getting the following warning whenever I try to connect to a database (via mysql_connect) Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50162 Libr..

Permission denied at hdfs

I am new to hadoop distributed file system, I have done complete installation of hadoop single node on my machine.but after that when i am going to upload data to hdfs it give an error message Permiss..

How to print matched regex pattern using awk?

Using awk, I need to find a word in a file that matches a regex pattern. I only want to print the word matched with the pattern. So if in the line, I have: xxx yyy zzz And pattern: /yyy/ I wa..

After submitting a POST form open a new window showing the result

JavaScript post request like a form submit shows you how to submit a form that you create via POST in JavaScript. Below is my modified code. var form = document.createElement("form"); form.setAttrib..

Getting time and date from timestamp with php

in my database I have a time stamp column...which reflects a format like this: 2012-04-02 02:57:54 However I would like to separate them up into $date and $time. after some research through the php ..

Understanding the order() function

I'm trying to understand how the order() function works. I was under the impression that it returned a permutation of indices, which when sorted, would sort the original vector. For instance, > ..

Warning:No JDK specified for module 'Myproject'.when run my project in Android studio

When I run my project, I found module is error then I click in found a error "Warning:No JDK specified for module 'Myproject'.when run my project.",vI setting JAVA_HOME and JDK_HOME in my path.hope A..

Reading rather large json files in Python

Possible Duplicate: Is there a memory efficient and fast way to load big json files in python? So I have some rather large json encoded files. The smallest is 300MB, but this is by far the ..

swift 3.0 Data to String?

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {} I want deviceToken to string but: let str = String.init(data: deviceToken, enc..

How to get all possible combinations of a list’s elements?

I have a list with 15 numbers in, and I need to write some code that produces all 32,768 combinations of those numbers. I've found some code (by Googling) that apparently does what I'm looking for, ..

File URL "Not allowed to load local resource" in the Internet Browser

I've got a major brainteaser. I want to open a file in classic ASP. I'm using various variables because things can change but the outcome is correct. I know this because I've tested the outcome by co..

Move layouts up when soft keyboard is shown?

I have a few elements in a RelativeView with the align bottom attribute set, when the soft keyboard comes up the elements are hidden by the soft keyboard. I would like them to move up so that if ther..

How to commit changes to a new branch

I just made changes to a branch. How can I commit the changes to the other branch? I am trying to use: git checkout "the commmit to the changed branch" -b "the other branch" However, I don't think..

Scala how can I count the number of occurrences in a list

val list = List(1,2,4,2,4,7,3,2,4) I want to implement it like this: list.count(2) (returns 3)...

How to avoid the "Windows Defender SmartScreen prevented an unrecognized app from starting warning"

My company distributes an installer to customers via our website. Recently when I download via the website and try to run the installer I get the warning message: Windows protected your PC Windows De..

Most Pythonic way to provide global configuration variables in config.py?

In my endless quest in over-complicating simple stuff, I am researching the most 'Pythonic' way to provide global configuration variables inside the typical 'config.py' found in Python egg packages. ..

How to find whether MySQL is installed in Red Hat?

I am currently using Red Hat linux. I just want to find out whether MySQL is installed in that system. If yes where is it located? can anyone help please.....

In a Git repository, how to properly rename a directory?

I think it should work to copy the directory to be renamed to a new directory with desired name, and delete the old directory, and git add, git commit and push everything. But is this the best way?..

Java null check why use == instead of .equals()

In Java I am told that when doing a null check one should use == instead of .equals(). What are the reasons for this?..

How to round a floating point number up to a certain decimal place?

Suppose I have 8.8333333333333339, and I want to convert it to 8.84. How can I accomplish this in Python? round(8.8333333333333339, 2) gives 8.83 and not 8.84. I am new to Python or programming in ge..

Cursor inside cursor

Main problem is about changing the index of rows to 1,2,3.. where contact-id and type is the same. but all columns can contain exactly the same data because of some ex-employee messed up and update al..

How can I draw circle through XML Drawable - Android?

I'm trying to draw circle with the help of XML file in android, but circle is not displaying properly. Below code is showing Oval. How can I create circle in XML file. <shape xmlns:android="http:/..

Powershell folder size of folders without listing Subdirectories

I have found several resources that use the following script to get folder sizes $colItems = (Get-ChildItem $startFolder -recurse | Where-Object {$_.PSIsContainer -eq $True} | Sort-Object) foreach ($..

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 github.com/examplesite/..

Why does Firebug say toFixed() is not a function?

I am using jQuery 1.7.2 and jQuery UI 1.9.1. I am using the code below within a slider. (http://jqueryui.com/slider/) I have a function that should test two values and depending on the difference bet..

Must declare the scalar variable

I wrote this SQL in a stored procedure but not working, declare @tableName varchar(max) = 'TblTest' declare @col1Name varchar(max) = 'VALUE1' declare @col2Name varchar(max) = 'VALUE2' declare @value1..

PHP Header redirect not working

include('header.php'); $name = $_POST['name']; $score = $_POST['score']; $dept = $_POST['dept']; $MyDB->prep("INSERT INTO demo (`id`,`name`,`score`,`dept`, `date`) VALUES ('','$name','$score','$d..

getElementsByClassName not working

I coded a php page that displays information from a mysql database neatly into tables. I would like to hide empty table rows with an onLoad event handler. Here is a sample table with code that hides ..

Foreign Key Django Model

I'm trying to create 3 models ; Person, Address and Anniversy. The plan is to have one address and one anniversy for each person. But each address and anniversy can have multiple persons. So far I ha..

Test if a string contains any of the strings from an array

How do I test a string to see if it contains any of the strings from an array? Instead of using if (string.contains(item1) || string.contains(item2) || string.contains(item3)) ..

What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?

While converting a project that used SlimDX, and therefore has unmanaged code, to .NET 4.0 I ran into the following error: Mixed mode assembly is built against version 'v2.0.50727' of the runtime ..

What's the difference between xsd:include and xsd:import?

What's the difference between xsd:include and xsd:import? When would you use one instead of the other, and when might it not matter?..

In Python, how do you convert seconds since epoch to a `datetime` object?

The time module can be initialized using seconds since epoch: >>> import time >>> t1=time.gmtime(1284286794) >>> t1 time.struct_time(tm_year=2010, tm_mon=9, tm_mday=12, tm_..

How to check if activity is in foreground or in visible background?

I have a splash screen on a timer. My problem is that before I finish() my activity I need to check that the next activity has started because a system dialogue box pops-up and I only want to finish()..