Questions Tagged with #Smd

Why does C++ code for testing the Collatz conjecture run faster than hand-written assembly?

I wrote these two solutions for Project Euler Q14, in assembly and in C++. They implement identical brute force approach for testing the Collatz conjecture. The assembly solution was assembled with: n..

failed to find target with hash string android-23

When trying to build OpenStreetMapView from git://github.com/osmdroid/osmdroid, I get this error: failed to find target with hash string android-23: D:\Users\myusername\AppData\Local\Android How ca..

How do I import material design library to Android Studio?

I want to import this library to my project in Android Studio v1.0.0 rc2: https://github.com/navasmdc/MaterialDesignLibrary But there is a problem. When I add this library as a module, this error ap..

XAMPP Port 80 in use by "Unable to open process" with PID 4

XAMPP won't work it says Port 80 in use by "Unable to open process" with PID 4! 6:32:24 PM [Apache] Apache WILL NOT start without the configured ports free! 6:32:24 PM [Apache] You need to u..

JDBC ResultSet: I need a getDateTime, but there is only getDate and getTimeStamp

I would like to get the DATETIME column from an Oracle DB Table with JDBC. Here is my code: int columnType = rsmd.getColumnType(i); if(columnType == Types.DATE) { Date aDate = rs.getDate(i); ..

Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down?

I've been reading the other posts on tracking down the reasons for getting a SIGSEGV in an Android app. I plan to scour my app for possible NullPointers related to Canvas use, but my SIGSEGV barfs up ..

CSS: Responsive way to center a fluid div (without px width) while limiting the maximum width?

I've seen a million questions about how to center a block element and there seem to be a couple popular ways to do it, but they all rely on fixed pixels widths. Then either margin:0 auto or with absol..

How to properly use jsPDF library

I want to convert some of my divs into PDF and I've tried jsPDF library but with no success. It seems I can't understand what I need to import to make the library work. I've been through the examples ..

How to read a CSV file from a URL with Python?

when I do curl to a API call link http://example.com/passkey=wedsmdjsjmdd curl 'http://example.com/passkey=wedsmdjsjmdd' I get the employee output data on a csv file format, like: "Steve","421","0..

Writing a large resultset to an Excel file using POI

This is sort of inline w/ Writing a large ResultSet to a File but the file in question is an Excel file. I'm using the Apache POI library to write an Excel file with a large data set retrieved from a..

Most efficient conversion of ResultSet to JSON?

The following code converts a ResultSet to a JSON string using JSONArray and JSONObject. import org.json.JSONArray; import org.json.JSONObject; import org.json.JSONException; import java.sql.SQLExce..

Gson: How to exclude specific fields from Serialization without annotations

I'm trying to learn Gson and I'm struggling with field exclusion. Here are my classes public class Student { private Long id; private String firstName = "Ph..

Python base64 data decode

I have the following piece of base64 encoded data, and I want to use python base64 module to extract information from it. It seems that module does not work. Can anyone tell me how? Q5YACgAAAABDlgA..

Impact of Xcode build options "Enable bitcode" Yes/No

Yesterday I recognized a ton of warnings regarding the parse.com library: URGENT: all bitcode will be dropped because '[path]/Parse.framework/Parse(PFAnalytics.o)' was built without bitcode. You ..

random.seed(): What does it do?

I am a bit confused on what random.seed() does in Python. For example, why does the below trials do what they do (consistently)? >>> import random >>> random.seed(9001) >>>..

Change default text in input type="file"?

I want to change default text on button that is "Choose File" when we use input="file". How can I do this? Also as you can see in image button is on left side of text. How can I put it on right sid..

How to get the instance id from within an ec2 instance?

How can I find out the instance id of an ec2 instance from within the ec2 instance?..

How to escape "&" in XML?

I write <string name="magazine">Newspaper & Magazines</string> in strings.xml But the Compiler says: The entity name must immediately follow the '&' in the entity refere..

What are the differences between Visual Studio Code and Visual Studio?

Microsoft recently released Visual Studio Code and I am a little confused about its usage, since Visual Studio has lot of similarities functionally with it. ..

How do I rename a local Git branch?

I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories. How can I rename a local branch which hasn't been pushed to a remote branch? ..

Iterate over Object Literal Values

I have a standard jQuery plugin set up that creates default settings at the top: jQuery.fn.myPlugin = function(options) { var defaults = { starts: "0px,0px", speed: 250, ... ..

What is the optimal algorithm for the game 2048?

I have recently stumbled upon the game 2048. You merge similar tiles by moving them in any of the four directions to make "bigger" tiles. After each move, a new tile appears at random empty position w..

How do I handle ImeOptions' done button click?

I am having an EditText where I am setting the following property so that I can display the done button on the keyboard when user click on the EditText. editText.setImeOptions(EditorInfo.IME_ACTION_D..

Show/Hide Multiple Divs with Jquery

I want to use some buttons to show/hide multiple divs using jquery. The page will initially show all divs. The idea then is that there will be a button to reset (show all) and then separate buttons t..

Difference between INNER JOIN and LEFT SEMI JOIN

What is the difference between an INNER JOIN and LEFT SEMI JOIN? In the scenario below, why am I getting two different results? The INNER JOIN result set is a lot larger. Can someone explain? I am..

'foo' was not declared in this scope c++

I'm just learning c++ (first day looking at it since I took a 1 week summer camp years ago) I was converting a program I'm working on in Java to C++: #ifndef ADD_H #define ADD_H #define _USE_MATH_DE..

How can I completely remove TFS Bindings

I have a solution that contains a good deal of projects, I would like to remove the source control bindings completely, how can I do this? Update: What I really want to do is move one solution and ..

Plot two histograms on single chart with matplotlib

I created a histogram plot using data from a file and no problem. Now I wanted to superpose data from another file in the same histogram, so I do something like this n,bins,patchs = ax.hist(mydata1,1..

byte array to pdf

I am trying to convert content of a file stored in a sql column to a pdf. I use the following piece of code: byte[] bytes; BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStr..

How do I get my Python program to sleep for 50 milliseconds?

How do I get my Python program to sleep for 50 milliseconds?..

Laravel: PDOException: could not find driver

I am developing a website on a server I only have access to MySQL and FTP, so all commands I run are through the b374k php shell . I am experiencing a Laravel problem with SQL driver. I tried switchin..

Using a SELECT statement within a WHERE clause

SELECT * FROM ScoresTable WHERE Score = (SELECT MAX(Score) FROM ScoresTable AS st WHERE st.Date = ScoresTable.Date) Is there a name to describe using a SELECT statement within a WHERE clause? Is ..

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

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

getting "No column was specified for column 2 of 'd'" in sql server cte?

I have this query, but its not working as it should, with c as (select month(bookingdate) as duration, count(*) as totalbookings from entbo..

Input type "number" won't resize

Why won't my input resize when I change the type to type="number" but it works with type="text"? EXAMPLE Email: <input type="text" name="email" size="10"><br/> number: <input ty..

Add element to a JSON file?

I am trying to add an element to a json file in python but I am not able to do it. This is what I tried untill now (with some variation which I deleted): import json data = [ { 'a':'A', 'b':(2, 4),..

In which case do you use the JPA @JoinTable annotation?

In which case do you use the JPA @JoinTable annotation?..

How to fade changing background image

I want to fade the images when I do this code: $("#large-img").css('background-image', 'url('+$img+')'); I've tried putting fade in so many places. Thanks..

What is the preferred syntax for initializing a dict: curly brace literals {} or the dict() function?

I'm putting in some effort to learn Python, and I am paying close attention to common coding standards. This may seem like a pointlessly nit-picky question, but I am trying to focus on best-practices..

Django request get parameters

In a Django request I have the following: POST:<QueryDict: {u'section': [u'39'], u'MAINS': [u'137']}> How do I get the values of section and MAINS? if request.method == 'GET': qd = reque..

Task<> does not contain a definition for 'GetAwaiter'

Client iGame Channel = new ChannelFactory<iGame> ( new BasicHttpBinding ( BasicHttpSecurityMode . None ) , new EndpointAddress ( new Uri ( "http://localhost:58597/Game.svc" ) ) ) . CreateChanne..

What is CDATA in HTML?

What is the use of CDATA inside JavaScript tags and HTML? <script type="text/javascript"> // <![CDATA[ // ]]> </script> ..

Bash syntax error: unexpected end of file

Forgive me for this is a very simple script in Bash. Here's the code: #!/bin/bash # june 2011 if [ $# -lt 3 -o $# -gt 3 ]; then echo "Error... Usage: $0 host database username" exit 0 fi aft..

Convert Uppercase Letter to Lowercase and First Uppercase in Sentence using CSS

How to convert UPPERCASE letter to lowercase and first letter Uppercase for each sentences like below only by using CSS? From: THIS IS AN EXAMPLE SENTENCE. To: This is an example sentence. Update:..

Find closing HTML tag in Sublime Text

I have a very long and very nested HTML document, where I need to quickly find the closing tag. How can I do this?..

What methods of ‘clearfix’ can I use?

I have the age-old problem of a div wrapping a two-column layout. My sidebar is floated, so my container div fails to wrap the content and sidebar. <div id="container"> <div id="content"&g..

Convert URL to File or Blob for FileReader.readAsDataURL

Reference: FileReader.readAsDataURL Considering the following example: function previewFile(file) { var reader = new FileReader(); reader.onloadend = function () { console.log(reader.resu..

How do I convert a column of text URLs into active hyperlinks in Excel?

I have a column in excel, wherein I have all the website url values. My question is I want to turn the url values to active links. There are about 200 entries in that column with different urls in all..

Eclipse error: "The import XXX cannot be resolved"

I'm trying to work with Hibernate in Eclipse. I'm creating a new simple project and I've downloaded a collegue project too, via CVS. Both don't work, while on my collegue's Eclipse do. The problem is ..

Tools for making latex tables in R

On general request, a community wiki on producing latex tables in R. In this post I'll give an overview of the most commonly used packages and blogs with code for producing latex tables from less stra..

How can I change the text inside my <span> with jQuery?

I have a really simple question but it's something I have not done before. I have the following: <td id="abc" style="width:15px;"><span></span></td> I would like to put some..

C++ Redefinition Header Files (winsock2.h)

How do I prevent from including header files twice? The problem is I'm including the in MyClass.h and then I'm including MyClass.h in many files, so it includes multiple times and redefinition error..

What does status=canceled for a resource mean in Chrome Developer Tools?

What would cause a page to be canceled? I have a screenshot of the Chrome Developer Tools. This happens often but not every time. It seems like once some other resources are cached, a page refresh ..

ie8 var w= window.open() - "Message: Invalid argument."

I have a site that has an IE8-only problem: The code is: var w = window.open(urlstring, wname, wfeatures, 'false'); The error is: Message: Invalid argument. Line: 419 Char: 5 Code: 0 ..

What's the difference between "Layers" and "Tiers"?

What's the difference between "Layers" and "Tiers"?..

How to convert an Object {} to an Array [] of key-value pairs in JavaScript

I want to convert an object like this: {"1":5,"2":7,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0} into an array of key-value pairs like this: [[1,5],[2,7],[3,0],[4,0]...]. How ..

Is It Possible to NSLog C Structs (Like CGRect or CGPoint)?

I want to be able to debug C structures without having to explicitly type every property that they consist of. i.e. I want to be able to do something like this: CGPoint cgPoint = CGPointMake(0,0); N..

Angular2: Cannot read property 'name' of undefined

I am beginning to learn Angular2. I've been following the Heroes Tutorial provided at angular.io. All was working fine until, being annoyed by the clutter of HTML using the template, I used template ..

How do I encode URI parameter values?

I want to send a URI as the value of a query/matrix parameter. Before I can append it to an existing URI, I need to encode it according to RFC 2396. For example, given the input: http://google.com/re..

Shortcut to Apply a Formula to an Entire Column in Excel

If I select a cell containing a formula, I know I can drag the little box in the right-hand corner downwards to apply the formula to more cells of the column. Unfortunately, I need to do this for 300,..

Play multiple CSS animations at the same time

How can I have two CSS animations playing at different speeds? The image should be rotating and growing at the same time. The rotation will cycle every 2 seconds. The growth will cycle every 4 se..

How do I remove a property from a JavaScript object?

Say I create an object as follows: let myObject = { "ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*" }; What is the b..

What is the best way to remove the first element from an array?

I have string array (String[]) and I need to remove the first item. How can I do that efficiently? ..

MySQL Foreign Key Error 1005 errno 150 primary key as foreign key

I'm making a small DataBase with MySQL Workbench. I have a main table, called "Immobili", which has a Primary Key composed by four columns: (Comune, Via, Civico, Immobile). I also have three..

GitHub - List commits by author

Is there any way on GitHub to list all commits made by a single author, in the browser (neither locally, e.g. via git log, nor via the API)? Clicking on a user name in the list of commits (Commit His..

How to set an "Accept:" header on Spring RestTemplate request?

I want to set the value of the Accept: in a request I am making using Spring's RestTemplate. Here is my Spring request handling code @RequestMapping( value= "/uom_matrix_save_or_edit", meth..

C#: easiest way to populate a ListBox from a List

If I have a list of strings, eg: List<string> MyList = new List<string>(); MyList.Add("HELLO"); MyList.Add("WORLD"); Is there an easy way to populate a ListBox using the contents of MyL..

Project vs Repository in GitHub

In GitHub, what is the conceptual difference between a project (that can be created inside a repository) and a repository? I've seen several similar questions (here, here and here) in SO, but none o..

How to timeout a thread

I want to run a thread for some fixed amount of time. If it is not completed within that time, I want to either kill it, throw some exception, or handle it in some way. How can it be done? One way of..

How to create a GUID/UUID in Python

How do I create a GUID in Python that is platform independent? I hear there is a method using ActivePython on Windows but it's Windows only because it uses COM. Is there a method using plain Python?..

Convert comma separated string to array in PL/SQL

How do I convert a comma separated string to a array? I have the input '1,2,3' , and I need to convert it into an array...

How to enable TLS 1.2 in Java 7

I am trying to enable TLS 1.2 in my web app which uses JBoss 6.4 and Java 1.7. I have -Dhttp.protocols = TLSv1.2 in my application environment but it doesn't seem to work for me. Is there anything I..

Extracting date from a string in Python

How can I extract the date from a string like "monkey 2010-07-10 love banana"? Thanks!..

What is the main difference between Collection and Collections in Java?

What is the main difference between Collection and Collections in Java?..

How to find if an array contains a specific string in JavaScript/jQuery?

Can someone tell me how to detect if "specialword" appears in an array? Example: categories: [ "specialword" "word1" "word2" ] ..

set div height using jquery (stretch div height)

I have 3 divs with ids header, content and footer. Header and footer has fixed height and they are styled to float on top and bottom. I want the middle content height calculated automatically with jqu..

What precisely does 'Run as administrator' do?

On Windows 7, I have a command-line program that fails due to file write permission errors, and popping up annoying UAC dialogs every time I run command-line programs that are from an 'unknown pu..

Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation

Even though I manually configured JDK project structure file/Project structure it still shows this error FAILURE: Build failed with an exception. `What went wrong: Execution failed for task ':sample..

How can I suppress all output from a command using Bash?

I have a Bash script that runs a program with parameters. That program outputs some status (doing this, doing that...). There isn't any option for this program to be quiet. How can I prevent the scri..

Styling an input type="file" button

How do you style an input type="file" button?..

What are carriage return, linefeed, and form feed?

What is the meaning of the following control characters: Carriage return Line feed Form feed ..

Conda version pip install -r requirements.txt --target ./lib

What is the conda version of this? pip install -r requirements.txt --target ./lib I've found these commands: while read requirement; do conda install --yes $requirement; done < requirements.txt..

Node.js spawn child process and get terminal output live

I have a script that outputs 'hi', sleeps for a second, outputs 'hi', sleeps for 1 second, and so on and so forth. Now I thought I would be able to tackle this problem with this model. var spawn = re..

How can I convert a string to boolean in JavaScript?

Can I convert a string representing a boolean value (e.g., 'true', 'false') into a intrinsic type in JavaScript? I have a hidden form in HTML that is updated based upon a user's selection within a li..

MySQL : transaction within a stored procedure

The basic structure of my stored procedure is, BEGIN .. Declare statements .. START TRANSACTION; .. Query 1 .. .. Query 2 .. .. Query 3 .. COMMIT; END My..

An object reference is required to access a non-static member

I'm having this error come up and I'm not sure why... I've tried to look it up, people are saying to create an object of the class or create the methods as static... but I'm unsure how. Here's my cod..

Get last 30 day records from today date in SQL Server

I have small question about SQL Server: how to get last 30 days information from this table Sample data: Product: Pdate ---------- 2014-11-20 2014-12-12 2014-11-10 2014-12-13 2014-10-12 2014-11-15..

AJAX cross domain call

I know about AJAX cross-domain policy. So I can't just call "http://www.google.com" over a ajax HTTP request and display the results somewhere on my site. I tried it with dataType "jsonp", that actua..

How to access a dictionary element in a Django template?

I would like to print out the number of votes that each choice got. I have this code in a template: {% for choice in choices %} {{choice.choice}} - {{votes[choice.id]}} <br /> {% endfor %}..

The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value

I have the following code in my HomeController: public ActionResult Edit(int id) { var ArticleToEdit = (from m in _db.ArticleSet where m.storyId == id select m).First(); return View(ArticleTo..

What is the most compatible way to install python modules on a Mac?

I'm starting to learn python and loving it. I work on a Mac mainly as well as Linux. I'm finding that on Linux (Ubuntu 9.04 mostly) when I install a python module using apt-get it works fine. I can im..

C++: Rounding up to the nearest multiple of a number

OK - I'm almost embarrassed posting this here (and I will delete if anyone votes to close) as it seems like a basic question. Is this the correct way to round up to a multiple of a number in C++? I..

Select something that has more/less than x character

Was wondering if it's possible to select something that has more/less than x characters in SQL. For example, I have an employee table and I want to show all employee names that has more than 4 charac..

Enums in Javascript with ES6

I'm rebuilding an old Java project in Javascript, and realized that there's no good way to do enums in JS. The best I can come up with is: const Colors = { RED: Symbol("red"), BLUE: Symbol(..

Command line for looking at specific port

Is there a way to examine the status of a specific port from the Windows command line? I know I can use netstat to examine all ports but netstat is slow and looking at a specific port probably isn't...

Should I use .done() and .fail() for new jQuery AJAX code instead of success and error

I have coded like this: $.ajax({ cache: false, url: "/Admin/Contents/GetData", data: { accountID: AccountID }, success: function (data) { $('#CityID').html(data); }, error..

Dictionary text file

I am writing a program that needs A LOT of words of the English language. I am trying to find a dictionary file that has a lot of words. Does anyone know of a good source? I tried many sources but the..

How do I enable EF migrations for multiple contexts to separate databases?

How do I enable Entity Framework 5 (version 5.0.0) migrations for multiple DB contexts in the same project, where each context corresponds to its own database? When I run Enable-Migrations in the PM c..

Member '<method>' cannot be accessed with an instance reference

I am getting into C# and I am having this issue: namespace MyDataLayer { namespace Section1 { public class MyClass { public class MyItem { ..

How to scroll to top of a div using jQuery?

I have a gridview inside a div.. I want to scroll to top of the div from the bottom of the div using jquery.. Any suggestion.. <div id="GridDiv"> // gridview inside.. </div> My gridview..

error: strcpy was not declared in this scope

I get this problem in a c++ problem compiling in Ubuntu g++ version 4.4.3. I dont know the headers to include to solve this problem.. Thanks centro_medico.cpp: In constructor ‘Centro_medico::Centro..

Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0

I am trying to include a php file in a page via require_once(http://localhost/web/a.php) I am getting an error Warning: require_once(): http:// wrapper is disabled in the server configuration ..

Inheritance and init method in Python

I'm begginer of python. I can't understand inheritance and __init__(). class Num: def __init__(self,num): self.n1 = num class Num2(Num): def show(self): print self.n1 mynumb..

Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?

I'm trying to link a UILabel with an IBOutlet created in my class. My application is crashing with the following error. What does this mean? How can I fix it? *** Terminating app due to uncau..

Reason for Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause

I got an error - Column 'Employee.EmpID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. select loc.LocationID, emp.EmpID f..

Open window in JavaScript with HTML inserted

How would I open a new window in JavaScript and insert HTML data instead of just linking to an HTML file?..

How to declare and use 1D and 2D byte arrays in Verilog?

How to declare and use 1D and 2D byte arrays in Verilog? eg. how to do something like byte a_2D[3][3]; byte a_1D[3]; // using 1D for (int i=0; i< 3; i++) { a_1D[i] = (byte)i; } // using 2D ..

HTML: Changing colors of specific words in a string of text

I have the below message (slightly changed): "Enter the competition by January 30, 2011 and you could win up to $$$$ — including amazing summer trips!" I currently have: <p style="font-s..

Rails: call another controller action from a controller

I need to call the create action in controller A, from controller B. The reason is that I need to redirect differently when I'm calling from controller B. Can it be done in Rails?..

PostgreSQL Exception Handling

I am new to PostgreSQL. Could anybody please correct this query. BEGIN TRANSACTION; BEGIN; CREATE TABLE "Logs"."Events" ( EventId BIGSERIAL NOT NULL PRIMARY KEY, PrimaryKeyId..

Node.js ES6 classes with require

So up until now, i have created classes and modules in node.js the following way: var fs = require('fs'); var animalModule = (function () { /** * Constructor initialize object * @c..

Jenkins/Hudson - accessing the current build number?

I have a report file I'm generating, and I would like to be able to add the current build number to that file within a Jenkins job. Is there an environment variable or plugin I can use to get at the c..

Having trouble setting working directory

I created a folder in order for it to be the main work directory meaning all the files I create go there, and files I read will be from there. For some reason after I created the folder and I'm trying..

Get first line of a shell command's output

While trying to read the version number of vim, I get a lot additional lines which I need to ignore. I tried to read the manual of head and tried the following command: vim --version | head -n 1 I ..

Overlay with spinner

I'm trying to create an overlay that overlays a page with a spinner in the middle. What's the simplest way to accomplish this? I only need to worry about IE 8 and above...

How to select the row with the maximum value in each group

In a dataset with multiple observations for each subject I want to take a subset with only the maximum data value for each record. For example, with a following dataset: ID <- c(1,1,1,2,2,2,2,3..

Mocking a function to raise an Exception to test an except block

I have a function (foo) which calls another function (bar). If invoking bar() raises an HttpError, I want to handle it specially if the status code is 404, otherwise re-raise. I am trying to write so..

Spring AMQP + RabbitMQ 3.3.5 ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN

I am getting below exception org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mecha..

Setting a max height on a table

I am trying to design a page where there are some tables. It seems that styling tables is much more painful than it ought to be. The problem is the following: The tables should have a fixed height an..

Switch case: can I use a range instead of a one number

I want to use switch, but I have many cases, is there any shortcut? So far the only solution I know and tried is: switch (number) { case 1: something; break; case 2: other thing; break; ... case 9:..

AngularJS: How can I pass variables between controllers?

I have two Angular controllers: function Ctrl1($scope) { $scope.prop1 = "First"; } function Ctrl2($scope) { $scope.prop2 = "Second"; $scope.both = Ctrl1.prop1 + $scope.prop2; //This is w..

Send POST data via raw json with postman

I've got Postman (the one that doesn't open in Chrome) and I'm trying to do a POST request using raw json. In the Body tab I have "raw" selected and "JSON (application/json)" with this body: { "..

How to format DateTime columns in DataGridView?

I'm using a DataGridView with object data binding to display information about logging entities in a system, retrieved via SOAP from a remote service. One of the columns is called "Last action" and me..

Convert Bitmap to File

I understand that using BitmapFactory can convert a File to a Bitmap, but is there any way to convert a Bitmap image to a File?..

How to revert a "git rm -r ."?

I accidentely said git rm -r .. How do I recover from this? I did not commit. I think all files were marked for deletion and were also physically removed from my local checkout. EDIT: I could (if I..

Use of Application.DoEvents()

Can Application.DoEvents() be used in C#? Is this function a way to allow the GUI to catch up with the rest of the app, in much the same way that VB6's DoEvents does?..

Can't import org.apache.http.HttpResponse in Android Studio

I want to use these libraries in Android Studio: import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.i..

How to search for an element in a golang slice

I have a slice of structs. type Config struct { Key string Value string } // I form a slice of the above struct var myconfig []Config // unmarshal a response body into the above slice if e..

How to execute a program or call a system command from Python

How do you call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?..

Can I run multiple programs in a Docker container?

I'm trying to wrap my head around Docker from the point of deploying an application which is intended to run on the users on desktop. My application is simply a flask web application and mongo databas..

Removing character in list of strings

If I have a list of strings such as: [("aaaa8"),("bb8"),("ccc8"),("dddddd8")...] What should I do in order to get rid of all the 8s in each string? I tried using strip or replace in a for loop but ..

A fast way to delete all rows of a datatable at once

I want to delete all rows in a datatable. I use something like this: foreach (DataRow row in dt.Rows) { row.Delete(); } TableAdapter.Update(dt); It works good but it takes lots of time if I have ..

get the data of uploaded file in javascript

I want to upload a csv file and process the data inside that file. What is the best method to do so? I prefer not to use php script. I did the following steps. But this method only returns the file na..

No module named _sqlite3

I am trying to run a Django app on my VPS running Debian 5. When I run a demo app, it comes back with this error: File "/usr/local/lib/python2.5/site-packages/django/utils/importlib.py", line 35, i..

Convert Json Array to normal Java list

Is there a way to convert JSON Array to normal Java Array for android ListView data binding?..

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

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

Address already in use: JVM_Bind java

Some times whenever I restart the application, which is built on Java Struts Mysql and Jboss 4.05 Version I get the error as Address already in use: JVM_Bind Only fix that i know is to restart the m..

Correct way to initialize HashMap and can HashMap hold different value types?

So I have two questions about HashMaps in Java: What is the correct way to initialize a HashMap? I think it might be best in my situation to use: HashMap x = new HashMap(); But Eclipse keeps sugg..

top align in html table?

how can i get the images and the content to the right to top align? i tried valign="top" as you can see. <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr vali..

Git Stash vs Shelve in IntelliJ IDEA

I am very unfamiliar with the shelve aspect of Git. If stash is used to put aside unfinished work what is shelve then? What would you use it for? For example on Update Project (from VCS menu) one wil..

Pass variable to function in jquery AJAX success callback

I am trying to preload some images with a jQuery AJAX call, but am having real problems passing a (url) string into a function within the success function of the AJAX call (if that makes sense). Her..

How to check Grants Permissions at Run-Time?

In Android M (Preview) the user can choose a specific app and retreive specific permission. So I am asking How to check Grants Permissions at Run-Time?..

How to compare two tables column by column in oracle

I have two similar tables in oracle in two different databases. For example : my table name is EMPLOYEE and primary key is employee id. The same table with same columns(say 50 columns are is avlbl in..

Reading value from console, interactively

I thought to make an simple server http server with some console extension. I found the snippet to read from command line data. var i = rl.createInterface(process.stdin, process.stdout, null); i...

How to Toggle a div's visibility by using a button click

Below is my javascript code which i used to show a div when clicked on a button. How can I hide it when clicked again? And then on clicking it, div should be visible again? <script type="text/ja..

The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception

I'm working with EF5 in a MVC 4 aspnet website. Locally, everything works just fine, but when I publish it to the IIS and try to enter, I get the error "The type initializer for 'System.Data.Entit..

How to increase request timeout in IIS?

How to increase request timeout in IIS 7.0? The same is done under application tab in ASP configuration settngs in IIS 6.0. I am not able to find the asp.net configuration section in IIS 7.0..

List all kafka topics

I'm using kafka 0.10 without zookeeper. I want to get kafka topics list. This command is not working since we're not using zookeeper: bin/kafka-topics.sh --list --zookeeper localhost:2181. How can I ..

Is it possible to install Xcode 10.2 on High Sierra (10.13.6)?

I recently upgraded iOS in my iPhone device to 12.2 (to provide support of latest versions for my app "Match4app"), and this does not appear to be compatible with Xcode 10.1. Should I update Xcode to ..

Netbeans 8.0.2 The module has not been deployed

I just installed netbeans and I have problems deploying a new Java Web App. I simply create the project without editing anything, this is what project has by default (using apache): index.html <!..

Naming returned columns in Pandas aggregate function?

I'm having trouble with Pandas' groupby functionality. I've read the documentation, but I can't see to figure out how to apply aggregate functions to multiple columns and have custom names for those c..

Declare a const array

Is it possible to write something similar to the following? public const string[] Titles = { "German", "Spanish", "Corrects", "Wrongs" }; ..

Abstraction vs Encapsulation in Java

Possible Duplicate: Abstraction VS Information Hiding VS Encapsulation I know this question might have been asked thousands times on this forum, even net is also filled with lots of definit..

What are the differences between numpy arrays and matrices? Which one should I use?

What are the advantages and disadvantages of each? From what I've seen, either one can work as a replacement for the other if need be, so should I bother using both or should I stick to just one of t..

Spring @Transactional read-only propagation

I'm experimenting with using the command pattern to allow my web layer to work with Hibernate entities within the context of a single transaction (thus avoiding lazy loading exceptions). I am, however..

How can I color Python logging output?

Some time ago, I saw a Mono application with colored output, presumably because of its log system (because all the messages were standardized). Now, Python has the logging module, which lets you spe..

Concatenate strings from several rows using Pandas groupby

I want to merge several strings in a dataframe based on a groupedby in Pandas. This is my code so far: import pandas as pd from io import StringIO data = StringIO(""" "name1","hej","2014-11-01" "n..

How to automatically indent source code?

How can I automatically indent source code in Visual Studio 2010? I have used Ctrl + K, Ctrl + F, but it does not work; is there any other way/plugin to do this?..

Do you recommend using semicolons after every statement in JavaScript?

In many situations, JavaScript parsers will insert semicolons for you if you leave them out. My question is, do you leave them out? If you're unfamiliar with the rules, there's a description of semic..

In python, what is the difference between random.uniform() and random.random()?

In python for the random module, what is the difference between random.uniform() and random.random()? They both generate pseudo random numbers, random.uniform() generates numbers from a uniform distri..

How to enable cross-origin resource sharing (CORS) in the express.js framework on node.js

I'm trying to build a web server in node.js that will support cross-domain scripting, while still providing static files from a public directory. I'm using the express.js and am not really sure how to..

ArrayList filter

How can you filter out something from a Java ArrayList like if you have: How are you How you doing Joe Mike And the filter is "How" it will remove Joe and Mike...

ScalaTest in sbt: is there a way to run a single test without tags?

I know that a single test can be ran by running, in sbt, testOnly *class -- -n Tag Is there a way of telling sbt/scalatest to run a single test without tags? For example: testOnly *class -- -X 2 ..

android adb turn on wifi via adb

My phone has been locked (too many pattern attempts). To unlock I need to enter username and password on my gmail account. This is the only way I can unlock it. I cant launch any activities, even to t..

Secure random token in Node.js

In this question Erik needs to generate a secure random token in Node.js. There's the method crypto.randomBytes that generates a random Buffer. However, the base64 encoding in node is not url-safe, it..

How to printf "unsigned long" in C?

I can never understand how to print unsigned long datatype in C. Suppose unsigned_foo is an unsigned long, then I try: printf("%lu\n", unsigned_foo) printf("%du\n", unsigned_foo) printf("%ud\n", un..

Angular2 Material Dialog css, dialog size

Angular2 material team recently released the MDDialog https://github.com/angular/material2/blob/master/src/lib/dialog/README.md I'd like to change the looking and feel about the angular2 material's d..

how to fetch data from database in Hibernate

This is my class to fetch data from database package com.javatpoint.mypackage; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Tra..

how to query child objects in mongodb

I'm new to mongodb and am trying to query child objects. I have a collection of States, and each State has child Cities. One of the Cities has a Name property that is null, which is causing errors in ..

How to extract a string using JavaScript Regex?

I'm trying to extract a substring from a file with JavaScript Regex. Here is a slice from the file : DATE:20091201T220000 SUMMARY:Dad's birthday the field I want to extract is "Summary". Here is th..

What are the rules for calling the superclass constructor?

What are the C++ rules for calling the superclass constructor from a subclass one? For example, I know in Java, you must do it as the first line of the subclass constructor (and if you don't, an impl..

How to use php serialize() and unserialize()

My problem is very basic. I did not find any example to meet my needs as to what exactly serialize() and unserialize() mean in php? They just give an example - serialize an array and show an output i..

You cannot call a method on a null-valued expression

I am simply trying to create a powershell script which calculates the md5 sum of an executable (a file). My .ps1 script: $answer = Read-Host "File name and extension (ie; file.exe)" $someFilePath = ..

Yarn: How to upgrade yarn version using terminal?

How should yarn be upgraded to the latest version?..

Refresh Page C# ASP.NET

Is there a Page.Refresh type of command to refresh a page? I don't want to redirect to the page or refresh in JavaScript...

How to automatically generate a stacktrace when my program crashes

I am working on Linux with the GCC compiler. When my C++ program crashes I would like it to automatically generate a stacktrace. My program is being run by many different users and it also runs on Li..

Create session factory in Hibernate 4

I'm having trouble generating a session factory in Hibernate 4. In Hibernate 3 I simple did: org.hibernate.cfg.Configuration conf= HibernateUtil .getLimsInitializedConfiguration(systemConfigurati..

BehaviorSubject vs Observable?

I'm looking into Angular RxJs patterns and I don't understand the difference between a BehaviorSubject and an Observable. From my understanding, a BehaviorSubject is a value that can change over time..

Should I use != or <> for not equal in T-SQL?

I have seen SQL that uses both != and <> for not equal. What is the preferred syntax and why? I like !=, because <> reminds me of Visual Basic...

Django: Display Choice Value

models.py: class Person(models.Model): name = models.CharField(max_length=200) CATEGORY_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) gender = models.CharField(max_len..

Java Set retain order?

Does a Java Set retain order? A method is returning a Set to me and supposedly the data is ordered but iterating over the Set, the data is unordered. Is there a better way to manage this? Does the m..

Video streaming over websockets using JavaScript

What is the fastest way to stream live video using JavaScript? Is WebSockets over TCP a fast enough protocol to stream a video of, say, 30fps?..

How to find first element of array matching a boolean condition in JavaScript?

I'm wondering if there's a known, built-in/elegant way to find the first element of a JS array matching a given condition. A C# equivalent would be List.Find. So far I've been using a two-function c..

How to check whether java is installed on the computer

I am trying to install java windows application on client machine.I want to check whether requried JRE is installed on the machine or not. I want to check it by java program not by cmd command..

In Maven how to exclude resources from the generated jar?

When I create an executable jar with dependencies (using this guide), all properties files are packaged into that jar too. How to stop it from happening? Thanks. UPDATE: I tried to exclude them using..

Select max value of each group

Name Value AnotherColumn ----------- Pump 1 8000.0 Something1 Pump 1 10000.0 Something2 Pump 1 10000.0 Something3 Pump 2 3043 Something4 Pump 2 4594 Something5 Pump 2 6165 Somethi..

SQLAlchemy insert or update example

In Python, using SQLAlchemy, I want to insert or update a row. I tried this: existing = db.session.query(Toner) for row in data: new = Toner(row[0], row[1], row[2]) It does not work. How do I..

How do I correctly clean up a Python object?

class Package: def __init__(self): self.files = [] # ... def __del__(self): for file in self.files: os.unlink(file) __del__(self) above fails with an Attrib..

Symfony2 and date_default_timezone_get() - It is not safe to rely on the system's timezone settings

I have a Symfony2 project. I updated my php to 5.5.7 today and since then, I am getting the Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *r..

How to get an element's top position relative to the browser's viewport?

I want to get the position of an element relative to the browser's viewport (the viewport in which the page is displayed, not the whole page). How can this be done in JavaScript? Many thanks..

How to log Apache CXF Soap Request and Soap Response using Log4j?

I am using the Apache CXF Framework. Inside my client program, I need to log CXF SOAP Requests and SOAP Responses. When I used JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.se..

How can I do a line break (line continuation) in Python?

I have a long line of code that I want to break up among multiple lines. What do I use and what is the syntax? For example, adding a bunch of strings, e = 'a' + 'b' + 'c' + 'd' and have it in two ..

How to bundle an Angular app for production

What is the best method to bundle Angular (version 2, 4, 6, ...) for production on a live web server. Please include the Angular version within answers so we can track better when it moves to later r..

OnChange event using React JS for drop down

var MySelect = React.createClass({ change: function(){ return document.querySelector('#lang').value; }, render: function(){ return( <div> ..

Separators for Navigation

I need to add separators between elements of navigation. Separators are images. My HTML structure is like: ol > li > a > img. Here I come to two possible solutions: To add more li tags for ..

How do I change the text of a span element using JavaScript?

If I have a span, say: <span id="myspan"> hereismytext </span> How do I use JavaScript to change "hereismytext" to "newtext"?..

Convert and format a Date in JSP

From my JSP Page, I am getting Date in this format. Fri May 13 2011 19:59:09 GMT 0530 (India Standard Time) How can I convert this to the pattern yyyy-MM-dd HH:mm:ss?..

How can I use inverse or negative wildcards when pattern matching in a unix/linux shell?

Say I want to copy the contents of a directory excluding files and folders whose names contain the word 'Music'. cp [exclude-matches] *Music* /target_directory What should go in place of [exclude-m..

Max or Default?

What is the best way to get the Max value from a LINQ query that may return no rows? If I just do Dim x = (From y In context.MyTable _ Where y.MyField = value _ Select y.MyCounter)...

Returning string from C function

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

Remove all unused resources from an android project

I want to remove all unused layouts, strings, drawables, colors, etc from my Android res directory. Are there any tools that will give me a list of files and I can remove from my repository and elemen..

How to find Port number of IP address?

We can find out IP address of a domain name or URL. But how to find out Port number on which a domain name is hosted?..

Query-string encoding of a Javascript Object

Do you know a fast and simple way to encode a Javascript Object into a string that I can pass via a GET Request? No jQuery, no other frameworks - just plain Javascript :)..

How to use shared memory with Linux in C

I have a bit of an issue with one of my projects. I have been trying to find a well documented example of using shared memory with fork() but to no success. Basically the scenario is that when the ..

Parse JSON String into List<string>

string json = "{\"People\":[{\"FirstName\":\"Hans\",\"LastName\":\"Olo\"} {\"FirstName\":\"Jimmy\",\"LastName\":\"Crackedcorn\"}]}"; var obj = JObject.Parse(json); List&l..

Must JDBC Resultsets and Statements be closed separately although the Connection is closed afterwards?

It is said to be a good habit to close all JDBC resources after usage. But if I have the following code, is it necessary to close the Resultset and the Statement? Connection conn = null; PreparedStat..

How can I install an older version of a package via NuGet?

I want to install an older version of a package (Newtonsoft.Json). But NuGet rolls back: PM> Install-Package Newtonsoft.Json -Version 4.0.5 Successfully installed 'Newtonsoft.Json 4.0.5'. Install f..

Replace non ASCII character from string

I have strings A função, Ãugent in which I need to replace character like ç,ã,Ã with empty strings. How can I match only those non ASCII characters? I am using a function public static String ..

mongodb count num of distinct values per field/key

Is there a query for calculating how many distinct values a field contains in DB. f.e I have a field for country and there are 8 types of country values (spain, england, france, etc...) If someone a..

Finding whether a point lies inside a rectangle or not

I want to find whether a point lies inside a rectangle or not. The rectangle can be oriented in any way, and need not be axis aligned. One method I could think of was to rotate the rectangle and poin..

httpd-xampp.conf: How to allow access to an external IP besides localhost?

I haven't found the right answer that works for me in other questions. This is how the httpd-xampp.conf looks like originally: # # New XAMPP security concept # <LocationMatch "^/(?i:(?:xampp|secur..

Sending JWT token in the headers with Postman

I'm testing an implementation of JWT Token based security based off the following article. I have successfully received a token from the test server. I can't figure out how to have the Chrome POSTMAN ..

How do I test if a string is empty in Objective-C?

How do I test if an NSString is empty in Objective-C?..