Questions Tagged with #Strstream

How to solve munmap_chunk(): invalid pointer error in C++

I have an application in C++ and OpenCV which tries to use the classification model realized with SVMLight in order to add the weight values which can be use for HOG Calssificator under OpenCV. The p..

How to save a spark DataFrame as csv on disk?

For example, the result of this: df.filter("project = 'en'").select("title","count").groupBy("title").sum() would return an Array. How to save a spark DataFrame as a csv file on disk ?..

Import Excel Spreadsheet Data to an EXISTING sql table?

I have a table called tblAccounts whose contents will come from an excel spreadsheet. I am using MS SQL Server 2008 (x64) on a Windows 8.1 (x64) I tried using the SQL Server Import/Export Wizard but..

Pandas/Python: Set value of one column based on value in another column

I need to set the value of one column based on the value of another in a Pandas dataframe. This is the logic: if df['c1'] == 'Value': df['c2'] = 10 else: df['c2'] = df['c3'] I am unable to ..

How to check if all of the following items are in a list?

I found, that there is related question, about how to find if at least one item exists in a list: How to check if one of the following items is in a list? But what is the best and pythonic way to fin..

Microsoft SQL Server 2005 service fails to start

I’ve been trying to install Ms SQL Server 2005 for over two weeks now, and I’ve finally gotten to the point where the prerequisites all seem to be in place. Unfortunately, every time I try to inst..

How to install multiple python packages at once using pip

I know it's an easy way of doing it but i didn't find it neither here nor on google. So i was curious if there is a way to install multiple packages using pip. Something like: pip install progra1..

Jquery Hide table rows

I am hiding a bunch of textboxes and it works fine, the problem is, the textboxes are in a table, so I also need to hide the corresponding labels. the structure is something like this <tr> <..

Request header field Access-Control-Allow-Headers is not allowed by itself in preflight response

I have come across CORS issues multiple times and can usually fix it but I want to really understand by seeing this from a MEAN stack paradigm. Before I simply added middleware in my express server ..

How to do the equivalent of pass by reference for primitives in Java

