Questions Tagged with #Server.mappath

The Server.MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.

Using Server.MapPath() inside a static field in ASP.NET MVC

I'm building an ASP.NET MVC site where I'm using Lucene.Net for search queries. I asked a question here about how to properly structure Lucene.Net usage in an ASP.NET MVC application and was told that..

Server.Mappath in C# classlibrary

How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite..

Cannot use Server.MapPath

What I must do to make Server.MapPath work? I have using System.Web; what else? When I type Server there is no quick result option (intelli-sense) for Server. Any help?..

Validating parameters to a Bash script

I came up with a basic one to help automate the process of removing a number of folders as they become unneeded. #!/bin/bash rm -rf ~/myfolder1/$1/anotherfolder rm -rf ~/myfolder2/$1/yetanotherfolder..

Can I create view with parameter in MySQL?

I have a view like this: CREATE VIEW MyView AS SELECT Column FROM Table WHERE Value = 2; I'd like to make it more generic, it means to change 2 into a variable. I tried this: CREATE VIEW MyVie..

Get Mouse Position

I would like to simulate a natural mouse movement in Java (going from here to there pixel by pixel). To do that I need to know the starting coordinates. I've found the method event.getX() and event.g..

How to add a set path only for that batch file executing?

Basically, I know I can go through my control panel and modify the path variable. But, I'm wondering if there is a way to through batch programming have a temporary path included? That way it is only ..

Selecting a Record With MAX Value

In SQL Server 2008 I have a table CUSTOMERS that has two columns as: ID, BALANCE How can I write the query that selects the ID of the customer who has maximum balance, "in the most effective way"? ..

How can I find whitespace in a String?

How can I check to see if a String contains a whitespace character, an empty space or " ". If possible, please provide a Java example. For example: String = "test word"; ..

How to draw checkbox or tick mark in GitHub Markdown table?

I am able to draw checkbox in Github README.md lists using - [ ] (for unchecked checkbox) - [x] (for checked checkbox) But this is not working in table. Does anybody know how to implement checkbox ..

Remove spacing between table cells and rows

I'm designing an HTML email template, which forces me to use tables. In the code below, I'm having trouble (1) removing the spacing below the placeholder image and (2) removing the space between the i..

Excel VBA function to print an array to the workbook

I've written a macro that takes a 2 dimensional array, and "prints" it to equivalent cells in an excel workbook. Is there a more elegant way to do this? Sub PrintArray(Data, SheetName, StartRow, Sta..

Cross domain POST request is not sending cookie Ajax Jquery

Seems that something similar already has been discussed on stackoverflow, but i could not find exactly the same. I am trying to send Cookie with CORS(Cross-origin resource sharing), but it is not wor..

Get started with Latex on Linux

Impressed by is-latex-worth-learning-today, and many how-to's on Windows, How do you have someone started with LaTeX on Linux? How do you generate a pdf out of it and give up the OOO Word processer?..

Insert string in beginning of another string

How to insert a string enclosed with double quotes in the beginning of the StringBuilder and String? Eg: StringBuilder _sb = new StringBuilder("Sam"); I need to insert the string "Hello" to the be..

Casting int to bool in C/C++

I know that in C and C++, when casting bools to ints, (int)true == 1 and (int)false == 0. I'm wondering about casting in the reverse direction... In the code below, all of the following assertions he..

Convert seconds to hh:mm:ss in Python

How do I convert an int (number of seconds) to the formats mm:ss or hh:mm:ss? I need to do this with Python code (and if possible in a Django template)...

How to Configure SSL for Amazon S3 bucket

I am using an Amazon S3 bucket for uploading and downloading of data using my .NET application. Now my question is: I want to access my S3 bucket using SSL. Is it possible to implement SSL for an Amaz..

How to create a label inside an <input> element?

I would like to insert a descriptive text inside an input element that disappers when the user click on it. I know it is a very common trick, but I do not know how to do that.. What is the simplest/..

Postgresql: error "must be owner of relation" when changing a owner object

What is the grant option/trick I need to give to the current user ("userA") to allow him to change a object's owner which belongs by another user ("userC")? More precisely, the contact table is owned..

Sibling package imports

I've tried reading through questions about sibling imports and even the package documentation, but I've yet to find an answer. With the following structure: +-- LICENSE.md +-- README.md +-- api ¦ ..

Can I have onScrollListener for a ScrollView?

I am using a HorizontalScrollView in a layout and I need to identify the user have reached the start and end point of the scroll. For ListView I have tried a the onScrollListener and it is possible t..

How to print out all the elements of a List in Java?

