Questions Tagged with #Freestanding

A freestanding implementation of C++ is an implementation that can work without an operating system, and has an implementation-defined set of libraries. Commonly found in embedded development environments.

Angular 4 img src is not found

I'm having a problem with sourcing an image with angular 4. It keeps telling me that the image is not found. Folder structure: app_folder/ app_component/ - my_componenet - image_folder/ - ..

Python float to int conversion

Basically, I'm converting a float to an int, but I don't always have the expected value. Here's the code I'm executing: x = 2.51 print("--------- 251.0") y = 251.0 print(y) print(int(y)) print("--..

Launch a shell command with in a python script, wait for the termination and return to the script

I've a python script that has to launch a shell command for every file in a dir: import os files = os.listdir(".") for f in files: os.execlp("myscript", "myscript", f) This works fine for the ..

How to apply font anti-alias effects in CSS?

How can we apply Photoshop-like font anti-aliasing such as crisp, sharp, strong, smooth in CSS? Are these supported by all browsers?..

How do I read a date in Excel format in Python?

How can I convert an Excel date (in a number format) to a proper date in Python?..

How to switch to the new browser window, which opens after click on the button?

I have situation, when click on button opens the new browser window with search results. Is there any way to connect and focus to new opened browser window? And work with it, then return back to or..

document.getElementById(id).focus() is not working for firefox or chrome

When ever I do onchange event, its going inside that function its validating, But focus is not comming I am using document.getElementById('controlid').focus(); I am using Mozilla Firefox and Google C..

cURL not working (Error #77) for SSL connections on CentOS for non-root users

Just recently my server has stopped working for curl requests to https:// addresses for my web server. Having dug around a little it appears that it's a problem with the user the webserver is running..

How do I reference the input of an HTML <textarea> control in codebehind?

I'm using a textarea control to allow the user to input text and then place that text into the body of an e-mail. In the code behind, what is the syntax for referencing the users input? I thought I co..

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'customerService' is defined

I need help fixing this error I get when trying to deploy my web application into tomcat. Why isn't the customerService bean being defined? Am I missing something in my web.xml or do I have to map the..

append multiple values for one key in a dictionary

I am new to python and I have a list of years and values for each year. What I want to do is check if the year already exists in a dictionary and if it does, append the value to that list of values fo..

Kubernetes pod gets recreated when deleted

I have started pods with command $ kubectl run busybox --image=busybox --restart=Never --tty -i --generator=run-pod/v1 Something went wrong, and now I can't delete this Pod. I tried using the meth..

Getting an attribute value in xml element

I have an xml string like this and I want to get attribute value of "name" in a loop for each element. How do I do that? I am using javax.xml.parsers library. <xml> <Item type="ItemHead..

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

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

Pretty-Print JSON in Java

I'm using json-simple and I need to pretty-print JSON data (make it more human readable). I haven't been able to find this functionality within that library. How is this commonly achieved?..

Using lambda expressions for event handlers

I currently have a page which is declared as follows: public partial class MyPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //snip MyButton..

VBA general way for pulling data out of SAP

Does anyone know how to use VBA to pull data from SAP Netweaver? I have a number of daily reports that require exporting data from SAP to Excel and formatting it into a report. I have already written..

Using the rJava package on Win7 64 bit with R

I'm trying to install rJava on a computer with Win 7 64 bit. When I run install.packages("rJava") everything seems to be fine: Installing package(s) into ‘C:/Users/djq/Documents/R/win-library/2...

When is the @JsonProperty property used and what is it used for?

This bean 'State' : public class State { private boolean isSet; @JsonProperty("isSet") public boolean isSet() { return isSet; } @JsonProperty("isSet") public void s..

Java Read Large Text File With 70million line of text

I have a big test file with 70 million lines of text. I have to read the file line by line. I used two different approaches: InputStreamReader isr = new InputStreamReader(new FileInputStream(FilePat..

Typescript: Type X is missing the following properties from type Y length, pop, push, concat, and 26 more. [2740]

I have this Product interface: export interface Product{ code: string; description: string; type: string; } Service with method calling product endpoint: public getProducts(): Observable<P..

How to get the size of a file in MB (Megabytes)?

I have a zip file on a server. How can I check if the file size is larger than 27 MB? File file = new File("U:\intranet_root\intranet\R1112B2.zip"); if (file > 27) { //do something } ..

How to cast Object to boolean?

How can I cast a Java object into a boolean primitive I tried like below but it doesn't work boolean di = new Boolean(someObject).booleanValue(); The constructor Boolean(Object) is undefined ..

How to make a list of n numbers in Python and randomly select any number?

I have taken a count of something and it came out to N. Now I would like to have a list, containing 1 to N numbers in it. Example: N = 5 then, count_list = [1, 2, 3, 4, 5] Also, once I have creat..

Get DOS path instead of Windows path

In a DOS window, how can I get the full DOS name/short name of the directory I am in? For example, if I am in the directory C:\Program Files\Java\jdk1.6.0_22, I want to display it's short name C:\PRO..

get dictionary key by value

How do I get a Dictionary key by value in C#? Dictionary<string, string> types = new Dictionary<string, string>() { {"1", "one"}, {"2", "two"}, {"3", "..

VBA Subscript out of range - error 9

Can somebody help me with this code, I am getting a subscript out of range error: The line after the 'creating the sheets is highlighted in yellow in debugger 'Validation of year If TextBox_Year...

How to get first N elements of a list in C#?

I would like to use Linq to query a bus schedule in my project, so that at any time I can get the next 5 bus arrival times. How can I limit my query to the first 5 results? More generally, how can I ..

AngularJS POST Fails: Response for preflight has invalid HTTP status code 404

I know there are a lot of questions like this, but none I've seen have fixed my issue. I've used at least 3 microframeworks already. All of them fail at doing a simple POST, which should return the da..

How to save final model using keras?

I use KerasClassifier to train the classifier. The code is below: import numpy from pandas import read_csv from keras.models import Sequential from keras.layers import Dense from keras.wrappers.scik..

Dynamic variable names in Bash

I am confused about a bash script. I have the following code: function grep_search() { magic_way_to_define_magic_variable_$1=`ls | tail -1` echo $magic_variable_$1 } I want to be able to c..

How does java do modulus calculations with negative numbers?

Am I doing modulus wrong? Because in Java -13 % 64 is supposed to evaluate to -13 but I get 51...

Responsive table handling in Twitter Bootstrap

When a table's width exceed the span's width, like this page: http://jsfiddle.net/rcHdC/ You will see the table's content is outside of the span. What would be the best method to cater this case? ..

Find the paths between two given nodes?

Say I have nodes connected in the below fashion, how do I arrive at the number of paths that exist between given points, and path details? 1,2 //node 1 and 2 are connected 2,3 2,5 4,2 5,11 11,12 6,7 ..

Draw horizontal rule in React Native

I've tried react-native-hr package - doesn't work for me nor on Android nor on iOS. Following code is also not suitable because it renders three dots at the end <Text numberOfLines={1}}> ..

How to check if a double value has no decimal part

I have a double value which I have to display at my UI. Now the condition is that the decimal value of double = 0 eg. - 14.0 In that case I have to show only 14 on my UI. Also, the max limit for chara..

check if a file is open in Python

In my app, I write to an excel file. After writing, the user is able to view the file by opening it. But if the user forgets to close the file before any further writing, a warning message should appe..

Version of Apache installed on a Debian machine

How can I check which version of Apache is installed on a Debian machine? Is there a command for doing this?..

Sniffing/logging your own Android Bluetooth traffic

I recently bought chinesse device that connects via bluetooth with android phone / tablet. Since there is no application availible for windows / linux I want to create one for personal usage. Usually..

Class JavaLaunchHelper is implemented in both. One of the two will be used. Which one is undefined

Have a simple Google App Engine Web Application Project on Eclipse Kepler on Mac OS X with java version "1.7.0_45" Running into the following : objc[5398]: Class JavaLaunchHelper is implemented in..

Center button under form in bootstrap

i have some problems with Bootstrap. i centered form and button by using span6 offset3 and don't know how to center button under this form right now. i tried with text-align: center but still it's mor..

How to add a boolean datatype column to an existing table in sql?

I have a table called person in my database. I want to add another column to the same table and it's a Boolean datatype column. I have tried following queries but it says syntax error near default. I ..

What does $@ mean in a shell script?

What does a dollar sign followed by an at-sign (@) mean in a shell script? For example: umbrella_corp_options $@ ..

How to debug SSL handshake using cURL?

I would like to troubleshoot per directory authentication with client certificate. I would specially like to find out which acceptable client certificates does server send. How do I debug SSL handsha..

Class vs. static method in JavaScript

I know this will work: function Foo() {}; Foo.prototype.talk = function () { alert('hello~\n'); }; var a = new Foo; a.talk(); // 'hello~\n' But if I want to call Foo.talk() // this will not w..

Laravel Eloquent update just if changes have been made

Is there any way to update a record in Laravel using eloquent models just if a change has been made to that record? I don't want any user requesting the database for no good reason over and over, just..

Convert DateTime to a specified Format

I have this date format yy/MM/dd HH:mm:ss ex: 12/02/21 10:56:09. The problem is, when i try to convert it to different format using this code: CDate("12/02/21 10:56:09").ToString("MMM. dd, yyyy HH:m..

how to get GET and POST variables with JQuery?

How do I simply get GET and POST values with JQuery? What I want to do is something like this: $('#container-1 > ul').tabs().tabs('select', $_GET('selectedTabIndex')); ..

How to get the anchor from the URL using jQuery?

I have a URL that is like: www.example.com/task1/1.3.html#a_1 How can I get the a_1 anchor value using jQuery and store it as a variable?..

How to use the switch statement in R functions?

I would like to use for my function in R the statement switch() to trigger different computation according to the value of the function's argument. For instance, in Matlab you can do that by writing..

How do I convert an integer to binary in JavaScript?

I’d like to see integers, positive or negative, in binary. Rather like this question, but for JavaScript...

How to print all information from an HTTP request to the screen, in PHP

I need some PHP code that does a dump of all the information in an HTTP request, including headers and the contents of any information included in a POST request. Basically, a diagnostic tool that spi..

Best way to parse command-line parameters?

What's the best way to parse command-line parameters in Scala? I personally prefer something lightweight that does not require external jar. Related: How do I parse command line arguments in Java? ..

jQuery: If this HREF contains

Why can't I get this to work?? $("a").each(function() { if ($(this[href$="?"]).length()) { alert("Contains questionmark"); } }); Ps.: This is just at simplifyed example, to make it ..

C++ error: "Array must be initialized with a brace enclosed initializer"

I am getting the following C++ error: array must be initialized with a brace enclosed initializer From this line of C++ int cipher[Array_size][Array_size] = 0; What is the problem here? What do..

How to close a Java Swing application from the code

What is the proper way to terminate a Swing application from the code, and what are the pitfalls? I'd tried to close my application automatically after a timer fires. But just calling dispose() on th..

How to convert a file into a dictionary?

I have a file comprising two columns, i.e., 1 a 2 b 3 c I wish to read this file to a dictionary such that column 1 is the key and column 2 is the value, i.e., d = {1:'a', 2:'b', 3:'c'} The f..

PowerShell: how to grep command output?

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

How can I convert JSON to a HashMap using Gson?

I'm requesting data from a server which returns data in the JSON format. Casting a HashMap into JSON when making the request wasn't hard at all but the other way seems to be a little tricky. The JSON ..

display html page with node.js

This is my first time with node.js. I get it to display the index.html, but it doesn't display the images on the site or anything else, it ONLY shows the basic html stuff. Here's how I set it up. Ther..

command to remove row from a data frame

Possible Duplicate: How to delete a row in R I can't figure out how to simply remove row (n) from a dataframe in R. R's documentation and intro manual are so horribly written, they are virt..

Create Map in Java

I'd like to create a map that contains entries consisting of (int, Point2D) How can I do this in Java? I tried the following unsuccessfully. HashMap hm = new HashMap(); hm.put(1, new Point2D.Doubl..

Why aren't variable-length arrays part of the C++ standard?

I haven't used C very much in the last few years. When I read this question today I came across some C syntax which I wasn't familiar with. Apparently in C99 the following syntax is valid: void foo(..

J2ME/Android/BlackBerry - driving directions, route between two locations

On Android 1.0 there was a com.google.googlenav namespace for driving directions: Route - Improved Google Driving Directions But in newer SDK it was removed by some reason... Android: DrivingDirection..

Schema validation failed with the following errors: Data path ".builders['app-shell']" should have required property 'class'

Schema validation failed with the following errors: Data path ".builders['app-shell']" should have required property 'class'. Schema validation failed with the following errors: Data path ".build..

Best TCP port number range for internal applications

I work in a place where each of our internal applications runs on an individual Tomcat instance and uses a specific TCP port. What would be the best IANA port range to use for these apps in order to a..

How to use placeholder as default value in select2 framework

To get the chosen value of a select2 I'm using: var x = $("#select").select2('data'); var select_choice = x.text The problem is this throws an error if not value has been selected and I was wonderi..

jQuery ajax error function

I have an ajax call passing data to a page which then returns a value. I have retrieved the successful call from the page but i have coded it so that it raises an error in the asp. How do i retrieve ..

How to rename a pane in tmux?

How to rename a pane in tmux ?..

Unfinished Stubbing Detected in Mockito

I am getting following exception while running the tests. I am using Mockito for mocking. The hints mentioned by Mockito library are not helping. org.mockito.exceptions.misusing.UnfinishedStubbingExc..

Why cannot change checkbox color whatever I do?

I try to style checkbox background color, but it won't change whatever I do. I am using firefox 29 latest. Is there some rule changes in css or may be in the browser? CSS: input[type="checkbox"] { ..

Android ListView headers

I have ListView that has some kind of events on it. Events are sorted by day, and I would like to have header with date on it for every day, and then events listen below. Here is how I populate that ..

What is the proper way to display the full InnerException?

What is the proper way to show my full InnerException. I found that some of my InnerExceptions has another InnerException and that go's on pretty deep. Will InnerException.ToString() do the job for ..

Right query to get the current number of connections in a PostgreSQL DB

Which of the following two is more accurate? select numbackends from pg_stat_database; select count(*) from pg_stat_activity; ..

Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $

What is this error ? How can I fix this? My app is running but can't load data. And this is my Error: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $ This is my frag..

Add timer to a Windows Forms application

I want to add a timer rather than a countdown which automatically starts when the form loads. Starting time should be 45 minutes and once it ends, i.e. on reaching 0 minutes, the form should terminat..

Get value (String) of ArrayList<ArrayList<String>>(); in Java

I know it's simple question, but in ArrayList<ArrayList<String>> collection; ArrayList<String> listOfSomething; collection= new ArrayList<ArrayList<String>>(); listOfSom..

extracting days from a numpy.timedelta64 value

I am using pandas/python and I have two date time series s1 and s2, that have been generated using the 'to_datetime' function on a field of the df containing dates/times. When I subtract s1 from s2 ..

Convert datetime to Unix timestamp and convert it back in python

I have dt = datetime(2013,9,1,11), and I would like to get a Unix timestamp of this datetime object. When I do (dt - datetime(1970,1,1)).total_seconds() I got the timestamp 1378033200. When converti..

Reading and writing to serial port in C on Linux

I'm trying to send/receive data over an USB Port using FTDI, so I need to handle serial communication using C/C++. I'm working on Linux (Ubuntu). Basically, I am connected to a device which is listen..

Using sendmail from bash script for multiple recipients

I'm running a bash script in cron to send mail to multiple recipients when a certain condition is met. I've coded the variables like this: subject="Subject" from="[email protected]" recipients="user1..

How can I get a value from a map?

I have a map named valueMap as follows: typedef std::map<std::string, std::string>MAP; MAP valueMap; ... // Entering data. Then I am passing this map to a function by reference: void functio..

Capture key press (or keydown) event on DIV element

How do you trap the keypress or key down event on a DIV element (using jQuery)? What is required to give the DIV element focus?..

Why is ZoneOffset.UTC != ZoneId.of("UTC")?

Why does ZonedDateTime now = ZonedDateTime.now(); System.out.println(now.withZoneSameInstant(ZoneOffset.UTC) .equals(now.withZoneSameInstant(ZoneId.of("UTC")))); print out false? I would e..

Format timedelta to string

I'm having trouble formatting a datetime.timedelta object. Here's what I'm trying to do: I have a list of objects and one of the members of the class of the object is a timedelta object that shows..

Gather multiple sets of columns

I have data from an online survey where respondents go through a loop of questions 1-3 times. The survey software (Qualtrics) records this data in multiple columns—that is, Q3.2 in the survey will h..

Ajax call Into MVC Controller- Url Issue

I've looked at the previously-posted jQuery/MVC questions and haven't found a workable answer. I have the following JavaScript code: $.ajax({ type: "POST", url: '@Url.Action("Search","Controller")..

Programmatically set the initial view controller using Storyboards

How do I programmatically set the InitialViewController for a Storyboard? I want to open my storyboard to a different view depending on some condition which may vary from launch to launch...

Value cannot be null. Parameter name: source

This is probably the biggest waste of time problem I have spent hours on solving for a long time. var db = new hublisherEntities(); establishment_brands est = new establishment_brands(); est.brand_i..

Where to download visual studio express 2005?

I'm trying to find download link for VS express 2005 but no luck. I need this version, not 2008...

When do I use the PHP constant "PHP_EOL"?

When is it a good idea to use PHP_EOL? I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues?..

Convert a Pandas DataFrame to a dictionary

I have a DataFrame with four columns. I want to convert this DataFrame to a python dictionary. I want the elements of first column be keys and the elements of other columns in same row be values. Da..

Is there something like Codecademy for Java

Does anyone know of a site like Codecademy that focuses on teaching programming with Java? (Codeacademy.com uses guided lessons in JavaScript, HTML and CSS, and Python)..

md-table - How to update the column width

I have started using the md-table for my project, and I want fixed column width. Currently all columns width are divided into equal size. Where can I get the documentation of data table dimensions? ..

What is an idempotent operation?

What is an idempotent operation?..

Convert file path to a file URI?

Does the .NET Framework have any methods for converting a path (e.g. "C:\whatever.txt") into a file URI (e.g. "file:///C:/whatever.txt")? The System.Uri class has the reverse (from a file URI to abso..

How can I execute a PHP function in a form action?

I am trying to run a function from a PHP script in the form action. My code: <?php require_once ( 'username.php' ); echo ' <form name="form1" method="post" action="user..

What is the actual use of Class.forName("oracle.jdbc.driver.OracleDriver") while connecting to a database?

What will the command Class.forName("oracle.jdbc.driver.OracleDriver") exactly do while connecting to a Oracle database? Is there an alternate way of doing the same thing?..

How to check if a database exists in SQL Server?

What is the ideal way to check if a database exists on a SQL Server using TSQL? It seems multiple approaches to implement this...

Error: Uncaught (in promise): Error: Cannot match any routes Angular 2

##Error I have implemented nested routing in my app. when application loads its shows login screen after login its redirects to admin page where further child routes exist like user, product, api etc...

Keras, How to get the output of each layer?

I have trained a binary classification model with CNN, and here is my code model = Sequential() model.add(Convolution2D(nb_filters, kernel_size[0], kernel_size[1], border_mode..

Difference between left join and right join in SQL Server

I know about joins in SQL Server. For example. There are two tables Table1, Table2. Their table structures are the following. create table Table1 (id int, Name varchar (10)) create table Table2 (..

Linking a UNC / Network drive on an html page

Just a basic html link question. I have an intranet setup, and I need to link to some network drives. They are located on drives such as \server_drive\blahblah\doc.docx Using file:// does not work..

How to define an empty object in PHP

with a new array I do this: $aVal = array(); $aVal[key1][var1] = "something"; $aVal[key1][var2] = "something else"; Is there a similar syntax for an object (object)$oVal = ""; $oVal->key1->..

How can I hide a checkbox in html?

I want to hide a checkbox. But also want that, when I click on label associated with corresponding checkbox, the checkbox should get checked/unchecked. I also want that the checkbox MUST be able to b..

DropdownList DataSource

Hi everyone I have problem about dropdown list. I am using dropdown list with datasource. How can I get that value which I selected ? // I need a if statement here because my programme doesn't know ..

Jquery split function

I have a ajax function as below <script type="text/javascript"> $(document).ready(function () { var timer, delay =600000; //5 minutes counted in milliseconds. timer = setInterval(function(){ ..

Hadoop: «ERROR : JAVA_HOME is not set»

I'm trying to install Hadoop on Ubuntu 11.10. I set the JAVA_HOME variable in the file conf/hadoop-env.sh to: # export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk and then I execute these commands (..

How to prevent ENTER keypress to submit a web form?

How do you prevent an ENTER key press from submitting a form in a web-based application?..

Excel VBA to Export Selected Sheets to PDF

I'm using the following code to export selected sheets from Excel 2010 to a single pdf file... ThisWorkbook.Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select ActiveSheet.ExportAsFixedFormat _ ..

Send inline image in email

Having an issue sending an image via email as an embedded image in the body. The image file shows as an attachment which is ok but the inline image portion just shows as a red x. Here is what I have ..

Execute PHP function with onclick

I am searching for a simple solution to call a PHP function only when a-tag is clicked. PHP: function removeday() { ... } HTML: <a href="" onclick="removeday()" class="deletebtn">Delete<..

How do I run Redis on Windows?

How do I run Redis on Windows? The Redis download page just seems to offer *nix options. Can I run Redis natively on Windows?..

How to copy a file to a remote server in Python using SCP or SSH?

I have a text file on my local machine that is generated by a daily Python script run in cron. I would like to add a bit of code to have that file sent securely to my server over SSH...

Change drive in git bash for windows

I was trying to navigate to my drive location E:/Study/Codes in git bash in windows. In command prompt in order to change drive I use E: It returns an error in git bash. bash: E:: command not fou..

How do I turn off Unicode in a VC++ project?

I have a VC++ project in Visual Studio 2008. It is defining the symbols for unicode on the compiler command line (/D "_UNICODE" /D "UNICODE"), even though I do not have this symbol turned on in the..

Create a user with all privileges in Oracle

I was googling about how to create a user and grant all privileges to him. I found these two methods : The first method : create user userName identified by password; grant connect to userName; gra..

SQL Server: how to select records with specific date from datetime column

I am pretty new to SQL and hope someone here can help me with this: I have a table with one column dateX formatted as datetime and containing standard dates. How can I select all records from this ..

How do I move files in node.js?

How can I move files (like mv command shell) on node.js? Is there any method for that or should I read a file, write to a new file and remove older file?..

Convert list into a pandas data frame

I am trying to convert my output into a pandas data frame and I am struggling. I have this list my_list = [1,2,3,4,5,6,7,8,9] I want to create a pandas data frame that would have 3 columns and thre..

How to replace blank (null ) values with 0 for all records?

MS Access: How to replace blank (null ) values with 0 for all records? I guess it has to be done using SQL. I can use Find and Replace to replace 0 with blank, but not the other way around (won't "fi..

How to print the value of a Tensor object in TensorFlow?

I have been using the introductory example of matrix multiplication in TensorFlow. matrix1 = tf.constant([[3., 3.]]) matrix2 = tf.constant([[2.],[2.]]) product = tf.matmul(matrix1, matrix2) When I ..

Can I stretch text using CSS?

Can I stretch text in CSS? I don't want the font to be bigger, because that makes it appear bolder than smaller text beside it. I just want to stretch the text vertically so it's kind of deformed. Th..

JavaScript property access: dot notation vs. brackets?

Other than the obvious fact that the first form could use a variable and not just a string literal, is there any reason to use one over the other, and if so under which cases? In code: // Given: var..

Change directory in PowerShell

My PowerShell prompt's currently pointed to my C drive (PS C:\>). How do I change directory to a folder on my Q (PS Q:\>) drive? The folder name on my Q drive is "My Test Folder"...

"Unresolved inclusion" error with Eclipse CDT for C standard library headers

I set up CDT for eclipse and wrote a simple hello world C program: #include <stdio.h> int main(void){ puts("Hello, world."); return 0; } The program builds and runs correctly..

Android camera intent

I need to push an intent to default camera application to make it take a photo, save it and return an URI. Is there any way to do this?..

Switch statement multiple cases in JavaScript

I need multiple cases in switch statement in JavaScript, Something like: switch (varName) { case "afshin", "saeed", "larry": alert('Hey'); break; def..

How can the Euclidean distance be calculated with NumPy?

I have two points in 3D: (xa, ya, za) (xb, yb, zb) And I want to calculate the distance: dist = sqrt((xa-xb)^2 + (ya-yb)^2 + (za-zb)^2) What's the best way to do this with NumPy, or with Python in g..

How to install Python MySQLdb module using pip?

How can I install the MySQLdb module for Python using pip?..

Passing parameter using onclick or a click binding with KnockoutJS

I have this function: function make(place) { place.innerHTML = "somthing" } I used to do this with plain JavaScript and html: <button onclick="make(this.parent)">click me</button> ..

How to create and show common dialog (Error, Warning, Confirmation) in JavaFX 2.0?

How do I create and show common dialogs (Error, Warning, Confirmation) in JavaFX 2.0? I can't find any "standard" classes like Dialog, DialogBox, Message or something...

C++ Fatal Error LNK1120: 1 unresolved externals

What is causing this error? I google'd it and first few solutions I found were that something was wrong with the library and the main function but both seem to be fine in my problem, I even retyped bo..

How to get DATE from DATETIME Column in SQL?

I have 3 columns in Table TransactionMaster in sql server 1) transaction_amount 2) Card_No 3) transaction_date-- datetime datatype So, I want to fetch SUM of transaction_amount where Card_No=' 12..

Android. WebView and loadData

It's possible to use following method for content's setting of a web-view loadData(String data, String mimeType, String encoding) How to handle the problem with unknown encoding of html data?! Is th..

How to do if-else in Thymeleaf?

What's the best way to do a simple if-else in Thymeleaf? I want to achieve in Thymeleaf the same effect as <c:choose> <c:when test="${potentially_complex_expression}"> <h2>H..

LINQ Join with Multiple Conditions in On Clause

I'm trying to implement a query in LINQ that uses a left outer join with multiple conditions in the ON clause. I'll use the example of the following two tables Project (ProjectID, ProjectName) and Ta..

Replace one character with another in Bash

I need to be able to do is replace a space () with a dot (.) in a string in bash. I think this would be pretty simple, but I'm new so I can't figure out how to modify a similar example for this use...

Why are unnamed namespaces used and what are their benefits?

I just joined a new C++ software project and I'm trying to understand the design. The project makes frequent use of unnamed namespaces. For example, something like this may occur in a class definiti..

How to put a new line into a wpf TextBlock control?

I'm fetching text from an XML file, and I'd like to insert some new lines that are interpreted by the textblock render as new lines. I've tried: <data>Foo bar baz \n baz bar</data> But..

How to convert Blob to File in JavaScript

I need to upload an image to NodeJS server to some directory. I am using connect-busboy node module for that. I had the dataURL of the image that I converted to blob using the following code: dataUR..

change PATH permanently on Ubuntu

I'd like to add to PATH the value ":/home/me/play/" for the installation of Play! framework. so I ran this command: PATH=$PATH:/home/me/play it worked. but in the next time I checked, the value c..

Store boolean value in SQLite

What is the type for a BOOL value in SQLite? I want to store in my table TRUE/FALSE values. I could create a column of INTEGER and store in it values 0 or 1, but it won't be the best way to implement ..

GROUP BY to combine/concat a column

I have a table as follow: ID User Activity PageURL 1 Me act1 ab 2 Me act1 cd 3 You act2 xy 4 You act2 st I want to group by User and Activi..

addEventListener not working in IE8

I have created a checkbox dynamically. I have used addEventListener to call a function on click of the checkbox, which works in Google Chrome and Firefox but doesn't work in Internet Explorer 8. This..

Broken references in Virtualenvs

I recently installed a bunch of dotfiles on my Mac along with some other applications (I changed to iTerm instead of Terminal, and Sublime as my default text editor) but ever since, all my virtual env..

Converting string format to datetime in mm/dd/yyyy

I have to convert string in mm/dd/yyyy format to datetime variable but it should remain in mm/dd/yyyy format. string strDate = DateTime.Now.ToString("MM/dd/yyyy"); Please help...

Eclipse error, "The selection cannot be launched, and there are no recent launches"

I have just started Android programming so downloaded Eclipse and got started. Created my first project following tutorial from here: http://developer.android.com/training/basics/firstapp/creating-pr..

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

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

Change navbar color in Twitter Bootstrap

How would I go about modifying the CSS to change the color of the navbar in Twitter Bootstrap?..

Disabling of EditText in Android

In my application, I have an EditText that the user only has Read access not Write access. In code I set android:enabled="false". Although the background of EditText changed to dark, when I click o..

How to set Google Chrome in WebDriver

I am trying to set Chrome as my browser for testing with Web-Driver and set the chromedriver.exe file properly but I am still getting the following error: org.openqa.selenium.WebDriverException: The..

MySQL error: key specification without a key length

I have a table with a primary key that is a varchar(255). Some cases have arisen where 255 characters isn't enough. I tried changing the field to a text, but I get the following error: BLOB/TEXT colu..

how to get list of port which are in use on the server

How to get list of ports which are in use on the server?..

.do extension in web pages?

I want to know what is .do extension in web pages. Is it a standard extension, or, if it's not, can we change the extension (like client-login.php to client-login.do and still run as PHP)? Thanks...

Dropping Unique constraint from MySQL table

How can I drop the "Unique Key Constraint" on a column of a MySQL table using phpMyAdmin?..

Google OAuth 2 authorization - Error: redirect_uri_mismatch

On the website https://code.google.com/apis/console I have registered my application, set up generated Client ID: and Client Secret to my app and tried to log in with Google. Unfortunately, I got the ..

How do you list volumes in docker containers?

When using docker images from registries, I often need to see the volumes created by the image's containers. Note: I'm using docker version 1.3.2 on Red Hat 7. Example The postgres official image f..

"Large data" workflows using pandas

I have tried to puzzle out an answer to this question for many months while learning pandas. I use SAS for my day-to-day work and it is great for it's out-of-core support. However, SAS is horrible a..

The AWS Access Key Id does not exist in our records

I created a new Access Key and configured that in the AWS CLI with aws configure. It created the .ini file in ~/.aws/config. When I run aws s3 ls it gives: A client error (InvalidAccessKeyId) occu..

What is the fastest way to compare two sets in Java?

I am trying to optimize a piece of code which compares elements of list. Eg. public void compare(Set<Record> firstSet, Set<Record> secondSet){ for(Record firstRecord : firstSet){ ..

Why do we need to use flatMap?

I am starting to use RxJS and I don't understand why in this example we need to use a function like flatMap or concatAll; where is the array of arrays here? var requestStream = Rx.Observable.just('ht..

How to add fixed button to the bottom right of page

I'm having some trouble adding a fixed button on the bottom of my webpage. Been testing out different numbers with the pixels, but the button hasn't been showing underneath the page on the right. HTM..

How to display binary data as image - extjs 4

Here is the binary for a valid .JPEG image. http://pastebin.ca/raw/2314500 I have tried to use Python to save this binary data into an image. How can I convert this data to a viewable .JPEG image ..

How to set a variable inside a loop for /F

I made this code dir /B /S %RepToRead% > %FileName% for /F "tokens=*" %%a in ('type %FileName%') do ( set z=%%a echo %z% echo %%a ) echo %%a is working fine but echo %z% returns "ec..

FormData.append("key", "value") is not working

Can you tell me whats wrong with this: var formdata = new FormData(); formdata.append("key", "value"); console.log(formdata); My output looks like this, I cant find my "key" - "value" pair FormDat..

Filter element based on .data() key/value

Say I have 4 div elements with class .navlink, which, when clicked, use .data() to set a key called 'selected', to a value of true: $('.navlink')click(function() { $(this).data('selected', true); }) ..

Web scraping with Python

I'd like to grab daily sunrise/sunset times from a web site. Is it possible to scrape web content with Python? what are the modules used? Is there any tutorial available?..

Override default Spring-Boot application.properties settings in Junit Test

I have a Spring-Boot application where the default properties are set in an application.properties file in the classpath (src/main/resources/application.properties). I would like to override some def..

Access all Environment properties as a Map or Properties object

I am using annotations to configure my spring environment like this: @Configuration ... @PropertySource("classpath:/config/default.properties") ... public class GeneralApplicationConfiguration implem..

How to get process details from its pid

I have maintained a list of pids of processes currently running on my system(Linux) from this now it would be great if i can get the process details from this pid i have come over syscall.Getrusage()..

How to add a downloaded .box file to Vagrant?

How do I add a downloaded .box file to Vagrant's list of available boxes? The .box file is located on an external drive. I tried running vagrant box add my-box d:/path/to/box, but Vagrant interprets ..

Indent starting from the second line of a paragraph with CSS

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

How can a Jenkins user authentication details be "passed" to a script which uses Jenkins API to create jobs?

I have a script that delete and re-create jobs through curl HTTP-calls and I want to get rid of any hard-coded "username:password". E.g. curl -X POST $url --user username:password Considerations: J..

Encoding conversion in java

Is there any free java library which I can use to convert string in one encoding to other encoding, something like iconv? I'm using Java version 1.3...

Java - No enclosing instance of type Foo is accessible

I have the following code: class Hello { class Thing { public int size; Thing() { size = 0; } } public static void main(String[] args) { Thin..

How to convert HH:mm:ss.SSS to milliseconds?

I have a String 00:01:30.500 which is equivalent to 90500 milliseconds. I tried using SimpleDateFormat which give milliseconds including current date. I just need that String representation to millise..

Using JQuery to open a popup window and print

A while back I created a lightbox plugin using jQuery that would load a url specified in a link into a lightbox. The code is really simple: $('.readmore').each(function(i){ $(this).popup(); }); ..

PHP case-insensitive in_array function

Is it possible to do case-insensitive comparison when using the in_array function? So with a source array like this: $a= array( 'one', 'two', 'three', 'four' ); The following lookups would all..

How to round an image with Glide library?

So, anybody know how to display an image with rounded corners with Glide? I am loading an image with Glide, but I don't know how to pass rounded params to this library. I need display image like foll..

What is object serialization?

What is meant by "object serialization"? Can you please explain it with some examples? ..

TypeScript typed array usage

I have a TypeScript class definition that starts like this; module Entities { export class Person { private _name: string; private _possessions: Thing[]; privat..

C++ where to initialize static const

I have a class class foo { public: foo(); foo( int ); private: static const string s; }; Where is the best place to initialize the string s in the source file?..

How to set a cookie to expire in 1 hour in Javascript?

How to set this cookie to expire in one hour from the current time: document.cookie = 'username=' + value; + 'expires=' + WHAT GOES HERE?; + 'path = /'; ..

YouTube embedded video: set different thumbnail

I want to embed a video from YouTube that is not mine (so I can not change it at YouTube). The video has a thumbnail that is not representative for the video (I refer to the initial still that is show..

R: `which` statement with multiple conditions

I have a matrix which consists of 13 columns (called PCs). I want to make a new matrix including only the rows that have a value between 4 and 8 (called EUR). I tried using this statement: EUR <- ..

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

How do I pipe or redirect the output of curl -v?

For some reason the output always gets printed to the terminal, regardless of whether I redirect it via 2> or > or |. Is there a way to get around this? Why is this happening?..

Compile/run assembler in Linux?

I'm fairly new to Linux (Ubuntu 10.04) and a total novice to assembler. I was following some tutorials and I couldn't find anything specific to Linux. So, my question is, what is a good package to com..

Invoking modal window in AngularJS Bootstrap UI using JavaScript

Using the example mentioned here, how can I invoke the modal window using JavaScript instead of clicking a button? I am new to AngularJS and tried searching the documentation here and here without lu..

Why I'm getting 'Non-static method should not be called statically' when invoking a method in a Eloquent model?

Im trying to load my model in my controller and tried this: return Post::getAll(); got the error Non-static method Post::getAll() should not be called statically, assuming $this from incompatible c..

UILabel is not auto-shrinking text to fit label size

I have this strange issue, and im dealing with it for more than 8 hours now.. Depending on situation i have to calculate UILabels size dynamically, e.g my UIViewController receives an event and i ch..

Picasso v/s Imageloader v/s Fresco vs Glide

Findings: Difference between Picasso v/s ImageLoader here ... Info about the library GLIDE here ... Now recently Facebook released new image library called Fresco Questions: What is the differ..

Error in Chrome only: XMLHttpRequest cannot load file URL No 'Access-Control-Allow-Origin' header is present on the requested resource

I am following a book example hence the code is very simple. This is the code: jQuery.get("ajax_search_results.php", { s:search_query }, write_results_to_page, "html"); And t..

Mongoimport of json file

I have a json file consisting of about 2000 records. Each record which will correspond to a document in the mongo database is formatted as follows: {jobID:"2597401", account:"XXXXX", user:"YYYYY", p..

PHP errors NOT being displayed in the browser [Ubuntu 10.10]

I'm new to PHP and the whole LAMP stack but I've managed to get it up and running on my Ubuntu 10.10 system. Everything seems to be working with the exception of error reposting in the browser which I..

How can I hide/show a div when a button is clicked?

I have a div that contains a register wizard, and I need hide/show this div when a button is clicked. How can I do this? Below I show you the code. Thanks :) <div id="wizard" class="swMain">..

How do you create a Marker with a custom icon for google maps API v3?

I've been reading https://developers.google.com/maps/documentation/javascript/overlays for a while now and I can't seem to get a custom icon for my map working. Here is my javascript: var simplerweb..

Override console.log(); for production

I'm fairly new to Javascript development so this might be a real newbie question. I've got a sencha-touch application riddled with console.log(); for debugging purposes. I've got chirpy doing all of..

Python Hexadecimal

How to convert decimal to hex in the following format (at least two digits, zero-padded, without an 0x prefix)? Input: 255 Output:ff Input: 2 Output: 02 I tried hex(int)[2:] but it seems ..