Questions Tagged with #Event routing

jQuery `.is(":visible")` not working in Chrome

if ($("#makespan").is(":visible") == true) { var make = $("#make").val(); } else { var make = $("#othermake").val(); } Make:<span id=makespan><select id=make></select><..

How to obtain Signing certificate fingerprint (SHA1) for OAuth 2.0 on Android?

I'm trying to register my android app following the steps in which leads me to follow

Can't bind to 'formControl' since it isn't a known property of 'input' - Angular2 Material Autocomplete issue

I am trying to use Angular Material Autocomplete component in my Angular 2 project. I added the following to my template. <md-input-container> <input mdInput placeholder="Category" [mdAut..

Bootstrap 3 Carousel fading to new slide instead of sliding to new slide

I am using Bootstrap 3, unmodified. Here's <!-- Carousel ================================================== --> <div id="myCarousel" class="carousel slide"> <!-- Indicators --> ..

How to execute cmd commands via Java

I am trying to execute command line arguments via Java. For example: // Execute command String command = "cmd /c start cmd.exe"; Process child = Runtime.getRuntime().exec(command); // Get output str..

How to execute an SSIS package from .NET?

I have a SSIS package that eventually I would like to pass parameters too, these parameters will come from a .NET application (VB or C#) so I was curious if anyone knows of how to do this, or better y..

PHP - check if variable is undefined

Consider this Javascript statement isTouch = document.createTouch !== undefined I would like to know if we have a similar statement in PHP, not being isset() but literally checking for an undefined v..

How to put a new line into a wpf TextBlock control?

I'm fetching text from an XML file, and I'd like to insert some new lines that are interpreted by the textblock render as new lines. I've tried: <data>Foo bar baz \n baz bar</data> But..

How to clear variables in ipython?

Sometimes I rerun a script within the same ipython session and I get bad surprises when variables haven't been cleared. How do I clear all variables? And is it possible to force this somehow every tim..

Running Jupyter via command line on Windows

I have installed Jupyter on Windows 10, Python 3.x via $ pip install jupyter The installation works fine, even though I did restart the terminal. But trying to run $ jupyter notebook gives the follo..

Compiling a java program into an executable

Possible Duplicate: How do I create an .exe for a Java program? I've just made a simple program with Eclipse and I want to compile it into an executable, but simply can't seem to find out h..

Setting the selected value on a Django forms.ChoiceField

Here is the field declaration in a form: max_number = forms.ChoiceField(widget = forms.Select(), choices = ([('1','1'), ('2','2'),('3','3'), ]), initial='3', required = True,) I would like to..

Squash my last X commits together using Git

How can I squash my last X commits together into one commit using Git?..

No connection could be made because the target machine actively refused it

I'm using the WCF4.0 template -REST. I'm trying to make a method that uploads a file using a stream. The problem always occur at Stream serverStream = request.GetRequestStream(); Class for streami..

How can I fetch all items from a DynamoDB table without specifying the primary key?

I have a table called products with primary key Id. I want to select all items in the table. This is the code is I'm using: $batch_get_response = $dynamodb->batch_get_item(array( 'RequestItems..

How to choose the id generation strategy when using JPA and Hibernate

I was going through Id generation section of the Hibernate reference guide and "java persistence with Hibernate" There are quite a few options available with Hibernate and JPA combined. I was lookin..

How to correctly represent a whitespace character

I wanted to know how to represent a whitespace character in C#. I found the empty string representation string.Empty. Is there anything like that that represents a whitespace character? I would like ..

Python: Open file in zip without temporarily extracting it

How can I open files in a zip archive without extracting them first? I'm using pygame. To save disk space, I have all the images zipped up. Is it possible to load a given image directly from the zip ..

mysqldump with create database line

I'm in the process of moving my files onto another computer, and one thing I would like to do is to transfer the data in my MySQL database. I want to dump the databases into .sql files, but also have ..

Add space between <li> elements

I have a nav-menu on which it seems that I can't add a space (margin: 3px;) between the <li> elements. You can see the HTML and CSS code on this jsfiddle or below. You will see that I've add..

How do I make a text go onto the next line if it overflows?

I tried word-wrap: break-word;, but it separates lines mid word...

Boolean.parseBoolean("1") = false...?

sorry to be a pain... I have: HashMap<String, String> o o.get('uses_votes'); // "1" Yet... Boolean.parseBoolean(o.get('uses_votes')); // "false" I'm guessing that ....parseBoolean doesn't ..

What are some ways of accessing Microsoft SQL Server from Linux?

We have a Windows machine running SQL Server 2005, and we need to be able to run some database queries on it from a Linux box. What are some of the recommended ways of doing this? Ideally, we would ..

Adding JPanel to JFrame

I have a program in which a JPanel is added to a JFrame: public class Test{ Test2 test = new Test2(); JFrame frame = new JFrame(); Test(){ ... frame.setLayout(new BorderLayout(..

How to see query history in SQL Server Management Studio

Is the query history stored in some log files? If yes, can you tell me how to find their location? If not, can you give me any advice on how to see it?..

How to catch an Exception from a thread

I have Java main class, in the class, I start a new thread, in the main, it waits until the thread dies. At some moment, I throw a runtime exception from the thread, but I can't catch the exception th..

JavaScript closure inside loops – simple practical example

_x000D_ _x000D_ var funcs = []; // let's create 3 functions for (var i = 0; i < 3; i++) { // and store them in funcs funcs[i] = function() { // each should log its value. console.log("M..

How to get values from selected row in DataGrid for Windows Form Application?

Title is pretty self-explanatory. I've got a DataGrid for a Windows Form Application, and I want to be able to store the values of a selected row. What is the easiest way to go about doing this? I ..

What should I set JAVA_HOME environment variable on macOS X 10.6?

Many Java applications that use shell scripts to configure their environment use the JAVA_HOME environment variable to start the correct version of Java, locate JRE JARs, and so on. In macOS X 10.6, ..

How to do integer division in javascript (Getting division answer in int not float)?

Is there any function in Javascript that lets you do integer division, I mean getting division answer in int, not in floating point number. var x = 455/10; // Now x is 45.5 // Expected x to be 45 B..

Chart won't update in Excel (2007)

I have an Excel document (2007) with a chart (Clustered Column) that gets its Data Series from cells containing calculated values The calculated values never change directly, but only as a result of ..

Custom events in jQuery?

I'm looking for some input on how to implement custom eventhandling in jquery the best way. I know how to hook up events from the dom elements like 'click' etc, but I'm building a tiny javascript libr..

Wavy shape with css

I'm trying to recreate this image with CSS: I would not need it to repeat. This is what I started but it just has a straight line: _x000D_ _x000D_ #wave {_x000D_ position: absolute;_x000D_ hei..

how to install gcc on windows 7 machine?

I have MinGW on my windows 7 machine. I wish to install and use complete gcc for C compiler. I found there is no single pre-compiled ready-made installation file for this purpose. I checked the follow..

expected constructor, destructor, or type conversion before ‘(’ token

Compiling polygone.h and gives error: error: expected constructor, destructor, or type conversion before ‘(’ token Code: //polygone.h # if !defined(__POLYGONE_H__..

Cannot deserialize the current JSON array (e.g. [1,2,3])

I am trying to read my JSON result. Here is my RootObject public class RootObject { public int id { get; set; } public bool is_default { get; set; } public string name { get; set; } public int quant..

'git' is not recognized as an internal or external command

I have an installation of Git for Windows, but when I try to use the git command in Command Prompt, I get the following error: 'git' is not recognized as an internal or external command, operable pro..

The #include<iostream> exists, but I get an error: identifier "cout" is undefined. Why?

I learn C++ and COM through the books. In the IDE MS Visual Studio 2012 I have created new empty C++ project, and added some existing files to it. My CPP file contains #include<iostream> row, b..

How to make cross domain request

As you know, the security of the web browser disallows making of cross domain requests. I read a book which says that you should use XMLHTTPRequest only if you can put the files on the server (means p..

postgresql return 0 if returned value is null

I have a query that returns avg(price) select avg(price) from( select *, cume_dist() OVER (ORDER BY price desc) from web_price_scan where listing_Type='AARM' and u_kbalikepart..

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'

I just want to install to my project which is located on folder. But when I run following command it shows following Warnings.And its not created a node_modules directory inside my pr..

How do I find out if first character of a string is a number?

In Java is there a way to find out if first character of a string is a number? One way is string.startsWith("1") and do the above all the way till 9, but that seems very inefficient. ..

How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?

I have shifted myself from Eclipse to Android Studio. Now I am trying to work on my Map app. So I need my SHA-1 fingerprint certificate number. When I was using Eclipse it was right under Windows -> ..

Android studio - Failed to find target android-18

I have a problem with Android Studio 0.2.3. When I run my project the build stops and appears message that says: Gradle: Execution failed for task ':AppName:compileDebugAidl'. > failed to find ..

Reversing an Array in Java

If I have an array like this: 1 4 9 16 9 7 4 9 11 What is the best way to reverse the array so that it looks like this: 11 9 4 7 9 16 9 4 1 I have the code below, but I feel it is a little ted..

maxFileSize and acceptFileTypes in blueimp file upload plugin do not work. Why?

I'm using Blueimp jQuery file upload plugin for upload files. I had no problem in uploading but the option maxFileSize and acceptFileTypes do not work. This is my code: $(document).ready(function (..

How to define custom sort function in javascript?

I use atocomplete.jquery plugin to suggest input text, as the result I get this array: ['White 023','White','White flower', 'Teatr'] When I start to search something thats begin from te substring i..

Bootstrap 3 grid with no gap

I am trying to create a 2 column grid, with literally a 50% with no margins or padding. How do I achieve this with Bootstrap 3 I tried this but end up with negative margins at tablet/desktop break p..

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'

This is the Warning im getting in console, Im confused with this warning: Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is ..

How to install MinGW-w64 and MSYS2?

I am trying to build some open source library. I need package management system to easily download the dependencies. At first I am using MinGW+MSYS. But the included packages are limited. Someone told..

Check if two lists are equal

I have a class as follows: public class Tag { public Int32 Id { get; set; } public String Name { get; set; } } And I have two lists of tag: List<Tag> tags1; List<Tag> tags2; I us..

How to upload file to server with HTTP POST multipart/form-data?

I am developing Windows Phone 8 app. I want to upload SQLite database via PHP web service using HTTP POST request with MIME type multipart/form-data & a string data called "userid=SOME_ID". I do..

How to parse an RSS feed using JavaScript?

I need to parse an RSS feed (XML version 2.0) and display the parsed details in an HTML page...

Add comma to numbers every three digits

How can I format numbers using a comma separator every three digits using jQuery? For example: +-------------------------+ ¦ Input ¦ Output ¦ ¦-----------+-------------¦ ¦ 298 �..

Javascript window.print() in chrome, closing new window or tab instead of cancelling print leaves javascript blocked in parent window

In the application I work on, we have several different places a user can print from. In all these cases we are using the same workflow of opening a new window(or tab), writing whatever we need to pr..

How to run Conda?

I installed Anaconda and can run Python, so I assume that I installed it correctly. Following this introductory documentation, I am trying to install Python v3.3, so I am copying and pasting the follo..

New lines inside paragraph in

When editing an issue and clicking Preview the following markdown source: a b c shows every letter on a new line. However, it seems to me that pushing similar markdown source structure in README.m..

Practical uses of git reset --soft?

I have been working with git for just over a month. Indeed I have used reset for the first time only yesterday, but the soft reset still doesn't make much sense to me. I understand I can use the soft..

What does "all" stand for in a makefile?

I read some tutorials concerning Makefiles but for me it is still unclear for what the target "all" stands for and what it does. Any ideas?..

Checking that a List is not empty in Hamcrest

I was wondering if anyone knew of a way to check if a List is empty using assertThat() and Matchers? Best way I could see just use JUnit: assertFalse(list.isEmpty()); But I was hoping that there w..

How to set environment variable for everyone under my linux system?

Can I have certain settings that are universal for all my users?..

Is there a "do ... while" loop in Ruby?

I'm using this code to let the user enter in names while the program stores them in an array until they enter an empty string (they must press enter after each name): people = [] info = 'a' # must fi..

Deleting queues in RabbitMQ

I have a few queues running with RabbitMQ. A few of them are of no use now, how can I delete them? Unfortunately I had not set the auto_delete option. If I set it now, will it be deleted? Is there a..

How to retrieve JSON Data Array from ExtJS Store

Is there a method allowing me to return my stored data in an ExtJS Grid Panel exactly the way I loaded it using: var data = ["value1", "value2"] Store.loadData(data); I would like to have a user op..

Can an ASP.NET MVC controller return an Image?

Can I create a Controller that simply returns an image asset? I would like to route this logic through a controller, whenever a URL such as the following is requested:

Convert and format a Date in JSP

From my JSP Page, I am getting Date in this format. Fri May 13 2011 19:59:09 GMT 0530 (India Standard Time) How can I convert this to the pattern yyyy-MM-dd HH:mm:ss?..

How to search if dictionary value contains certain string with Python

I have a dictionary with key-value pair. My value contains strings. How can I search if a specific string exists in the dictionary and return the key that correspond to the key that contains the value..

Difference between two lists

I Have two generic list filled with CustomsObjects. I need to retrieve the difference between those two lists(Items who are in the first without the items in the second one) in a third one. I was t..

C# Switch-case string starting with

Is there any way to make a case condition in a switch statement where you say if a string begins with something? ex Switch (mystring) { case("abc")://String begins with abc (abcd or abc1 or abcz ..

When should I use nil and NULL in Objective-C?

This is sample code: NSDictionary *myDictionary = [NSDictionary dictionary]; NSNumber *myNumber = [myDictionary valueForKey: @"MyNumber"]; NSLog(@"myNumber = %@", myNumber); // output myNumber = (nul..

How to square or raise to a power (elementwise) a 2D numpy array?

I need to square a 2D numpy array (elementwise) and I have tried the following code: import numpy as np a = np.arange(4).reshape(2, 2) print a^2, '\n' print a*a that yields: [[2 3] [0 1]] [[0 1] ..

Remove/ truncate leading zeros by javascript/jquery

Suggest solution for removing or truncating leading zeros from number(any string) by javascript,jquery...

Peak detection in a 2D array

I'm helping a veterinary clinic measuring pressure under a dogs paw. I use Python for my data analysis and now I'm stuck trying to divide the paws into (anatomical) subregions. I made a 2D array of e..

CodeIgniter -> Get current URL relative to base url

Tried URI::uri_string() but can't get it to work with the base_url. URL: http://localhost/dropbox/derrek/shopredux/ahahaha/hihihi Returns: dropbox/derrek/shopredux/ahahaha/hihihi but http://localhos..

How can I see an the output of my C programs using Dev-C++?

I'm looking to follow along with The C Programming Language (Second Addition) on a machine running Vista. So far, I've found Dev-C++ the easiest IDE to do this in. However, I still have one problem. ..

Error after upgrading pip: cannot import name 'main'

Whenever I am trying to install any package using pip, I am getting this import error: guru@guru-notebook:~$ pip3 install numpy Traceback (most recent call last): File "/usr/bin/pip3", line 9, in &..

how to set select element as readonly ('disabled' doesnt pass select value on server)

When i used any of the following code ,select element do looks like disabled,but the select is not pass on the server : Im thinking of the readonly to be used, but i dont know or is that will solved t..

Java reverse an int value without using array

Can anyone explain to me how to reverse an integer without using array or String. I got this code from online, but not really understand why + input % 10 and divide again. while (input != 0) { re..

curl -GET and -X GET

Curl offers a series of different http method calls that are prefixed with a X, but also offers the same methods without. I've tried both and I can't seem to figure out the difference. Can someone exp..

What is InputStream & Output Stream? Why and when do we use them?

Someone explain to me what InputStream and OutputStream are? I am confused about the use cases for both InputStream and OutputStream. If you could also include a snippet of code to go along with you..

Convert timestamp to readable date/time PHP

I have a timestamp stored in a session (1299446702). How can I convert that to a readable date/time in PHP? I have tried srttotime, etc. to no avail...

UTL_FILE.FOPEN() procedure not accepting path for directory?

I am trying to write in a file stored in c:\ drive named vin1.txt and getting this error .Please suggest! > ERROR at line 1: ORA-29280: invalid > directory path ORA-06512: at > "SYS.UTL_FILE..

Is it possible to specify proxy credentials in your web.config?

I need to configure a website to access a webservice on another machine, via a proxy. I can configure the website to use a proxy, but I can't find a way of specifying the credentials that the proxy r..

Get a DataTable Columns DataType

DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn(gridColumn1, typeof(bool))); I was expecting the result of the below line to include info about the DataColumns Type (bool): ?dt.Co..

How does the communication between a browser and a web server take place?

Can anyone explain how the communication takes place between the browser and web server? I want to learn how GET, POST verbs (among others) cookies sessions query strings work behind the scene...

How do I make Git ignore file mode (chmod) changes?

I have a project in which I have to change the mode of files with chmod to 777 while developing, but which should not change in the main repo. Git picks up on chmod -R 777 . and marks all files as c..

How to use Google fonts in React.js?

I had built a website with React.js and webpack. I want to use Google fonts in the webpage, so I put the link in the section. Google Fonts <link href="

Couldn't process file resx due to its being in the Internet or Restricted zone or having the mark of the web on the file

I am facing an issue while debugging c# API Coding in Visual studio 2017. Debugging not started and showing a error message like Any idea about this error message? ..

Fatal error: Call to undefined function curl_init()

<?php $filename = "xx.gif"; $handle = fopen($filename, "r"); $data = fread($handle, filesize($filename)); // $data is file data $pvars = array('image' => base64_encode($data), 'key' => IMG..

Instant run in Android Studio 2.0 (how to turn off)

How to disable Instant Run in Android Studio 2.0 Preview. When I go to the settings I see it: and I can not remove the tick from "Enable Instant Run..." I use Android Studio 2.0 Preview 9, but thi..

Error TF30063: You are not authorized to access ... \DefaultCollection

I'm using TFS Preview (Team Foundation Service) with one of my projects with Visual Studio 2012. I'm also using an on-premises TFS server with most of my projects. When I use my on-premises TFS after ..

Scroll back to the top of scrollable div

<div id="containerDiv"></div> #containerDiv { position: absolute; top: 0px; width: 400px; height: 100%; padding: 5px; font-size: .875em; overflow-y: scroll; }

Adding 'serial' to existing column in Postgres

I have a small table (~30 rows) in my Postgres 9.0 database with an integer ID field (the primary key) which currently contains unique sequential integers starting at 1, but which was not created usin..

How to disable scrolling in UITableView table when the content fits on the screen

I have a few (grouped style) tables in my iphone app (only on part of the screen and added with Interface Builder though, not subclassed from UITableViewController) that 80% of the time are small and ..

Check if MySQL table exists or not

Possible Duplicate: MySQL check if a table exists without throwing an exception I have a dynamic mysql query builder in my project that creates select queries from different tables. I need ..

standard size for html newsletter template

i'm wanting to create an html newsletter template to be emailed out, however, i'm unsure of standard dimensions for it. would a 800w be good? or should i go w/ something smaller? for webpages my stan..

Add a column in a table in HIVE QL

I'm writing a code in HIVE to create a table consisting of 1300 rows and 6 columns: create table test1 as SELECT cd_screen_function, SUM(access_count) AS max_count, MIN(response_time_min) a..

How do I reflect over the members of dynamic object?

I need to get a dictionary of properties and their values from an object declared with the dynamic keyword in .NET 4? It seems using reflection for this will not work. Example: dynamic s = new Expa..

Node.js Web Application examples/tutorials

So I finished watching Douglas Crockford's excellent series on Javascript, and in the final episode (so far), loopage he lays out why Node.js is a near perfect solution for server side code. He tal..

Npm Please try using this command again as root/administrator

I've been desperately trying to install modules using node.js but it always fails getting packages with npm. I logged in as Administrator and used powershell/cmd with "run as administrator". I also h..

What does (function($) {})(jQuery); mean?

I am just starting out with writing jQuery plugins. I wrote three small plugins but I have been simply copying the line into all my plugins without actually knowing what it means. Can someone tell me ..

CSS pseudo elements in React

I'm building React components. I have added CSS inline in the components as suggested in this brilliant presentation by one of the guys behind React. I've been trying all night to find a way to add CS..

Creating a triangle with for loops

I don't seem to be able to find the answer to this- I need to draw a simple triangle using for loops. * *** ***** ******* ********* I can make a half triangle, but I don't know h..

Retrieving a Foreign Key value with django-rest-framework serializers

I'm using the django rest framework to create an API. I have the following models: class Category(models.Model): name = models.CharField(max_length=100) def __unicode__(self): retur..

Remove specific characters from a string in Python

I'm trying to remove specific characters from a string using Python. This is the code I'm using right now. Unfortunately it appears to do nothing to the string. for char in line: if char in " ?.!..

How can I get all element values from Request.Form without specifying exactly which one with .GetValues("ElementIdName")

Currently using the below code to create a string array (elements) that contains all string values from Request.Form.GetValues("ElementIdName"), the problem is that in order for this to work..

Variable that has the path to the current ansible-playbook that is executing?

Is there an ansible variable that has the absolute path to the current ansible-playbook that is executing? some context: I'm running/creating an ansible script against localhost to configure a mysql ..

Double quote string replace in C#

How to replace the below string in C# Current: "John K "GEN" Greg" The Goal: "John K \"GEN\" Greg" This is wrong because I'm not escaping it properly: s = s.Replace(""","\""); What is synta..

Uncaught TypeError: Object #<Object> has no method 'movingBoxes'

Im trying to use the movingBoxes plugin with my mvc site and it is not working (obviously). I have the movingboxes.js imported in my head tag in the site.master like so <script src="&..

If/else else if in Jquery for a condition

I am having a set of text fields where i am doing validation Say I am Having a field called "seats" this can accept value less than "99999".Meaning I should not able to enter the "99999" any thing ..

Syntax for if/else condition in SCSS mixin

Hi I'm trying to learn SASS/SCSS and am trying to refactor my own mixin for clearfix what I'd like is for the mixin to be based on whether I pass the mixin a width. thoughts so far (pseudo code only..

How to set environment variable or system property in spring tests?

I'd like to write some tests that check the XML Spring configuration of a deployed WAR. Unfortunately some beans require that some environment variables or system properties are set. How can I set an ..

How do I check if a variable exists?

I want to check if a variable exists. Now I'm doing something like this: try: myVar except NameError: # Do something. Are there other ways without exceptions?..

Bootstrap throws Uncaught Error: Bootstrap's JavaScript requires jQuery

I am trying to use Bootstrap to make an interface for a program. I added jQuery 1.11.0 to the <head> tag and thought that was that, but when I launch the web page in a browser jQuery reports an ..

Preventing scroll bars from being hidden for MacOS trackpad users in WebKit/Blink

WebKit/Blink's (Safari/Chrome) default behaviour on MacOS since 10.7 (Mac OS X Lion) is to hide scroll bars from trackpad users when they're not in use. This can be confusing; the scroll bar is often ..

how to delete files from amazon s3 bucket?

I need to write code in python that will delete the required file from an Amazon s3 bucket. I am able to connect to the Amazon s3 bucket, and also to save files, but how can I delete a file?..

Hide Twitter Bootstrap nav collapse on click

This is not a submenu dropdown, the category is class li as in the picture: By selecting a category from the responsive menu (the template is just one page), I want to hide nav collapse automaticall..

Handling Enter Key in Vue.js

I'm learning Vue.js. In my Vue, I have a text field and a button. By default, this button submits a form when someone presses the Enter key on their keyboard. When someone is typing in the text field,..

How to find and replace string?

If s is a std::string, then is there a function like the following? s.replace("text to replace", "new text"); ..

new Date() is working in Chrome but not Firefox

I am creating a datetime string that looks like this: 2010-07-15 11:54:21 And with the following code I get invalid date in Firefox but works just fine in Chrome var todayDateTime = year + '-' + mo..

How to remove the Flutter debug banner?

How to remove the debug banner in flutter? I am using flutter screenshot and I would like the screenshot not to have banner. Now it does have. Note that I get not supported for emulator message for pr..

CSS3 Spin Animation

I have reviewed quite a few demos and have no idea why I can't get the CSS3 spin to function. I am using the latest stable release of Chrome. The fiddle: _x000D_ _x000D_..

Function not defined javascript

For some reason my javascript code is messed up. When run through firebug, I get the error proceedToSecond not defined, but it is defined! JavaScript: <script type = "text/javascript"> fu..

How to close existing connections to a DB

I want to close the existing connections to an MS SQL Server so that I can do a restore on that database programatically...

How to make CSS width to fill parent?

I am sure this problem has been asked before but I cannot seem to find the answer. I have the following markup: <div id="foo"> <div id="bar"> here be dragons </div>..

Keep getting No 'Access-Control-Allow-Origin' error with XMLHttpRequest

I would have solved this issue by using jQuery $.ajax function but in this case jQuery is not option. Instead I am going with CORS request. I feel there is something wrong with the webserver that is..

How to get number of entries in a Lua table?

Sounds like a "let me google it for you" question, but somehow I can't find an answer. The Lua # operator only counts entries with integer keys, and so does table.getn: tbl = {} tbl["test"] = 47 tbl[..

Export from pandas to_excel without row names (index)?

I'm trying to print out a dataframe from pandas into Excel. Here I am using to_excel() functions. However, I found that the 1st column in Excel is the "index", 0 6/6/2021 0:00 8/6/2021 0:00 1 ..

Is Django for the frontend or backend?

I often see people claiming their backend is implemented in Django, but isn't Django supposed to be for the frontend? I'd assume the backend refers to the business logic where the frontend refers to t..

How do you remove an array element in a foreach loop?

I want to loop through an array with foreach to check if a value exists. If the value does exist, I want to delete the element which contains it. I have the following code: foreach($display_related_..

Function pointer as parameter

I try to call a function which passed as function pointer with no argument, but I can't make it work. void *disconnectFunc; void D::setDisconnectFunc(void (*func)){ disconnectFunc = func; } voi..

Linq to Entities - SQL "IN" clause

In T-SQL you could have a query like: SELECT * FROM Users WHERE User_Rights IN ("Admin", "User", "Limited") How would you replicate that in a LINQ to Entities query? Is it even possible?..

Convert Python ElementTree to string

Whenever I call ElementTree.tostring(e), I get the following error message: AttributeError: 'Element' object has no attribute 'getroot' Is there any other way to convert an ElementTree object into ..

How do I set up the database.yml file in Rails?

I'm doing this tutorial ( and step 4 before I begin is to set up the database.yml file. Not sure what that means. Could so..

Create a tag in a GitHub repository

I have a repository in GitHub and I need to tag it. I tagged in a shell, but on GitHub, it is not showing up. Do I have to do anything else? The command I used in the shell is: git tag 2.0 And n..

creating custom tableview cells in swift

I have a custom cell class with a couple of IBOutlets. I have added the class to the storyboard. I have connected all my outlets. my cellForRowAtIndexPath function looks like this: override func tabl..

how to log in to mysql and query the database from linux terminal

I am using debian linux. I have a linux machine on which mysql is install. I can log in to my linux machine using root user as well as other user. I can connect to mysql database on linux machine from..

How do I use 'git reset --hard HEAD' to revert to a previous commit?

I know that Git tracks changes I make to my application, and it holds on to them until I commit the changes, but here's where I'm hung up: When I want to revert to a previous commit I use: git rese..

Curl: Fix CURL (51) SSL error: no alternative certificate subject name matches

I am new to CURL world, coming from Windows + .NET domain. Trying to access Rest API for basic authentication at curl -X GET

How to read a file from jar in Java?

I want to read an XML file that is located inside one of the jars included in my class path. How can I read any file which is included in the jar?..

Python OpenCV2 (cv2) wrapper to get image size?

How to get the size of an image in cv2 wrapper in Python OpenCV (numpy). Is there a correct way to do that other than numpy.shape(). How can I get it in these format dimensions: (width, height) list?..

:: (double colon) operator in Java 8

I was exploring the Java 8 source and found this particular part of code very surprising: //defined in @Override public final OptionalInt reduce(IntBinaryOperator op) { return ev..

Serializing PHP object to JSON

So I was wandering around for information about serializing PHP objects to JSON, when I stumbled across the new JsonSerializable Interface. It's only PHP >= 5.4 though, and I'm running in a 5...

NuGet Package Restore Not Working

I checked in a project on one computer, checked out on another, and find that the binaries installed by NuGet are missing. I could check them in to source control as well, but it looks like there's a..

Set System.Drawing.Color values

Hi how to set R G B values in System.Drawing.Color.G ? which is like System.Drawing.Color.G=255; is not allowed because its read only Property or indexer 'System.Drawing.Color.G' cannot be assigned..

What's the name for hyphen-separated case?

This is PascalCase: SomeSymbol This is camelCase: someSymbol This is snake_case: some_symbol So my questions is whether there is a widely accepted name for this: some-symbol? It's commonly used in ..

HTTP Error 503. The service is unavailable. App pool stops on accessing website

There are number of posts on this and I have tried many a things by now. But to no avail. Myself a Winforms Developer basically, started working on this Web stuff few days back as my company is taking..

ActiveRecord OR query

How do you do an OR query in Rails 3 ActiveRecord. All the examples I find just have AND queries. Edit: OR method is available since Rails 5. See ActiveRecord::QueryMethods ..

How to parse XML and count instances of a particular node attribute?

I have many rows in a database that contains XML and I'm trying to write a Python script to count instances of a particular node attribute. My tree looks like: <foo> <bar> <typ..

How to shrink temp tablespace in oracle?

How can we shrink temp tablespace in oracle? And why it is increasing so much like upto 25 GB since there is only one schema in the database for the application and data table space size is 2 GB and i..

Why was the name 'let' chosen for block-scoped variable declarations in JavaScript?

I understand why var takes that name - it is variable, const - it is a constant, but what is the meaning behind the name for let, which scopes to the current block? Let it be?..

Namenode not getting started

I was using Hadoop in a pseudo-distributed mode and everything was working fine. But then I had to restart my computer because of some reason. And now when I am trying to start Namenode and Datanode I..

How to set environment variables from within package.json?

How to set some environment variables from within package.json to be used with npm start like commands? Here's what I currently have in my package.json: { ... "scripts": { "help": "tagove he..

Rebuild Docker container on file changes

For running an ASP.NET Core application, I generated a dockerfile which build the application and copys the source code in the container, which is fetched by Git using Jenkins. So in my workspace, I d..

CSS :selected pseudo class similar to :checked, but for <select> elements

Is there a way to style the currently selected <option> element in a <select> element? I could then give a background color to the currently selected option element? That way I can style ..

How to test if parameters exist in rails

I'm using an IF statement in Ruby on Rails to try and test if request parameters are set. Regardless of whether or not both parameters are set, the first part of the following if block gets triggered..

How to delete all files and folders in a directory?

Using C#, how can I delete all files and folders from a directory, but still keep the root directory?..

How can I create a copy of an Oracle table without copying the data?

I know the statement: create table xyz_new as select * from xyz; Which copies the structure and the data, but what if I just want the structure?..

Normalize data in pandas

Suppose I have a pandas data frame df: I want to calculate the column wise mean of a data frame. This is easy: df.apply(average) then the column wise range max(col) - min(col). This is easy ag..

How to get a parent element to appear above child

I have two nested CSS elements. I need to get the parent to be on top, that is, above in z-axis, of the child element. Just setting z-index is not sufficient. I can't set a negative z-index on the c..

How can I see function arguments in IPython Notebook Server 3?

I've recently switched to IPython Notebook 3 (3.1.0-cbccb68 to be exact), the Anaconda version. Previously when I typed a function and opened a parenthesis like this: time.sleep() and if the cursor..

What's the Android ADB shell "dumpsys" tool and what are its benefits?

I'm looking for the full list of ADB shell dumpsys commands with a full explanation of all of the commands. Where can I find this information?..

How to copy Docker images from one host to another without using a repository

How do I transfer a Docker image from one machine to another one without using a repository, no matter private or public? I create my own image in VirtualBox, and when it is finished I try to deploy ..

jQuery post() with serialize and extra data

I'm trying to find out if it's possible to post serialize() and other data that's outside the form. Here's what I thought would work, but it only sends 'wordlist' and not the form data. $.post("page..

Regex to match a 2-digit number (to validate Credit/Debit Card Issue number)

I would like to use regex to match a string of exactly 2 characters, and both of those characters have to be between 0 and 9. The string to match against would be coming from a single-line text input ..

Ansible: filter a list by its attributes

I have variable named "network" registered in Ansible: { "addresses": { "private_ext": [ { "type": "fixed", "addr": "" ..

How do you read a CSV file and display the results in a grid in Visual Basic 2010?

How do you read a CSV file and display the results in a grid in Visual Basic 2010? This sounds so simple but I still can't find the answer to it after googling for a while. I have DataGridView on a fo..

How to match "anything up until this sequence of characters" in a regular expression?

Take this regular expression: /^[^abc]/. This will match any single character at the beginning of a string, except a, b, or c. If you add a * after it – /^[^abc]*/ – the regular expression will c..

Show SOME invisible/whitespace characters in Eclipse

A long while back I transitioned to doing all my web application development in Eclipse from BBEdit. But I miss one little feature from BBEdit. I used to be able to show invisible characters like tabs..

Error creating bean with name

I'm using SpringMVC for a web app as well as to inject my sessionFactory for Hibernate. When I run my application, I get the following error... Apr 29, 2012 3:18:05 PM org.apache.catalina.core.AprLi..

Angularjs prevent form submission when input validation fails

I'm writing a simple login form using angularjs with some client side input validation to check that the user name and password is not empty and longer than three characters. See the below code: <..

"No backupset selected to be restored" SQL Server 2012

I have a SQL Server 2012 database with filestream enabled. However, when I backup it and try to restore it on another SQL Server 2012 instance (on another machine), I simply get this message that: ..

How to disable copy/paste from/to EditText

In my application, there is a registration screen, where i do not want the user to be able to copy/paste text into the EditText field. I have set an onLongClickListener on each EditText so that the co..

Url to a google maps page to show a pin given a latitude / longitude?

Is there some url I can construct with a latitude,longitude pair that will lead me directly to a google maps page to visualize that location? For example, the following pseudocode: var lat = 43.23; ..

The client and server cannot communicate, because they do not possess a common algorithm - ASP.NET C# IIS TLS 1.0 / 1.1 / 1.2 - Win32Exception

I have an issue with a C# PayTrace Gateway. The below code was working fine until yesterday when I believe they turned off SSL3 due to the Poodle Exploit. When running the code below we got the follow..

dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib with anything php related

Using any php application results in: dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib Referenced from: /usr/local/bin/php Reason: image not found [1] 4494 trace trap php Most of my p..

How to "grep" out specific line ranges of a file

There are often times I'll grep -n whatev file to find what I'm looking for. Say the output is 1234: whatev 1 5555: whatev 2 6643: whatev 3 If I want to then just extract the lines between 1234 an..

Rename Pandas DataFrame Index

I've a csv file without header, with a DateTime index. I want to rename the index and column name, but with df.rename() only the column name is renamed. Bug? I'm on version 0.12.0 In [2]: df = pd.rea..


I am getting the following error: Exception in thread Thread-3: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/", line 810, in ..

ASP.NET Core form POST results in a HTTP 415 Unsupported Media Type response

Sending a form POST HTTP request (Content-Type: application/x-www-form-urlencoded) to the below controller results into a HTTP 415 Unsupported Media Type response. public class MyController : Control..

What's the difference between faking, mocking, and stubbing?

I know how I use these terms, but I'm wondering if there are accepted definitions for faking, mocking, and stubbing for unit tests? How do you define these for your tests? Describe situations where ..

Force re-download of release dependency using Maven

I'm working on a project with dependency X. X, in turn, depends on Y. I used to explicitly include Y in my project's pom. However, it was not used and to make things cleaner, I instead added it to X'..

How to select option in drop down protractorjs e2e tests

I am trying to select an option from a drop down for the angular e2e tests using protractor. Here is the code snippet of the select option: <select id="locregion" class="create_select ng-pristine..

How to format date in angularjs

I want to format date as mm/dd/yyyy. I tried the following and none of it works for me. Can anyone help me with this? reference: ui-date <input ui-date ui-date-format="mm/dd/yyyy" ng-model="value..

How to delete or add column in SQLITE?

I want to delete or add column in sqlite database I am using following query to delete column. ALTER TABLE TABLENAME DROP COLUMN COLUMNNAME But it gives error System.Data.SQLite.SQLiteException..

Using Python to execute a command on every file in a folder

I'm trying to create a Python script that would : Look into the folder "/input" For each video in that folder, run a mencoder command (to transcode them to something playable on my phone) Once menco..

WSDL/SOAP Test With soapui

I have tested my web services (wsdl/soap) with soapui. and i have the errors : http/log : error 400 BAD REQUEST. What can be the error please with my wsdl ? error/log : un Jun 05 14:10:37 CEST 2011..

Script Tag - async & defer

I have a couple of questions about the attributes async & defer for the <script> tag which to my understanding only work in HTML5 browsers. One of my sites has two external JavaScript files ..

convert streamed buffers to utf8-string

I want to make a HTTP-request using node.js to load some text from a webserver. Since the response can contain much text (some Megabytes) I want to process each text chunk separately. I can achieve th..

E: gnupg, gnupg2 and gnupg1 do not seem to be installed, but one of them is required for this operation

I have installed docker on windows 10 pro. I am facing an issue while running the following command in git-bash. docker-compose up -d --build and got following error. E: gnupg, gnupg2 and gnupg1 ..

How to drop a PostgreSQL database if there are active connections to it?

I need to write a script that will drop a PostgreSQL database. There may be a lot of connections to it, but the script should ignore that. The standard DROP DATABASE db_name query doesn't work when t..

Two color borders

Client wants two color borders for an embossed look. Can I do this on one element? I was hoping to avoid stacking two DOM elements with individual borders...

How to make HTML open a hyperlink in another window or tab?

This is a line for a hyperlink in HTML: <a href="">Starfall</a> Thus, if I click on "Starfall" my browser - I am using FireFox - will take me to that new page an..

How do I concatenate strings and variables in PowerShell?

Suppose I have the following snippet: $assoc = New-Object PSObject -Property @{ Id = 42 Name = "Slim Shady" Owner = "Eminem" } Write-Host $assoc.Id + " - "..

Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)

I've installed Python 3.5 and while running pip install mysql-python it gives me the following error error: Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat) I have added th..

How to get current screen width in CSS?

I use the following CSS code for formatting when screen width is less than 480px, and it works well. @media screen and (min-width: 480px) { body { background-color: lightgreen; } } I ..

Saving binary data as file using JavaScript from a browser

I am working on a business application using angularJS. One of my service method returning me a byte[] (inclding PDF file content) now i need to download this file as PDF to client machine using JavaS..

Error: Configuration with name 'default' not found in Android Studio

I am using the volley library to perform network operation in android. So I am trying to add this library in my project which is created in Android Studio and gradle system. I added the volley libra..

How to do joins in LINQ on multiple fields in single join

I need to do a LINQ2DataSet query that does a join on more than one field (as var result = from x in entity join y in entity2 on x.field1 = y.field1 and x.field2 = y.field2 I ha..

How to center an iframe horizontally?

Consider the following example: (live demo) HTML: <div>div</div> <iframe></iframe> CSS: div, iframe { width: 100px; height: 50px; margin: 0 auto; backgroun..