Questions Tagged with #Dom manipulation

The process of changing the Document Object Model (DOM). It includes adding, removing or changing DOM elements.

filters on ng-model in an input

I have a text input and I don't want to allow users to use spaces, and everything typed will be turned into lowercase. I know I'm not allowed to use filters on ng-model eg. ng-model='tags | lowercas..

How to clear all <div>s’ contents inside a parent <div>?

I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="childdiv..

How to add a class to a given element?

I have an element that already has a class: <div class="someclass"> <img ... id="image1" name="image1" /> </div> Now, I want to create a JavaScript..

How to move all HTML element children to another parent using JavaScript?

Imagine: <div id="old-parent"> <span>Foo</span> <b>Bar</b> Hello World </div> <div id="new-parent"></div> What JavaScript can be written ..

Check if registry key exists using VBScript

I thought this would be easy, but apparently nobody does it... I'm trying to see if a registry key exists. I don't care if there are any values inside of it such as (Default). This is what I've been ..

How can I get the Windows last reboot reason

I'd like to know what is the Windows API function (if any exists) that provides information about the last Windows reboot source. There are three main possible causes: The computer crashed on a blue..

CreateProcess: No such file or directory

I am getting this error whenever I try to run GCC outside of its installation directory (E:\MinGW\bin). So, let's say I am in E:\code and have a file called one.c. Running: gcc one.c -o one.exe will..

What is the easiest way to initialize a std::vector with hardcoded elements?

I can create an array and initialize it like this: int a[] = {10, 20, 30}; How do I create a std::vector and initialize it similarly elegant? The best way I know is: std::vector<int> ints; ..

Laravel 5.2 - Use a String as a Custom Primary Key for Eloquent Table becomes 0

I am trying to use email as my table's primary key, so my eloquent code is- <?php namespace App; use Illuminate\Database\Eloquent\Model; class UserVerification extends Model { protected $ta..

"unary operator expected" error in Bash if condition

I've been trying to figure out whats wrong with this but just can't figure it out.. This is the part seems to be getting an error.. elif [ $operation = "man" ]; then if [ $aug1 = "add" ]; then ..

How do I read a text file of about 2 GB?

I have a .txt file whose memory is more than 2 GB. The problem is I cannot open it with Notepad, Notepad++ or any other editor programs. Any solutions?..

Accessing a class' member variables in Python?

class Example(object): def the_example(self): itsProblem = "problem" theExample = Example() print(theExample.itsProblem) How do I access a class's variable? I've tried adding this defi..

jQuery - Sticky header that shrinks when scrolling down

I wonder how to make a sticky header shrink(with animation) when you scroll down the page and goes back to normal state when the page is scrolled up to the top. Here are two examples to clearify: htt..

Add custom buttons on Slick Carousel

How do I apply custom prev and next buttons to slick carousel? I have tried a background image on the .slick-prev and .slick-next css classes. I have also tried adding a new class as per the documenta..

Install pip in docker

I'm not able to install pip in Docker. Here's my Dockerfile: FROM ubuntu:14.04 # Install dependencies RUN apt-get update -y RUN apt-get install -y git curl apache2 php5 libapache2-mod-php5 php5-mcr..

How to change the locale in chrome browser

I want to change Accept-language request header to anything I wanted in chrome, is there any extension or plugin where I can do it. I want to be able to change locale and language both. Main requireme..

How to repair a serialized string which has been corrupted by an incorrect byte count length?

I am using Hotaru CMS with the Image Upload plugin, I get this error if I try to attach an image to a post, otherwise there is no error: unserialize() [function.unserialize]: Error at offset The..

JavaScript backslash (\) in variables is causing an error

In Javascript, when I put a backslash in some variables like: var ttt = "aa ///\\\"; var ttt = "aa ///\"; Javascript shows an error. If I try to restrict user in entering this character, I also g..

Java Could not reserve enough space for object heap error

I have Java7 running on 32-bit Windows and 4 GB RAM, but: java -Xmx4G -Xms4G -jar Minecraft.jar java -Xmx3G -Xms3G -jar Minecraft.jar java -Xmx2G -Xms2G -jar Minecraft.jar ...still does not work...

Error: The type exists in both directories

In a MVC2 project I moved a file from App_code to Content folder and compiled it. Then move it back again to App_Code and then changed its Build Action to "Compile". Now I get this error and I don't k..

Polygon Drawing and Getting Coordinates with Google Map API v3

I'm trying to develop an application by using Google Maps API v3. What I'm trying to do is; first let the user draw a polygon on a Google Map and get his/her polygon's coordinates and save them into a..

How to properly set Column Width upon creating Excel file? (Column properties)

I am using standard library using Excel = Microsoft.Office.Interop.Excel; And this is how I create Excel, just small part of code: //Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Work..

Php, wait 5 seconds before executing an action

I have a .php script that I use for creating the list of my products. I am on shared hosting, so I can't do a lot of queries otherwise I get a blank page. This is how I use my script now: script.php..

Inconsistent Accessibility: Parameter type is less accessible than method

I'm trying to pass an object (a reference to the currently logged on user, basically) between two forms. At the moment, I have something along these lines in the login form: private ACTInterface oAc..

Find if value in column A contains value from column B?