This Java code: public class XYZ { public static void main(){ int toyNumber = 5; XYZ temp = new XYZ();; System.out.println("Toy nu..

Anybody knows any knowledge base open source?

I want to build a web-based knowledge base system for our call center. To save some development time, I am looking for a open source. Does anybody know any good one out there?..

How to check if a table is locked in sql server

I have a large report I am running on sql server. It takes several minutes to run. I don't want users clicking run twice. Since i wrap the whole procedure in a transaction, how do I check to see if th..

How can I pass command-line arguments to a Perl program?

I'm working on a Perl script. How can I pass command line parameters to it? Example: "string1" "string2" ..

How to use ClassLoader.getResources() correctly?

How can I use ClassLoader.getResources() to find recursivly resources from my classpath? E.g. finding all resources in the META-INF "directory": Imagine something like getClass().getClassLoader(..

Angular2 module has no exported member

For a website with authentication in Angular2, I want to use a component of the authentication submodule in the main app component. However, I keep getting the following error: app/app.component.ts(..

Alternative to deprecated getCellType

I'm reading an excel-file (file extension xlsx) using org.apache.poi 3.15. This is my code: try (FileInputStream fileInputStream = new FileInputStream(file); XSSFWorkbook workbook = new XSSFWorkboo..

DTO pattern: Best way to copy properties between two objects

In my application's architecture I usually send the object or list of objects from the data access layer to the web layer via the service layer, in which these objects get transformed from a DAO objec..

How to remove text before | character in notepad++

I have a document like this, so i wan't to remove text before | character on any line. Work in notepad++. So what i can do? ..

PHP Multidimensional Array Searching (Find key by specific value)

I have this multidimensional array. I need to search it and return only the key that matches the value of the "slug". I know there are other threads about searching multidimensional arrays, but I'm no..

Sequence contains no elements?

I'm currently using a single query in two places to get a row from a database. BlogPost post = (from p in dc.BlogPosts where p.BlogPostID == ID select p).Single(); ..

Javascript - Regex to validate date format

Is there any way to have a regex in JavaScript that validates dates of multiple formats, like: DD-MM-YYYY or DD.MM.YYYY or DD/MM/YYYY etc? I need all these in one regex and I'm not really good with it..

WPF chart controls

I am looking for a very simple WPF chart which should have a 2D graph and should have pan and zoom facilities . ..

How to remove padding around buttons in Android?

In my Android app, I have this layout: <?xml version="1.0" encoding="utf-8" ?> <LinearLayout xmlns:android="" android:layout_width="match_pa..

compareTo() vs. equals()

When testing for equality of String's in Java I have always used equals() because to me this seems to be the most natural method for it. After all, its name already says what it is intended to do. How..

input type="submit" Vs button tag are they interchangeable?

input type="submit" and button tag are they interchangeable? or if there is any difference then When to use input type="submit" and when button ? And if there is no difference then why we have 2 tags..

Oracle Not Equals Operator

There are two not equals operator - != and <>. What's the difference between them? I heard that != is more efficient than other for comparing strings. Could anyone give a qualitative comment o..

Select N random elements from a List<T> in C#

I need a quick algorithm to select 5 random elements from a generic list. For example, I'd like to get 5 random elements from a List<string>...

CSS selectors ul li a {...} vs ul > li > a {...}

What is the difference between ul > li > a {...} and ul li a {...} in CSS? Which one is more efficient and why? ..

How do I get the current year using SQL on Oracle?

I need to add the current year as a variable in an SQL statement, how can I retrieve the current year using SQL? i.e. BETWEEN TO_DATE('01/01/**currentYear** 00:00:00', 'DD/MM/YYYY HH24:MI:SS..

Excel VBA Run-time Error '32809' - Trying to Understand it

A colleague at work made some changes to one of our macro workbooks and now on my PC only I receive the dreaded Run-time Error '32809' when I attempt to run it. This latest version runs fine on his PC..

How can I escape latex code received through user input?

I read in a string from a GUI textbox entered by the user and process it through pandoc. The string contains latex directives for math which have backslash characters. I want to send in the string as ..

What are naming conventions for MongoDB?

Is there a set of preferred naming conventions for MongoDB entitites such as databases, collections, field names? I was thinking along these lines: Databases: consist of the purpose (word in singul..

Alter column in SQL Server

What is correct syntax for an ALTER statement to add a default value to an existing column? I can add new column with no errors: ALTER TABLE tb_TableName ADD Record_Status varchar(20) But If I try..

java.lang.IllegalStateException: Fragment not attached to Activity

I am rarely getting this error while making an API call. java.lang.IllegalStateException: Fragment not attached to Activity I tried putting the code inside isAdded() method to check whether fragm..

Can't resolve module (not found) in React.js

I can't believe that I'm asking an obvious question, but I still get the error in console log. Console says that it can't find the module in the directory, but I've checked at least 10 times for typo..

Neither user 10102 nor current process has android.permission.READ_PHONE_STATE

I am trying to call getCallCapablePhoneAccounts() method of android.telecom.TelecomManager class. Though i have added required user-permission, i am getting Security exception. Here is the line of co..

CSS: Set Div height to 100% - Pixels

I have a header on my page which is just over 100px (111px to be exact) The div below it needs to extend to the bottom of the viewport, as if i had set the bottom to 0px. The problem lies in the fact ..

Tomcat in Intellij Idea Community Edition

Is it possible to run a web application using Tomcat Server in Intellij Idea Community Edition? I tried to find some information about it but haven't achived any success...

Xpath for href element

I need to click on the below href element,which is present among similar href elements. <a id="oldcontent" href=""><u>Re-Call</u></a> Can anyone prov..

Tooltip on image

I am using the tooltip. But I want that on image tag, like when I mouseover the image then the tooltip should work. I have tried but not working for me on image tag...

Attach the Java Source Code

I cannot for the life of me attach the java source code to eclipse so I can see the inner workings of the language. Not even something as simple as the String Class. when I run java -version this is ..

Case statement with multiple values in each 'when' block

The best way I can describe what I'm looking for is to show you the failed code I've tried thus far: case car when ['honda', 'acura'].include?(car) # code when 'toyota' || 'lexus' # code ..

Switch on ranges of integers in JavaScript

I want to do something like this switch ( { case 1-4: // Do something. break; case 5-8: // Do something. break; ..

How to delete last item in list?

I have this program that calculates the time taken to answer a specific question, and quits out of the while loop when answer is incorrect, but i want to delete the last calculation, so i can call min..

Most efficient solution for reading CLOB to String, and String to CLOB in Java?

I have a big CLOB (more than 32kB) that I want to read to a String, using StringBuilder. How do I do this in the most efficient way? I can not use the "int length" constructor for StringBuilder since ..

Setting paper size in FPDF

i want to seting paper size in fpdf to a half of letter size, it's approximately 8.5x5.5 inc. How can i do that? My fpdf function in php language is $pdf = new FPDF('P','mm','?????'); is..

Can not find module “@angular-devkit/build-angular”

Using npm, I followed the getting started directions on the Angular CLI quick start page. Angular CLI Quickstart Running ng serve --open after creating and going into my new project "frontend" gave..

How to get a Fragment to remove itself, i.e. its equivalent of finish()?

I'm converting an app to use fragments using the compatibility library. Now currently I have a number of activities (A B C D) which chain onto one another, D has a button 'OK' which when pressed calls..

Remove last character from string. Swift language

How can I remove last character from String variable using Swift? Can't find it in documentation. Here is full example: var expression = "45+22" expression = expression.substringToIndex(countElement..

Subprocess check_output returned non-zero exit status 1

This is my python code: import subprocess subprocess.check_output("ls",shell=True,stderr=subprocess.STDOUT) import subprocess subprocess.check_output("yum",shell=True,stderr=subprocess.STDOUT) The..

How do I REALLY reset the Visual Studio window layout?

I had a plugin installed in Visual Studio 2008, and it created some extra dockable windows. I have uninstalled it, and I can't get rid of the windows it created - I close them, but they always come b..

Check empty string in Swift?

In Objective C, one could do the following to check for strings: if ([myString isEqualToString:@""]) { NSLog(@"myString IS empty!"); } else { NSLog(@"myString IS NOT empty, it is: %@", myStri..

Use multiple @font-face rules in CSS

How can I use more than @font-face rule in my CSS? I've inserted this into my stylesheet: body { background: #fff url(../images/body-bg-corporate.gif) repeat-x; padding-bottom: 10px; fon..

Create directory if it does not exist

I am writing a PowerShell script to create several directories if they do not exist. The filesystem looks similar to this D:\ D:\TopDirec\SubDirec\Project1\Revision1\Reports\ D:\TopDirec\SubDirec\Pr..

How can I sort a dictionary by key?

What would be a nice way to go from {2:3, 1:89, 4:5, 3:0} to {1:89, 2:3, 3:0, 4:5}? I checked some posts but they all use the "sorted" operator that returns tuples. ..


I have the following php script to read the request in URL : $id = '/' != ($_SERVER['REQUEST_URI']) ? str_replace('/?id=' ,"", $_SERVER['REQUEST_URI']) : 0; It was used when the URL is http://..

How do I scroll a row of a table into view (element.scrollintoView) using jQuery?

I'm dynamically adding rows to a table using jQuery. The table is inside a div which has overflow:auto thus causing a vertical scrollbar. I now want to autoscroll my container div to the last row. Wh..

Turning multi-line string into single comma-separated

Let's say I have the following string: something1: +12.0 (some unnecessary trailing data (this must go)) something2: +15.5 (some more unnecessary trailing data) something4: +9.0 (some ..

MySQL Server has gone away when importing large sql file

I tried to import a large sql file through phpMyAdmin...But it kept showing error 'MySql server has gone away' What to do?..

Why does Git treat this text file as a binary file?

I wonder why git tells me this? $ git diff MyFile.txt diff --git a/MyFile.txt b/MyFile.txt index d41a4f3..15dcfa2 100644 Binary files a/MyFile.txt and b/MyFile.txt differ Aren't they text files? I ha..

What is a callback?

What's a callback and how is it implemented in C#?..

Maintain the aspect ratio of a div with CSS

I want to create a div that can change its width/height as the window's width changes. Are there any CSS3 rules that would allow the height to change according to the width, while maintaining its asp..

coercing to Unicode: need string or buffer, NoneType found when rendering in django admin

I have this error since a long time but can't figure it out : Caught TypeError while rendering: coercing to Unicode: need string or buffer, NoneType found It happens in admin when I try to add or mo..

Python: How to create a unique file name?

I have a python web form with two options - File upload and textarea. I need to take the values from each and pass them to another command-line program. I can easily pass the file name with file uploa..

how to convert integer to string?

Possible Duplicate: How to convert from int to string in objective c: example code… How to convert integer to string in Objective C?..

How to parse JSON in Java

I have the following JSON text. How can I parse it to get the values of pageName, pagePic, post_id, etc.? { "pageInfo": { "pageName": "abc", ..

HashMap: One Key, multiple Values

How I can get the third value for the first key in this map? Is this possible?..

How do I declare and initialize an array in Java?

How do I declare and initialize an array in Java?..

How to add an element to Array and shift indexes?

I need to add an element to Array specifying position and value. For example, I have Array int []a = {1, 2, 3, 4, 5, 6}; after applying addPos(int 4, int 87) it should be int []a = {1, 2, 3, 4, 87..

How do I check to see if a value is an integer in MySQL?

I see that within MySQL there are Cast() and Convert() functions to create integers from values, but is there any way to check to see if a value is an integer? Something like is_int() in PHP is what ..

Git list of staged files

I staged a lot of files using git add, now I want to see all the files I have staged, without untracked files or changed but unstaged files. How do I do that? When using git diff --cached I can see t..

What's the difference between <mvc:annotation-driven /> and <context:annotation-config /> in servlet?

I am migrating from Spring 2.5 to Spring 3. They have introduced <mvc:annotation-driven /> which does some black magic. This is expected to be declared in servlet configuration file only. In ..

Retrieve column values of the selected row of a multicolumn Access listbox

How can I retrieve the value of specified column of the selected row in a multicolumn listbox? I populate the listbox by setting the RowSource property with a SQL string. BoundColumn set to value 1. ..

Returning string from C function

I haven't used C in over 3 years, I'm pretty rusty on a lot of things. I know this may seem stupid but I cannot return a string from a function at the moment. Please assume that: I cannot use string...

How do I create a unique constraint that also allows nulls?

I want to have a unique constraint on a column which I am going to populate with GUIDs. However, my data contains null values for this columns. How do I create the constraint that allows multiple null..

Combining the results of two SQL queries as separate columns

I have two queries which return separate result sets, and the queries are returning the correct output. How can I combine these two queries into one so that I can get one single result set with each ..

Abort a git cherry-pick?

I ran git cherry-pick <hash> and had merge conflicts. I don't want to resolve the conflicts, I just want to abort the cherry-pick. When doing an actual merge (with git merge) there's the handy g..

How do I divide so I get a decimal value?

I want to know how to get remainder and quotient in single value in Java. Example: 3/2 I should get value as 1.5. If I use the / operator I get only the quotient. If I user the % operator I ..

How to auto import the necessary classes in Android Studio with shortcut?

I've just switch to Android Studio 0.5.1, and the things going so slow here, because nothing works in the regular way... How do I import the necessary classes with shortcut? I mean like this ones? ..

Regular expression to match a line that doesn't contain a word

I know it's possible to match a word and then reverse the matches using other tools (e.g. grep -v). However, is it possible to match lines that do not contain a specific word, e.g. hede, using a regul..

Is it possible to log all HTTP request headers with Apache?

How to make a record into the logfile the contents of the HTTP request header (all) as received by apache? Currently my apache combined log format configuration is: LogFormat "%h %l %u %t \"%r\" %&g..

:first-child not working as expected

I'm trying to select the first h1 inside a div with a class called detail_container. It works if h1 is the first element within this div, but if it comes after this ul it won't work. <style type="..

Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document'

<button id="'+item['id']+'" class="btnDeactivateKeyInChildPremiumCustomer waves-effect waves-light">ok</button> I used above code for generating button inside of jquer..

Number of occurrences of a character in a string

I am trying to get the number of occurrences of a certain character such as & in the following string. string test = "key1=value1&key2=value2&key3=value3"; How do I determine that there..

How to execute INSERT statement using JdbcTemplate class from Spring Framework

In Spring, how can I insert data in table using JdbcTemplate. Can anyone please provide me a code sample for doing this...

How do I import a sql data file into SQL Server?

I have a .sql file and I am trying to import it into SQL Server 2008. What is the proper way to do this?..

Failed to load resource: the server responded with a status of 404 (Not Found) error in server

I'm trying to load up image in my Image Folder, but it's not working. Upon debugging, I see this error: Failed to load resource: the server responded with a status of 404 (Not Found) My image..

Beamer: How to show images as step-by-step images

I'm trying to make a presentation using the Beamer class. I want to show a simple list of images, one by one in one frame, just like when you use itemize<+->. I have no problem showing the images ..

Why do I get PLS-00302: component must be declared when it exists?

I am using Oracle 10.2. I am working in some scripts to move some ORACLE Objects from one SCHEMA (S1) to another (S2). I am creating the functions with DBA role. When moved, one of my functions beco..

Return outside function error in Python

This is the problem: Given the following program in Python, suppose that the user enters the number 4 from the keyboard. What will be the value returned? N = int(input("enter a positive integer:")) ..

Replace HTML page with contents retrieved via AJAX

I have an HTML page with a typical structure: <html> <head> <script src="..." ></script> <style>...</style> </head> <body> content <..

Using Ajax.BeginForm with ASP.NET MVC 3 Razor

Is there a tutorial or code example of using Ajax.BeginForm within MVC 3 where unobtrusive validation and Ajax exist? This is an elusive topic for MVC 3, and I cannot seem to get my form to w..

Java - Change int to ascii

Is there a way for java to convert int's to ascii symbols?..

ImportError in importing from sklearn: cannot import name check_build

I am getting the following error while trying to import from sklearn: >>> from sklearn import svm Traceback (most recent call last): File "<pyshell#17>", line 1, in <module> ..

How can I create directories recursively?

Is there a Python method to create directories recursively? I have this path: /home/dail/ I would like to create /home/dail/first/second/third Can I do it recursively or I have to create one dir..

Can you use if/else conditions in CSS?

I would like to use conditions in my CSS. The idea is that I have a variable that I replace when the site is run to generate the right style-sheet. I want it so that according to this variable the s..

Do you know the Maven profile for

I am trying to include some dependencies in my Maven project. These dependencies are not available in the default Maven 2 repository They are available at http://mvnrep..

Property 'value' does not exist on type EventTarget in TypeScript

So the following code is in Angular 4 and I can't figure out why it doesn't work the way as expected. Here is a snippet of my handler: onUpdatingServerName(event: Event) { console.log(event); th..

How to duplicate a whole line in Vim?

How do I duplicate a whole line in Vim in a similar way to Ctrl+D in IntelliJ IDEA/ Resharper or Ctrl+Alt+↑/↓ in Eclipse?..

How do you add Boost libraries in CMakeLists.txt?

I need to add Boost libraries into my CMakeLists.txt. How do you do it or how do you add it?..

SQL query question: SELECT ... NOT IN

I am sure making a silly mistake but I can't figure what: In SQL Server 2005 I am trying select all customers except those who have made a reservation before 2 AM. When I run this query: SELECT idC..

How to add column if not exists on PostgreSQL?

Question is simple. How to add column x to table y, but only when x column doesn't exist ? I found only solution here how to check if column exists. SELECT column_name FROM information_schema.colum..

Java method: Finding object in array list given a known attribute value

I have a couple of questions actually. I have a class Dog with the following instance fields: private int id; private int id_mother; private int id_father; private String name=""; private String own..

How to read an entire file to a string using C#?

What is the quickest way to read a text file into a string variable? I understand it can be done in several ways, such as read individual bytes and then convert those to string. I was looking for a m..

Process all arguments except the first one (in a bash script)

I have a simple script where the first argument is reserved for the filename, and all other optional arguments should be passed to other parts of the script. Using Google I found this wiki, but it pr..

On npm install: Unhandled rejection Error: EACCES: permission denied

I have managed to corrupt my npm install, and whenever I try to install packages using npm install, I receive error messages along these lines: Unhandled rejection Error: EACCES: permission denied..

How to make a query with group_concat in sql server

I know that in sql server we cannot use Group_concat function but here is one issue i have in which i need to Group_Concat my query.I google it found some logic but not able to correct it.My sql query..

UIView Hide/Show with animation

My simple goal is to fade animate hiding and showing functions. Button.hidden = YES; Simple enough. However, is it possible to have it fade out rather than just disappearing? It looks rather unprof..

AngularJS Dropdown required validation

Following is my code snippet. I want to validate my dropdown using angular. <td align="left" width="52%"> <span class="requiredSmall">*</span> <select class="Sitedropdow..

Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

I am trying to configure hibernate orm mapping tool to my java class and using PostgreSQL as my database and configured the password as "password". When I tried to run the application, I hav..

Getting "The remote certificate is invalid according to the validation procedure" when SMTP server has a valid certificate

This seems a common error but while I've found a work-around (see below) I can't pin down the reason I'm getting it in the first place. I am writing SMTP functionality into our application and I'm at..

What is the right way to check for a null string in Objective-C?

I was using this in my iPhone app if (title == nil) { // do something } but it throws some exception, and the console shows that the title is "(null)". So I'm using this now: if (title == nil..

Dynamic Web Module 3.0 -- 3.1

I have a mavenized codebased configured Spring 3.2.4 web app. When I build the app with Maven/pom.xml first I got an error that web.xml is missing. first I tried to create an empty web.xml. this was..

Sql error on update : The UPDATE statement conflicted with the FOREIGN KEY constraint

I have a table called patient_address, which reference a PK key in patient table. But if i try to run one of the following statements : update patient set id_no='7008255601088' where id_no='800825560..

Android SDK location should not contain whitespace, as this cause problems with NDK tools

Recently I have installed the last version of Android Studio (Android Studio 2.1), keeping the old 1.2 version previously installed. Now i have Android Studio 2.1 and Android Studio 1.2. In Android S..

Why am I getting tree conflicts in Subversion?

I had a feature branch of my trunk and was merging changes from my trunk into my branch periodically and everything was working fine. Today I went to merge the branch back down into the trunk and any ..

ActionBarCompat: java.lang.IllegalStateException: You need to use a Theme.AppCompat

I am getting a RuntimeException on Android 2.3.5 but I am using Theme.AppCompat (res/values/themes.xml). This is the phone: <!-- res/values..

MySQL Nested Select Query?

Ok, so I have the following query: SELECT MIN(`date`), `player_name` FROM `player_playtime` GROUP BY `player_name` I then need to use this result inside the following query: SELECT DATE(`date`) , ..

C multi-line macro: do/while(0) vs scope block

Possible Duplicates: What’s the use of do while(0) when we define a macro? Why are there sometimes meaningless do/while and if/else statements in C/C++ macros? do { … } while (0..

Jboss server error : Failed to start service jboss.deployment.unit."jbpm-console.war"

When starting the jboss server, it giving an error Failed to start service jboss.deployment.unit."jbpm-console.war". But when i'm running jbpm6 demo using start.demo its working fine. 23:43:41,042 ER..

Parse JSON from JQuery.ajax success data

I am having trouble getting the contents of JSON object from a JQery.ajax call. My call: $('#Search').click(function () { var query = $('#query').valueOf(); $.ajax({ url: '/Products/S..

How to resolve git's "not something we can merge" error

I just encountered a problem when merging a branch into master in git. First, I got the branch name by running git ls-remote. Let's call that branch "branch-name". I then ran git merge branch-name com..

ASP.NET MVC - Extract parameter of an URL

I'm trying to extract the parameters of my URL, something like this. /Administration/Customer/Edit/1 extract: 1 /Administration/Product/Edit/18?allowed=true extract: 18?allowed=true /Administrati..

printf %f with only 2 numbers after the decimal point?

In my printf, I need to use %f but I'm not sure how to truncate to 2 decimal places: Example: getting 3.14159 to print as: 3.14..

How to convert .pfx file to keystore with private key?

I need to sign Android application (.apk). I have .pfx file. I converted it to .cer file via Internet Explorer and then converted .cer to .keystore using keytool. Then I've tried to sign .apk with jar..

How to represent empty char in Java Character class

I want to represent an empty character in Java as "" in String... Like that char ch = an empty character; Actually I want to replace a character without leaving space. I think it might be suffici..

Where can I download the jar for org.apache.http package?

I want the jar file for org.apache.http package but I am not able to find it,can anyone let me know from where can I download it? I was not able to find the jar even in Apache site as well ..

Placing Unicode character in CSS content value

I have a problem. I have found the HTML code for the downwards arrow, &darr; (↓) Cool. Now I need to use it in CSS like so: nav a:hover {content:"&darr";} That obviously won't work si..

Embed Google Map code in HTML with marker

I have several places with their latitude and longitude. I want to display them in google map. Thats ok, what i can't is to display the marker at the specific lat,long position. e.g. if i've the foll..

PHP - remove <img> tag from string

Hey, I need to delete all images from a string and I just can't find the right way to do it. Here is what I tryed, but it doesn't work: preg_replace("/<img[^>]+\>/i", "(image) ", $content);..

Laravel: Get Object From Collection By Attribute

In Laravel, if I perform a query: $foods = Food::where(...)->get(); ...then $foods is an Illuminate Collection of Food model objects. (Essentially an array of models.) However, the keys of thi..

AngularJS $http-post - convert binary to excel file and download

I've created an application in Angular JS for downloading an Excel workbook through $http post. In the below code I'm passing the information in the form of JSON , and send it to the server REST web ..

Why do we usually use || over |? What is the difference?

I'm just wondering why we usually use logical OR || between two booleans not bitwise OR |, though they are both working well. I mean, look at the following: if(true | true) // pass if(true | fals..

Easiest way to use SVG in Android?

I have found a myriad of libraries in order to use svg in Android and avoid the frustrating creation of different resolutions and dropping files for each resolution, this becomes very annoying when th..

how to parse a "dd/mm/yyyy" or "dd-mm-yyyy" or "dd-mmm-yyyy" formatted date string using JavaScript or jQuery

Possible Duplicate: Extending JavaScript's Date.parse to allow for DD/MM/YYYY (non-US formatted dates)? Convert dd-mm-yyyy string to date Entered a date in textbox, for example: 05/09..

Getting attribute using XPath

Given an XML structure like so: <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> <title lang="eng">Harry Potter</title> <price>29.99</price&..

TypeError: 'dict_keys' object does not support indexing

def shuffle(self, x, random=None, int=int): """x, random=random.random -> shuffle list x in place; return None. Optional arg random is a 0-argument function returning a random float in..

Running MSBuild fails to read SDKToolsPath

Howdy, I'm having a bit of an issue runnning a NAnt script that used to properly build my .Net 2.0 based website, when compiling with VS2008 and it's associated tools. I've recently upgraded all the ..

Displaying one div on top of another

I have some HTML with two divs: <div> <div id="backdrop"><img alt="" src='/backdrop.png' /></div> <div id="curtain" style="background-image:url(/curtain.png);background..

Failed to instantiate module [$injector:unpr] Unknown provider: $routeProvider

I received this error upon upgrading from AngularJS 1.0.7 to 1.2.0rc1. ..

How to enable Bootstrap tooltip on disabled button?

I need to display a tooltip on a disabled button and remove it on an enabled button. Currently, it works in reverse. What is the best way to invert this behaviour? _x000D_ _x000D_ $('[rel=tooltip]')..

Cannot find R.layout.activity_main

I was trying to work out with multiple layout using some online tutorials. The thing is my program was building and compiling correctly as long as there was only one XML file. When I added multiple XM..

How can I start InternetExplorerDriver using Selenium WebDriver

I downloaded the driver and I gave the exact path in my code but when I ran the code it shows me error my code with java is as below: System.out.println("Internet Explorer is selected"); System.setP..

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

How to pretty-print a numpy.array without scientific notation and with given precision?

I'm curious, whether there is any way to print formatted numpy.arrays, e.g., in a way similar to this: x = 1.23456 print '%.3f' % x If I want to print the numpy.array of floats, it prints several d..

Select query to get data from SQL Server

I am trying to run the SQL Select query in my C# code. But I always get the -1 output on int result = command.ExecuteNonQuery(); However, the same table if I use for delete or insert works... Co..

Determine if a cell (value) is used in any formula

I am trying to reverse engineer an ancient program written using VBA in excel and formulas in cells. There are many cells with values scattered across everywhere. Is there a fast way to check if a cel..

MySQL error - #1932 - Table 'phpmyadmin.pma user config' doesn't exist in engine

I am trying to set up my database in MySQL using XAMPP. I am doing this via phpMyAdmin on localhost(Apache is running). The only action on my part is typing in a new, unused, name for a database, clic..

How to remove element from an array in JavaScript?

var arr = [1,2,3,5,6]; Remove the first element I want to remove the first element of the array so that it becomes: var arr = [2,3,5,6]; Remove the second element To extend this question, what ..

How to find the most recent file in a directory using .NET, and without looping?

I need to find the most recently modified file in a directory. I know I can loop through every file in a folder and compare File.GetLastWriteTime, but is there a better way to do this without loopin..

Unable to connect PostgreSQL to remote database using pgAdmin

I installed PostgreSQL on my local server (Ubuntu) with IP Now, I'm trying to access the database from my client machine (Ubuntu) with IP with pgAdmin. I know I have to ma..

git repo says it's up-to-date after pull but files are not updated

I have 3 repos. A bare repo which I use as a master repo, a dev repo in which I make and test changes, and prod repo from which scripts are executed in the prod environment. After I have tested chang..

Composer Warning: openssl extension is missing. How to enable in WAMP

Trying to install Composer dependency management tool on Win7/64 + WampServer 2.2 via the Setup Installer and I am getting the following message: The openssl extension is missing, which will reduc..

Log exception with traceback

How can I log my Python errors? try: do_something() except: # How can I log my exception here, complete with its traceback? ..

Run Function After Delay

I have the below global jQuery function stored, but on page load, I want to execute it after a 1000 delay. Is there something wrong with my syntax? I know the delay always goes before the function. It..

Quick way to list all files in Amazon S3 bucket?

I have an amazon s3 bucket that has tens of thousands of filenames in it. What's the easiest way to get a text file that lists all the filenames in the bucket?..

Javascript - remove an array item by value

My situation: var id_tag = [1,2,3,78,5,6,7,8,47,34,90]; I would like to delete where id_tag = 90 and to return: var id_tag = [1,2,3,78,5,6,7,8,47,34]; How can I do that?..

How to import popper.js?

It seems to be a lame question, but I cannot to figure it out. How to import popper.js which comes toghether with Bootstrap 4 beta? I use bower and I've installed Bootstrap 4 beta. Now in bower_compo..

How do I create a simple 'Hello World' module in Magento?

How can the following be accomplished in Magento? Display a "Hello World" message using a controller/view/model approach. So, if I went to it would show the string 'H..

How to force a line break in a long word in a DIV?

Okay, this is really confusing me. I have some content inside of a div like so: <div style="background-color: green; width: 200px; height: 300px;"> Thisisatest.Thisisatest.Thisisatest.Thisisat..

How can I decode HTML characters in C#?

I have email addresses encoded with HTML character entities. Is there anything in .NET that can convert them to plain strings?..

create multiple tag docker image

How can several tags be attached to one Docker image? Is it possible to create multiple tags using one Dockerfile? It is possible, somehow; for example docker pull ubuntu will get several images, some..

How to loop through each and every row, column and cells in a GridView and get its value

I have a GridView which is databound, on button_click I want to read the GridView row by row each column and read the value of each cell in a row and update a table in database? I also know how to che..

How to adjust text font size to fit textview

Is there any way in android to adjust the textsize in a textview to fit the space it occupies? E.g. I'm using a TableLayout and adding several TextViews to each row. Since I don't want the TextViews ..

Query Mongodb on month, day, year... of a datetime

I'm using mongodb and I store datetime in my database in this way for a date "17-11-2011 18:00" I store: date = datetime.datetime(2011, 11, 17, 18, 0) db.mydatabase.mycollection.insert({"date" : dat..

BeanFactory vs ApplicationContext

I'm pretty new to the Spring Framework, I've been playing around with it and putting a few samples apps together for the purposes of evaluating Spring MVC for use in an upcoming company project. So fa..

Explicit Return Type of Lambda

When I try and compile this code (VS2010) I am getting the following error: error C3499: a lambda that has been specified to have a void return type cannot return a value void DataFile::removeComment..

How to read existing text files without defining path

Most of the examples shows how to read text file from exact location (f.e. "C:\Users\Owner\Documents\test1.txt"). But, how to read text files without writing full path, so my code would work when copi..

jQuery pass more parameters into callback

Is there a way to pass more data into a callback function in jQuery? I have two functions and I want the callback to the $.post, for example, to pass in both the resulting data of the AJAX call, as w..

Angular 2 execute script after template render

So I have this slider component that use materializecss javascript. So after it's rendered, I need to execute $(document).ready(function(){ $('body').on('Slider-Loaded',function(){ consol..

Java Serializable Object to Byte Array

Let's say I have a serializable class AppMessage. I would like to transmit it as byte[] over sockets to another machine where it is rebuilt from the bytes received. How could I achieve this?..

insert vertical divider line between two nested divs, not full height

I have float left and float right <div> nested within a light blue box div as shown in the image below. I can't figure out how to insert a vertical line between them as shown in this image: ..

Deserializing JSON array into strongly typed .NET object

When I can call the 3rd party api and get back a single class worth of data everything deserialises fine using this code TheUser me = jsonSerializer.Deserialize(response, typeof(TheUser)) as TheUser..

How do I invoke a text editor from the terminal?

In the Windows command prompt, I can type notepad helloworld.cpp which will then create a .cpp file with the name helloworld and open up Notepad for me. Is there a similar function for Mac Terminal, ..

How to convert a char array to a string?

Converting a C++ string to a char array is pretty straightorward using the c_str function of string and then doing strcpy. However, how to do the opposite? I have a char array like: char arr[ ] = "Th..

How do I clear/delete the current line in terminal?

If I'm using terminal and typing in a line of text for a command, is there a hotkey or any way to clear/delete that line? For example, if my current line/command is something really long like: > ..

Web colors in an Android color xml resource file

What do all of the X11/w3c color codes look like in the format of an Android XML resource file? I know this looks a tad ridiculous as a question, but given the votes apparently it's useful and sin..

Get list of Excel files in a folder using VBA

I need to get the names of all the Excel files in a folder and then make changes to each file. I've gotten the "make changes" part sorted out. Is there a way to get a list of the .xlsx files in one fo..

Asynchronous Function Call in PHP

I am working on an a PHP web application and i need to perform some network operations in the request like fetching someone from remote server based on user's request. Is it possible to simulate asyn..

Call one constructor from another

I have two constructors which feed values to readonly fields. public class Sample { public Sample(string theIntAsString) { int i = int.Parse(theIntAsString); _intField = i; ..

How to list all `env` properties within jenkins pipeline job?

Given a jenkins build pipeline, jenkins injects a variable env into the node{}. Variable env holds environment variables and values. For example, environment variable BRANCH_NAME can be accessed with ..

MVC4 DataType.Date EditorFor won't display date value in Chrome, fine in Internet Explorer

I'm using the DataType.Date attribute on my model and an EditorFor in my view. This is working fine in Internet Explorer 8 and Internet Explorer 9, but in Google Chrome it is showi..

How do I grant read access for a user to a database in SQL Server?

I want to grant access to a user to a specific database with read and write access. The user is already available in the domain but not in the DB. So, how can I give them that access with creating a ..

How to add a second x-axis in matplotlib

I have a very simple question. I need to have a second x-axis on my plot and I want that this axis has a certain number of tics that correspond to certain position of the first axis. Let's try with a..

MongoDB: How to update multiple documents with a single command?

I was surprised to find that the following example code only updates a single document: >{"_id":1, "foo":"bar"}); >{"_id":2, "foo":"bar"}); > db.test.update({"fo..

How to check if a value exists in a dictionary (python)

I have the following dictionary in python: d = {'1': 'one', '3': 'three', '2': 'two', '5': 'five', '4': 'four'} I need a way to find if a value such as "one" or "two" exists in this dictionary. F..

Partition Function COUNT() OVER possible using DISTINCT

I'm trying to write the following in order to get a running total of distinct NumUsers, like so: NumUsers = COUNT(DISTINCT [UserAccountKey]) OVER (PARTITION BY [Mth]) Management studio doesn't seem..

Convert ascii char[] to hexadecimal char[] in C

I am trying to convert a char[] in ASCII to char[] in hexadecimal. Something like this: hello --> 68656C6C6F I want to read by keyboard the string. It has to be 16 characters long. This is my code..

Set start value for column with autoincrement

I have a table Orders with the following fields: Id | SubTotal | Tax | Shipping | DateCreated The Id column is set to autoincrement(1,1). This is to be used in an E-commerce storefront. Sometim..

Insert into ... values ( SELECT ... FROM ... )

I am trying to INSERT INTO a table using the input from another table. Although this is entirely feasible for many database engines, I always seem to struggle to remember the correct syntax for the SQ..

How do I create a ListView with rounded corners in Android?

How do I create a ListView with rounded corners in Android?..

What does %~dp0 mean, and how does it work?

I find %~dp0 very useful, and I use it a lot to make my batch files more portable. But the label itself seems very cryptic to me... What is the ~ doing? Does dp mean drive and path? Does the 0 refer ..

How to write to a file, using the logging Python module?

How can I use the logging module in Python to write to a file? Every time I try to use it, it just prints out the message...

What's the "average" requests per second for a production web application?

I have no frame of reference in terms of what's considered "fast"; I'd always wondered this but have never found a straight answer.....

How to run a Runnable thread in Android at defined intervals?

I developed an application to display some text at defined intervals in the Android emulator screen. I am using the Handler class. Here is a snippet from my code: handler = new Handler(); Runnable r ..

Get element inside element by class and ID - JavaScript

Alright, I've dabbled in JavaScript before, but the most useful thing I've written is a CSS style-switcher. So I'm somewhat new to this. Let's say I have HTML code like this: <div id="foo"..

Spring Boot and multiple external configuration files

I have multiple property files that I want to load from classpath. There is one default set under /src/main/resources which is part of myapp.jar. My springcontext expects files to be on the classpath...

Flatten an irregular list of lists

Yes, I know this subject has been covered before (here, here, here, here), but as far as I know, all solutions, except for one, fail on a list like this: L = [[[1, 2, 3], [4, 5]], 6] Where the desi..

Why does fatal error "LNK1104: cannot open file 'C:\Program.obj'" occur when I compile a C++ project in Visual Studio?

I've created a new C++ project in Visual Studio 2008. No code has been written yet; Only project settings have been changed. When I compile the project, I receive the following fatal error: fat..

how to change php version in htaccess in server

I'm using php 5.3 on my local machine. On our webserver we have php 4.8. Our server is a shared server. So I want to change the php version on our server via .htaccess file. Is it possible to do it? I..

Applying function with multiple arguments to create a new pandas column

I want to create a new column in a pandas data frame by applying a function to two existing columns. Following this answer I've been able to create a new column when I only need one column as an argum..