Questions Tagged with #Pfx

pfx is a file format containing public key together with the private key for encryption and chain of trust certificates attached to the public key if such a chain exists. Pfx files are protected by a password to access.

Cannot import the keyfile 'blah.pfx' - error 'The keyfile may be password protected'

We just upgraded our Visual Studio 2008 projects to Visual Studio 2010. All of our assemblies were strong signed using a Verisign code signing certificate. Since the upgrade we continuously get the fo..

Convert .pfx to .cer

Is it possible to convert a .pfx (Personal Information Exchange) file to a .cer (Security Certificate) file? Unless I'm mistaken, isn't a .cer somehow embedded inside a .pfx? I'd like some way to extr..

Converting pfx to pem using openssl

How to generate a .pem CA certificate and client certificate from a PFX file using OpenSSL...

checked = "checked" vs checked = true

What is the difference between the below two usages? document.getElementById('myRadio').checked = "checked"; and document.getElementById('myRadio').checked = true; For me, both are behaving the..

SystemError: Parent module '' not loaded, cannot perform relative import

I have the following directory: myProgram +-- app +-- __init__.py +-- main.py +-- mymodule.py mymodule.py: class myclass(object): def __init__(self): pass def myfunc(self): ..

How do I pass the this context to a function?

I thought this would be something I could easily google, but maybe I'm not asking the right question... How do I set whatever "this" refers to in a given javascript function? for example, like with ..

Why use Ruby's attr_accessor, attr_reader and attr_writer?

Ruby has this handy and convenient way to share instance variables by using keys like attr_accessor :var attr_reader :var attr_writer :var Why would I choose attr_reader or attr_writer if I could s..

It is more efficient to use if-return-return or if-else-return?

Suppose I have an if statement with a return. From the efficiency perspective, should I use if(A > B): return A+1 return A-1 or if(A > B): return A+1 else: return A-1 Should I ..

Check whether a request is GET or POST

Possible Duplicate: PHP detecting request type (GET, POST, PUT or DELETE) This should be an easy one. I have a script, and in the script I want to determine whether the request arrive via ..

React prevent event bubbling in nested components on click

Here's a basic component. Both the <ul> and <li> have onClick functions. I want only the onClick on the <li> to fire, not the <ul>. How can I achieve this? I've played around ..

Bootstrap col-md-offset-* not working

I'm trying to add Bootstrap offset class in my code to achieve diagonal alignment like this: But I don't know what offset should I use. I've tried couple of offsets to achieve this but no use.Text ..

Stopping Excel Macro executution when pressing Esc won't work

I'm running excel 2007 on XP. Is there a way to stop a macro from running during its execution other than pressing escape? Usually if I think I created an infinate loop or otherwise messed something..

Using Cygwin to Compile a C program; Execution error

I'm enrolled in a masters computer science course. The course is using C and the instructor wants us to use Cygwin to compile programs if we are using windows. I've downloaded and installed Cygwin a..

Allow only pdf, doc, docx format for file upload?

I am triggering a file upload on href click. I am trying to block all extension except doc, docx and pdf. I am not getting the correct alert value. <div class="cv"> Would you like to attach you..

Serializing list to JSON

I am sending information between client and Django server, and I would like to use JSON to this. I am sending simple information - list of strings. I tried using django.core.serializers, but when I di..

Moving matplotlib legend outside of the axis makes it cutoff by the figure box

I'm familiar with the following questions: Matplotlib savefig with a legend outside the plot How to put the legend out of the plot It seems that the answers in these questions have the luxury of be..

Undefined index with $_POST

