Questions Tagged with #Security policy

Refused to load the font 'data:font/woff.....'it violates the following Content Security Policy directive: "default-src 'self'". Note that 'font-src'

My react webApp give this Error in Browser Console Refused to load the font 'data:font/woff;base64,d09........' because it` `violates the following Content Security Policy directive: "default-src` `..

Content Security Policy: The page's settings blocked the loading of a resource

I am using CAPTCHA on page load, but it is blocking because of some security reason. I am facing this problem: Content Security Policy: The page's settings blocked the loading of a resource a..

What is the "Upgrade-Insecure-Requests" HTTP header?

I made a POST request to a HTTP (non-HTTPS) site, inspected the request in Chrome's Developer Tools, and found that it added its own header before sending it to the server: Upgrade-Insecure-Requests:..

Refused to load the script because it violates the following Content Security Policy directive

When I tried to deploy my app onto devices with Android system above 5.0.0 (Lollipop), I kept getting these kind of error messages: 07-03 18:39:21.621: D/SystemWebChromeClient(9132): file:///android_..

How does Content Security Policy (CSP) work?

I'm getting a bunch of errors in the developer console: Refused to evaluate a string Refused to execute inline script because it violates the following Content Security Policy directive Refused to lo..

"No Content-Security-Policy meta tag found." error in my phonegap application

After update Cordova 5.0 in my system, I create new applications. When I tested my application on a device that time I get an error in the console log: No Content-Security-Policy meta tag found. Plea..

Content Security Policy "data" not working for base64 Images in Chrome 28

In this simple example, I'm trying to set a CSP header with the meta http-equiv header. I included a base64 image and I'm trying to make Chrome load the image. I thought the data keyword should do th..

How to run php files on my computer

Could anyone please tell me how to run a php file locally on my system. Currently I am using a server to run files. I know both php & Apache to be installed. I need to see out put of this program,..

How to clear the interpreter console?

Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc. Like any console, after a while the visible b..

Capture close event on Bootstrap Modal

I have a Bootstrap Modal to select events. If the user clicks on the X button or outside the modal, I would like to send them to the default event. How can I capture these events? This is my HTML cod..

Recommended way to embed PDF in HTML?

What is the recommended way to embed PDF in HTML? iFrame? Object? Embed? What does Adobe say itself about it? In my case, the PDF is generated on the fly, so it can't be uploaded to a third-par..

Extract the first (or last) n characters of a string

I want to extract the first (or last) n characters of a string. This would be the equivalent to Excel's LEFT() and RIGHT(). A small example: # create a string a <- paste('left', 'right', sep = '')..

jQuery: Slide left and slide right

I have seen slideUp and slideDown in jQuery. What about functions/ways for sliding to left and right?..

MySQL SELECT only not null values

Is it possible to do a select statement that takes only NOT NULL values? Right now I am using this: SELECT * FROM table And then I have to filter out the null values with a php loop. Is there a w..

Load properties file in JAR?

I'm having trouble when one of the jars that my web app depends on tries to load a properties file from within the jar. Here is the code in the jar. static { Properties props = new Properties();..

How to set root password to null

How can I change the password for root user of MySQL to null -- meaning no password or '' -- from the MySQL command line client?..

Find object by id in an array of JavaScript objects

I've got an array: myArray = [{'id':'73','foo':'bar'},{'id':'45','foo':'bar'}, etc.] I'm unable to change the structure of the array. I'm being passed an id of 45, and I want to get 'bar' for that ..

Listing all the folders subfolders and files in a directory using php

Please give me a solution for listing all the folders,subfolders,files in a directory using php. My folder structure is like this: Main Dir Dir1 SubDir1 File1 File2 SubDir2 File3 Fil..

In c# is there a method to find the max of 3 numbers?

Like Math.Max but takes 3 or params of int? thanks..

How to install OpenSSL for Python

I need to install OpenSSL on my python2.7. I tried $ pip install pyopenssl And I got the following /usr/local/lib/python2.7/distutils/ UserWarning: Unknown distribution option: 'zip_safe'..

PowerShell Remoting giving "Access is Denied" error

I am trying to use PowerShell Remoting to check some disk sizes from a Server in a remote domain, but the commands I am running are failing to work. The situation is like this: Source Server is in ..

Why can't I use background image and color together?

What I am trying to do is to show both background-color and background-image, so that half of my div will cover the right shadow background image, and the other left part will cover the background col..

Customizing Bootstrap CSS template

I am just getting started with Bootstrap from Twitter and am wondering what the ‘best practices’ is for customization. I want to develop a system that will take advantage of all the power of a css..