I am trying to print out all the elements of a List, however it is printing the pointer of the Object rather than the value. This is my printing code... for(int i=0;i<list.size();i++){ System..

How to get 30 days prior to current date?

I have a start calendar input box and an end calendar input box. We want defaults start calendar input box 30 days prior to current date and the end calendar input box to be the current date. Here is ..

Oracle date function for the previous month

I have the query below where the date is hard-coded. My objective is to remove the harcoded date; the query should pull the data for the previous month when it runs. select count(distinct switch_id) ..

CSS Font Border?

With all the new CSS3 border stuff going on (-webkit, ...) is it now possible to add a border to your font? (Like the solid white border around the blue Twitter logo). If not, are there any not-too-ug..

How to terminate a process in vbscript

How can I terminate process using vbscript. PLEASE NOTE, I need to terminate process that runs under windows 64-bit environment as native 64 (not using select * from win_32_Process) Thanks,..

Create folder with batch but only if it doesn't already exist

Can anybody tell me how to do the following in in a Windows batch script? (*.bat): Create a folder only if it doesn't already exist In more detail, I want to create a folder named VTS on the C:\ ..

Android- create JSON Array and JSON Object

How can I create a JSON with this format in Android: Since the API that I will be passing will parse JsonArray then the object. Or would it be okay if just to pass a json object? Since I will just hav..

Max length UITextField

When I've tried How to you set the maximum number of characters that can be entered into a UITextField using swift?, I saw that if I use all 10 characters, I can't erase the character too. The only t..

How to render html with AngularJS templates

This is my template: <div class="span12"> <ng:view></ng:view> </div> and this is my view template: <h1>{{stuff.title}}</h1> {{stuff.content}} I am getting ..

Confirmation dialog on ng-click - AngularJS

I am trying to setup a confirmation dialog on an ng-click using a custom angularjs directive: app.directive('ngConfirmClick', [ function(){ return { priority: 1, t..

git pull displays "fatal: Couldn't find remote ref refs/heads/xxxx" and hangs up

I created a branch called '6796', then I pushed it to remote, checked it out on another machine, made other edits, pushed it, then merged it with the master, and deleted it - locally and remotely (git..

Display all post meta keys and meta values of the same post ID in wordpress

I'm trying to display post meta values and post meta keys, If only one value is to be display I can used the simple function get_post_meta() but what I need now is to post all post meta data with the ..

Python Pandas - Find difference between two data frames

I have two data frames df1 and df2, where df2 is a subset of df1. How do I get a new data frame (df3) which is the difference between the two data frames? In other word, a data frame that has all the..

How to add leading zeros for for-loop in shell?

I have a basic number for loop which increments the variable num by 1 over each iteration... for (( num=1; num<=5; num++ )) do echo $num done Which outputs: 1 2 3 4 5 I'm trying to make it p..

Apply CSS style attribute dynamically in Angular JS

This should be a simple problem, but I can't seem to find a solution. I have the following markup: <div style="width:20px; height:20px; margin-top:10px; border:solid 1px black; background-color:#..

Div 100% height works on Firefox but not in IE

I have a container div that holds two internal divs; both should take 100% width and 100% height within the container. I set both internal divs to 100% height. That works fine in Firefox, however in ..

get the value of input type file , and alert if empty

how to alert if input type file is empty !? this is my jquery code but i didnt know how to get the value $('.upload').live("click",function() { var imgVal = $('#uploadImage').val(); if(imgVa..

How to handle static content in Spring MVC?

I am developing a webapp using Spring MVC 3 and have the DispatcherServlet catching all requests to '/' like so (web.xml): <servlet> <servlet-name>app</servlet-name> <s..

JavaScript, Node.js: is Array.forEach asynchronous?

I have a question regarding the native Array.forEach implementation of JavaScript: Does it behave asynchronously? For example, if I call: [many many elements].forEach(function () {lots of work to do}..

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

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

How can I load storyboard programmatically from class?

My problem is that I was looking for way to use both storyboard and xib. But I can't find proper way to load and show storyboard programmatically. Project was started developing with xib, and now it's..

Reading a date using DataReader

I read a string using this format with a data reader. How can I read in a date using similar format? while (MyReader.Read()) { TextBox1.Text = (string)MyReader["Note"]; } ..

How do I use the JAVA_OPTS environment variable?

How do I use the JAVA_OPTS variable to configure a web server (a linux server)? How can I set -Djava.awt.headless=true using JAVA_OPTS?..

sed: print only matching group

I want to grab the last two numbers (one int, one float; followed by optional whitespace) and print only them. Example: foo bar <foo> bla 1 2 3.4 Should print: 2 3.4 So far, I have the fo..

Getting "project" nuget configuration is invalid error

I'm getting "[project] nuget configuration is invalid" error. I received an error like this before and used the 'Update Nuget package manager' solution mentioned here: Unable to Install Any Package i..

SQL Error: ORA-00922: missing or invalid option

CREATE TABLE chartered flight(flight_no NUMBER(4) PRIMARY KEY , customer_id NUMBER(6) REFERENCES customer(customer_id) , aircraft_no NUMBER(4) REFERENCES aircraft(aircraft_no) , flight_type VARCHAR2 (..

Hide "NFC Tag type not supported" error on Samsung Galaxy devices

I am working on an app that scans just the UID of MIFARE Classic cards to facilitate attendance registration. I have got it working. However, every time I scan a card on my Galaxy S4, I get a toast st..

Mysql - delete from multiple tables with one query

I have 4 tables that stores different information about a user in each. Each table has a field with user_id to identify which row belongs to which user. If I want to delete the user is this the best..

Ignore mapping one property with Automapper

I'm using Automapper and I have the following scenario: Class OrderModel has a property called 'ProductName' that isn't in the database. So when I try to do the mapping with: Mapper.CreateMap<Orde..

How to turn NaN from parseInt into 0 for an empty string?

Is it possible somehow to return 0 instead of NaN when parsing values in JavaScript? In case of the empty string parseInt returns NaN. Is it possible to do something like that in JavaScript to check..

Compare one String with multiple values in one expression

I have one String variable, str with possible values, val1, val2 and val3. I want to compare (with equal case) str to all of these values using an if statement, for example: if("val1".equalsIgnoreCa..

How does HttpContext.Current.User.Identity.Name know which usernames exist?

This is not necessarily an issue, I am just curious as to how it works. I have a method: public static bool UserIsAuthenticated() { bool isAuthed = false; try { if (HttpContext.Cu..

Unknown URL content://downloads/my_downloads

I'm using Download Manger for download some multimedia files and categorize them. I'm also using Crashlytics and this is an error I frequently get it on different devices and versions of Android. I'm ..

How do you do a ‘Pause’ with PowerShell 2.0?

OK, I'm losing it. PowerShell is annoying me. I'd like a pause dialog to appear, and it won't. PS W:\>>> $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") Exception calling "ReadKey" with "1" ..

How to view the current heap size that an application is using?

I think I increased my heap size to 1 GB in NetBeans since I changed the config to look like this: netbeans_default_options="-J-Xmx1g ...... After I restarted NetBeans, can I be sure that my app is..

How is returning the output of a function different from printing it?

In my previous question, Andrew Jaffe writes: In addition to all of the other hints and tips, I think you're missing something crucial: your functions actually need to return something. When yo..

How to get array keys in Javascript?

I have an array created with this code: var widthRange = new Array(); widthRange[46] = { min:0, max:52 }; widthRange[66] = { min:52, max:70 }; widthRange[90] = { min:70, max:94 }; I want to get ea..

How to change the default message of the required field in the popover of form-control in bootstrap?

<form class="form-asd" role="form"> <h2 class="form-signin-heading">login</h2><hr /> <label class="control-label" for="username">Username</label> <..

nodejs vs node on ubuntu 12.04

I installed nodejs on ubuntu from instructions given here When I write node --version in the terminal I see this : -bash: /usr/sbin/node: No such file or directory I can see node in the /usr/sbin/ ..

How to find index of list item in Swift?

I am trying to find an item index by searching a list. Does anybody know how to do that? I see there is list.StartIndex and list.EndIndex but I want something like python's list.index("text")...

selecting rows with id from another table

Let's call this table terms_relation: +---------+----------+-------------+------------+------------+--+ | term_id | taxonomy | description | created_at | updated_at | | +---------+----------+-------..

show loading icon until the page is load?

I wanted to show a loading icon to users until the page elements are fully loaded. How can I do that with javascript and I want to do it with javascript, not jquery? Here is a link how google does it..

Check if an excel cell exists on another worksheet in a column - and return the contents of a different column

What I want to do is to say if the contents of cell D3 (on current worksheet) exist in column A in the first worksheet (in my case entitled list). (and they always do exist somewhere). Return the cont..

Compare dates in MySQL

I want to compare a date from a database that is between 2 given dates. The column from the database is DATETIME, and I want to compare it only to the date format, not the datetime format. SELECT * F..

Setting a checkbox as checked with Vue.js

I have been googling and playing with every combination I know but I cannot get my checkboxes to be initialised as checked. Example: <ul class="object administrator-checkbox-list"> <li ..

ImageView in circular through xml

I'd Like to make any image from my ImageView to be circular with a border. I searched but couldn't find any useful information (anything that I tried didn't work). How can I achieve this through xm..

What is the better API to Reading Excel sheets in java - JXL or Apache POI

Which of the 2 APIs is simpler to read/write/edit excel sheets ? Do these APIs not support CSV extensions ? Using JXL for file.xls and file.xlsx, I get an exception like: jxl.read.biff.BiffExceptio..

How to upgrade Git on Windows to the latest version?

I just upgraded to Git 1.8.0.1 for Windows, from my previous version 1.7.9.mysysgit.0. I downloaded the new version from the Git site and installed through the normal Git installer EXE. That said, wh..

Value of type 'T' cannot be converted to

This is likely a a novice question, but google surprisingly did not provide an answer. I have this rather artificial method T HowToCast<T>(T t) { if (typeof(T) == typeof(string)) { ..

How to call stopservice() method of Service class from the calling activity class

I am trying to call my service class's stopService() method from my activity. But I dont know how to access stopservice method from my activity class. I have the below code but its not working..........

What is the syntax for adding an element to a scala.collection.mutable.Map?

What is the syntax for adding an element to a scala.collection.mutable.Map ? Here are some failed attempts: val map = scala.collection.mutable.Map map("mykey") = "myval" map += "mykey" -> "myva..

How do you calculate program run time in python?

How do you calculate program run time in python?..

String.Format not work in TypeScript

String.Format does not work in TypeScript. Error: The property 'format' does not exist on value of type '{ prototype: String; fromCharCode(...codes: number[]): string; (value?: any): string; new..

Pandas - 'Series' object has no attribute 'colNames' when using apply()

I need to use a lambda function to do a row by row computation. For example create some dataframe import pandas as pd import numpy as np def myfunc(x, y): return x + y colNames = ['A', 'B'] dat..

How to convert a Kotlin source file to a Java source file

I have a Kotlin source file, but I want to translate it to Java. How can I convert Kotlin to Java source?..

How do I post button value to PHP?

I want use A-Z buttons on a html page like shown below (only sample and few words) <INPUT TYPE="BUTTON" VALUE=" A " ONCLICK="A"> <INPUT TYPE="BUTTON" VALUE=" B " ONCLICK="B"> <INPUT TY..

Get div tag scroll position using JavaScript

How do I get the amount of scroll in a div tag using JavaScript? Please provide me with an example. I don't want to use jQuery, only JavaScript...

How to access pandas groupby dataframe by key

How do I access the corresponding groupby dataframe in a groupby object by the key? With the following groupby: rand = np.random.RandomState(1) df = pd.DataFrame({'A': ['foo', 'bar'] * 3, ..

How to create an HTTPS server in Node.js?

Given an SSL key and certificate, how does one create an HTTPS service?..

Is there a "standard" format for command line/shell help text?

If not, is there a de facto standard? Basically I'm writing a command line help text like so: usage: app_name [options] required_input required_input2 options: -a, --argument Does something..

Does the 'mutable' keyword have any purpose other than allowing the variable to be modified by a const function?

A while ago I came across some code that marked a member variable of a class with the mutable keyword. As far as I can see it simply allows you to modify a variable in a const method: class Foo { ..

INSERT and UPDATE a record using cursors in oracle

I have 2 tables- student and studLoad both having 2 fields studID and studName. I want to load data from student table into stuLoad table. If the data already exists in the studLoad table, then it sho..

How to strip a specific word from a string?

I need to strip a specific word from a string. But I find python strip method seems can't recognize an ordered word. The just strip off any characters passed to the parameter. For example: >>..

Change the color of cells in one column when they don't match cells in another column

I want to check if the values in one column are the same as values in another column. Whenever the values are not the same, I would like to change the color of these cells. For example: Column I, ..

c# dictionary one key many values

I want to create a data store to allow me to store some data. The first idea was to create a dictionary where you have 1 key with many values, so a bit like a one to many relationship. I think the d..

How to add checkboxes to JTABLE swing

Does anyone know how to put a JCheckBox in a JTable column? Something like this: I took this from How To use Tables Thanks in advance...

uint8_t vs unsigned char

What is the advantage of using uint8_t over unsigned char in C? I know that on almost every system uint8_t is just a typedef for unsigned char, so why use it?..

Android: converting String to int

I'm simply trying to convert a string that is generated from a barcode scanner to an int so that I can manipulate it by taking getting the remainder to generate a set number of integers. So far I hav..

How to get the current taxonomy term ID (not the slug) in WordPress?

I've created a taxonomy.php page in my WordPress theme folder. I would like to get the current term id for a function. How can I get this? get_query_var('taxonomy') only returns the term slug, I wan..

Javascript wait() function

I want to create a JavaScript wait() function. What should I edit? function wait(waitsecs) { setTimeout(donothing(), 'waitsecs'); } function donothing() { // } ..

Hibernate error: ids for this class must be manually assigned before calling save():

Caused by: org.springframework.orm.hibernate3.HibernateSystemException: ids for this class must be manually assigned before calling save(): com.rfid.model.Role; nested exception is org.hibernate.id.I..

Side-by-side plots with ggplot2

I would like to place two plots side by side using the ggplot2 package, i.e. do the equivalent of par(mfrow=c(1,2)). For example, I would like to have the following two plots show side-by-side with t..

Angularjs Template Default Value if Binding Null / Undefined (With Filter)

I have a template binding that displays a model attribute called 'date' which is a date, using Angular's date filter. <span class="gallery-date">{{gallery.date | date:'mediumDate'}}</span>..

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 do I find the absolute position of an element using jQuery?

Is there a way of finding the absolute position of an element, i.e. relative to the start of the window, using jQuery?..

Set focus to field in dynamically loaded DIV

What is the proper method to set the focus to a specific field within a dynamically loaded DIV? $("#display").load("?control=msgs"); // loads the HTML into the DIV $('#display').fadeIn("fast"); // di..

How can I get the name of an html page in Javascript?

I have an html page and I would like inside the html page to retrieve the name of the html document via Javascript. Is that possible? e.g. name of html document = "indexOLD.html"..

Fixed sidebar navigation in fluid twitter bootstrap 2.0

Is it possible to make sidebar navigation stay always fixed on scroll in fluid layout?..

Java: Static Class?

I have a class full of utility functions. Instantiating an instance of it makes no semantic sense, but I still want to call its methods. What is the best way to deal with this? Static class? Abstract?..

How to handle query parameters in angular 2

In my routable component I have @RouteConfig { {path: '/login', name: 'Login', component: LoginComponent} } But how do I get the query params if I go to app_url/login?token=1234?..

How to delete a specific file from folder using asp.net

here's the deal I got a datagridviewer which is called gridview1 and a fileupload1 when i upload a file it updates the gridview1 and table in database with the file name and path and stores the said f..

ReferenceError: describe is not defined NodeJs

I am trying to define some endpoints and do a test using nodejs. In server.js I have: var express = require('express'); var func1 = require('./func1.js'); var port = 8080; var server = express(); se..

Is there a way to pass optional parameters to a function?

Is there a way in Python to pass optional parameters to a function while calling it and in the function definition have some code based on "only if the optional parameter is passed"..

How to edit binary file on Unix systems

On Windows machines there are lots of third party editors available to edit a binary file. Any idea how can I edit a binary file on Unix system?..

PHP how to get value from array if key is in a variable

I have a key stored in a variable like so: $key = 4; I tried to get the relevant value like so: $value = $array[$key]; but it failed. Help...

Twitter Bootstrap inline input with dropdown

I'm trying to display a text input inline with a dropdown button. I can't figure out how to do this though. Here's the HTML I've tried (I've put all of it on a single line with no results): <div..

Any good, visual HTML5 Editor or IDE?

Well it looks like Dreamweaver CS5 will try to smoother the HTML5 thing for a few more years (weeks actually). Seems like the next rung down is right to Notepad! Anyone know a good HTML5 editor with ..

How to find MAC address of an Android device programmatically

How do i get Mac Id of android device programmatically. I have done with IMIE Code and I know how to check Mac id on device manually but have no idea how to find out programmatically...

Installing MySQL Python on Mac OS X

Long story short, when I write the following: sudo easy_install MySQL-python I get the error EnvironmentError: mysql_config not found All right, so there are plenty of threads and the like on..

How to sort a list of objects based on an attribute of the objects?

I've got a list of Python objects that I'd like to sort by an attribute of the objects themselves. The list looks like: >>> ut [<Tag: 128>, <Tag: 2008>, <Tag: <>, <T..

Save Dataframe to csv directly to s3 Python

I have a pandas DataFrame that I want to upload to a new CSV file. The problem is that I don't want to save the file locally before transferring it to s3. Is there any method like to_csv for writing t..

Save text file UTF-8 encoded with VBA

how can I write UTF-8 encoded strings to a textfile from vba, like Dim fnum As Integer fnum = FreeFile Open "myfile.txt" For Output As fnum Print #fnum, "special characters: äöüß" 'latin-1 or som..

How can I connect to MySQL in Python 3 on Windows?

I am using ActiveState Python 3 on Windows and wanted to connect to my MySQL database. I heard that mysqldb was the module to use. I can't find mysqldb for Python 3. Is there a repository available w..

How can I round a number in JavaScript? .toFixed() returns a string?

Am I missing something here? var someNumber = 123.456; someNumber = someNumber.toFixed(2); alert(typeof(someNumber)); //alerts string Why does .toFixed() return a string? I want to round the numbe..

PHP - Merging two arrays into one array (also Remove Duplicates)

Hi I'm Trying to merge two arrays and also want to remove duplicate values from final Array. Here is my Array 1: Array ( [0] => stdClass Object ( [ID] => 749 [post_author] ..

How to compare timestamp dates with date-only parameter in MySQL?

In a SQL statement, how do I compare a date saved as TIMESTAMP with a date in YYYY-MM-DD format? Ex.: SELECT * FROM table WHERE timestamp = '2012-05-25' I want this query returns all rows having times..

What should I do if the current ASP.NET session is null?

In my web application, I do something like this to read the session variables: if (HttpContext.Current.Session != null && HttpContext.Current.Session["MyVariable"] != null) { string myVa..

Installing Pandas on Mac OSX

I'm having trouble installing the Python Pandas library on my Mac OSX computer. I type the following in Terminal: $ sudo easy_install pandas But then I get the following: Searching for pandas Rea..

Change URL parameters

I have this URL: site.fwx?position=1&archiveid=5000&columns=5&rows=20&sorting=ModifiedTimeAsc what I need is to be able to change the 'rows' url param value to something i specify, ..

Convert String to Carbon

I am using Laravel 5.1 Few days ago I used protected $dates = ['license_expire'] in my model to convert the string date to Carbon instances. In HTML the default value in create form for the date was ..

Embed Youtube video inside an Android app

I'm using a WebView for displaying embedded Youtube video and that works on Galaxcy S2 (OS 2.3.5) and doesn't on Nexus S (OS 2.3.4), all I get is white screen without any video display. Here is the c..

adding text to an existing text element in javascript via DOM

I am trying to figure how to add text to a p tag or h1 tag that already has a text node. For example: _x000D_ _x000D_ var t = document.getElementById("p").textContent;_x000D_ var y = document.creat..

How to perform keystroke inside powershell?

I have ps1 script to grab some information from the vmware cluster environment. In some place of ps1 script requires the ENTER button keystroke. So, How to do that ? -Thanks..

SQL Server - Convert date field to UTC

I have recently updated my system to record date/times as UTC as previously they were storing as local time. I now need to convert all the local stored date/times to UTC. I was wondering if there is ..

jQuery: keyPress Backspace won't fire?

I wonder what I'm doing wrong: $(".s").keypress(function(e) { switch (e.keyCode) { case 8: // Backspace //console.log('backspace'); case 9: // Tab case 13: // Enter c..

SQL: parse the first, middle and last name from a fullname field

How do I parse the first, middle, and last name out of a fullname field with SQL? I need to try to match up on names that are not a direct match on full name. I'd like to be able to take the full n..

File Upload in WebView

I have been struggling to upload files from WebView since last few days and there is no progress. I googled and implemented all suggested solutions but none works, like: solutions suggested here, and ..

Styling mat-select in Angular Material

How to style mat-select's panel component. From the docs I get that I need to provide panelClass so I make it like this: <mat-form-field> <mat-select placeholder="Search for" [(ngMode..

How to draw border around a UILabel?

Is there a way for UILabel to draw a border around itself? This is useful for me to debug the text placement and to see the placement and how big the label actually is...

link_to method and click event in Rails

How do I create a link of this type: <a href="#" onclick="document.getElementById('search').value=this.value"> using method link_to in Rails? I couldn't figure it out from Rails docs...

WAMP server, localhost is not working

My WAMP server localhost was broken when my Windows 7 updates automatically. My port 80 is already used by IIS server. I searched on website, many people suggested that I need to change the port 80..

How to initialize a nested struct?

I cannot figure out how to initialize a nested struct. Find an example here: http://play.golang.org/p/NL6VXdHrjh package main type Configuration struct { Val string Proxy struct { A..

Jquery sortable 'change' event element position

Is there way to get current position of helper being dragged on over new position ? $("#sortable").sortable({ start: function (event, ui) { var currPos1 = ui.item.index(); ..

What is the advantage of using heredoc in PHP?

What is the advantage of using heredoc in PHP, and can you show an example?..

Is there any JSON Web Token (JWT) example in C#?

I feel like I'm taking crazy pills here. Usually there's always a million library and samples floating around the web for any given task. I'm trying to implement authentication with a Google "Service ..

Split a List into smaller lists of N size

I am attempting to split a list into a series of smaller lists. My Problem: My function to split lists doesn't split them into lists of the correct size. It should split them into lists of size 30 bu..

How do you follow an HTTP Redirect in Node.js?

I want to open a page up in node and process the contents in my application. Something like this seems to work well: var opts = {host: host, path:pathname, port: 80}; http.get(opts, function(res) { ..

How to get text box value in JavaScript

I am trying to use JavaScript to get the value from an HTML text box but value is not coming after white space For example: <input type="text" name="txtJob" value="software engineer"> I onl..

How to obtain the total numbers of rows from a CSV file in Python?

I'm using python (Django Framework) to read a CSV file. I pull just 2 lines out of this CSV as you can see. What I have been trying to do is store in a variable the total number of rows the CSV also. ..

What's the difference between KeyDown and KeyPress in .NET?

What is the difference between the KeyDown and KeyPress events in .NET?..

git: How to ignore all present untracked files?

Is there a handy way to ignore all untracked files and folders in a git repository? (I know about the .gitignore.) So git status would provide a clean result again...

Easier way to create circle div than using an image?

I'm wondering if there's an easier way to create circular divs than what I'm doing now. Currently, I am just making an image for each different size, but it's annoying to do this. Is there anyway us..

Android Canvas.drawText

I have a view, I'm drawing with the Canvas object in the onDraw(Canvas canvas) method. My code is: Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setStyle(Style.FILL); canvas.drawPaint..

How to remove outliers from a dataset

I've got some multivariate data of beauty vs ages. The ages range from 20-40 at intervals of 2 (20, 22, 24....40), and for each record of data, they are given an age and a beauty rating from 1-5. When..

How to include a quote in a raw Python string

Consider: >>> r"what"ever" SyntaxError: invalid syntax >>> r"what\"ever" 'what\\"ever' So how do we get the quote, but not the slash? And please don't suggest r'what"ever', becau..

SSIS - Text was truncated or one or more characters had no match in the target code page - Special Characters

I have a text file with Vertical Bar{|} separated values and I am using a Flat File source to read the values which fails with the above error. I have a Flat File Connection Manager, where I set the ..

How to add an onchange event to a select box via javascript?

I've got a script where I am dynamically creating select boxes. When those boxes are created, we want to set the onchange event for the new box to point to a function called toggleSelect(). I can't s..

whitespaces in the path of windows filepath

I am working on file operations using python. I have a filepath as : filepath = "E:/ABC/SEM 2/testfiles/all.txt" when I am opening the file using python, it says me : IOError: No such file:..

How to sort a dataFrame in python pandas by two or more columns?

Suppose I have a dataframe with columns a, b and c, I want to sort the dataframe by column b in ascending order, and by column c in descending order, how do I do this?..

centos: Another MySQL daemon already running with the same unix socket

I have a strange error when starting mysqld service: Another MySQL daemon already running with the same unix socket. I've tried to list running services and stopping them but the same error happens..

How to compile and run C in sublime text 3?

I would like to compile and run C program in sublime text 3 on ubuntu 14.04. Currently the program is being compiled with gcc using sublime text 3 executing a command (see below code), but I was wonde..

How to Maximize window in chrome using webDriver (python)

Is there a way to maximize the chrome browser window using python selenium WebDriver? Note: I am using Chrome Driver 23.0 Any solution on this would be greatly appreciated!..

How to unzip a list of tuples into individual lists?

Possible Duplicate: A Transpose/Unzip Function in Python I have a list of tuples, where I want to unzip this list into two independent lists. I'm looking for some standardized operation in ..

java.net.SocketException: Connection reset

I am getting the following error trying to read from a socket. I'm doing a readInt() on that InputStream, and I am getting this error. Perusing the documentation this suggests that the client part of ..

Difference Between Cohesion and Coupling

What is the difference between cohesion and coupling? How can coupling and cohesion lead to either good or poor software design? What are some examples that outline the difference between the two, a..

How to annotate MYSQL autoincrement field with JPA annotations

Straight to the point, problem is saving the object Operator into MySQL DB. Prior to save, I try to select from this table and it works, so is connection to db. Here is my Operator object: @Entity p..

Unable to read repository at http://download.eclipse.org/releases/indigo

I was trying to add the PDT, Indigo - http://download.eclipse.org/releases/indigo Unable to read repository at http://download.eclipse.org/releases/indigo. Unable to read repository at http://download..

excel VBA run macro automatically whenever a cell is changed

Is there a simple way to get Excel to automatically execute a macro whenever a cell is changed? The cell in question would be in Worksheet("BigBoard").Range("D2") What I thought would be a simple Go..

How to start/stop/restart a thread in Java?

I am having a real hard time finding a way to start, stop, and restart a thread in Java. Specifically, I have a class Task (currently implements Runnable) in a file Task.java. My main application nee..

SQL select statements with multiple tables

Given the following two tables: Person table id (pk) first middle last age Address table id(pk) person_id (fk person.id) street city state zip How do I create an SQL statement that retu..

AngularJs ReferenceError: $http is not defined

I have the following Angular function: $scope.updateStatus = function(user) { $http({ url: user.update_path, method: "POST", data: {user_id: user.id, draft: true} ..

Getting "method not valid without suitable object" error when trying to make a HTTP request in VBA?

I tried to follow this example: http://libkod.info/officexml-CHP-9-SECT-5.shtml - Archive.org - Donate but it gave this error on this line: Dim objHTTP As New MSXML2.XMLHTTP I tried to use this exam..

LaTeX Optional Arguments

How do you create a command with optional arguments in LaTeX? Something like: \newcommand{\sec}[2][]{ \section*{#1 \ifsecondargument and #2 \fi} } } Then, I can ..

How to programmatically determine the current checked out Git branch

In a Unix or GNU scripting environment (e.g. a Linux distro, Cygwin, OSX), what is the best way to determine which Git branch is currently checked out in a working directory? One use of this techniqu..

How to convert a List<String> into a comma separated string without iterating List explicitly

List<String> ids = new ArrayList<String>(); ids.add("1"); ids.add("2"); ids.add("3"); ids.add("4"); Now i want an output from this list as 1,2,3,4 without explicitly iterating over it...

"Retrieving the COM class factory for component.... error: 80070005 Access is denied." (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

I just created a simple application and hosted in IIS6.0. In code I'm just instantiating excel objects. using excel = Microsoft.Office.Interop.Excel.Application; namespace TestHosting { public p..

What does getActivity() mean?

What does getActivity() mean? I saw in somewhere, they wrote MainActivity.this.startActionMode(mActionModeCallback) instead of getActivity(). could someone explain what this two lines mean? someVie..

Running stages in parallel with Jenkins workflow / pipeline

Please note: the question is based on the old, now called "scripted" pipeline format. When using "declarative pipelines", parallel blocks can be nested inside of stage blocks (see Parallel stages w..

Can I simultaneously declare and assign a variable in VBA?

I'm new to VBA and want to know if I can convert the following declaration and assignment into one line: Dim clientToTest As String clientToTest = clientsToTest(i) or Dim clientString As Variant c..

PowerShell: how to grep command output?

In PowerShell I have tried: alias | select-string Alias This fails even though Alias is clearly in the output. I know this is because select-string is operating on some object and not the actual ou..

how do I get the bullet points of a <ul> to center with the text?

When I try to center a <ul> the text in the <li> centers but the bullet points stay on the far left of the page. Is there any way to get the bullet points to stay with the text when it is ..

Remove last character of a StringBuilder?

When you have to loop through a collection and make a string of each data separated by a delimiter, you always end up with an extra delimiter at the end, e.g. for (String serverId : serverIds) { sb..

IOS 7 Navigation Bar text and arrow color

I want to set background for Navigation Bar to be black and all colors inside it to be white. So, I used this code : [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictiona..

day of the week to day number (Monday = 1, Tuesday = 2)

Does php have a function to automatically convert dates to their day value, where Monday=1, Tuesday=2, etc. Something like this $daynum = func('wednesday'); //echos 3 ..

How to use Ajax.ActionLink?

First of all, where is the documentation for Ajax.* methods in asp.net mvc? Can Ajax.ActionLink be used to call an action, get a partial view, open a modal window and put the content in it?..

How to run .APK file on emulator

Possible Duplicate: How do you install an APK file in the Android emulator? I download an APK file and I want to run it on an Android emulator but I don't know how. Please help me. Thanks..

Converting json results to a date

Possible Duplicate: How to format a JSON date? I have the following result from a $getJSON call from JavaScript. How do I convert the start property to a proper date in JavaScript? [ ..

What is the best way to trigger onchange event in react js

We use Backbone + ReactJS bundle to build a client-side app. Heavily relying on notorious valueLink we propagate values directly to the model via own wrapper that supports ReactJS interface for two wa..

Container is running beyond memory limits

In Hadoop v1, I have assigned each 7 mapper and reducer slot with size of 1GB, my mappers & reducers runs fine. My machine has 8G memory, 8 processor. Now with YARN, when run the same application..

Visually managing MongoDB documents and collections

I'm using MongoDB in a reporting system and have to delete a whole bunch of test documents. While I don't have too much trouble using the JSON-based command-line tools, it gets extremely tedious to h..

how to replace characters in hive?

I have a string column description in a hive table which may contain tab characters '\t', these characters are however messing some views when connecting hive to an external application. is there a si..

How to create a DateTime equal to 15 minutes ago?

I need to create a DateTime object that represents the current time minus 15 minutes...

How do I trim whitespace from a string?

How do I remove leading and trailing whitespace from a string in Python? For example: " Hello " --> "Hello" " Hello" --> "Hello" "Hello " --> "Hello" "Bob has a cat" --> "Bob has a cat..

How to cast int to enum in C++?

How do I cast an int to an enum in C++? For example: enum Test { A, B }; int a = 1; How do I convert a to type Test::A?..

How can I suppress the newline after a print statement?

I read that to suppress the newline after a print statement you can put a comma after the text. The example here looks like Python 2. How can it be done in Python 3? For example: for item in [1,2,3,..

How to suppress Update Links warning?

I'm trying to write a script that opens many Excel files. I keep getting the prompt: This workbook contains links to other data sources. I want to keep this message from appearing, so that my scri..

Get the week start date and week end date from week number

I have a query that counts member's wedding dates in the database. SELECT SUM(NumberOfBrides) AS [Wedding Count] , DATEPART( wk, WeddingDate) AS [Week Number] , DATEPART( year, WeddingDate) AS ..

How can I ask the Selenium-WebDriver to wait for few seconds in Java?

I'm working on a Java Selenium-WebDriver. I added driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS); and WebElement textbox = driver.findElement(By.id("textbox")); because my App..

How to write ternary operator condition in jQuery?

In this fiddle http://jsfiddle.net/mjmitche/6nar4/3/, if you drag, for example, the little blue box into the yellow box, then the big black box will turn pink. All of the 4 boxes along the left can be..

How can I get the last 7 characters of a PHP string?

How would I go about grabbing the last 7 characters of the string below? For example: $dynamicstring = "2490slkj409slk5409els"; $newstring = some_function($dynamicstring); echo "The new string is: "..

How to get a .csv file into R?

I have this .csv file: ID,GRADES,GPA,Teacher,State 3,"C",2,"Teacher3","MA" 1,"A",4,"Teacher1","California" And what I want to do is read in the file using the R statistical software and read in t..

Timestamp with a millisecond precision: How to save them in MySQL

I have to develop a application using MySQL and I have to save values like "1412792828893" which represent a timestamp but with a precision of a millisecond. That is, the amount of milliseconds since ..

Convert a list of characters into a string

If I have a list of chars: a = ['a','b','c','d'] How do I convert it into a single string? a = 'abcd' ..

How to make a DIV visible and invisible with JavaScript

Can you do something like function showDiv() { [DIV].visible = true; //or something } ..

IPC performance: Named Pipe vs Socket

Everyone seems to say named pipes are faster than sockets IPC. How much faster are they? I would prefer to use sockets because they can do two-way communication and are very flexible but will choose s..

AngularJS $resource RESTful example

I would like to use $resource to call my RESTful web service, (which I am still working on) but I would like to find out if I got my AngularJS script correct first. The todo DTO has: {id, order, cont..

jQuery - Add ID instead of Class

I'm using the current jQuery: $(function() { $('span .breadcrumb').each(function(){ $('#nav').addClass($(this).text()); $('#container').addClass($(this).text()); $('.stret..

How to get Node.JS Express to listen only on localhost?

I have an application that I have behind a reverse proxy, I would like for it to only listen to localhost/127.0.0.1. I expected this to work: app.listen(3001, 'localhost'); or app.listen(3001, '12..

Save internal file in my own internal folder in Android

I try to save a txt file in my folder, in internal storage, but I face the same problem every time: "Source Not Found" I write my code in different ways expressed here as follows but in all ways..

How do I properly escape quotes inside HTML attributes?

I have a drop down on a web page which is breaking when the value string contains a quote. The value is "asd, but in the DOM it always appears as an empty string. I have tried every way I know to es..

How do I declare an array variable in VBA?

I need to add the var in array Public Sub Testprog() Dim test As Variant Dim iCounter As Integer If test = Empty Then iCounter = 0 test(iCounter) = "test" Else iCounter = UBound(test) E..