I have two columns- column E which extends upto 99504(values) and column I which extends to 2691(values).Both the columns contains filenames with extension. Something like this E I TSL..

How to restrict SSH users to a predefined set of commands after login?

This is a idea for a security. Our employees shall have access to some commands on a linux server but not all. They shall e.g. have the possibility to access a log file (less logfile) or start differe..

Uncaught TypeError: Cannot read property 'msie' of undefined

This error message is arising from the following code: $.fn.extend({ chosen: function(options) { if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) ..

Use Excel pivot table as data source for another Pivot Table

I have a Pivot table in excel that is using a raw table as its data source. This pivot table is doing a bunch of grouping and summing of rows. I'd like to now use the result of this new pivot tabl..

What is difference between Axios and Fetch?

I am calling the web service by using fetch but the same I can do with the help of axios. So now I am confused. Should I go for either axios or fetch?..

How do I give ASP.NET permission to write to a folder in Windows 7?

I have a new Win7 workstation and I am trying to get ScrewTurn Wiki to run on the machine. My STW installation is using the file system option to store its data, and as such I need to give write perm..

Load image with jQuery and append it to the DOM

I'm trying to load an image from a given link var imgPath = $(imgLink).attr('href'); and append it to the page, so I can insert it into a given element for an image viewer. Even though I searched ..

How to get data out of a Node.js http get request

I'm trying to get my function to return the http get request, however, whatever I do it seems to get lost in the ?scope?. I'm quit new to Node.js so any help would be appreciated function getData(){ ..

Using Axios GET with Authorization Header in React-Native App

I'm trying to use axios for a GET request with an API which requires an Authorization header. My current code: const AuthStr = 'Bearer ' + USER_TOKEN; where USER_TOKEN is the access token needed. ..

How can labels/legends be added for all chart types in chart.js (chartjs.org)?

The documentation for chart.js mentions "legend templates" but gives no resources or examples of such legends. How can these be displayed?..

jQuery Validation plugin: validate check box

I am using jQuery Validation plugin to validate check box since it does not have default option, One should be selected and max two check boxes can be selected, these is the criteria. I am not getting..

Make a Bash alias that takes a parameter?

I used to use CShell (csh), which lets you make an alias that takes a parameter. The notation was something like alias junk="mv \\!* ~/.Trash" In Bash, this does not seem to work. Given that Bash h..

Bootstrap modal link

How can I make button become a link only and have a popup in bootstrap 3? code <a href="" data-toggle="modal" data-target=".bannerformmodal">Load me</a> <div class="modal fade banne..

Ruby: How to get the first character of a string

How can I get the first character in a string using Ruby? Ultimately what I'm doing is taking someone's last name and just creating an initial out of it. So if the string was "Smith" I just want "S"..

How to set a:link height/width with css?

I just can't set the height and width of a elements of my navigation. #header div#snav div a{ width:150px; height:77px; } #header div#snav div a:link{ width:150px; height:77px; } #..

Javascript: how to validate dates in format MM-DD-YYYY?

I saw a potential answer here but that was for YYYY-MM-DD: JavaScript date validation I modified the code code above for MM-DD-YYYY like so but I still can't get it to work: String.prototype.isValid..

In Flask, What is request.args and how is it used?

I'm new in Flask. I can't understand how request.args is used. I read somewhere that it is used to return values of query string[correct me if I'm wrong]. And how many parameters request.args.get() ta..

Why can't Visual Studio find my DLL?

In Visual Studio 2010, under VC++ Directories > Executable Directories, I have specified the path to glew32d.dll. However, when I run the executable, it still complains. On the other hand, if I co..

div with dynamic min-height based on browser window height

I have three div elements: one as a header, one as a footer, and a center content div. the div in the center needs to expand automatically with content, but I would like a min-height such that the bo..

What does the @ symbol before a variable name mean in C#?

Possible Duplicate: What's the use/meaning of the @ character in variable names in C#? I understand that the @ symbol can be used before a string literal to change how the compiler pars..

setTimeout or setInterval?

As far as I can tell, these two pieces of javascript behave the same way: Option A: function myTimeoutFunction() { doStuff(); setTimeout(myTimeoutFunction, 1000); } myTimeoutFunction(); O..

javascript create array from for loop

I have a years range stored into two variables. I want to create an array of the years in the range. something like: var yearStart = 2000; var yearEnd = 2040; var arr = []; for (var i = yearStart;..

Add new value to an existing array in JavaScript

In PHP, I'd do something like: $array = array(); $array[] = "value1"; $array[] = "value2"; $array[] = "value3"; How would I do the same thing in JavaScript?..

Which ORM should I use for Node.js and MySQL?

I'm rewriting a project to use Node.js. I'd like to keep using MySQL as the DB (even though I don't mind rewriting the schema). I'm looking for a simple-to-use, reasonable-performance ORM, which suppo..

Controlling Spacing Between Table Cells

I'm trying to create a table where each cell has a background color with white space between them. But I seem to be having trouble doing this. I tried setting td margins but it seems to have no effec..

ORA-01652: unable to extend temp segment by 128 in tablespace SYSTEM: How to extend?

I have a large Oracle table, which contains 542512 rows. It has three columns and when I try to create an index for it with the following command: CREATE INDEX FTS_INDEX ON FILTERED_TEKLI_IIS_TABLO..

What does iterator->second mean?

In C++, what is the type of a std::map<>::iterator? We know that an object it of type std::map<A,B>::iterator has an overloaded operator -> which returns a std::pair<A,B>*, and t..

How to check status of PostgreSQL server Mac OS X

How can I tell if my Postgresql server is running or not? I'm getting this message: [~/dev/working/sw] sudo bundle exec rake db:migrate rake aborted! could not connect to server: Connection refused..

Accessing clicked element in angularjs

I'm relatively new to AngularJS and suspect I'm not grasping a concept. I'm also using Twitter Bootstrap and I've got jQuery loaded. Workflow: User clicks a link from a list, "master" section is upda..

How to extend an existing JavaScript array with another array, without creating a new array

There doesn't seem to be a way to extend an existing JavaScript array with another array, i.e. to emulate Python's extend method. I want to achieve the following: >>> a = [1, 2] [1, 2] >..

Effectively use async/await with ASP.NET Web API

I am trying to make use of the async/await feature of ASP.NET in my Web API project. I am not very sure whether it will make any difference in performance of my Web API service. Please find below the ..

What is an unsigned char?

In C/C++, what an unsigned char is used for? How is it different from a regular char?..

Bash script prints "Command Not Found" on empty lines

Every time I run a script using bash scriptname.sh from the command line in Debian, I get Command Not found and then the result of the script. The script works but there is always a Command Not Found..

How to center div vertically inside of absolutely positioned parent div

I am trying to get blue container in the middle of pink one, however seems vertical-align: middle; doesn't do the job in that case. <div style="display: block; position: absolute; left: 50px; top:..

Add spaces between the characters of a string in Java?

I just want to add a space between each character of a string. Can anyone help me figuring out how to do this? E.g. given "JAYARAM", I need "J A Y A R A M" as the result...

How to create the branch from specific commit in different branch

I have made several commits in the master branch and then merged them to dev branch. I want to create a branch from a specific commit in dev branch, which was first committed in master branch. I use..

Room persistance library. Delete all

How can I delete all entries on specific table using Room Persistence Library? I need to drop table, but I cannot to find any information how to do this. Only when database is migrating or to load al..

TCPDF Save file to folder?

I'm using TCPDF to print a receipt and then send it to customer with phpMailer, but I have a problem: I have no idea how to save the file into a pdf. I've tried this: // reset pointer to the last ..

How can I get a list of all open named pipes in Windows?

Is there an easy way to test whether your named pipe is working correctly? I want to make sure that the data I'm sending from my app is actually being sent. Is there a quick and easy way to get a list..

Time comparison

I have a time in hh:mm and it has to be entered by the user in that format. However, I want to compare the time (eg. 11:22) is it between 10am to 6pm? But how do I compare it?..

How do I autoindent in Netbeans?

In eclipse you can click Ctrl+I at any line, and it'll automatically indent the line or group of lines according to the indentation scheme you chose in the settings. I'm really missing this feature i..

Uploading images using Node.js, Express, and Mongoose

Please consider newer answers that have more up-to-date information as things have changed over the years! Since many new Node.js libraries are quickly being rendered obsolete and there are relativel..

Default values in a C Struct

I have a data structure like this: struct foo { int id; int route; int backup_route; int current_route; } and a function called update() that is used to req..

Making view resize to its parent when added with addSubview

I'm having a problem when using addSubview. Example code: ParentView *myParentView = [[ParentView alloc] initWithNibName:@"ParentView " bundle:nil]; ChildeView *myChildeView = [[ChildeView alloc] in..

Determine whether a Access checkbox is checked or not

Such a simple question, but I cannot find the answer (Google, MS help, SO): How can I check by VBA whether an unbound checkbox on an Access form is checked by the user or not? Can't find the right pr..

How to check the multiple permission at single request in Android M?

I want to use the android.permission.CAMERA android.permission.WRITE_EXTERNAL_STORAGE in single request using ActivityCompat.requestPermissions(Activity activity,new String permisionList[],int ..

How do I escape the wildcard/asterisk character in bash?

For example: me$ FOO="BAR * BAR" me$ echo $FOO BAR file1 file2 file3 file4 BAR and using the \ escape character: me$ FOO="BAR \* BAR" me$ echo $FOO BAR \* BAR I'm obviously doing something stupi..

CSS transition fade in

So I have used CSS transitions before but I have a unique case with this one. I am writing a custom plugin for creating modals. Essentially I create a div on the fly document.createElement('div') an..

How can I get the file name from request.FILES?

How can I get the file name from request.FILES in Django? def upload(request): if request.method == 'POST': form = UploadForm(request.POST, request.FILES) if form.is_valid(): ..

Vim autocomplete for Python

I am trying to incorporate an autocomplete feature in Vim. I have used the omnicompletion of Vim as well as Pydiction. But in both the cases this message pops up: Omni completion (^O^N^P) Pattern not..

How to convert char* to wchar_t*?

I've tried implementing a function like this, but unfortunately it doesn't work: const wchar_t *GetWC(const char *c) { const size_t cSize = strlen(c)+1; wchar_t wc[cSize]; mbstowcs (wc, c..

Python function pointer

I have a function name stored in a variable like this: myvar = 'mypackage.mymodule.myfunction' and I now want to call myfunction like this myvar(parameter1, parameter2) What's the easiest way to..

Javascript getElementsByName.value not working

I am trying to make a simple javascript program bit it isn't working. Kindly help. In eclipse I have created a dynamic web project and in DD my welcome file is index.jsp. Given below is my code for in..

Removing the remembered login and password list in SQL Server Management Studio

I've recently used our company's spare laptop (that has a general user set up) while mine was being repaired. I've checked the "Remember password" option in SQL Server Management Studio when logging i..

Python: Converting string into decimal number

I have a python list with strings in this format: A1 = [' "29.0" ',' "65.2" ',' "75.2" '] How do I convert those strings into decimal numbers to perform arithmetic operations on the list elements?..

call javascript function onchange event of dropdown list

I want to invoke javascript function when value in the dropdown list changes. I dont want to hardcode dropdown list id . Hence not using document.getElementById My Code: <select id ="ddl" name=..

Returning a boolean from a Bash function

I want to write a bash function that check if a file has certain properties and returns true or false. Then I can use it in my scripts in the "if". But what should I return? function myfun(){ ... ret..

findViewByID returns null

First of all: yes, I read all the other threads on this topic. And not only those from this site... (you see, I'm a little frustrated) Most of them come with the advice to use android:id instead of j..

Including external jar-files in a new jar-file build with Ant

I have just 'inherited' a Java-project and not coming from a Java-background I am a little lost at times. Eclipse is used to debug and run the application during development. I have through Eclipse su..

correct way to define class variables in Python

I noticed that in Python, people initialize their class attributes in two different ways. The first way is like this: class MyClass: __element1 = 123 __element2 = "this is Africa" def..

jump to line X in nano editor

Does the Nano minimal text editor have a keyboard shortcut feature to jump to a specified line? Vim provides several analogs...

Sum function in VBA

I have a problem with summing cells in vba. I need to use Cells(a,b): Range("A1").function="=SUM(Range(Cells(2,1),Cells(3,2)))" but it doesn't work...

Modifying Objects within stream in Java8 while iterating

In Java8 streams, am I allowed to modify/update objects within? For eg. List<User> users: users.stream().forEach(u -> u.setProperty("value")) ..

How to retrieve the dimensions of a view?

I have a view made up of TableLayout, TableRow and TextView. I want it to look like a grid. I need to get the height and width of this grid. The methods getHeight() and getWidth() always return 0. ..

Label word wrapping

Is there a way to do a word wrap in a .NET label control? I know there is an alternate way of using a TextBox, make property BorderStyle to none, property ReadOnly to true and set property WordWrap a..

MVC 4 client side validation not working

Can anyone tell me why client side validation is not working in my MVC 4 application. _layout.schtml @Scripts.Render("~/bundles/jquery") @RenderSection("scripts", required: false) ..

How to increase Neo4j's maximum file open limit (ulimit) in Ubuntu?

Currently ulimit -n shows 10000. I want to increase it to 40000. I've edited "/etc/sysctl.conf" and put fs.file-max=40000. I've also edited /etc/security/limits.conf and updated hard and soft values. ..

How to hide Bootstrap previous modal when you opening new one?

I have such trouble: I have authentification which is made using Bootstrap modals. When user opens sign in modal he can go to sign up modal ( or other ) . So, I need to close previous one. Now I'm ..

How to delete all data from solr and hbase

How do I delete all data from solr by command? We are using solr with lily and hbase. How can I delete data from both hbase and solr? http://lucene.apache.org/solr/4_10_0/tutorial.html#Deleting+Dat..

How do the likely/unlikely macros in the Linux kernel work and what is their benefit?

I've been digging through some parts of the Linux kernel, and found calls like this: if (unlikely(fd < 0)) { /* Do something */ } or if (likely(!err)) { /* Do something */ } I've foun..

How to uninstall Eclipse?

I want to uninstall Eclipse version Mars 2, but it doesn't appear in the "Programs and Features" area of the Windows Control Panel. The installer has installed start menu shortcuts and other artifacts..

how to replace an entire column on Pandas.DataFrame

I would like to replace an entire column on a Pandas DataFrame with another column taken from another DataFrame, an example will clarify what I am looking for import pandas as pd dic = {'A': [1, 4, 1,..

.toLowerCase not working, replacement function?

The .toLowerCase method is giving me an error when I try to use it on numbers. This is what I have: var ans = 334; var temp = ans.toLowerCase(); alert(temp); And then it gives me this error: 'unde..

Count number of times value appears in particular column in MySQL

This has probably been asked before, but I'm unable to make my way through the myriad of search results. Given a non-normalized MySQL table, what is the most optimized query to count the number of ti..

Maven project.build.directory

In Maven, what does the project.build.directory refer to? I am a bit confused, does it reference the source code directory or the target directory in the Maven project?..

jQuery changing font family and font size

I am trying to change font family and font size of the text that appears in a textarea and a container by choosing the font from the list, font size should be fixed. I am also trying to change color o..

How to know Laravel version and where is it defined?

How to know Laravel version and where is it defined? Is Laravel version is defined inside my application directory or somewhere in global server side directory? UPDATE Sorry, the main question is w..

Can I call curl_setopt with CURLOPT_HTTPHEADER multiple times to set multiple headers?

Can I call curl_setopt with CURLOPT_HTTPHEADER multiple times to set multiple headers? $url = 'http://www.example.com/'; $curlHandle = curl_init($url); curl_setopt($curlHandle, CURLOPT_HTTPHEADER, a..

Carriage return in C?

Output of Following program is : hai I didn't get how the \r carriage return works in this program and in real can any one help me out ? #include <stdio.h> #include<conio.h> void main..

How to close Browser Tab After Submitting a Form?

<?php /* ... SQL EXECUTION TO UPDATE DB ... */ ?> <form method = "post" action = "<?=$_SERVER['php_self']?>" onSubmit= "window.close();"> ... <input type="..

How to add a scrollbar to an HTML5 table?

I have an table in HTML5 that I would like to add a scrollbar to. I want the table to show ten rows and then the user can scroll down to see other songs. How can I add the scrollbar? Here is my code ..

What is the difference between bindParam and bindValue?

What is the difference between PDOStatement::bindParam() and PDOStatement::bindValue()?..

Linux command line howto accept pairing for bluetooth device without pin

Is there a way to pair a device in linux without requiring a pin(for testing purposes so I need it to be done w/out human interaction, assuming you have root access)? bluez-simple-agent seems to requ..

Percentage Height HTML 5/CSS

I am trying to set a <div> to a certain percentage height in CSS, but it just remains the same size as the content inside it. When I remove the HTML 5 <!DOCTYTPE html> however, it works, t..

How to get the mobile number of current sim card in real device?

I have to make an application which shows the contact no of the SIM card that is being used in the cell. For that I need to use TelephonyManager class. Can I get details on its usage?..

How do I display local image in markdown?

Does anyone know how to display a local image in markdown? I don't want to setup a webserver for that. I try the following in markdown, but it doesn't work: ![image](files/Users/jzhang/Desktop/Isolate..

Convert laravel object to array

Laravel output: Array ( [0] = stdClass Object ( [ID] = 5 ) [1] = stdClass Object ( [ID] = 4 ) ) I want to convert this into normal array. Just want to re..

Convert INT to FLOAT in SQL

I have this Query : SELECT sl.sms_prefix, sum( sl.parts ) , cp.country_name, CAST(SUM(sl.parts) AS NUMERIC(10,4)) * CAST(cp.price AS NUMERIC(10,4)) FROM sms_log sl, sms_transaction st, country_pre..

pointer to array c++

What is the following code doing? int g[] = {9,8}; int (*j) = g; From my understanding its creating a pointer to an array of 2 ints. But then why does this work: int x = j[0]; and this not work:..

Is there a way to make text unselectable on an HTML page?

I'm building an HTML UI with some text elements, such as tab names, which look bad when selected. Unfortunately, it's very easy for a user to double-click a tab name, which selects it by default in ma..

Command /usr/bin/codesign failed with exit code 1

I have the following error: Command /usr/bin/codesign failed with exit code 1 Here is what I already did for trying to fix this: set the bundle identifier to com.server.pgmname set the code si..

Swap two variables without using a temporary variable

I'd like to be able to swap two variables without the use of a temporary variable in C#. Can this be done? decimal startAngle = Convert.ToDecimal(159.9); decimal stopAngle = Convert.ToDecimal(355.87)..

Why does DEBUG=False setting make my django Static Files Access fail?

Am building an app using Django as my workhorse. All has been well so far - specified db settings, configured static directories, urls, views etc. But trouble started sneaking in the moment I wanted t..

How can I display a tooltip message on hover using jQuery?

As the title states, how can I display a tooltip message on hover using jQuery?..

Division of integers in Java

This is a basic question but I can't find an answer. I've looked into floating point arithmetic and a few other topics but nothing has seemed to address this. I'm sure I just have the wrong terminol..

argparse module How to add option without any argument?

I have created a script using argparse. The script needs to take a configuration file name as an option, and user can specify whether they need to proceed totally the script or only simulate it. The..

python .replace() regex

I am trying to do a grab everything after the '</html>' tag and delete it, but my code doesn't seem to be doing anything. Does .replace() not support regex? z.write(article.replace('</html>..

Retrieving a property of a JSON object by index?

Assuming this JSON object: var obj = { "set1": [1, 2, 3], "set2": [4, 5, 6, 7, 8], "set3": [9, 10, 11, 12] }; The "set2" property may be retrieved like so: obj["set2"] Is there a w..

Resolving LNK4098: defaultlib 'MSVCRT' conflicts with

This warning: LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library is a fairly common warning in Visual Studio. I'd like to understand the exact..

How to remove package using Angular CLI?

Angular 6 has new CLI command ng add <package>. How can I remove the package using Angular CLI? UPDATE documentation ng add will use your package manager to download new dependencies and ..

java.time.format.DateTimeParseException: Text could not be parsed at index 21

I get the datetime value as created_at '2012-02-22T02:06:58.147Z' Read-only. The time at which this task was created. Which is given by Asana API I am using Java 8 to parse the date time as fol..

Encrypt and decrypt a String in java

I am new to cryptography. I wish to learn how to encrypt and decrypt the text in a file... when I refer the related articles in net. I had a doubt that whether the encrypted text will be same for sing..

Parsing JSON array into java.util.List with Gson

I have a JsonObject named "mapping" with the following content: { "client": "127.0.0.1", "servers": [ "8.8.8.8", "8.8.4.4", "156.154.70.1", "156.154.71.1" ..

How can I clear the terminal in Visual Studio Code?

I need to clean the contents of the terminal in Visual Studio Code. Every time I use Maven, the output of the terminal is attached to the previous build, which is confusing me. How do I clear the te..

How to empty a list in C#?

I want to empty a list. How to do that?..

Padding characters in printf

I am writing a bash shell script to display if a process is running or not. So far, I got this: printf "%-50s %s\n" $PROC_NAME [UP] The code gives me this output: JBoss ..

Java Returning method which returns arraylist?

I have one class with a method like this: public ArrayList<Integer> myNumbers() { ArrayList<Integer> numbers = new ArrayList<Integer>(); numbers.add(5); numbers.add(1..

How do I make a comment in a Dockerfile?

I am writing a Dockerfile. Is there a way to make comments in this file? Does Docker have a comment option that takes the rest of a line and ignores it?..

Replace a newline in TSQL

I would like to replace (or remove) a newline character in a TSQL-string. Any Ideas? The obvious REPLACE(@string, CHAR(13), '') just won't do it.....

How can I render inline JavaScript with Jade / Pug?

I'm trying to get JavaScript to render on my page using Jade (http://jade-lang.com/) My project is in NodeJS with Express, eveything is working correctly until I want to write some inline JavaScript ..

What is special about /dev/tty?

ls -la /dev/tty shows the output: crw-rw-rw- 1 root tty 5, 0 Dec 14 22:21 /dev/tty What does c at the beginning mean? When I do something like pwd > /dev/tty it prints to the stdout. What does t..

How do I set vertical space between list items?

Within a <ul> element, clearly the vertical spacing between lines can be formatted with the line-height attribute. My question is, within a <ul> element, how do I set the vertical spacing..

What is the purpose of the "final" keyword in C++11 for functions?

What is the purpose of the final keyword in C++11 for functions? I understand it prevents function overriding by derived classes, but if this is the case, then isn't it enough to declare as non-virtua..

What is the difference between Forking and Cloning on GitHub?

I'd like to know the differences between doing a Fork of a project and doing a clone of it. Can I only send pull requests via GitHub if I've forked a project?..

Splitting a string at every n-th character

In JavaScript this is how we can split a string at every 3-rd character "foobarspam".match(/.{1,3}/g) I am trying to figure out how to do this in Java. Any pointers?..

Using $_POST to get select option value from HTML

I use select as below: <select name="taskOption"> <option>First</option> <option>Second</option> <option>Third</option> </select> How do ..

How to copy a file along with directory structure/path using python?

First thing I have to mention here, I'm new to python. Now I have a file located in: a/long/long/path/to/file.py I want to copy to my home directory with a new folder created: /home/myhome/new_fo..

What is a good regular expression to match a URL?

Currently I have an input box which will detect the URL and parse the data. So right now, I am using: var urlR = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+) (?::(\d+))?(?:\/([^?#]*))?(?..

How to break out of the IF statement

I have code like this: public void Method() { if(something) { //some code if(something2) { now I should break from ifs and go to te code outside ifs ..

What charset does Microsoft Excel use when saving files?

I have a Java app which reads CSV files which have been created in Excel (e.g. 2007). Does anyone know what charset MS Excel uses to save these files in? I would have guessed either: windows-1255 (..

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

Do fragments really need an empty constructor?

I have a Fragment with a constructor that takes multiple arguments. My app worked fine during development, but in production my users sometimes see this crash: android.support.v4.app.Fragment$Instant..

Error inflating when extending a class

I'm trying to create a custom view GhostSurfaceCameraView that extends SurfaceView. Here's my class definition file GhostSurfaceCameraView.java: public class GhostSurfaceCameraView extends SurfaceV..

How do I get the "id" after INSERT into MySQL database with Python?

I execute an INSERT INTO statement cursor.execute("INSERT INTO mytable(height) VALUES(%s)",(height)) and I want to get the primary key. My table has 2 columns: id primary, auto increment he..

Changing image sizes proportionally using CSS?

I have been trying for a couple of days now to configure my thumbnail gallery so all the images appear the same height and width. However when I change the Css code to, max-height: 150px; max-width:..

How can I show figures separately in matplotlib?

Say that I have two figures in matplotlib, with one plot per figure: import matplotlib.pyplot as plt f1 = plt.figure() plt.plot(range(0,10)) f2 = plt.figure() plt.plot(range(10,20)) Then I show bo..

Various ways to remove local Git changes

I just cloned a git repository and checked out a branch. I worked on it, and then decided to remove all my local changes, as I wanted the original copy. In short, I had to do the following two comman..

Difference between fprintf, printf and sprintf?

Can anyone explain in simple English about the differences between printf, fprintf, and sprintf with examples? What stream is it in? I'm really confused between the three of these while reading abo..

Not equal <> != operator on NULL

Could someone please explain the following behavior in SQL? SELECT * FROM MyTable WHERE MyColumn != NULL (0 Results) SELECT * FROM MyTable WHERE MyColumn <> NULL (0 Results) SELECT * FROM MyTab..

AngularJS/javascript converting a date String to date object

Im stuck on a problem and would appreciate any help. I have read through lot of the discussions already but they dont seem to work for me. //I have a date as a string which I want to get to a date f..

How does the keyword "use" work in PHP and can I import classes with it?

I have a file with a class Resp. The path is: C:\xampp\htdocs\One\Classes\Resp.php And I have an index.php file in this directory: C:\xampp\htdocs\Two\Http\index.php In this index.php file I wan..

align an image and some text on the same line without using div width?

Ok so I'm trying to align an image(which is contained in a div) and some text(also contained in a div) on the same line, without setting width for the text, how can i do it? This is what I have so far..

Create a BufferedImage from file and make it TYPE_INT_ARGB

I have a PNG file with transparency that is loaded and stored in a BufferedImage. I need this BufferedImage to be of TYPE_INT_ARGB. However, when I use getType() the returned value is 0 (TYPE_CUSTOM) ..

Remove padding from columns in Bootstrap 3

Problem: Remove padding/margin to the right and left of col-md-* in Bootstrap 3. HTML code: <div class="col-md-12"> <h2>OntoExplorer<span style="color:#b92429">.</span>&..

OpenSSL: PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE

I need a hash-name for file for posting in Stunnel's CApath directory. I have got some certs in this directory and they are working well. Also, I have a server sert and server key: cert = c:\Program ..

pip install mysql-python fails with EnvironmentError: mysql_config not found

This is the error I get (mysite)zjm1126@zjm1126-G41MT-S2:~/zjm_test/mysite$ pip install mysql-python Downloading/unpacking mysql-python Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded..

Converting pixels to dp

I have created my application with the height and width given in pixels for a Pantech device whose resolution is 480x800. I need to convert height and width for a G1 device. I thought converting it i..

Get file name from URL

In Java, given a java.net.URL or a String in the form of http://www.example.com/some/path/to/a/file.xml , what is the easiest way to get the file name, minus the extension? So, in this example, I'm lo..

How to get primary key of table?

Is there a way to get the name of primary key field from mysql-database? For example: I have a table like this: +----+------+ | id | name | +----+------+ | 1 | Foo1 | | 2 | Foo2 | | 3 | Foo3 | +-..

How to stretch in width a WPF user control to its window?

I have a Window with my user control and I would like to make usercontrol width equals window width. How to do that? The user control is a horizontal menu and contains a grid with three columns: <..

Regex not operator

Is there an NOT operator in Regexes? Like in that string : "(2001) (asdf) (dasd1123_asd 21.01.2011 zqge)(dzqge) name (20019)" I want to delete all \([0-9a-zA-z _\.\-:]*\) but not the one where it is ..

How do I close an Android alertdialog

I am developing a quiz and I need the user to answer all the questions before proceeding. When the user has not answered all the questions I display a simple alertdialog informing him or her. The pro..

Where in memory are my variables stored in C?

By considering that the memory is divided into four segments: data, heap, stack, and code, where do global variables, static variables, constant data types, local variables (defined and declared in fu..

How to "fadeOut" & "remove" a div in jQuery?

I'm trying to give fadeout effect to a div & delete that div(id = "notification"), when an image is clicked. This is how I'm doing that: <a onclick="$("#notification").fadeOut(300,function() ..

How to .gitignore all files/folder in a folder, but not the folder itself?

Possible Duplicate: How do I add an empty directory to a git repository I want to check in a blank folder. How can I do this?..

Where are the recorded macros stored in Notepad++?

I have recorded a macro that I want to share with my work colleague. In what location are these recorded macros saved, so that I can add it to his machine? If interested, the macro is for taking a l..

Environment variable to control java.io.tmpdir?

I've used the TMP environment variable to control things like where gcc writes it's temporary files, but I can't seem to find an equivalent for java's createTempFile API. Does such an environment var..

Remove menubar from Electron app

How do I remove this menu-bar from my electron apps: Also it says "Hello World"(is this because I downloaded electron pre-built, and will go away once I package the application?). I didn't code the..

Create a .txt file if doesn't exist, and if it does append a new line

I would like to create a .txt file and write to it, and if the file already exists I just want to append some more lines: string path = @"E:\AppServ\Example.txt"; if (!File.Exists(path)) { File.C..

How to clear browsing history using JavaScript?

I am doing a simple project, let us take high secure website. I have 5 different JSP pages. If I started from first JSP page, it is redirecting to second JSP page and so on. In the meanwhile, it shoul..

Heroku "psql: FATAL: remaining connection slots are reserved for non-replication superuser connections"

I'm developing an app on Heroku with a Postgresql backend. Periodically, I get this error message when trying to access the database, both from the CLI and from loading a page on the server: psql: FA..

How to generate range of numbers from 0 to n in ES2015 only?

I have always found the range function missing from JavaScript as it is available in python and others? Is there any concise way to generate range of numbers in ES2015 ? EDIT: MY question is differen..

Writing numerical values on the plot with Matplotlib

Is it possible, with Matplotlib, to print the values of each point on the graph? For example, if I have: x = numpy.range(0,10) y = numpy.array([5,3,4,2,7,5,4,6,3,2]) pyplot.plot(x,y) How can I dis..

Set padding for UITextField with UITextBorderStyleNone

I wanted to use a custom background for my UITextFields. This works fine except for the fact that I have to use UITextBorderStyleNone to make it look pretty. This forces the text to stick to the left ..

What is Bit Masking?

I am fairly new to C programming, and I encountered bit masking. Can someone explain to me the general concept and function of bit masking? Examples are much appreciated...

How to check if a string contains text from an array of substrings in JavaScript?

Pretty straight forward. In javascript, I need to check if a string contains any substrings held in an array...

How to show and update echo on same line

I have the following in Bash (In Linux) for dir in Movies/* do (cd "$dir" && pwd|cut -d \/ -f5|tr -s '\n' ', ' >> ../../movielist && exiftool * -t -s3 -ImageSize -FileType|t..

How npm start runs a server on port 8000

I recently used a angular-seed folder from github for angular application development. In some previous angularjs tutorial there was a script folder and a server.js file in the angular-seed folder whi..

The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

Occasionally I get this error when working on remote computers. It's hit or miss on which computer I get it on. But I am able to ping the computer and test-connection pans out. For example, the com..

Setting the focus to a text field

I have an application developed in netbeans and I want to set the focus to a certain jTextField when a panel is displayed. I have read a number of post and have tried various methods but non have work..

Loop through files in a folder in matlab

I have a set of days of log files that I need to parse and look at in matlab. The log files look like this: LOG_20120509_120002_002.csv (year)(month)(day)_(hour)(minute)(second)_(log part number) ..

Copying a rsa public key to clipboard

I am trying to copy a public key to the clipboard on macOS, but I keep getting "no such file or directory." The command I am using is pasted below pbcopy < ~/.ssh/id_rsa.pub ..

Usage of $broadcast(), $emit() And $on() in AngularJS

I understand that $Broadcast(), $Emit() And $On() are used to raise an event in one controller and handling in another controller. If possible, can someone just give me some real time example on the ..

Disable eslint rules for folder

Is there a way to disable specific rules for a folder? For example, I don't want to have required JSDoc comments for all my test files in the test folder. Is there a way to do this?..

How to import js-modules into TypeScript file?

I have a Protractor project which contains such a file: var FriendCard = function (card) { var webElement = card; var menuButton; var serialNumber; this.getAsWebElement = function () ..

Append values to query string

I have set of URL's similar to the ones below in a list http://somesite.com/backup/lol.php?id=1&server=4&location=us http://somesite.com/news.php?article=1&lang=en I have managed to ge..

Angular 2 - Setting selected value on dropdown list

I have run into an issue in pre-selecting values on a dropdown list in Angular 2. I set an array of colours in the component which I bind successfully to the dropdown list. The issue I'm experienc..

Generating all permutations of a given string

What is an elegant way to find all the permutations of a string. E.g. permutation for ba, would be ba and ab, but what about longer string such as abcdefgh? Is there any Java implementation example?..

Get the Id of current table row with Jquery

Hi I have the following code in a form . When the user clicks a button I want to get the current row in order to identify which of the buttons was clicked <tr id="TEST1" > <td align="l..

How to remove an element from a list by index

How do I remove an element from a list by index in Python? I found the list.remove method, but say I want to remove the last element, how do I do this? It seems like the default remove searches the l..

Android: Remove all the previous activities from the back stack

When i am clicking on Logout button in my Profile Activity i want to take user to Login page, where he needs to use new credentials. Hence i used this code: Intent intent = new Intent(ProfileActivit..

How can I make the browser wait to display the page until it's fully loaded?

I hate how you can actually see webpages load. I think it'd be much more appealing to wait until the page is fully loaded and ready to be displayed, including all scripts and images, and then have th..

Filter output in logcat by tagname

I'm trying to filter logcat output from a real device (not an emulator) by tag name but I get all the messages which is quite a spam. I just want to read messages from browser which should be somethin..

How to execute an action before close metro app WinJS

I want to trigger a function before closing my metro app but I don't know where such as app.onactivated = function (args){ //all the actions here will be executed on app's activation } I want som..

Get immediate first child element

I'm writing a Chrome content script extension and I need to be able to target a specific element that, unfortunately, has no unique identifiers except its parent element. I need to target the immedia..

With CSS, use "..." for overflowed block of multi-lines

with overflow: hidden; text-overflow: ellipsis; white-space: nowrap; "..." will be shown in the end of the line if overflowed. However, this will be shown only in one line. But I would like it to b..

PHP/MySQL: How to create a comment section in your website

Instead of asking 'how to use PHP/MySQL to let users affect webpages' I'll ask this, because I learn better from projects and examples. So how would I incorporate a VERY basic comment feature using P..

Fade In Fade Out Android Animation in Java

I want to have a 2 second animation of an ImageView that spends 1000ms fading in and then 1000ms fading out. Here's what I have so far in my ImageView constructor: Animation fadeIn = new AlphaAnimat..

How do I connect to a terminal to a serial-to-USB device on Ubuntu 10.10 (Maverick Meerkat)?

I am trying to connect minicom to a serial device that is connected via a USB-to-serial adapter. This is a PL2303 and from everything I've read no additional drivers are required. The device is recogn..

Indent starting from the second line of a paragraph with CSS

How can I indent starting from the second line of a paragraph? I've tried p { text-indent: 200px; } p:first-line { text-indent: 0; } and p { margin-left: 200px; } p:first-line { m..