I am trying to relearn some PHP basics for making a simple login script, however I get an error I have not received before(I made the same script a little over a year ago and never had this error. I s..

Oracle SQL Developer - tables cannot be seen

I was using SQL Developer 1.1. I have recently upgraded to SQL Developer 3. After the upgrade, I noticed that some of my connections do not show their tables. I can do a select on the tables and the d..

Installing SQL Server 2012 - Error: Prior Visual Studio 2010 instances requiring update

I'm trying to install SQL Server 2012 Developer Edition and I can get to the point where it's doing the Installation Rule Checks but one of the rules keep failing: 'Prior Visual Studio 2010 instances..

How to split the name string in mysql?

How to split the name string in mysql ? E.g.: name ----- Sachin ramesh tendulkar Rahul dravid Split the name like firstname,middlename,lastname: firstname middlename lastname --------- --..

How to use default Android drawables

What is the best approach when using default Android drawables? Should I use android.R.drawable or should I copy the drawables in my project and use R.drawable? Is there any risk, that in a newer ver..

How to open the second form?

I have Form1 and Form2 in my project. Form2 is just a form with settings for Form1. What is the command to open the Form2 from the Form1 and also what's the command to close it please?..

Thin Black Border for a Table

I need to have such thin line for the whole table as seen above. The above image is a sample only. My solution, doesn't work. The table shows no border at all. Here is my CSS: table { border-w..

PHP Converting Integer to Date, reverse of strtotime

<?php echo strtotime("2014-01-01 00:00:01")."<hr>"; // output is 1388516401 ?> I am surprised if it can be reverse. I mean can I convert 1388516401 to 2014-01-01 00:00:01. What I actuall..

Copy entire directory contents to another directory?

Method to copy entire directory contents to another directory in java or groovy?..

Python set to list

How can I convert a set to a list in Python? Using a = set(["Blah", "Hello"]) a = list(a) doesn't work. It gives me: TypeError: 'set' object is not callable ..

"Continue" (to next iteration) on VBScript

A colleague and I were trying to figure out a way of doing the equivalent of a "continue" statement within a VBScript "For/Next" loop. Everywhere we looked we found people had no way to do this in VB..

How to set upload_max_filesize in .htaccess?

I have try to put theese 2 lines php_value post_max_size 30M php_value upload_max_filesize 30M in my root .htaccess file but that brings me "internal server error" message ... php5 is running on ..

JS search in object values

I have an array of homogeneous objects like so; [ { "foo" : "bar", "bar" : "sit" }, { "foo" : "lorem", "bar" : "ipsum" }, { "foo" : "dolor", "bar" : "amet" } ] I..

How to create file object from URL object (image)

I need to create a File object from URL object My requirement is I need to create a file object of a web image (say googles logo) URL url = new URL("http://google.com/pathtoaimage.jpg"); File f = c..

jquery how to get the page's current screen top position?

jquery how to get the page's current screen top position? If I scroll my mouse wheel to some part of the page, how do I get the page's current top position? I want click one element in my page, th..

public static const in TypeScript

Is there such a thing as public static constants in TypeScript? I have a class that looks like: export class Library { public static BOOK_SHELF_NONE: string = "None"; public static BOOK_SHELF_FU..

How to make several plots on a single page using matplotlib?

I have written code that opens 16 figures at once. Currently they all open as separate graphs. I'd like them to open all on the same page. Not the same graph. I want 16 separate graphs on a single ..

How to pass parameter to function using in addEventListener?

In the traditional way to add event listener: function getComboA(sel) { var value = sel.options[sel.selectedIndex].value; } <select id="comboA" onchange="getComboA(this)"> <option val..

Unknown column in 'field list' error on MySQL Update query

I keep getting MySQL error #1054, when trying to perform this update query: UPDATE MASTER_USER_PROFILE, TRAN_USER_BRANCH SET MASTER_USER_PROFILE.fellow=`y` WHERE MASTER_USER_PROFILE.USER_ID = TRAN_US..

How do I pipe a subprocess call to a text file?

subprocess.call(["/home/myuser/run.sh", "/tmp/ad_xml", "/tmp/video_xml"]) RIght now I have a script that I run. When I run it and it hits this line, it starts printing stuff because run.sh has prin..

Change name of folder when cloning from GitHub?

When I clone something from Github, it creates a folder with the same name as the app on my computer. Is there a way to change the name? For example, doing this clone creates a long "sign-in-with..

How do I remove all non alphanumeric characters from a string except dash?

How do I remove all non alphanumeric characters from a string except dash and space characters?..

How can I compare a date and a datetime in Python?

Here's a little snippet that I'm trying execute: >>> from datetime import * >>> item_date = datetime.strptime('7/16/10', "%m/%d/%y") >>> from_date = date.today()-timedelta(..

What's the idiomatic syntax for prepending to a short python list?

list.append() is the obvious choice for adding to the end of a list. Here's a reasonable explanation for the missing list.prepend(). Assuming my list is short and performance concerns are negligible..

How do I run a single test using Jest?

I have a test 'works with nested children' within the file fix-order-test.js. Running the below runs all the tests in the file. jest fix-order-test How do I run only a single test? The below does ..

Jquery Date picker Default Date

I am using a Jquery Datepicker in my project. The problem is that it is not loading the current date, but showing a date 1st January 2001 as default. Can you please let me know how the default date ca..

How to upload images into MySQL database using PHP code

I am trying to save images in my database from HTML form. I have written PHP code to accomplish this task. The program is not generating any error message, but also not inserting image data in MySQL d..

How to calculate the angle between a line and the horizontal axis?

In a programming language (Python, C#, etc) I need to determine how to calculate the angle between a line and the horizontal axis? I think an image describes best what I want: Given (P1x,P1y) and ..

How to extract filename.tar.gz file

I want to extract an archive named filename.tar.gz. Using tar -xzvf filename.tar.gz doesn't extract the file. it is gives this error: gzip: stdin: not in gzip format tar: Child returned status 1 tar..

Retrieving data from a POST method in ASP.NET

I am using ASP.NET. There is a system that needs to POST data to my site and all they asked for is for me to provide them with a URL. So I gave them my URL http://www.example.com/Test.aspx. Now I do..

How to exit git log or git diff

I'm trying to learn Git with the help of Git Immersion. There's one thing that frustrates me whenever I use git log or git diff: I can't figure out what to do next when I encounter this (END) word...

Regex AND operator

Based on this answer Regular Expressions: Is there an AND operator? I tried the following on http://regexpal.com/ but was unable to get it to work. What am missing? Does javascript not support it? ..

Why does SSL handshake give 'Could not generate DH keypair' exception?

When I make an SSL connection with some IRC servers (but not others - presumably due to the server's preferred encryption method) I get the following exception: Caused by: java.lang.RuntimeException:..

OnClickListener in Android Studio

I'm attempting to develop and app using the new Android Studio, but I keep receiving major errors on my OnClickListeners. Mainly it is telling me that it cannot resolve symbol "setOnClickListener" and..

Octave/Matlab: Adding new elements to a vector

Having a vector x and I have to add an element (newElem) . Is there any difference between - x(end+1) = newElem; and x = [x newElem]; ?..

How to get the value of a variable given its name in a string?

For simplicity this is a stripped down version of what I want to do: def foo(a): # I want to print the value of the variable # the name of which is contained in a I know how to do this in P..

How to use ng-if to test if a variable is defined

Is there a way to use ng-if to test if a variable is defined, not just if it's truthy? In the example below (live demo), the HTML displays a shipping cost for the red item only, because item.shipping..

Storing WPF Image Resources

For a WPF application which will need 10 - 20 small icons and images for illustrative purposes, is storing these in the assembly as embedded resources the right way to go? If so, how do I specify in X..

Using intents to pass data between activities

I am trying to pass the data between Activities I use intents to pass data between regular activities consider the code below:: AndroidTabRestaurantDescSearchListView.java public class AndroidTabR..

How to change the link color in a specific class for a div CSS

In my Page the following CSS is set: a:link { color: #0094DE; text-decoration: none; } a:visited { text-decoration: none; color: #0094DE; } a:hover { text-decoration: underline; c..

Find empty or NaN entry in Pandas Dataframe

I am trying to search through a Pandas Dataframe to find where it has a missing entry or a NaN entry. Here is a dataframe that I am working with: cl_id a c d e ..

How to install PyQt4 on Windows using pip?

I'm using Python 3.4 on Windows. When I run a script, it complains ImportError: No Module named 'PyQt4' So I tried to install it, but pip install PyQt4 gives Could not find any downloads that s..

How to delete or add column in SQLITE?

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

How to get the python.exe location programmatically?

Basically I want to get a handle of the python interpreter so I can pass a script file to execute (from an external application)...

Meaning of delta or epsilon argument of assertEquals for double values

I have a question about JUnit assertEquals to test double values. Reading the API doc I can see: @Deprecated public static void assertEquals(double expected, double actual) Deprecated. Use assertEqu..

Drawing an SVG file on a HTML5 canvas

Is there a default way of drawing an SVG file onto a HTML5 canvas? Google Chrome supports loading the SVG as an image (and simply using drawImage), but the developer console does warn that resource in..

Set Matplotlib colorbar size to match graph

I cannot get the colorbar on imshow graphs like this one to be the same height as the graph, short of using Photoshop after the fact. How do I get the heights to match?..

Embedding DLLs in a compiled executable

Is it possible to embed a pre-existing DLL into a compiled C# executable (so that you only have one file to distribute)? If it is possible, how would one go about doing it? Normally, I'm cool with ju..

Can I convert long to int?

I want to convert long to int. If the value of long > int.MaxValue, I am happy to let it wrap around. What is the best way?..

Checking password match while typing

I have a registration form with "password" and "confirm password" input fields. I want to check if the "confirm password" matches the "password" while the user is typing it and give the appropriate me..

how to call javascript function in html.actionlink in asp.net mvc?

how to call javascript function in html.actionlink in asp.net mvc? i wan to call one method which is in java script but how to call it within html.actionlink in same page thanks in advance..

What's the best way to loop through a set of elements in JavaScript?

In the past and with most my current projects I tend to use a for loop like this: var elements = document.getElementsByTagName('div'); for (var i=0; i<elements.length; i++) { doSomething(eleme..

Create a branch in Git from another branch

I have two branches: master and dev I want to create a "feature branch" from the dev branch. Currently on the branch dev, I do: $ git checkout -b myfeature dev ... (some work) $ git commit -am "..

Does delete on a pointer to a subclass call the base class destructor?

I have an class A which uses a heap memory allocation for one of its fields. Class A is instantiated and stored as a pointer field in another class (class B. When I'm done with an object of class B, ..

How to get a list of images on docker registry v2

I'm using docker registry v1 and I'm interested in migrating to the newer version, v2. But I need some way to get a list of images present on registry; for example with registry v1 I can execute a GET..

Spark dataframe: collect () vs select ()

Calling collect() on an RDD will return the entire dataset to the driver which can cause out of memory and we should avoid that. Will collect() behave the same way if called on a dataframe? What abou..

Hide html horizontal but not vertical scrollbar

I have an HTML textarea that is of fixed width, but variable height. I would like to set overflow:scroll and be able to show a vertical scrollbar, but not a horizontal one. I am not able to use overfl..

What is a constant reference? (not a reference to a constant)

A pretty theoretical question...Why constant references do not behave the same way as constant pointers and I can actually change the object they are pointing to? They really seem like another plain v..

Changing one character in a string

What is the easiest way in Python to replace a character in a string? For example: text = "abcdefg"; text[1] = "Z"; ^ ..

SFTP Libraries for .NET

Can anyone recommend a good SFTP library to use? Right now I'm looking at products such as SecureBlackbox, IPWorks SSH, WodSFTP, and Rebex SFTP. However, I have never used any SFTP library before so..

Represent space and tab in XML tag

How to represent space and tab in XML tag. Is there any special characters for them to represent...

How do I trim a file extension from a String in Java?

What's the most efficient way to trim the suffix in Java, like this: title part1.txt title part2.html => title part1 title part2 ..

Set the text in a span

I have this span <a title="Prev" data-event="click" data-handler="prev" class="ui-datepicker-prev ui-corner-all"> <span class="ui-icon ui-icon-circle-triangle-w">Prev</span&..

How to send an email with Python?

This code works and sends me an email just fine: import smtplib #SERVER = "localhost" FROM = '[email protected]' TO = ["[email protected]"] # must be a list SUBJECT = "Hello!" TEXT = "This messa..

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

Session only cookies with Javascript

I was wondering if it's possible to create session only cookies with Javascript. When the browser is closed the cookies should be removed. I can't use anything on the server as the website is HTML o..

In Java, how to find if first character in a string is upper case without regex

In Java, find if the first character in a string is upper case without using regular expressions...

Determine whether an array contains a value

I need to determine if a value exists in an array. I am using the following function: Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] == obj..

The server encountered an internal error that prevented it from fulfilling this request - in servlet 3.0

I want to run easy registration jsp page with servlet. And it throw this error message: description The server encountered an internal error that prevented it from fulfilling this request. java.lang..

How to download fetch response in react as file

Here is the code in actions.js export function exportRecordToExcel(record) { return ({fetch}) => ({ type: EXPORT_RECORD_TO_EXCEL, payload: { promise: fetch('/record..

How can I remove an element from a list, with lodash?

I have an object that looks like this: var obj = { "objectiveDetailId": 285, "objectiveId": 29, "number": 1, "text": "x", "subTopics": [{ "subTopicId": 1, "number"..

Convert from java.util.date to JodaTime

I want to convert a java.util.Date to JodaTime so as to carry out subtractions between dates. Is there a good concise way to convert from Date to JodaTime?..

Counting the Number of keywords in a dictionary in python

I have a list of words in a dictionary with the value = the repetition of the keyword but I only want a list of distinct words so I wanted to count the number of keywords. Is there a way to count the ..

JPA getSingleResult() or null

I have an insertOrUpdate method which inserts an Entity when it doesn't exist or update it if it does. To enable this, I have to findByIdAndForeignKey, if it returned null insert if not then update. T..

How to round a Double to the nearest Int in swift?

I'm trying to make a calculator of growth rate (Double) that will round the result to the nearest Integer and recalculate from there, as such: let firstUsers = 10.0 let growth = 0.1 var users = first..

android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>

I am receiving many errors of kind displayed in the subj. These errors seems to be occasional and I cannot reproduce them. From stack I can learn that such error may occurs for my different layout res..

taking input of a string word by word

I just started learning C++. I was just playing around with it and came across a problem which involved taking input of a string word by word, each word separated by a whitespace. What I mean is, supp..

Capitalize words in string

What is the best approach to capitalize words in a string?..

JavaScript variable assignments from tuples

In other languages like Python 2 and Python 3, you can define and assign values to a tuple variable, and retrieve their values like this: tuple = ("Bob", 24) name, age = tuple print(name) #..

CSS: How to position two elements on top of each other, without specifying a height?

I have two DIVs that I need to position exactly on top of each other. However, when I do that, the formatting gets all screwed up because the containing DIV acts like there is no height. I think this ..

How to use a ViewBag to create a dropdownlist?

Controller: public ActionResult Filter() { ViewBag.Accounts = BusinessLayer.AccountManager.Instance.getUserAccounts(HttpContext.User.Identity.Name); return View(); } View: <td>Accoun..

Compare two MySQL databases

I'm currently developing an application using a MySQL database. The database-structure is still in flux and changes while development progresses (I change my local copy, leaving the one on the test-s..

Git : fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists

I am getting this error - D:\Projects\wamp\www\REPO [master]> git pull origin master Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts. ERROR: Repository not..

How can I start PostgreSQL server on Mac OS X?

Final update: I had forgotten to run the initdb command. By running this command ps auxwww | grep postgres I see that postgres is not running > ps auxwww | grep postgres remcat 1789 0...

Full-screen iframe with a height of 100%

Is iframe height=100% supported in all browsers? I am using doctype as: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"..

How to PUT a json object with an array using curl

I have a series of data to enter into database. The user interface to enter the data isn't good for bulk entry, so I'm trying to formulate a command line equivalent. When I examine the network reque..

Why rgb and not cmy?

Seeing as how the three primary colors are cyan, magenta and yellow (CMY), why do monitors and almost all the GUI components out there use red, green and blue (RGB)? (If I'm not mistaken, printers use..

Python "\n" tag extra line

I am trying to build a simple board in command line. Problem: When i use "\n" for ending current line, it adds an extra blank line. How can i fix that? Code: def drawBoard(): board = [ [0,0,0,0..

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

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

Get JSONArray without array name?

I'm new to JSON and trying this tutorial: http://p-xr.com/android-tutorial-how-to-parse-read-json-data-into-a-android-listview/#comments I'm new to JSON, C languages, Java and also Android, but am le..

How can I use onItemSelected in Android?

package org.example.mbtiapplication; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.AdapterView; import android.widge..

How do I display ? Play (Forward) or Solid right arrow symbol in html?

How do I display this ? Play (Forward) or Solid right arrow symbol in html?..

Spring Boot yaml configuration for a list of strings

I am trying to load an array of strings from application.yml file. This is the config: ignore: filenames: - .DS_Store - .hg This is the class: @Value("${ignore.filenames}") pri..

count of entries in data frame in R

I'm looking to get a count for the following data frame: > Santa Believe Age Gender Presents Behaviour 1 FALSE 9 male 25 naughty 2 TRUE 5 male 20 nice 3 TR..

How to install a Notepad++ plugin offline?

I am trying to install a Notepad++ plugin from Plugins -> Plugin Manager, but my office firewall is restricting its download. Is there any alternate way to download plugin offline?..

Excel how to fill all selected blank cells with text

Is it possible to select all the bank cells in an excel sheet and put the same value in all the cells? I just want to populate them with "null" I have Excel student 2010..

How to push both key and value into an Array in Jquery

I am reading RSS feed and pushing both Title and Link into an Array in Jquery. What i did is var arr = []; $.getJSON("displayjson.php",function(data){ $.each(data.news,..

HTML Button Close Window

I have an html button that I want to close the current window when clicked. I thought I could just set the onclick feature like I did below. Am I missing something? <button type="button" onclick..

Checking character length in ruby

I got stuck in another situation: our users enter a text to be stored in a variable. The condition for that text is it can be allowed to enter only 25 characters, Now I have to write a regular express..

Generate .pem file used to set up Apple Push Notifications

I tried and tried to generate a .pem file, every time generating certificates from the client's account and then generating the .pem file using the terminal, but it's of no use. Can anyone give a step..

How can I get query parameters from a URL in Vue.js?

How can I fetch query parameters in Vue.js? E.g. http://somesite.com?test=yay. Can’t find a way to fetch or do I need to use pure JS or some library for this?..

Converting video to HTML5 ogg / ogv and mpg4

Does anyone know about any software that can convert video (avi, flv, whatever) to HTML5 supported ogg/ogv and mpeg4 formats? I tried a few but I couldn't find anything that actually works...

How, in general, does Node.js handle 10,000 concurrent requests?

I understand that Node.js uses a single-thread and an event loop to process requests only processing one at a time (which is non-blocking). But still, how does that work, lets say 10,000 concurrent re..

How do I validate a date string format in python?

I have a python method which accepts a date input as a string. How do I add a validation to make sure the date string being passed to the method is in the ffg. format: 'YYYY-MM-DD' if it's not, me..

How to get ASCII value of string in C#

I want to get the ASCII value of characters in a string in C#. If my string has the value "9quali52ty3", I want an array with the ASCII values of each of the 11 characters. How can I get ASCII value..

how to fix groovy.lang.MissingMethodException: No signature of method:

I am trying to use this method without a closure def copyAndReplaceText(source, dest, targetText, replaceText){ dest.write(source.text.replaceAll(targetText, replaceText)) } def source = new Fi..

How can I determine the current CPU utilization from the shell?

How can I determine the current CPU utilization from the shell in Linux? For example, I get the load average like so: cat /proc/loadavg Outputs: 0.18 0.48 0.46 4/234 30719 ..

How do you convert a time.struct_time object into a datetime object?

How do you convert a Python time.struct_time object into a datetime.datetime object? I have a library that provides the first one and a second library that wants the second one...

isset() and empty() - what to use

Could you help me to improve my coding style?:) In some tasks I need to check - is variable empty or contains something. To solve this task, I usually do the following. Check - is this variable set ..

How to send custom headers with requests in Swagger UI?

I have some endpoints in the API - /user/login, /products. In Swagger UI I post email and password to /user/login and as a response I receive a token string. Then, I can copy the token from the resp..

How to set connection timeout with OkHttp

I am developing app using OkHttp library and my trouble is I cannot find how to set connection timeout and socket timeout. OkHttpClient client = new OkHttpClient(); Request request = new Request.Bui..

How to convert string to Title Case in Python?

Example: HILO -> Hilo new york -> New York SAN FRANCISCO -> San Francisco Is there a library or standard way to perform this task? ..

How to set zoom level in google map

Here is the code I have written to add a marker to the google map by providing latitude and longitude. The problem is that I get a very highly zoomed google map. I have tried setting the zoom level to..

Laravel 4: Redirect to a given url

Is there a method in Redirect class of laravel where the parameter is a complete url? We all know parameters to these methods are just route name,action, slash,..etc but what I want now is like retu..

Ruby's File.open gives "No such file or directory - text.txt (Errno::ENOENT)" error

I installed Ruby 1.9.2 on my Win 7 machine. Created a simple analyzer.rb file. It has this one line: File.open("text.txt").each {|line| puts line} When I run the code, it gives me this error: anal..

ASP.NET Core Web API exception handling

I am using ASP.NET Core for my new REST API project after using regular ASP.NET Web API for many years. I don't see any good way to handle exceptions in ASP.NET Core Web API. I tried to implement exce..

Editor does not contain a main type in Eclipse

I downloaded eclipse-jee-kepler-SR1-linux-gtk-x86_64.tar.gz. This eclipse is built-in with java and my Lubuntu is 64-bit. Whenever I compile and run a simple code in java like this one below: public ..

Interpreting segfault messages

What is the correct interpretation of the following segfault messages? segfault at 10 ip 00007f9bebcca90d sp 00007fffb62705f0 error 4 in libQtWebKit.so.4.5.2[7f9beb83a000+f6f000] segfault at 10 ip 00..

C# code to validate email address

What is the most elegant code to validate that a string is a valid email address?..

Select query with date condition

I would like to retrieve the records in certain dates after d/mm/yyyy, or after d/mm/yyyy and before d/mm/yyyy, how can I do it ? SELECT date FROM table WHERE date > 1/09/2008; and SELECT date ..

Single Form Hide on Startup

I have an application with one form in it, and on the Load method I need to hide the form. The form will display itself when it has a need to (think along the lines of a outlook 2003 style popup), b..

How to read line by line or a whole text file at once?

I'm in a tutorial which introduces files (how to read and write from\to file) First of all, this is not a homework, this is just general help I'm seeking. I know how to read one word at a time, but ..

Java : How to determine the correct charset encoding of a stream

With reference to the following thread: Java App : Unable to read iso-8859-1 encoded file correctly What is the best way to programatically determine the correct charset encoding of an inputstream/fi..

matplotlib error - no module named tkinter

I tried to use the matplotlib package via Pycharm IDE on windows 10. when I run this code: from matplotlib import pyplot I get the following error: ImportError: No module named 'tkinter' I know ..

How to round a number to n decimal places in Java

What I would like is a method to convert a double to a string which rounds using the half-up method - i.e. if the decimal to be rounded is 5, it always rounds up to the next number. This is the standa..

How do I write a Windows batch script to copy the newest file from a directory?

I need to copy the newest file in a directory to a new location. So far I've found resources on the forfiles command, a date-related question here, and another related question. I'm just having a bit ..

Codeigniter: Passing data from controller to view

I want to pass $data from the controller named poll to the results_view however I am getting an undefined variable error. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'..

How can I send a Firebase Cloud Messaging notification without use the Firebase Console?

I'm starting with the new Google service for the notifications, Firebase Cloud Messaging. Thanks to this code https://github.com/firebase/quickstart-android/tree/master/messaging I was able to send ..

Strip double quotes from a string in .NET

I'm trying to match on some inconsistently formatted HTML and need to strip out some double quotes. Current: <input type="hidden"> The Goal: <input type=hidden> This is wrong becaus..

SQL Server: how to create a stored procedure

I'm learning sql from a book and I'm trying to write a stored procedure but I don't believe that I'm doing it correctly. Is the following way not valid in Microsoft SQL? If not, when is it valid, if e..

Why are C++ inline functions in the header?

NB This is not a question about how to use inline functions or how they work, more why they are done the way they are. The declaration of a class member function does not need to define a function as..

Execution failed for task 'app:mergeDebugResources' Crunching Cruncher....png failed

I've added some pictures with the format *.png to my drawable-directory and linked it with the layouts. But every time when I tried to build it, there appears an error "...Crunching Crunsher ...p..

Get Android .apk file VersionName or VersionCode WITHOUT installing apk

How can I get programmatically get the version code or version name of my apk from the AndroidManifest.xml file after downloading it and without installing it. <manifest xmlns:android="http://sche..

Get connection string from App.config

var connection = ConnectionFactory.GetConnection( ConfigurationManager.ConnectionStrings["Test"] .ConnectionString, DataBaseProvider); And this is my App.config: <?xml version="1.0" enc..

How to subtract 2 hours from user's local time?

Can anyone give me a simple JavaScript code block that will allow me to display the local time minus 2 hours?..

String format currency

I have this line @String.Format("{0:C}", @price) in my razor view. I want it to display a dollar sign in front of the price but instead it display a pound sign. How do I achieve this?..

Regex for string not ending with given suffix

I have not been able to find a proper regex to match any string not ending with some condition. For example, I don't want to match anything ending with an a. This matches b ab 1 This doesn't match..

Move to next item using Java 8 foreach loop in stream

I have a problem with the stream of Java 8 foreach attempting to move on next item in loop. I cannot set the command like continue;, only return; works but you will exit from the loop in this case. I ..

'No database provider has been configured for this DbContext' on SignInManager.PasswordSignInAsync

.Net Core 1.0.0 - SDK Preview 2 (x64) .Net Core 1.0.0 - VS "15" Preview 2 (x64) .Net Core 1.0.0 - Runtime (x64) So, we updated an RC1 app to the latest versions above. After many hours of ..

SQL query to check if a name begins and ends with a vowel

I want to query the list of CITY names from the table STATION(id, city, longitude, latitude) which have vowels as both their first and last characters. The result cannot contain duplicates. For this ..

Have a fixed position div that needs to scroll if content overflows

I have actually two issues, but lets resolve the primary issue first as I believe the other is easier to address. I have a fixed position div on the left side of the scroll for a menu. Right side is ..

“Unable to find manifest signing certificate in the certificate store” - even when add new key

I cannot build projects with a strong name key signing - the message in the title always comes up. Yes the project was initially copied over from another machine. However even if I add a new key via ..

Why does the C++ STL not provide any "tree" containers?

Why does the C++ STL not provide any "tree" containers, and what's the best thing to use instead? I want to store a hierarchy of objects as a tree, rather than use a tree as a performance enhancement..

Python - Using regex to find multiple matches and print them out

I need to find content of forms from HTML source file, I did some searching and found very good method to do that, but the problem is that it prints out only first found, how can I loop through it and..

Python: Find a substring in a string and returning the index of the substring

I have: a function: def find_str(s, char) and a string: "Happy Birthday", I essentially want to input "py" and return 3 but I keep getting 2 to return instead. Code: def find_str(s, char): ..

PHP file_get_contents() and setting request headers

With PHP, is it possible to send HTTP headers with file_get_contents() ? I know you can send the user agent from your php.ini file. However, can you also send other information such as HTTP_ACCEPT, H..

Get the data received in a Flask request

I want to be able to get the data sent to my Flask app. I've tried accessing request.data but it is an empty string. How do you access request data? from flask import request @app.route('/', methods..

Getting XML Node text value with Java DOM

I can't fetch text value with Node.getNodeValue(), Node.getFirstChild().getNodeValue() or with Node.getTextContent(). My XML is like <add job="351"> <tag>foobar</tag> <..

How can I pass a list as a command-line argument with argparse?

I am trying to pass a list as an argument to a command line program. Is there an argparse option to pass a list as option? parser.add_argument('-l', '--list', type=list, action=..

What does the 'u' symbol mean in front of string values?

Yes in short i would like to know why am I seeing a u in front of my keys and values. I am rendering a form. The form has check-box for the particular label and one text field for the ip address. I ..

Detecting EOF in C

I am using the following C code to take input from user until EOF occurs, but problem is this code is not working, it terminates after taking first input. Can anyone tell me whats wrong with this code..

How can I render inline JavaScript with Jade / Pug?

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

How to parse XML using shellscript?

I would like to know what would be the best way to parse an XML file using shellscript ? Should one do it by hand ? Does third tiers library exist ? If you already made it if you could let me know..

Insert a new row into DataTable

I have a datatable filled with staff data like.. Staff 1 - Day 1 - Total Staff 1 - Day 2 - Total Staff 1 - Day 3 - Total Staff 2 - Day 1 - Total Staff 2 - Day 2 - Total Staff 2 - Day 3 - Total Staff ..

How can I load storyboard programmatically from class?

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

Force SSL/https using .htaccess and mod_rewrite

How can I force to SSL/https using .htaccess and mod_rewrite page specific in PHP...

How to send post request with x-www-form-urlencoded body

How in java, can I send a request with x-www-form-urlencoded header. I don't understand how to send a body with a key-value, like in the above screenshot. I have tried this code: String urlParamet..

function to return a string in java

I wrote the following function to convert a time in milliseconds to a string of the format mins:seconds. Being a former C programmer I assumed that "ans" would have to be static in order to work prope..

Python logging: use milliseconds in time format

By default logging.Formatter('%(asctime)s') prints with the following format: 2011-06-09 10:54:40,638 where 638 is the millisecond. I need to change the comma to a dot: 2011-06-09 10:54:40.638 T..

Is there a way to use SVG as content in a pseudo element :before or :after

I want to place some SVG images before some selected elements. I am using jQuery but that is irrelevant. I would like to have the :before element to be as: #mydiv:before { content: '<svg.. code h..

How to start a stopped Docker container with a different command?

I would like to start a stopped Docker container with a different command, as the default command crashes - meaning I can't start the container and then use 'docker exec'. Basically I would like to ..

get value from DataTable

I want to get all column value from DataTable and store it to the ListBox. Here is my code If myTableData.Rows.Count > 0 Then For i As Integer = 0 To myTableData.Rows.C..

Extract only right most n letters from a string

How can I extract a substring which is composed of the rightmost six letters from another string? Ex: my string is "PER 343573". Now I want to extract only "343573". How can I do this?..

Plotting multiple time series on the same plot using ggplot()

I am fairly new to R and am attempting to plot two time series lines simultaneously (using different colors, of course) making use of ggplot2. I have 2 data frames. the first one has 'Percent change..

Why Python 3.6.1 throws AttributeError: module 'enum' has no attribute 'IntFlag'?

I just installed Python 3.6.1 for MacOS X When I attempt to run the Console(or run anything with Python3), this error is thrown: AttributeError: module 'enum' has no attribute 'IntFlag' $ /Librar..

How can I make a time delay in Python?

I would like to know how to put a time delay in a Python script...

Pandas: rolling mean by time interval

I'm new to Pandas.... I've got a bunch of polling data; I want to compute a rolling mean to get an estimate for each day based on a three-day window. As I understand from this question, the rolling_* ..

How to increase memory limit for PHP over 2GB?

I have an problem increasing memory limit for PHP as Apache module. If I put following directive in Apache configuration, that work OK: php_value memory_limit 1.99G But over 2GB do not work, it's ..

Get data from php array - AJAX - jQuery

I have a page as below; <head> <script type="text/javascript" src="jquery-1.6.1.js"></script> <script type="text/javascript"> $(document).ready( function() { $('#prev').click(..

How to enable Ad Hoc Distributed Queries

When I run a query with OPENROWSET in SQL Server 2000 it works. But the same query in SQL Server 2008 generates the following error: SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasou..

Disable firefox same origin policy

I'm developing a local research tool that requires me to turn off Firefox's same origin policy (in terms of script access, I don't really care about cross domain requests). More specifically, I want..

How to store printStackTrace into a string

How can I get the e.printStackTrace() and store it into a String variable? I want to use the string generated by e.printStackTrace() later in my program. I'm still new to Java so I'm not too familiar..

Different names of JSON property during serialization and deserialization

Is it possible: to have one field in class, but different names for it during serialization/deserialization in Jackson library? For example, I have class "Coordiantes". class Coordinates{ int red;..

A Parser-blocking, cross-origin script is invoked via document.write - how to circumvent it?

Google Chrome started implementing Blocking the load of cross-origin, parser-blocking scripts inserted via document.write in the main frame on slow networks, which causes the following error: A Pa..

Display HTML snippets in HTML

How can I show HTML snippets on a webpage without needing to replace each < with &lt; and > with &gt;? In other words, is there a tag for don't render HTML until you hit the closing tag..

Javascript to open popup window and disable parent window

I want to open a popup window and disable the parent window. Below is the code that I am using; function popup() { popupWindow = window.open('child_page.html','name','width=200,height=200'); ..

How to apply border radius in IE8 and below IE8 browsers?

I would like to know how to apply border-radius to IE8 and below IE8 browsers. I know that border-radius is a HTML5 feature and IE8 doesn't support it. I found that by using .htc we can achieve this..

How to transfer data from JSP to servlet when submitting HTML form

I have a JSP page with an HTML form: <form action="SERVLET"> <input type="text" name="name"/><br> <input type="text" name="group"/> <input type="text" n..

Difference between PACKETS and FRAMES

Two words commonly used in networking world - Packets and frames. Can anyone please give the detail difference between these two words? Hope it might sounds silly but does it mean as below A packet..

How to get text of an input text box during onKeyPress?

I am trying to get the text in a text box as the user types in it (jsfiddle playground): _x000D_ _x000D_ function edValueKeyPress() {_x000D_ var edValue = document.getElementById("edValue");_x000..

How can I replace a regex substring match in Javascript?

var str = 'asd-0.testing'; var regex = /asd-(\d)\.\w+/; str.replace(regex, 1); That replaces the entire string str with 1. I want it to replace the matched substring instead of the whole string. ..

How to use IntelliJ IDEA to find all unused code?

When I am in a .java file the unused code is usually grayed out or has a green underline saying this code will probably (probably because of some weird JNI/Reflection corner cases) be unused. But I ha..

How do I create a singleton service in Angular 2?

I've read that injecting when bootstrapping should have all children share the same instance, but my main and header components (main app includes header component and router-outlet) are each getting ..

Make anchor link go some pixels above where it's linked to

I'm not sure the best way to ask/search for this question: When you click on an anchor link, it brings you to that section of the page with the linked-to area now at the VERY TOP of the page. I would..

Python IndentationError: unexpected indent

Here is my code ... I am getting indentation error but i don't know why it occurs. -> # loop while d <= end_date: # print d.strftime("%Y%m%d") fecha = d.strftime("%Y%m%d") # set url ..

Setting Camera Parameters in OpenCV/Python

I am using OpenCV (2.4) and Python (2.7.3) with a USB camera from Thorlabs (DC1545M). I am doing some image analysis on a video stream and I would like to be able to change some of the camera paramet..

Getter and Setter of Model object in Angular 4

How can I make getter and setter work in my model class? My goal is to calculate integer value of the selected day when input, containing the date, updated. I was going to do it in setter, but Angula..