Normally whats the reason to get java.lang.ClassCastException ..? I get the following error in my application java.lang.ClassCastException: [Lcom.rsa.authagent.authapi.realmstat.AUTHw ..

Remove duplicates from a List<T> in C#

Anyone have a quick method for de-duplicating a generic List in C#?..

Change Project Namespace in Visual Studio

How can I change the project namespace in Visual Studio? The namespace is currently WindowsFormsApplication16, and I want the namespace to be MyName...

Using the value in a cell as a cell reference in a formula?

I'd like to know how to pull cell references from the value of another cell and insert them into a formula. For a simple example: In cell A1 I have this: COUNT(B4:H4) Instead of choosing the range ..

How to use regex with find command?

I have some images named with generated uuid1 string. For example 81397018-b84a-11e0-9d2a-001b77dc0bed.jpg. I want to find out all these images using "find" command: find . -regex "[a-f0-9\-]\{36\}\...

Force IE compatibility mode off using tags

I am doing work for a client who forces compatibility mode on all intranet sites. I was wondering if there is a tag I can put into my HTML that forces compatibility mode off...

PHP Parse error: syntax error, unexpected T_PUBLIC

I am getting this error in this PHP code on line 3, what could be wrong? This code has been taken from php manual user notes by frank at interactinet dot com <?php public function myMethod() { re..

The network adapter could not establish the connection - Oracle 11g

I wrote a servlet program and I want it to connect to my Oracle database but its giving me an error. I am using Eclipse Helios, Tomcat 6.0.37, Oracle 11g (, ojdbc6.jar(added in run configur..

Using CMake to generate Visual Studio C++ project files

I am working on an open source C++ project, for code that compiles on Linux and Windows. I use CMake to build the code on Linux. For ease of development setup and political reasons, I must stick to Vi..

IndexError: tuple index out of range ----- Python

Please Help me. I'm running a simple python program that will display the data from mySQL database in a tkinter form... from Tkinter import * import MySQLdb def button_click(): root.destroy() r..

EOFException - how to handle?

I'm a beginner java programmer following the java tutorials. I am using a simple Java Program from the Java tutorials's Data Streams Page, and at runtime, it keeps on showing EOFException. I was wond..

Error:(1, 0) Plugin with id '' not found

This is my first attempt at Android Studio. I installed 0.8.0 and updated to 0.8.2. As soon as a project is created I get the error message: Error:(1, 0) Plugin with id ''..

How do you load custom UITableViewCells from Xib files?

The question is simple: How do you load custom UITableViewCell from Xib files? Doing so allows you to use Interface Builder to design your cells. The answer apparently is not simple due to memory mana..

Swift performSelector:withObject:afterDelay: is unavailable

I have an app in Objective C that I'm transitioning to Swift. In Objective C, I have this method: [self.view performSelector:@selector(someSelector) withObject:self afterDelay:0.1f]; I'm working wit..

Bash integer comparison

I want to write a bash script that checks if there is at least one parameter and if there is one, if that parameter is either a 0 or a 1. this is the script: #/bin/bash if (("$#" < 1)) && ..

Running Command Line in Java

Is there a way to run this command line within a Java application? java -jar map.jar time.rel test.txt debug I can run it with command but I couldn't do it within Java...

Foreign Key to multiple tables

I've got 3 relevant tables in my database. CREATE TABLE dbo.Group ( ID int NOT NULL, Name varchar(50) NOT NULL ) CREATE TABLE dbo.User ( ID int NOT NULL, Name varchar(50) NOT NULL ..

When to use .First and when to use .FirstOrDefault with LINQ?

I've searched around and haven't really found a clear answer as to when you'd want to use .First and when you'd want to use .FirstOrDefault with LINQ. When would you want to use .First? Only when yo..

How to return data from promise

I need to get the out of the promise so it can be returned by the enclosing function. I know, I probably can't do it the way I've coded it because of normal JavaScript scope. Is there an..

SELECT from nothing?

Is it possible to have a statement like SELECT "Hello world" WHERE 1 = 1 in SQL? The main thing I want to know, is can I SELECT from nothing, ie not have a FROM clause...

How to pass multiple checkboxes using jQuery ajax post

How to pass multiple checkboxes using jQuery ajax post this is the ajax function function submit_form(){ $.post("ajax.php", { selectedcheckboxes:user_ids, confirm:"true" }, function(data){ $..

PowerShell script to check the status of a URL

Similar to this question here I am trying to monitor if a set of website links are up and running or not responding. I have found the same PowerShell script over the Internet. However, instead of dir..

How to get row index number in R?

Suppose I have a list or data frame in R, and I would like to get the row index, how do I do that? That is, I would like to know how many rows a certain matrix consists of...

cannot find zip-align when publishing app zipalign tool was not found in the SDK. Please update to the latest SDK and re-export your application or run zipalign manually. Aligning applications allows Android to use..

WAITING at sun.misc.Unsafe.park(Native Method)

One of my applications hangs under some period of running under load, does anyone know what could cause such output in jstack: "scheduler-5" prio=10 tid=0x00007f49481d0000 nid=0x2061 waiting on condi..

Merge data frames based on rownames in R

How can I merge the columns of two data frames, containing a distinct set of columns but some rows with the same names? The fields for rows that don't occur in both data frames should be filled with z..

C++ equivalent of StringBuffer/StringBuilder?

Is there a C++ Standard Template Library class that provides efficient string concatenation functionality, similar to C#'s StringBuilder or Java's StringBuffer?..

Sending HTML email using Python

How can I send the HTML content in an email using Python? I can send simple text...

Could not load file or assembly 'xxx' or one of its dependencies. An attempt was made to load a program with an incorrect format

I just checked out a revision from Subversion to a new folder. Opened the solution and I get this when run: Could not load file or assembly 'xxxx' or one of its dependencies. An attempt was made to ..

error: Unable to find vcvarsall.bat

I tried to install the Python package dulwich: pip install dulwich But I get a cryptic error message: error: Unable to find vcvarsall.bat The same happens if I try installing the package manua..

Rename all files in a folder with a prefix in a single command

Rename all the files within a folder with prefix "Unix_" Suppose a folder has two files a.txt b.pdf then they both should be renamed from a single command to Unix_a.txt Unix_b.pdf ..

How can I work with command line on synology?

For some reason, I'm now working on a Synology system. But I can't see any command line tool like terminal on Linux or CMD on Windows within Synology. Is there any tool to use command line on Synology..

How can I make an entire HTML form "readonly"?

I have two pages with HTML forms. The first page has a submission form, and the second page has an acknowledgement form. The first form offers a choice of many controls, while the second page displays..

React Native: Possible unhandled promise rejection

I'm getting the following error: Possible unhandled promise rejection (id:0: Network request failed Here's the promise code, I don't see what's wrong here, any ideas? return fetch(url) .the..

lambda expression for exists within list

If I want to filter a list of objects against a specific id, I can do this: list.Where(r => r.Id == idToCompare); What if, instead of a single idToCompare, I have a list of Ids to compare aga..

T-SQL to list all the user mappings with database roles/permissions for a Login

I am looking for a t-sql script which can list the databases and and the respective roles/privileges mapped for a particular user. Using SQL Server 2008 R2...

How to create SPF record for multiple IPs?

I do not find any guidelines regarding how to configure multiple IPs into an SPF record. So far I used (for example): v=spf1 ip4: a mx ?all But now I should add another range of IPs ..

How to comment and uncomment blocks of code in the Office VBA Editor

In the VBA editor of Office (ALT + F11), how do you comment or uncomment a block of code?..

How to iterate over the file in python

I have a text file with some hexadecimal numbers and i am trying to convert it to decimal. I could successfully convert it, but it seems before the loop exist it reads some unwanted character and so i..

Efficiently checking if arbitrary object is NaN in Python / numpy / pandas?

My numpy arrays use np.nan to designate missing values. As I iterate over the data set, I need to detect such missing values and handle them in special ways. Naively I used numpy.isnan(val), which wo..

Alarm Manager Example

I want to implement a schedule function in my project. So I Googled for an Alarm manager program but I can`t find any examples. Can anyone help me with a basic alarm manager program?..

PHP file_get_contents() returns "failed to open stream: HTTP request failed!"

I am having problems calling a url from PHP code. I need to call a service using a query string from my PHP code. If I type the url into a browser, it works ok, but if I use file-get-contents() to mak..

How to 'update' or 'overwrite' a python list

aList = [123, 'xyz', 'zara', 'abc'] aList.append(2014) print aList which produces o/p [123, 'xyz', 'zara', 'abc', 2014] What should be done to overwrite/update this list. I want the o/p to be [2..

How to uncheck checked radio button

The thing is this solution work only in firefox $(':radio').on("change", function(event) { $(this).prop('checked', true); }); $(':radio').on("click", function(event) { $(this).prop('checked', fa..

JSHint and jQuery: '$' is not defined

The following JS: (function() { "use strict"; $("#target").click(function(){ console.log("clicked"); }); }()); Yields: test.js: line 5, col 3, '$' is not defined. When linted using J..

LEFT JOIN only first row

I read many threads about getting only the first row of a left join, but, for some reason, this does not work for me. Here is my structure (simplified of course) Feeds id | title | content -------..

php Replacing multiple spaces with a single space

I'm trying to replace multiple spaces with a single space. When I use ereg_replace, I get an error about it being deprecated. ereg_replace("[ \t\n\r]+", " ", $string); Is there an identical replace..

How can I count all the lines of code in a directory recursively?

We've got a PHP application and want to count all the lines of code under a specific directory and its subdirectories. We don't need to ignore comments, as we're just trying to get a rough idea. wc -l..

TypeError: $.browser is undefined

I am using msdropdown image combo box to create dropdown select options. when i run this code locally on my PC, everything works great. But when i run it on go daddy servers, the msdropdown becomes d..

Why is Dictionary preferred over Hashtable in C#?

In most programming languages, dictionaries are preferred over hashtables. What are the reasons behind that?..

Pass a JavaScript function as parameter

How do I pass a function as a parameter without the function executing in the "parent" function or using eval()? (Since I've read that it's insecure.) I have this: addContact(entityId, refreshContac..

undefined reference to `WinMain@16'

When I try to build a program using Eclipse CDT, I get the following: /mingw/lib/libmingw32.a(main.o):main.c:(.text+0x106): undefined reference to `WinMain@16 Why is that? And, how can I solve..

Is it possible to send an array with the Postman Chrome extension?

I've been using Postman Chrome extension to test out my API and would like to send an array of IDs via post. Is there a way to send something list this as a parameter in Postman? { user_ids: ["1234..

Why does LayoutInflater ignore the layout_width and layout_height layout parameters I've specified?

I've had severe trouble getting LayoutInflater to work as expected, and so did other people: How to use layoutinflator to add views at runtime?. Why does LayoutInflater ignore the layout parameters I..

How to get the day name from a selected date?

I have this : Datetime.Now(); or 23/10/2009 I want this : Friday For local date-time (GMT-5) and using Gregorian calendar...

Get Value of Row in Datatable c#

i have a problem with my code. foreach (DataRow dr in dt_pattern.Rows) { part = dr["patternString"].ToString(); if (part != vpart) { System.Console.WriteLine(part); ..

Get filename from file pointer

If I have a file pointer is it possible to get the filename? fp = open("C:\hello.txt") Is it possible to get "hello.txt" using fp?..

How to show all rows by default in JQuery DataTable

Does anybody know how to show all rows by default in jQuery datatable? I have tried this code, but it only shows 10 rows by default. $("#adminProducts").dataTable({ "aLengthMenu": [100] ..

enabling cross-origin resource sharing on IIS7

I recently ran into with posting Javascript requests to another domain. By default XHR posting to other domains is not allowed. Following the instructions from, I enabled th..

How to determine if Javascript array contains an object with an attribute that equals a given value?

I have an array like vendors = [{ Name: 'Magenic', ID: 'ABC' }, { Name: 'Microsoft', ID: 'DEF' } // and so on... ]; How do I check this array to see if "Magenic" exis..

How do I check that a number is float or integer?

How to find that a number is float or integer? 1.25 --> float 1 --> integer 0 --> integer 0.25 --> float ..

php $_POST array empty upon form submission

I have a custom Content Management System (CMS) I've built that works perfectly on my dev box (Ubuntu/PHP5+/MySQL5+). I just moved it up to the production box for my client and now all form submission..

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 2: ordinal not in range(128)

I am attempting to work with a very large dataset that has some non-standard characters in it. I need to use unicode, as per the job specs, but I am baffled. (And quite possibly doing it all wrong.) ..

How to use external ".js" files

I have the following two javascript functions: 1 showCountry() 2 showUser() I would like to put them in external ".js" files 1 <a href="javascript:showCountry('countryCode')">country..

Remove all subviews?

When my app gets back to its root view controller, in the viewDidAppear: method I need to remove all subviews. How can I do this?..

When does System.gc() do something?

I know that garbage collection is automated in Java. But I understood that if you call System.gc() in your code that the JVM may or may not decide to perform garbage collection at that point. How does..

Comparing double values in C#

I've a double variable called x. In the code, x gets assigned a value of 0.1 and I check it in an 'if' statement comparing x and 0.1 if (x==0.1) { ---- } Unfortunately it does not enter the if stat..

How do I disable TextBox using JavaScript?

earlier I asked for help disabling a Button when a drop down menu item was selected. I was given some code that did the trick but now I need the same with a Textbox and for some odd reason its not wor.. serialize/deserialize derived types? (newtonsoft) I am looking through the documentation but I can't find anything on this or the best way to do it. public class Base { public string Name; } public class Derived : Base { ..

Django Model() vs Model.objects.create()

What it the difference between running two commands: foo = FooModel() and bar = BarModel.objects.create() Does the second one immediately create a BarModel in the database, while for FooModel, t..

keytool error bash: keytool: command not found

I have tried to execute keytool from Java bin directory but I get an error with warning bash: keytool: command not found. root@xxxxxx]# keytool -genkey -alias mypassword -keyalg RSA bash: keytools: ..

Read text file into string array (and write)

The ability to read (and write) a text file into and out of a string array is I believe a fairly common requirement. It is also quite useful when starting with a language removing the need initially t..

Update and left outer join statements

I have two tabels with a relation and I want to update a field in table A. Is it possible to combine update and join in the same query? I googled it but didnt find any working solution? UPDATE md SET..

Why is JsonRequestBehavior needed?

Why is Json Request Behavior needed? If I want to restrict the HttpGet requests to my action I can decorate the action with the [HttpPost] attribute Example: [HttpPost] public JsonResult Foo() { ..

What equivalents are there to TortoiseSVN, on Mac OSX?

I am using a MacBook Pro running Mac OS X 10.5. I am new to this development environment, and previously worked on Windows. I find there is no TortoiseSVN for Mac PC, and I am wondering any alternativ..

Rails migration for change column

We have script/generate migration add_fieldname_to_tablename fieldname:datatype syntax for adding new columns to a model. On the same line, do we have a script/generate for changing the datatype of a..

Viewing full version tree in git

I am using the command line version of Git and gitk. I want to see the full version tree, not just the part that is reachable from the currently checked out version. Is it possible?..

Check object empty

Basically how do you check if an object is null or empty. What I mean is that if I have an object instantiated but all its values or fields are null, the how do I check in code if it is empty? I hav..

Vertically align text within a div

The code below (also available as a demo on JS Fiddle) does not position the text in the middle, as I ideally would like it to. I cannot find any way to vertically centre text in a div, even using the..

org.apache.jasper.JasperException: Unable to compile class for JSP:

Hi I'm trying to compile a simple jsp file with tomcat but I kept having this error message org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 13 in the ..

Event binding on dynamically created elements?

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off. This happens on page ready..

Importing class from another file

Before you mark it as duplicate please read my problem: I am trying to import a class from a file from a subdirectory > > --->folder/ > -----> and in i have a c..

Remove elements from collection while iterating

AFAIK, there are two approaches: Iterate over a copy of the collection Use the iterator of the actual collection For instance, List<Foo> fooListCopy = new ArrayList<Foo>(fooList); for..

Best Practices for securing a REST API / web service

When designing a REST API or service are there any established best practices for dealing with security (Authentication, Authorization, Identity Management) ? When building a SOAP API you have WS-Sec..

How to rollback just one step using rake db:migrate

After adding migration files in the db/migrate folder and running rake db:migrate, I want get back to the previous step, I think using VERSION=n is the right way to do that, but I don't know the corre..

Set Locale programmatically

My app supports 3 (soon 4) languages. Since several locales are quite similar I'd like to give the user the option to change locale in my application, for instance an Italian person might prefer Spani..

Junit test case for database insert method with DAO and web service

I am implementing a webservice based university management system. This system adds certain courses to database. here below is the code that I am using. public class Course { privat..

What is the proper way to format a multi-line dict in Python?

In Python, I want to write a multi-line dict in my code. There are a couple of ways one could format it. Here are a few that I could think of: mydict = { "key1": 1, "key2": 2, ..

How to check the version of scipy

How can I check the version of scipy installed on my system?..

How to convert map to url query string?

Do you know of any utility class/library, that can convert Map into URL-friendly query string? Example: I have a map: "param1"=12, "param2"="cat" I want to get: param1=12&param2=cat final..

What does the question mark and the colon (?: ternary operator) mean in objective-c?

What does this line of code mean? label.frame = (inPseudoEditMode) ? kLabelIndentedRect : kLabelRect; The ? and : confuse me...

Sass Nesting for :hover does not work

I've written this code, but it does not work. What is my problem? .class { margin:20px; :hover { color:yellow; } } ..

Git: How to remove file from index without deleting files from any repository

When you use git rm --cached myfile it doesn't delete from the local filesystem, which is the goal. But if you've already versioned and committed the file, pushed it to a central repository, and pu..

How ViewBag in ASP.NET MVC works

How does the ASP.NET MVC's ViewBag work? MSDN says it is just an Object, which intrigues me, how does "Magic" properties such as ViewBag.Foo and magic strings ViewBag["Hello"] actually work? Also, ho..

Least common multiple for 3 or more numbers

How do you calculate the least common multiple of multiple numbers? So far I've only been able to calculate it between two numbers. But have no idea how to expand it to calculate 3 or more numbers. ..

Django Admin - change header 'Django administration' text

How does one change the 'Django administration' text in the django admin header? It doesn't seem to be covered in the "Customizing the admin" documentation...

How to convert data.frame column from Factor to numeric

I have a data.frame whose class column is Factor. I'd like to convert it to numeric so that I can use correlation matrix. > str(breast) 'data.frame': 699 obs. of 10 variables: .... $ class ..

How to remove all the punctuation in a string? (Python)

For example: asking="hello! what's your name?" Can I just do this? asking.strip("!'?") ..

How to execute multiple commands in a single line

I know Unix has the following command which can execute multiple commands in a single line, how can I do this in DOS? command1 ; command2 ; command3 ... ..

How can I remount my Android/system as read-write in a bash script using adb?

For info adb remount returns "remount failed: Operation not permitted" adb shell 'su -c mount -o rw,remount /system' returns unknown option -- o My device is rooted...

How do we download a blob url video

I want to download a video whose url is not simple mp4 file, but its url is blob type for eg. <video id="playerVideo" width="450px" autoplay="autoplay" height="338px" style="height:100%;w..

Reading an Excel file in PHP

I'm trying to read an Excel file (Office 2003). There is an Excel file that needs to be uploaded and its contents parsed. Via Google, I can only find answers to these related (and insufficient topics..

Handling click events on a drawable within an EditText

I have added an image right of the text in an EditText widget, using the following XML: <EditText android:id="@+id/txtsearch" ... android:layout_gravity="center_vertical" android:backgroun..

Need to navigate to a folder in command prompt

My command prompt starts in C:\Users\ (Name) and I need it to be in a different folder, how can I do this using the command prompt itself?..

ORA-00972 identifier is too long alias column name

i have a query like : SELECT column as averyveryveryverylongalias (more than 30 characters) FROM Table_name it returns the error ORA-00972 identifier is too long , is there any tip to make it wo..

How to get DataGridView cell value in messagebox?

How can I get DataGridView cell value to be written in the MessageBox in C#?..

CURL to pass SSL certifcate and password

I need to specify a certificate with CURL i tried with --cert option it is not working. Could you please let me know to specify the keystore and passpharse while invoking with curl?..

Twig: in_array or similar possible within if statement?

I am using Twig as templating engine and I am really loving it. However, now I have run in a situation which definitely mustbe accomplishable in a simpler way than I have found. What I have right now..

Google Maps v2 - set both my location and zoom in

My question is, does anyone know how to set google maps up, to open up both my location and in a zoomed-in view? Currently, the main view opens up to Africa, all the way zoomed out. And so I have be..

How can I disable a button on a jQuery UI dialog?

How do I go about disabling a button on the jQuery UI dialog. I can't seem to find this in any of the documentation in the link above. I have 2 buttons on the modal confirmation ("Confirm" and "Cance..

Bootstrap 3 Multi-column within a single ul not floating properly

I have been encountering problems like this on the current bootstrap 3 for a while now. I have managed to fix them in the past in one way or another but have no clue of how to fix it this time. I nee..

What is the size of ActionBar in pixels?

I need to know the exact size of ActionBar in pixels so to apply correct background image...

Including one C source file in another?

Is it OK (or even recommended/good practice) to #include a .c file in another .c file?..

ssh connection refused on Raspberry Pi

I realize this question has already been asked in some different ways, however it doesn't seem like any of the ways I've come across have worked to fix this problem, so here it goes: I'm trying to co..

Get Substring - everything before certain char

I'm trying to figure out the best way to get everything before the - character in a string. Some example strings are below. The length of the string before - varies and can be any length 223232-1.j..

What is Python buffer type for?

There is a buffer type in python, but I don't know how can I use it. In the Python doc the description is: buffer(object[, offset[, size]]) The object argument must be an object that support..

What is a word boundary in regex, does \b match hyphen '-'?

I'm trying to use regexes to match space-separated numbers. I can't find a precise definition of \b ("word boundary"). I had assumed that -12 would be an "integer word" (matched by..

Batch files - number of command line arguments

Just converting some shell scripts into batch files and there is one thing I can't seem to find...and that is a simple count of the number of command line arguments. eg. if you have: myapp foo bar ..

How to style a JSON block in Github Wiki?

Is there a way to nicely format/style JSON code in Github Wiki (i.e Markdown preferred)? Something like this with few colors (or bold) and correct indentation:

how to compare two elements in jquery

var a=$('#start > div:last-child'); var b=$('#start >')[0]; alert(a==b) alert(a==$(b)) It's always false. How can you compare two elements in jQuery? thanks..

Adding a collaborator to my free GitHub account?

I created a GitHub account, and I want to give someone write access so he can push just like me, there is a way to add a collaborator with a free plan? If not, what can I do? (besides buying a paid ac..

How to remove a build from itunes connect?

I want to delete one of my app builds from new itunes connect site. But I couldn't find a delete/remove button. Any ideas? ..

Difference between adjustResize and adjustPan in android?

I tried to write a code which is used to re-size the UI components when soft-keyboard appears. When I use adjustResize, it res-size the UI components and at the same time adjustPan gave me same outpu..

Best way to test if a row exists in a MySQL table

I'm trying to find out if a row exists in a table. Using MySQL, is it better to do a query like this: SELECT COUNT(*) AS total FROM table1 WHERE ... and check to see if the total is non-zero or is ..

Decoding a Base64 string in Java

I'm trying to decode a simple Base64 string, but am unable to do so. I'm currently using the org.apache.commons.codec.binary.Base64 package. The test string I'm using is: abcdefg, encoded using PHP ..

How do I run .sh or .bat files from Terminal?

I have a pretty basic problem here, that has happened so haphazardly to me that up until now, I've just ignored it. I downloaded tomcat web server and "Murach's Java Servlets and JSP" book is telling ..

TS1086: An accessor cannot be declared in ambient context

I have a thousands of this error after initial implementation nad typing in terminal ng serve my-app of and i can't resolve it. This is first time for me when i have problem like this inside angular w..

Is there a difference between using a dict literal and a dict constructor?

Using PyCharm, I noticed it offers to convert a dict literal: d = { 'one': '1', 'two': '2', } into a dict constructor: d = dict(one='1', two='2') Do these different approaches differ..

Rename multiple files in a folder, add a prefix (Windows)

I'd like to batch rename files in a folder, prefixing the folder's name into the new names. i.e. files in C:\house chores\ will all be renamed house chores - $old_name...

How to read values from properties file?

I am using spring. I need to read values from properties file. This is internal properties file not the external properties file. Properties file can be as below. ---file name. valu..

Switching to a TabBar tab view programmatically?

Let's say I have a UIButton in one tab view in my iPhone app, and I want to have it open a different tab in the tab bar of the TabBarController. How would I write the code to do this? I'm assuming..

Closure in Java 7

What is closure? It is supposed to be included in Java 7. (Closures were discussed for inclusion in Java 7, but in the end were not included. -ed) Can anyone please provide me with some reliable refe..

Access an arbitrary element in a dictionary in Python

If a mydict is not empty, I access an arbitrary element as: mydict[mydict.keys()[0]] Is there any better way to do this?..

Get final URL after curl is redirected

I need to get the final URL after a page redirect preferably with curl or wget. For example may redirect to The contents are easy to get(ex. curl --max-redir..

How do you change the server header returned by nginx?

There's an option to hide the version so it will display only nginx, but is there a way to hide that too so it will not show anything or change the header?..

How do I keep a label centered in WinForms?

In WinForms I am using a Label to display different messages like success, failure, etc. I'd like to center that label in the center form. I want a solution that will keep it centered whether there's..

C#: Converting byte array to string and printing out to console

public void parse_table(BinaryReader inFile) { byte[] idstring = inFile.ReadBytes(6); Console.WriteLine(Convert.ToString(idstring)); } It is a simple snippet: read the first 6 bytes of the ..

store and retrieve a class object in shared preference

In Android can we store an object of a class in shared preference and retrieve the object later? If it is possible how to do it? If it is not possible what are the other possibilities of doing it? ..

Constructor in an Interface?

I know it's not possible to define a constructor in an interface. But I'm wondering why, because I think it could be very useful. So you could be sure that some fields in a class are defined for ever..

Hibernate-sequence doesn't exist

I tried to upgrade hibernate from 4 to 5 in my project with spring 4.2 version. After this upgrade, I found the following error in my stack trace when I called a method for updating. 10:53:32,185 ERR..

jQuery find and replace string

I have somewhere on website a specific text, let's say "lollypops", and I want to replace all the occurrences of this string with "marshmellows". The problem is that I don't know where exactly the tex..

Sending data back to the Main Activity in Android

I have two activities: main activity and child activity. When I press a button in the main activity, the child activity is launched. Now I want to send some data back to the main screen. I used the ..

How to pass multiple parameters in json format to a web service using jquery?

I'm trying to execute a webservice using jquery. When I pass only one input parameter it works fine: $.ajax({ type: "POST", url: url, data: "{'Id1':'2'}", contentType..

How can you get the Manifest Version number from the App's (Layout) XML variables?

I would like to have a way to reference the project's manifest version number in the main part of the code. What I have been doing up until now is to link the version number in a String XML file to th..

Passing route control with optional parameter after root in express?

I'm working on a simple url-shortening app and have the following express routes: app.get('/', function(req, res){ res.render('index', { link: null }); });'/', function(req, res){ ..

Creating a SearchView that looks like the material design guidelines

I'm currently in the process of learning how to convert my app to Material design and I'm a bit stuck right now. I've got the Toolbar added and I have made my navigation drawer overlay all the content..

What's the best way to check if a String represents an integer in Java?

I normally use the following idiom to check if a String can be converted to an integer. public boolean isInteger( String input ) { try { Integer.parseInt( input ); return true; ..

How to checkout a specific Subversion revision from the command line?

I want to checkout a specific revision of a folder in Subversion using the command line. I don't see an option for specifying the revision number in TortoiseProc.exe, TortoiseProc.exe /command:check..

Python csv string to array

Anyone know of a simple library or function to parse a csv encoded string and turn it into an array or dictionary? I don't think I want the built in csv module because in all the examples I've seen t..

How to set width to 100% in WPF

Is there any way how to tell component in WPF to take 100% of available space? Like width: 100%; in CSS I've got this XAML, and I don't know how to force Grid to take 100% width. <List..

Python dictionary replace values

I have a dictionary with 20 000 plus entries with at the moment simply the unique word and the number of times the word was used in the source text (Dante's Divine Comedy in Italian). I would like to..

Get Time from Getdate()

I would like to take the Getdate() results of, for example 2011-10-05 11:26:55.000 into 11:26:55 AM I have looked other places and found Select RIGHT(CONVERT(VARCHAR, GETDATE(), 100),7) wh..

Git: Permission denied (publickey) fatal - Could not read from remote repository. while cloning Git repository

I am unable to clone a Git repository, and getting this error: krishna.soni@KRISHNACHANDRAS /c/Projects $ git clone http://<url>/<repository> Cloning into '..

Import existing source code to GitHub

How can I import source code from my computer to my GitHub account?..

Calculate rolling / moving average in C++

I know this is achievable with boost as per: Using boost::accumulators, how can I reset a rolling window size, does it keep extra history? But I really would like to avoid using boost. I have google..

Add new field to every document in a MongoDB collection

How can I add a new field to every document in an existent collection? I know how to update an existing document's field but not how to add a new field to every document in a collection. How can I do..

ClassNotFoundException com.mysql.jdbc.Driver

This question might have asked here number of times . After doing some google search for the above error and doing some update, I can't understand why I'm still getting that error. I've already put my..

How can I read comma separated values from a text file in Java?

I have got this text file with latitude and longitude values of different points on a map. How can I split my string into latitudes and longitudes? What is the general way to do these type of things ..

RecyclerView - How to smooth scroll to top of item on a certain position?

On a RecyclerView, I am able to suddenly scroll to the top of a selected item by using: ((LinearLayoutManager) recyclerView.getLayoutManager()).scrollToPositionWithOffset(position, 0); However, thi..

What is the best IDE to develop Android apps in?

I am about to start developing an android app and need to get an IDE. Eclipse and the android eclipse plugin appears to be the natural choice. However I am familiar with intelliJ and re-sharper so I w..

Copy from one workbook and paste into another

I have written the following code and continually see pastespecial method of class has failed. I have tried to overcome this issue, but nothing seems to work. I am trying to copy an entire sheet from ..

Create MSI or setup project with Visual Studio 2012

I create a small application and I would like to create one MSI file. In Visual Studio 2010 you have this project type under: Other Project Types -> Setup and Deployment -> Visual studio Install..

Find difference between timestamps in seconds in PostgreSQL

I have a table in PostgreSQL 8.3 with 2 timestamp columns. I would like to get the difference between these timestamps in seconds. Could you please help me how to get this done? TableA ( timestamp_..

Checking if a character is a special character in Java

Possible Duplicate: JAVA: check a string if there is a special character in it I am a novice programmer and am looking for help determining if a character is a special character. My program..

The entity cannot be constructed in a LINQ to Entities query

There is an entity type called Product that is generated by entity framework. I have written this query public IQueryable<Product> GetProducts(int categoryID) { return from p in db.Products ..

How can I exclude directories from grep -R?

I want to traverse all subdirectories, except the "node_modules" directory...

How to set the authorization header using curl

How do I pass authorization header using cURL? ( executable in /usr/bin/curl)...

What are some resources for getting started in operating system development?

One thing I've always wanted to do is develop my very own operating system (not necessarily fancy like Linux or Windows, but better than a simple boot loader which I've already done). I'm having a ha..

Update Rows in SSIS OLEDB Destination

I have a data flow process where I have an OLEDB Source and an OLEDB Destination like below: Source merges data from two staging tables and returns a result set (say, 50K rows). These 50K rows are ..

What is initial scale, user-scalable, minimum-scale, maximum-scale attribute in meta tag?

I was going through the source code of a website and found this piece of code. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-s..

Replace all particular values in a data frame

Having a data frame, how do I go about replacing all particular values along all rows and columns. Say for example I want to replace all empty records with NA's (without typing the positions): df <..

Create a asmx web service in C# using visual studio 2013

Hy, how can I create a asmx web service in Visual Studio 2013? I have found this short tutorial about that, but when I follow this in Visual Studio 2013 I get an error that says "the type 'Service1'..

WinForms DataGridView font size

How do I change font size on the DataGridView?..

Vue template or render function not defined yet I am using neither?

This is my main javascript file: import Vue from 'vue' new Vue({ el: '#app' }); My HTML file: <body> <div id="app"></div> <script src="{{ mix('/js/app.js') }}">..

How do I determine the dependencies of a .NET application?

How do I determine the dependencies of a .NET application? Does Dependency Walker work with managed apps? I've downloaded the latest and tried profiling the app, but it just exits without much of an e..

java.lang.NoClassDefFoundError in junit

I am getting this error in java in my junit test code. I looked up on the net and it says that I need to add the junit.jar in the classpath. In Eclipse I have added it in the classpath of Project Pro..

Bitbucket fails to authenticate on git pull

I use BitBucket and had to change my password because it was compromised. git pull remote: Invalid username or password. If you log in via a third party service you must ensure you have an accou..

Get current value selected in dropdown using jQuery

I have a set of dynamically generated dropdown boxes on my page. basically I clone them using jQuery. now I want to capture the value selected on each dropdown on change event. I tried something like..

Creating a div element inside a div element in javascript

I'm trying a very basic example of creating a div inside an already existing div. It doesn't seem to be working when I use: document.getElementbyId('lc').appendChild(element) but works fine when I..

Can multiple different HTML elements have the same ID if they're different elements?

Can multiple HTML elements have the same ID if they're of different element types? Is a scenario like this valid? Eg: div#foo span#foo a#foo ..

Calling async method synchronously

I have an async method: public async Task<string> GenerateCodeAsync() { string code = await GenerateCodeService.GenerateCodeAsync(); return code; } I need to call this method from a s..

Get the _id of inserted document in Mongo database in NodeJS

I use NodeJS to insert documents in MongoDB. Using collection.insert I can insert a document into database like in this code: // ... collection.insert(objectToInsert, function(err){ if (err) retur..

Multiple scenarios @RequestMapping produces JSON/XML together with Accept or ResponseEntity

I am working with Spring 4.0.7 About Spring MVC, for research purposes, I have the following: @RequestMapping(value="/getjsonperson", method=RequestMethod.GET, pro..

How to write logs in text file when using java.util.logging.Logger

I have a situation in which I want to write all logs created by me into a text file. We are using java.util.logging.Logger API to generate the logs. I tried: private static Logger logger = Logger.g..