Examples On Programing Languages

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

heroku - how to see all the logs

I have a small app on heroku. Whenever I want to see the logs I go to the command line and do heroku logs That only shows me about 100 lines. Is there not a way to see complete logs for our application on heroku? ...

How to run a command in the background on Windows?

In linux you can use command & to run command on the background, the same will continue after the shell is offline. I was wondering is there something like that for windows…...

access denied for user @ 'localhost' to database ''

I'm seeing a lot of of similar questions to this. but can't find one exactly like mine yet. Not sure where to change these settings or anything, any help appreciated. access denied Access denied for user ''@'localhost' to database '' This is the ...

Post an object as data using Jquery Ajax

My code that I tried is as follows: var dataO = new Object(); dataO.numberId = 1; dataO.companyId = 531; $.ajax({ type: "POST", url: "TelephoneNumbers.aspx/DeleteNumber", data: "{numberId:1,companyId:531}", contentType: "application/json; chars...

jQuery UI Dialog with ASP.NET button postback

I have a jQuery UI Dialog working great on my ASP.NET page: jQuery(function() { jQuery("#dialog").dialog({ draggable: true, resizable: true, show: 'Transfer', hide: 'Transfer', width: 320, autoOpen...

java.lang.ClassNotFoundException: org.apache.log4j.Level

I'm trying to use hibernate 3.5.1 final in a swing application and here are the jars I'm using: hibernate-core-3.5.1-Final hibernate-entitymanager-3.5.1-Final hibernate-jpa-2.0-api-1.0.0.Final hibernate-annotations-3.5.1-Final hibernate-commons-ann...

matplotlib: colorbars and its text labels

I'd like to create a colorbar legend for a heatmap, such that the labels are in the center of each discrete color. Example borrowed from here: import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import ListedColormap #discrete...

How to implement a secure REST API with node.js

I start planning a REST API with node.js ,express and mongodb. The API provides data for a website (public and private area) and maybe later a mobile app. The frontend will be developed with AngularJS. For some days I read a lot about securing REST ...

Setting a div's height in HTML with CSS

I am trying to lay out a table-like page with two columns. I want the rightmost column to dock to the right of the page, and this column should have a distinct background color. The content in the right side is almost always going to be smaller tha...

Select query with date condition

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

How to empty a redis database?

I've been playing with redis (and add some fun with it) during the last fews days and I'd like to know if there is a way to empty the db (remove the sets, the existing key....) easily. During my tests, I created several sets with a lot of members, ev...

How to convert JSON string into List of Java object?

This is my JSON Array :- [ { "firstName" : "abc", "lastName" : "xyz" }, { "firstName" : "pqr", "lastName" : "str" } ] I have this in my String object. Now I want to convert it into Java object a...

Radio/checkbox alignment in HTML/CSS

What is the cleanest way to align properly radio buttons / checkboxes with text? The only reliable solution which I have been using so far is table based: <table> <tr> <td><input type="radio" name="opt"></td> &l...

Is it possible to specify the schema when connecting to postgres with JDBC?

Is it possible? Can i specify it on the connection URL? How to do that?...

How to POST JSON data with Python Requests?

I need to POST a JSON from a client to a server. I'm using Python 2.7.1 and simplejson. The client is using Requests. The server is CherryPy. I can GET a hard-coded JSON from the server (code not shown), but when I try to POST a JSON to the server, I...

How can I get the height of an element using css only

We have a lot of options to get the height of an element using jQuery and JavaScript. But how can we get the height using CSS only? Suppose, I have a div with dynamic content - so it does not have a fixed height: _x000D_ _x000D_ .dynamic-height {_...

MySQL "WITH" clause

I'm trying to use MySQL to create a view with the "WITH" clause WITH authorRating(aname, rating) AS SELECT aname, AVG(quantity) FROM book GROUP BY aname But it doesn't seem like MySQL supports this. I thought this was pretty standard and...

Opening a folder in explorer and selecting a file

I'm trying to open a folder in explorer with a file selected. The following code produces a file not found exception: System.Diagnostics.Process.Start( "explorer.exe /select," + listView1.SelectedItems[0].SubItems[1].Text + "\\" + li...

Access a global variable in a PHP function

According to the most programming languages scope rules, I can access variables that are defined outside of functions inside them, but why doesn't this code work? <?php $data = 'My data'; function menugen() { echo "[" . $data . "...

mysql server port number

I've just made a database on mysql on my server. I want to connect to this via my website using php. This is the contents of my connections file: $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser,...

How to remove list elements in a for loop in Python?

I have a list a = ["a", "b", "c", "d", "e"] I want to remove elements in this list in a for loop like below: for item in a: print item a.remove(item) But it doesn't work. What can I do?...

How do you merge two Git repositories?

Consider the following scenario: I have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big repository. I'd now like to add A as a subdirectory of B. ...

Netbeans installation doesn't find JDK

installing Netbeans 6.0.1 on my windows computer, I find this error: Even if I my enviroment variables seems to be ok, when executing: I rebooted my system, but the error persists. Does anybody know why?? Thans in advance...

Enter key pressed event handler

I want to capture the text from the textbox when enter key is hit. I am using WPF/visual studio 2010/.NET 4. I dont know what event handler to be used in the tag ? I also want to do the same for maskedtextbox....

How to convert an array into an object using stdClass()

I have made the following array: $clasa = array( 'e1' => array('nume' => 'Nitu', 'prenume' => 'Andrei', 'sex' => 'm', 'varsta' => 23), 'e2' => array('nume' => 'Nae', 'prenume' => 'Ionel', 'sex' => 'm', 'var...

Duplicate Entire MySQL Database

Is it posible to duplicate an entire MySQL database on a linux server? I know I can use export and import but the original database is >25MB so that's not ideal. Is it possible using mysqldump or by directly duplicates the database files?...

Delete a row in Excel VBA

I have this piece of code which finds the excel row of an item from a list and deletes the items from a list. What I want... is to delete the Excel row as well. The code is here Private Sub imperecheaza_Click() Dim ws As Worksheet Dim Rand As Long ...

How to create PDF files in Python

I'm working on a project which takes some images from user and then creates a PDF file which contains all of these images. Is there any way or any tool to do this in Python? E.g. to create a PDF file (or eps, ps) from image1 + image 2 + image 3 -> P...

Get data from php array - AJAX - jQuery

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

WARNING in budgets, maximum exceeded for initial

When build my angular 7 project with --prod, i have a warning in budgets. I have a angular 7 project, i want to build it, but i have a warning: WARNING in budgets, maximum exceeded for initial. Budget 2 MB was exceeded by 1.77 MB these are chunk ...

Reading From A Text File - Batch

I have a text file, a.txt: Hello World Good Afternoon I have written a batch script to read contents of this file line by line: FOR /F "tokens=* delims=" %%x in (a.txt) DO echo %%x I am getting output as "Hello" "World" due to default beh...

Authentication issue when debugging in VS2013 - iis express

I'm trying to pick up the windows username when debugging in Visual Studio 2013. I am simply using: httpcontext.current.user.identity.name If I run this on my Dev Server it works fine, if I run it in debug mode on any previous version of Visual St...

Make elasticsearch only return certain fields?

I'm using elasticsearch to index my documents. Is it possible to instruct it to only return particular fields instead of the entire json document it has stored?...

forEach is not a function error with JavaScript array

I'm trying to make a simple loop: const parent = this.el.parentElement console.log(parent.children) parent.children.forEach(child => { console.log(child) }) But I get the following error: VM384:53 Uncaught TypeError: parent.children.forEa...

Sending websocket ping/pong frame from browser

I keep reading about ping/pong messages in websockets to keep the connection alive, but I'm not sure what they are. Is it a distinct frame type? (I don't see any methods on a javascript WebSocket object in chrome related to ping-pong). Or is it jus...

C# Convert List<string> to Dictionary<string, string>

This may seem an odd thing to want to do but ignoring that, is there a nice concise way of converting a List to Dictionary where each Key Value Pair in the Dictionary is just each string in the List. i.e. List = string1, string2, string3 Dictionary ...

Angular 4 setting selected option in Dropdown

several questions about this and diffrent answeres. But none of them realy answeres the question. So again: Setting default of a Dropdown select by value isnt working in my case. why? This is from the dynamic Form tutorial of Angular 4: <select ...

Cannot connect to the Docker daemon on macOS

I normally prefer to manage my apps on my OSX with brew I am able to install docker, docker-compose and docker-machine docker --version Docker version 17.05.0-ce, build 89658be docker-compose --version docker-compose version 1.13.0, build unknown d...

Error: Cannot invoke an expression whose type lacks a call signature

I am brand new to typescript, and I have two classes. In the parent class I have: abstract class Component { public deps: any = {}; public props: any = {}; public setProp(prop: string): any { return <T>(val: T): T => { this...

jQuery change method on input type="file"

I'm trying to embrace jQuery 100% with it's simple and elegant API but I've run into an inconsistency between the API and straight-up HTML that I can't quite figure out. I have an AJAX file uploader script (which functions correctly) that I want to ...

Ruby Regexp group matching, assign variables on 1 line

I'm currently trying to rexp a string into multiple variables. Example string: ryan_string = "RyanOnRails: This is a test" I've matched it with this regexp, with 3 groups: ryan_group = ryan_string.scan(/(^.*)(:)(.*)/i) Now to access each group ...

Suppress output of a function

I'm looking to suppress the output of one command (in this case, the apply function). Is it possible to do this without using sink()? I've found the described solution below, but would like to do this in one line if possible. How to suppress outpu...

Display Last Saved Date on worksheet

Does anyone know how to display the Last Saved Date of an Excel Spreadsheet on one of the worksheets? I have found ways to do it using macros, but the spreadsheet is populated by an add-in called Jet Essentials, and this does not like macros so a so...

Python: Random numbers into a list

Create a 'list' called my_randoms of 10 random numbers between 0 and 100. This is what I have so far: import random my_randoms=[] for i in range (10): my_randoms.append(random.randrange(1, 101, 1)) print (my_randoms) Unfortunately Python'...

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

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

How to set up tmux so that it starts up with specified windows opened?

How to set up tmux so that it starts up with specified windows opened?...

Getting DOM elements by classname

I'm using PHP DOM and I'm trying to get an element within a DOM node that have a given class name. What's the best way to get that sub-element? Update: I ended up using Mechanize for PHP which was much easier to work with....

Add days to JavaScript Date

How to add days to current Date using JavaScript. Does JavaScript have a built in function like .Net's AddDay?...

Python strftime - date without leading 0?

When using Python strftime, is there a way to remove the first 0 of the date if it's before the 10th, ie. so 01 is 1? Can't find a %thingy for that? Thanks!...

Difference between static, auto, global and local variable in the context of c and c++

I’ve a bit confusion about static, auto, global and local variables. Somewhere I read that a static variable can only be accessed within the function, but they still exist (remain in the memory) after the function returns. However, I also know t...

How to use moment.js library in angular 2 typescript app?

I tried to use it with typescript bindings: npm install moment --save typings install moment --ambient -- save test.ts: import {moment} from 'moment/moment'; And without: npm install moment --save test.ts: var moment = require('moment/momen...

How do I "decompile" Java class files?

What program can I use to decompile a class file? Will I actually get Java code, or is it just JVM assembly code? On Java performance questions on this site I often see responses from people who have "decompiled" the Java class file to see how the c...

How to select a value in dropdown javascript?

i have a drop down like this <select style="width: 280px" id="Mobility" name="Mobility"> <option selected="">Please Select</option> <option>K</option> <option>1</option> <option>2</option>...

How to keep the console window open in Visual C++?

I'm starting out in Visual C++ and I'd like to know how to keep the console window. For instance this would be a typical "hello world" application: int _tmain(int argc, _TCHAR* argv[]) { cout << "Hello World"; return 0; } What's th...

Amazon S3 direct file upload from client browser - private key disclosure

I'm implementing a direct file upload from client machine to Amazon S3 via REST API using only JavaScript, without any server-side code. All works fine but one thing is worrying me... When I send a request to Amazon S3 REST API, I need to sign the r...

NSCameraUsageDescription in iOS 10.0 runtime crash?

Using iOS 10.0 last beta. I had tried to use Camera to scan barcode in my app, and it crashed with this runtime error. This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist...

What is a pre-revprop-change hook in SVN, and how do I create it?

I wanted to edit a log comment in the repository browser and received an error message that no pre-revprop-change hook exists for the repository. Besides having a scary name, what is a pre-revprop-change hook, and how do I create it?...

How to apply Hovering on html area tag?

I am trying to hover the area tag of HTML. I tried this in CSS: area:hover { border:1px solid black; } This is the HTML on which it should be applied. <!-- This imagemap inserted by Gwyn's Imagemap Selector http://gwynethllewelyn.net/gwyns...

How to extract the hostname portion of a URL in JavaScript

Is there a really easy way to start from a full URL: document.location.href = "http://aaa.bbb.ccc.com/asdf/asdf/sadf.aspx?blah" And extract just the host part: aaa.bbb.ccc.com There's gotta be a JavaScript function that does this reliably, but ...

How to change the size of the font of a JLabel to take the maximum size

I have a JLabel in a Container. The defaut size of the font is very small. I would like that the text of the JLabel to take the maximum size. How can I do that?...

CXF: No message body writer found for class - automatically mapping non-simple resources

I am using the CXF rest client which works well for simple data types (eg: Strings, ints). However, when I attempt to use custom Objects I get this: Exception in thread "main" org.apache.cxf.interceptor.Fault: .No message body writer found for class...

Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2)

I have created a new maven project in SpringSource Tool Suite. I am getting this error in my new maven project. Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from http://repo1.maven.org/maven2 was cached in the ...

How to type ":" ("colon") in regexp?

: ("colon") has a special meaning in regexp, but I need to use it as is, like [A-Za-z0-9.,-:]*. I have tried to escape it, but this does not work [A-Za-z0-9.,-\:]*...

Merging two images in C#/.NET

Simple idea: I have two images that I want to merge, one is 500x500 that is transparent in the middle the other one is 150x150. Basic idea is this: Create an empty canvas that is 500x500, position the 150x150 image in the middle of the empty canvas ...

How to get size of mysql database?

How to get size of a mysql database? Suppose the target database is called "v3"....

JAXB :Need Namespace Prefix to all the elements

I am Using Spring WebServiceTemplate to make webservice call which uses JAXB to generate request XML. My requirement needs all the elements (including root) to have a namespace prefix (there is only a single namespace) in the SOAP request. Ex : <...

Why can't I inherit static classes?

I have several classes that do not really need any state. From the organizational point of view, I would like to put them into hierarchy. But it seems I can't declare inheritance for static classes. Something like that: public static class Base { ...

pod has unbound PersistentVolumeClaims

When I push my deployments, for some reason, I'm getting the error on my pods: pod has unbound PersistentVolumeClaims Here are my YAML below: This is running locally, not on any cloud solution. apiVersion: extensions/v1beta1 kind: Deploymen...

Confirm postback OnClientClick button ASP.NET

<asp:Button runat="server" ID="btnUserDelete" Text="Delete" CssClass="GreenLightButton" OnClick="BtnUserDelete_Click" OnClientClick="return UserDeleteConfirmation();" meta:resourcekey="BtnUse...

libaio.so.1: cannot open shared object file

I have a simple test program that when I run I get: ./hello: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory I link it like this: $(CC) $(CCFLAGS) -o hello hello.o -L../ocilib-3.9.3/src...

CORS Access-Control-Allow-Headers wildcard being ignored?

I am having trouble getting a cross domain CORS request to work correctly using Chrome. Request Headers: Accept:*/* Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Access-Control-Reque...

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="[email protected] [email protected]" mail="subject:$subject...

How to increase scrollback buffer size in tmux?

How do I increase scrollback buffer size in tmux? If I enter copy mode, the number of available scrollback lines (visible in upper right corner) is always below 2000. I tried to find a list of all tmux commands, but I can't find anything about scr...

tooltips for Button

Is it possible to create a tooltip for an html button. Its the normal HTML button and there is no Title attribute as it is there for some html controls. Any thoughts or comments?...

Pagination using MySQL LIMIT, OFFSET

I have some code that LIMITs data to display only 4 items per page. The column I'm using has about 20-30 items, so I need to make those spread out across the pages. On the first page, I have: $result = mysqli_query($con,"SELECT * FROM menuitem...

How to center an iframe horizontally?

Consider the following example: (live demo) HTML: <div>div</div> <iframe></iframe> CSS: div, iframe { width: 100px; height: 50px; margin: 0 auto; background-color: #777; } Result: Why the iframe is no...

Splitting string with pipe character ("|")

I'm not able to split values from this string: "Food 1 | Service 3 | Atmosphere 3 | Value for money 1 " Here's my current code: String rat_values = "Food 1 | Service 3 | Atmosphere 3 | Value for money 1 "; String[] value_split = rat_values.split(...

Nodejs - Redirect url

How do I get a node.js server to redirect users to a 404.html page when they enter an invalid url? I did some searching, and it looks like most results are for Express, but I want to write my server in pure node.js....

java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient

I am trying to make a get request from the GWT servlet to get JSON response from a web service. Following is the code in my servlet : public String getQueData() throws IllegalArgumentException { String message = null; try { ...

How to set column header text for specific column in Datagridview C#

How to set column header text for specific column in Datagridview C#...

Iterating through a JSON object

I am trying to iterate through a JSON object to import data, i.e. title and link. I can't seem to get to the content that is past the :. JSON: [ { "title": "Baby (Feat. Ludacris) - Justin Bieber", "description": "Baby (Feat. L...

rails 3.1.0 ActionView::Template::Error (application.css isn't precompiled)

I made a basic rails app with a simple pages controller with an index function and when I load the page I get: ActionView::Template::Error (application.css isn't precompiled): 2: <html> 3: <head> 4: <title>Demo</ti...

String.Replace(char, char) method in C#

How do I replace \n with empty space? I get an empty literal error if I do this: string temp = mystring.Replace('\n', ''); ...

How to resize an Image C#

As Size, Width and Height are Get() properties of System.Drawing.Image; How can I resize an Image object at run-time in C#? Right now, I am just creating a new Image using: // objImage is the original Image Bitmap objBitmap = new Bitmap(objImage, n...

The remote server returned an error: (407) Proxy Authentication Required

I'm getting this error when I call a web service: "The remote server returned an error: (407) Proxy Authentication Required". I get the general idea and I can get the code to work by adding myProxy.Credentials = NetworkCredential("user", "password...

C# Syntax - Split String into Array by Comma, Convert To Generic List, and Reverse Order

What is the correct syntax for this: IList<string> names = "Tom,Scott,Bob".Split(',').ToList<string>().Reverse(); What am I messing up? What does TSource mean?...

AngularJS event on window innerWidth size change

I'm looking for a way to watch changes on window inner width size change. I tried the following and it didn't work: $scope.$watch('window.innerWidth', function() { console.log(window.innerWidth); }); any suggestions?...

C++ - struct vs. class

Possible Duplicates: C/C++ Struct vs Class What are POD types in C++? Hi, In the C++ In a Nutshell book, in chapter 6: classes, unders Access specifiers, mentioned the following: In a class definition, the default access for membe...

HTTP headers in Websockets client API

Looks like it's easy to add custom HTTP headers to your websocket client with any HTTP header client which supports this, but I can't find how to do it with the JSON API. Yet, it seems that there should be support these headers in the spec. Anyone...

When and Why to use abstract classes/methods?

I have some basic questions about abstract classes/methods. I know the basic use of abstract classes is to create templates for future classes. But are there any more uses for them? When should you prefer them over interfaces and when not? Also, when...

What does "Could not find or load main class" mean?

A common problem that new Java developers experience is that their programs fail to run with the error message: Could not find or load main class ... What does this mean, what causes it, and how should you fix it?...

How to set the matplotlib figure default size in ipython notebook?

I use "$ipython notebook --pylab inline" to start the ipython notebook. The display matplotlib figure size is too big for me, and I have to adjust it manually. How to set the default size for the figure displayed in cell?...

How do I parse an ISO 8601-formatted date?

I need to parse RFC 3339 strings like "2008-09-03T20:56:35.450686Z" into Python's datetime type. I have found strptime in the Python standard library, but it is not very convenient. What is the best way to do this?...

jquery - is not a function error

Here is my code: (function($){ $.fn.pluginbutton = function (options) { myoptions = $.extend({ left: true }); return this.each(function () { var focus = false; if (focus === false) { this.h...

Radio buttons not checked in jQuery

I have this line of code for page load: if ($("input").is(':checked')) { and it works fine when the radio button input is checked. However, I want the opposite. Something along the lines of if ($("input").not(.is(':checked'))) { so that my i...

PHP function to generate v4 UUID

So I've been doing some digging around and I've been trying to piece together a function that generates a valid v4 UUID in PHP. This is the closest I've been able to come. My knowledge in hex, decimal, binary, PHP's bitwise operators and the like is ...

What's the difference between Thread start() and Runnable run()

Say we have these two Runnables: class R1 implements Runnable { public void run() { … } … } class R2 implements Runnable { public void run() { … } … } Then what's the difference between this: public static void main() { ...

Find files in created between a date range

I use AIX via telnet here at work, and I'd like to know how to find files in a specific folder between a date range. For example: I want to find all files in folder X that were created between 01-Aug-13 and 31-Aug-13. Observations: The touch trick...

Can't append <script> element

Any idea why the piece of code below does not add the script element to the DOM? var code = "<script></script>"; $("#someElement").append(code); ...

Rendering React Components from Array of Objects

I have some data called stations which is an array containing objects. stations : [ {call:'station one',frequency:'000'}, {call:'station two',frequency:'001'} ] I'd like to render a ui component for each array position. So far I can write va...

Hide all elements with class using plain Javascript

I normally use document.getElementById('id').style.display = 'none' to hide a single div via Javascript. Is there a similarly simple way to hide all elements belonging to the same class? I need a plain Javascript solution that does not use jQuery....

Spin or rotate an image on hover

I want to find out how to make a spinning or rotating image when it is hovered. I would like to know how to emulate that functionality with CSS on the following code : _x000D_ _x000D_ img {_x000D_ border-radius: 50%;_x000D_ }_x000D_ <img src="h...

How to schedule a function to run every hour on Flask?

I have a Flask web hosting with no access to cron command. How can I execute some Python function every hour?...

How to use SQL Select statement with IF EXISTS sub query?

How to select Boolean value from sub query with IF EXISTS statement (SQL Server)? It should be something like : SELECT TABEL1.Id, NewFiled = (IF EXISTS(SELECT Id FROM TABLE2 WHERE TABLE2.ID = TABEL1.ID) SELECT 'TRUE' ...

Software Design vs. Software Architecture

Could someone explain the difference between Software Design and Software Architecture? More specifically; if you tell someone to present you the 'design' - what would you expect them to present? Same goes for 'architecture'. My current understand...

usr/bin/ld: cannot find -l<nameOfTheLibrary>

I'm trying to compile my program and it returns this error : usr/bin/ld: cannot find -l<nameOfTheLibrary> in my makefile I use the command g++ and link to my library which is a symbolic link to my library located on an other directory. Is t...

How does facebook, gmail send the real time notification?

I have read some posts about this topic and the answers are comet, reverse ajax, http streaming, server push, etc. How does incoming mail notification on Gmail works? How is GMail Chat able to make AJAX requests without client interaction? I would...

How to parse the Manifest.mbdb file in an iOS 4.0 iTunes Backup

In iOS 4.0 Apple has redesigned the backup process. iTunes used to store a list of filenames associated with backup files in the Manifest.plist file, but in iOS 4.0 it has moved this information to a Manifest.mbdb You can see an example of this f...

Dropping Unique constraint from MySQL table

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

Crop image in PHP

The code below crops the image well, which is what i want, but for larger images, it wotn work as well. Is there any way of 'zooming out of the image' Idealy i would be able to have each image roughly the same size before cropping so that i would ge...

Pick images of root folder from sub-folder

Let's say following is the directory structure of my website : Now in index.html I can simply refer images like: <img src="./images/logo.png"> But I want to refer the same image from sub.html. What should be the src?...

Calculate days between two Dates in Java 8

I know there are lots of questions on SO about how to get Dates in Java, but I want an example using new Java 8 Date API. I also know about the JodaTime library, but I want a method without relying on external libraries. The function needs to be comp...

Evaluating string "3*(4+2)" yield int 18

Is there a function the .NET framework that can evaluate a numeric expression contained in a string and return the result? F.e.: string mystring = "3*(2+4)"; int result = EvaluateExpression(mystring); Console.Writeln(result); // Outputs 18 Is ther...

Format a JavaScript string using placeholders and an object of substitutions?

I have a string with say: My Name is %NAME% and my age is %AGE%. %XXX% are placeholders. We need to substitute values there from an object. Object looks like: {"%NAME%":"Mike","%AGE%":"26","%EVENT%":"20"} I need to parse the object and replace the...

How can I use regex to get all the characters after a specific character, e.g. comma (",")

Need a Regex to get all characters after , (not including it) from a variable. This variable can contain for example 'SELECT___100E___7',24 'SELECT___100E___7',1 'SELECT___100E___7',286 'SELECT___100E___7',5147 Note: There can be any length of ch...

Simple Java Client/Server Program

I'm writing my first java client/server program which just establishes a connection with the server sends it a sentence and the server sends the sentence back all capitalized. This is actually an example straight out of the book, and it works well an...

How do I compile a Visual Studio project from the command-line?

I'm scripting the checkout, build, distribution, test, and commit cycle for a large C++ solution that is using Monotone, CMake, Visual Studio Express 2008, and custom tests. All of the other parts seem pretty straight-forward, but I don't see how ...

Reading specific columns from a text file in python

I have a text file which contains a table comprised of numbers e.g: 5 10 6 6 20 1 7 30 4 8 40 3 9 23 1 4 13 6 if for example I want the numbers contained only in the second column, how do i extract that column into a list?...

How to config routeProvider and locationProvider in angularJS?

I want to active html5Mode in angularJS, but I don't know why it's not working. Is there anything wrong with my code? angular .module('myApp',[]) .config(function($locationProvider, $routeProvider) { $locationProvider.html5Mode(true)...

Different font size of strings in the same TextView

I have a textView inside with a number (variable) and a string, how can I give the number one size larger than the string? the code: TextView size = (TextView)convertView.findViewById(R.id.privarea_list_size); if (ls.numProducts != null) { size....

Javascript: output current datetime in YYYY/mm/dd hh:m:sec format

I need to output the current UTC datetime as a string with the following format: YYYY/mm/dd hh:m:sec How do I achieve that with Javascript?...

parent & child with position fixed, parent overflow:hidden bug

I don't know if there is an issue, but I was wondering why the overflow:hidden does not function on fixed parent/children element. Here's an example: CSS and HTML: _x000D_ _x000D_ .parent{_x000D_ position:fixed;_x000D_ overflow:hidden;_x000D_ ...

CSS word-wrapping in div

I have a div with a width of 250px. When the innertext is wider than that i want it to break down. The div is float: left and now has an overflow. I want the scrollbar to go away by using word-wrapping. How can i achieve this? <div id="Treeview"&...

How to display special characters in PHP

I've seen this asked several times, but not with a good resolution. I have the following string: $string = "<p>Résumé</p>"; I want to print or echo the string, but the output will return <p>R?sum?</p>. So I try htmlspecia...

How to hide Bootstrap previous modal when you opening new one?

I have such trouble: I have authentification which is made using Bootstrap modals. When user opens sign in modal he can go to sign up modal ( or other ) . So, I need to close previous one. Now I'm closing them like this: $(document).ready(functio...

Apache Maven install "'mvn' not recognized as an internal or external command" after setting OS environmental variables?

I've followed the official installation instructions here for Windows XP. But sometimes when I execute mvn --version, I receive the error message, 'mvn' not recognized as an internal or external command I've even rebooted my machine a couple ti...

Using Font Awesome icon for bullet points, with a single list item element

We'd like to be able to use a Font Awesome ( http://fortawesome.github.com/Font-Awesome/ ) icon as a bullet point for unordered lists in a CMS. The text editor on the CMS only outputs raw HTML so additional elements/ classes cannot be added. This m...

Dynamic Height Issue for UITableView Cells (Swift)

Dynamic text of variable length are being injected into tableview cell labels. In order for the tableview cells' heights to be dynamically sized, I have implemented in viewDidLoad(): self.tableView.estimatedRowHeight = 88.0 self.tableView.rowHeight ...

How to consume a SOAP web service in Java

Can someone please help me with some links and other on how to consume a web service WSDL in Java?...

Parameter "stratify" from method "train_test_split" (scikit Learn)

I am trying to use train_test_split from package scikit Learn, but I am having trouble with parameter stratify. Hereafter is the code: from sklearn import cross_validation, datasets X = iris.data[:,:2] y = iris.target cross_validation.train_test_s...

What is the maximum length of a URL in different browsers?

What is the maximum length of a URL in different browsers? Does it differ among browsers? Is a maximum URL length part of the HTTP specification?...

Reliable method to get machine's MAC address in C#

I need a way to get a machine's MAC address, regardless of the OS it is running, by using C#. The application will need to work on XP/Vista/Win7 32bit and 64bit, as well as on those OSs but with a foreign language default. Also, many of the C# comman...

sort csv by column

I want to sort a CSV table by date. Started out being a simple task: import sys import csv reader = csv.reader(open("files.csv"), delimiter=";") for id, path, title, date, author, platform, type, port in reader: print date I used Python's CS...

What command shows all of the topics and offsets of partitions in Kafka?

I'm looking for a Kafka command that shows all of the topics and offsets of partitions. If it's dynamically would be perfect. Right now I'm using java code to see these information, but it's very inconvenient....

python: Appending a dictionary to a list - I see a pointer like behavior

I tried the following in the python interpreter: >>> >>> a = [] >>> b = {1:'one'} >>> a.append(b) >>> a [{1: 'one'}] >>> b[1] = 'ONE' >>> a [{1: 'ONE'}] >>> Here, after append...

How to reverse an animation on mouse out after hover

So, it is possible to have reverse animation on mouse out such as: .class{ transform: rotate(0deg); } .class:hover{ transform: rotate(360deg); } but, when using @keyframes animation, I couldn't get it to work, e.g: .class{ animation-nam...

Reading input files by line using read command in shell scripting skips last line

I usually use the read command to read an input file to the shell script line by line. An example code such as the one below yields a wrong result if a new line isn't inserted at the end of the last line in the input file, blah.txt. #!/bin/sh while...

Makefile: How to correctly include header file and its directory?

I have the following makefile: CC=g++ INC_DIR = ../StdCUtil CFLAGS=-c -Wall -I$(INC_DIR) DEPS = split.h all: Lock.o DBC.o Trace.o %.o: %.cpp $(DEPS) $(CC) -o $@ $< $(CFLAGS) clean: rm -rf *o all This makefile and all three source fil...

Paste Excel range in Outlook

I want to paste a range of cells in Outlook. Here is my code: Sub Mail_Selection_Range_Outlook_Body() Dim rng As Range Dim OutApp As Object Dim OutMail As Object Set rng = Nothing On Error Resume Next ' Only send the visible cells in the selecti...

WELD-001408: Unsatisfied dependencies for type Customer with qualifiers @Default

I'm a Java EE-newbie. I want to test JSF and therefore made a simple program but can not deploy it. I get the following error message: cannot Deploy onlineshop-war deploy is failing=Error occurred during deployment: Exception while loading the app :...

Generate signed apk android studio

I am new to android development and just finished my first app. I want to generate a signed apk in android studio. I read the developer docs but couldn't understand the steps. When I click on Build>Generate Signed APK..., it shows me a dialog box ...

MYSQL: How to copy an entire row from one table to another in mysql with the second table having one extra column?

I have two tables with identical structure except for one column... Table 2 has that additional column in which i would insert the CURRENT_DATE() I would like to copy all the values from table1 to table2. if i use INSERT INTO dues_storage SELECT *...

Matplotlib: ValueError: x and y must have same first dimension

I am trying to fit a linear line of best fit to my matplotlib graph. I keep getting the error that x and y do not have the same first dimension. But they both have lengths of 15. What am I doing wrong? import matplotlib.pyplot as plt from scipy impo...

Escape double quote character in XML

Is there an escape character for a double quote in xml? I want to write a tag like: <parameter name="Quote = " "> but if I put ", then that means string has ended. I need something like this (c++): printf("Quote = \" "); Is there a char...

How to resolve "The requested URL was rejected. Please consult with your administrator." error?

I have a ASP application. On click of a particular link, some VB scripts are executed and an ASP page is to be shown, but instead I get a screen that says: Information Not Available. The requested URL was rejected. Please consult with your admi...

Using for loop inside of a JSP

I want to loop through an ArrayList of "Festivals" and get their information with get methods, printing out all its values. For some reason when I use this code, it will always choose the "0"th value and not increment the loop. If I hard code the va...

Is calling destructor manually always a sign of bad design?

I was thinking: they say if you're calling destructor manually - you're doing something wrong. But is it always the case? Are there any counter-examples? Situations where it is neccessary to call it manually or where it is hard/impossible/impractical...

Use jQuery to navigate away from page

I will only have a relative link available to me but I want to use jQuery to navigate to this rel link. I only see AJAX functionality in jQuery. How can I do this using jQuery or just pure HTML/JavaScript?...

Check if a value is in an array or not with Excel VBA

I've got some code below, that is supposed to be checking if a value is in an Array or not. Sub test() vars1 = Array("Examples") vars2 = Array("Example") If IsInArray(Range("A1").Value, vars1) Then x = 1 End If If IsInAr...

Reverse a string without using reversed() or [::-1]?

I came across a strange Codecademy exercise that required a function that would take a string as input and return it in reverse order. The only problem was you could not use the reversed method or the common answer here on stackoverflow, [::-1]. Obv...

How do you copy a record in a SQL table but swap out the unique id of the new row?

This question comes close to what I need, but my scenario is slightly different. The source table and destination table are the same and the primary key is a uniqueidentifier (guid). When I try this: insert into MyTable select * from MyTable whe...

Sending images using Http Post

I want to send an image from the android client to the Django server using Http Post. The image is chosen from the gallery. At present, I am using list value name Pairs to send the necessary data to the server and receiving responses from Django in J...

Setting default values to null fields when mapping with Jackson

I am trying to map some JSON objects to Java objects with Jackson. Some of the fields in the JSON object are mandatory(which I can mark with @NotNull) and some are optional. After the mapping with Jackson, all the fields that are not set in the JSON...

Why does instanceof return false for some literals?

"foo" instanceof String //=> false "foo" instanceof Object //=> false true instanceof Boolean //=> false true instanceof Object //=> false false instanceof Boolean //=> false false instanceof Object //=> false ...

Simple WPF RadioButton Binding?

What is the simplest way to bind a group of 3 radiobuttons to a property of type int for values 1, 2, or 3?...

doGet and doPost in Servlets

I've developed an HTML page that sends information to a Servlet. In the Servlet, I am using the methods doGet() and doPost(): public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String id ...

mysqli::query(): Couldn't fetch mysqli

Warning: mysqli::query(): Couldn't fetch mysqli in C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\data\localweb\my portable files\class_EventCalendar.php on line 43 The following is my connection file: <?php if(!isset($_SESSION)) { s...

I would like to see a hash_map example in C++

I don't know how to use the hash function in C++, but I know that we can use hash_map. Does g++ support that by simply including #include <hash_map>? What is a simple example using hash_map?...

Tomcat won't stop or restart

I tried stopping tomcat. It failed with this message: Tomcat did not stop in time. PID file was not removed. I then tried again and got this: PID file (/opt/tomcat/work/catalina.pid) found but no matching process was found. Stop aborted. I t...

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

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

Command to close an application of console?

I need to close the console when the user selects a menu option. I tried using close() but it did not work.. how can I do this?...

failed to open stream: HTTP wrapper does not support writeable connections

I have uploaded my localhost files to my website but it is showing me this error:- : [2] file_put_contents( ***WebsiteURL*** /cache/lang/ ***FileName*** .php) [function.file-put-contents]: failed to open stream: HTTP wrapper does not support write...

Find number of decimal places in decimal value regardless of culture

I'm wondering if there is a concise and accurate way to pull out the number of decimal places in a decimal value (as an int) that will be safe to use across different culture info? For example: 19.0 should return 1, 27.5999 should return 4, 19.12 sh...

Access restriction: Is not accessible due to restriction on required library ..\jre\lib\rt.jar

I am trying to modify some legacy code from while back and getting the following kind of errors: Access restriction: The method create(JAXBRIContext, Object) from the type Headers is not accessible due to restriction on required library ..\jre\lib\r...

Chrome javascript debugger breakpoints don't do anything?

I can't seem to figure out the Chrome debugging tool. I have chrome version 21.0.1180.60 m. Steps I took: I pressed ctrl-shift-i to bring up the console. Clicked on Sources then select the relevant javascript file that I want to debug. I set brea...

How to kill all active and inactive oracle sessions for user

I am trying the below script to kill all active and inactive oracle sessions for user at once but it doesn't work. The script executes successfully but does not kill sessions for user. BEGIN FOR r IN (select sid,serial# from v$session where userna...

How to set UICollectionViewCell Width and Height programmatically

I am trying to implement a CollectionView. When I am using Autolayout, my cells won't change the size, but their alignment. Now I would rather want to change their sizes to e.g. //var size = CGSize(width: self.view.frame.width/10, height: self.view...

Exception in thread "main" java.lang.UnsupportedClassVersionError: a (Unsupported major.minor version 51.0)

Possible Duplicate: unsupported major .minor version 51.0 I installed JDK7, a simple hello word program gets compile but when I run this I got following exception. Exception in thread "main" java.lang.UnsupportedClassVersionError: a (Unsu...

How to draw a rounded Rectangle on HTML Canvas?

I found that there are only can fill rectangle, but no rounded corner one, how can I do that?...

Add Twitter Bootstrap icon to Input box

How can we add a Twitter Bootstrap icon icon-search to the right of a text input element? The following attempt placed all the icons inside the input element, how can we crop it so it only displays the icon for icon-search? Current Attempt CSS ...

Detect browser or tab closing

Is there any cross-browser JavaScript/jQuery code to detect if the browser or a browser tab is being closed, but not due to a link being clicked?...

C++ equivalent of java's instanceof

What is the preferred method to achieve the C++ equivalent of java's instanceof?...

When should I use double or single quotes in JavaScript?

console.log("double"); vs. console.log('single'); I see more and more JavaScript libraries out there using single quotes when handling strings. What are the reasons to use one over the other? I thought they're pretty much interchangeable....

What does it mean: The serializable class does not declare a static final serialVersionUID field?

I have the warning message given in the title. I would like to understand and remove it. I found already some answers on this question but I do not understand these answers because of an overload with technical terms. Is it possible to explain this i...

IF EXISTS in T-SQL

If we have a SELECT statement inside an IF EXISTS, does the execution stop as soon as it finds a record in the table? For example: IF EXISTS(SELECT * FROM table1 WHERE Name='John' ) return 1 else return 0 If a row exists in the table with th...

What's the best practice to "git clone" into an existing folder?

I have a working copy of the project, without any source control meta data. Now, I'd like to do the equivalent of git-clone into this folder, and keep my local changes. git-clone doesn't allow me to clone into an existing folder. What is the best pr...

What is 'Currying'?

I've seen references to curried functions in several articles and blogs but I can't find a good explanation (or at least one that makes sense!)...

How to git commit a single file/directory

Tried the following command: git commit path/to/my/file.ext -m 'my notes' Receive an error in git version 1.5.2.1: error: pathspec '-m' did not match any file(s) known to git. error: pathspec 'MY MESSAGE' did not match any file(s) known to git. ...

#pragma pack effect

I was wondering if someone could explain to me what the #pragma pack preprocessor statement does, and more importantly, why one would want to use it. I checked out the MSDN page, which offered some insight, but I was hoping to hear more from people ...

How do I prevent 'git diff' from using a pager?

Is there a command line switch to pass to git diff and other commands that use the less pager by default? I know I can pipe it to cat, but that removes all the syntax highlighting. I know I can set the pager in the global .gitconfig to cat by GITPA...

space between divs - display table-cell

I have here two divs: <div style="display:table-cell" id="div1"> content </div> <div style="display:table-cell" id="div2"> content </div> Is there a way to make space between these two divs (that have display:table...

Jquery-How to grey out the background while showing the loading icon over it

I'm trying to grey out the background when a user clicks on the submit button and show the loading icon over the greyed background. below is the icon im trying to show, however I'm not able to show the animation, the icon just stays still. Here ...

iOS Detection of Screenshot?

The app Snapchat, on the App Store, is an app that lets you share pictures with a self-destruct on them. You can only view the pics for X seconds. If you attempt to take a screenshot while the picture is showing using the home-power key combo, it wil...

Delete multiple objects in django

I need to select several objects to be deleted from my database in django using a webpage. There is no category to select from so I can't delete from all of them like that. Do I have to implement my own delete form and process it in django or does dj...

Check table exist or not before create it in Oracle

Trying to check is table exist before create in Oracle. Search for most of the post from Stackoverflow and others too. Find some query but it didn't work for me. IF((SELECT count(*) FROM dba_tables where table_name = 'EMPLOYEE') <= 0) THEN create...

Python: Figure out local timezone

I want to compare UTC timestamps from a log file with local timestamps. When creating the local datetime object, I use something like: >>> local_time=datetime.datetime(2010, 4, 27, 12, 0, 0, 0, tzinfo=pytz....

How to get StackPanel's children to fill maximum space downward?

I simply want flowing text on the left, and a help box on the right. The help box should extend all the way to the bottom. If you take out the outer StackPanel below it works great. But for reasons of layout (I'm inserting UserControls dynamically...

$rootScope.$broadcast vs. $scope.$emit

Now that the performance difference between $broadcast and $emit has been eliminated, is there any reason to prefer $scope.$emit to $rootScope.$broadcast? They are different, yes. $emit is restricted to the scope hierarchy (upwards) - this may be ...

XPath to return only elements containing the text, and not its parents

In this xml, I want to match, the element containing 'match' (random2 element) <root> <random1> <random2>match</random2> <random3>nomatch</random3> </random1> </root> ok, so far I have: //[re:...

Datatable select method ORDER BY clause

HI, I 'm trying to sort the rows in my datatable using select method. I know that i can say datatable.select("col1='test'") which in effect is a where clause and will return n rows that satisfy the condition. I was wondering can i do the followi...

How to verify a method is called two times with mockito verify()

I want to verify if a method is called at least once through mockito verify. I used verify and it complains like this: org.mockito.exceptions.verification.TooManyActualInvocations: Wanted 1 time: But was 2 times. Undesired invocation: ...

How to alert using jQuery

This works: $('.overdue').addClass('alert'); But this doesn't: $('.overdue').alert('Your book is overdue.'); What is the correct jQuery syntax for: FOR EACH CLASS="overdue" alert('Your book is overdue'); NEXT ...

Understanding [TCP ACKed unseen segment] [TCP Previous segment not captured]

We are doing some load testing on our servers and I'm using tshark to capture some data to a pcap file then using the wireshark GUI to see what errors or warnings are showing up by going to Analyze -> expert Info with my pcap loaded in.. I'm seeing ...

How to set selected value on select using selectpicker plugin from bootstrap

I'm using the Bootstrap-Select plugin like this: HTML: <select name="selValue" class="selectpicker"> <option value="1">Val 1</option> <option value="2">Val 2</option> <option value="3">Val 3</option&g...

Web scraping with Java

I'm not able to find any good web scraping Java based API. The site which I need to scrape does not provide any API as well; I want to iterate over all web pages using some pageID and extract the HTML titles / other stuff in their DOM trees. Are the...

How to define custom configuration variables in rails

I was wondering how to add custom configuration variables to a rails application and how to access them in the controller, for e.g I wanna be able to define an upload_directory in the configuration files say development.rb and be able to access it in...

How to examine processes in OS X's Terminal?

I’d like to view information for processes running in OS X. Running ps in the terminal just lists the open Terminal windows. How can I see all processes that are running? Say I’m running a web browser, terminal and text editor. I’d like to see...

keytool error bash: keytool: command not found

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

Get program path in VB.NET?

How can I get the absolute path of program I'm running?...

Unit tests vs Functional tests

What is the difference between unit tests and functional tests? Can a unit test also test a function?...

How do I get an apk file from an Android device?

How do I get the apk file from an android device? Or how do I transfer the apk file from device to system?...

MySQL stored procedure vs function, which would I use when?

I'm looking at MySQL stored procedures and function. What is the real difference? They seem to be similar, but a function has more limitations. I'm likely wrong, but it seems a stored procedure can do everything and more a stored function can. Why...

How can I get color-int from color resource?

Is there any way to get a color-int from a color resource? I am trying to get the individual red, blue and green components of a color defined in the resource (R.color.myColor) so that I can set the values of three seekbars to a specific level....

Use IntelliJ to generate class diagram

How do I get IntelliJ 10.5 (on the Mac) to generate a class diagram showing all of the classes in my project? I'm sure I'm overlooking something obvious, but I can only get the "Show Diagram" feature to show one class at a time. (I also figured out...

@Cacheable key on multiple method arguments

From the spring documentation : @Cacheable(value="bookCache", key="isbn") public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed) How can I specify @Cachable to use isbn and checkWarehouse as key?...

How can I solve ORA-00911: invalid character error?

I tried to execute an SQL INSERT with Toad for oracle: INSERT INTO GRAT_ACTIVITY (UUID, IP_ADRESS, SEND_MAIL, DATE_CREA, DATE_UPD, CREATOR, CENTER, ETAT, REQUEST) VALUES('555-vgd9-pllkd-5513', '172.12.23.130', 'N', SYSDATE, SYSDATE, '1554', 'M18...

run program in Python shell

I have a demo file: test.py. In the Windows Console I can run the file with: C:\>test.py How can I execute the file in the Python Shell instead?...

read file from assets

public class Utils { public static List<Message> getMessages() { //File file = new File("file:///android_asset/helloworld.txt"); AssetManager assetManager = getAssets(); InputStream ims = assetManager.open("helloworl...

Returning Promises from Vuex actions

I recently started migrating things from jQ to a more structured framework being VueJS, and I love it! Conceptually, Vuex has been a bit of a paradigm shift for me, but I'm confident I know what its all about now, and totally get it! But there exist...

What's the difference between lists and tuples?

What's the difference? What are the advantages / disadvantages of tuples / lists?...

Hide axis and gridlines Highcharts

I am trying to hide the axis and gridlines of my Highcharts chart entirely. So far I have tried to set the width of the lines to 0, but it didn't work out. xAxis: { lineWidth: 0, minorGridLineWidth: 0, lineColor: 'transparent' } Is it possib...

Query to get only numbers from a string

I have data like this: string 1: 003Preliminary Examination Plan string 2: Coordination005 string 3: Balance1000sheet The output I expect is string 1: 003 string 2: 005 string 3: 1000 And I want to implement it in SQL....

Determining Referer in PHP

What is the most reliable and secure way to determine what page either sent, or called (via AJAX), the current page. I don't want to use the $_SERVER['HTTP_REFERER'], because of the (lack of) reliability, and I need the page being called to only co...

PHP Check for NULL

Here is the below Code: $query = mysql_query("SELECT * FROM tablex"); if ($result = mysql_fetch_array($query)){ if ($result['column'] == NULL) { print "<input type='checkbox' />"; } else { print "<input type='checkbox' checked /&g...

Using NULL in C++?

Possible Duplicate: Do you use NULL or 0 (zero) for pointers in C++? Is it a good idea to use NULL in C++ or just the value 0? Is there a special circumstance using NULL in C code calling from C++? Like SDL?...

How to remove folders with a certain name

In Linux, how do I remove folders with a certain name which are nested deep in a folder hierarchy? The following paths are under a folder and I would like to remove all folders named a. 1/2/3/a 1/2/3/b 10/20/30/a 10/20/30/b 100/200/300/a 100/200/...

Remove First and Last Character C++

How to remove first and last character from std::string, I am already doing the following code. But this code only removes the last character m_VirtualHostName = m_VirtualHostName.erase(m_VirtualHostName.size() - 1) How to remove the first charac...

How to fit in an image inside span tag?

I have an image inside a span tag. But the problem is the image doesn't fit inside the span tag. Instead a part of the image goes out of the span tag. <span style="padding-right:3px; padding-top: 3px;"> <img class="manImg" src...

converting a javascript string to a html object

can I convert a string to a html object? like: string s = '<div id="myDiv"></div>'; var htmlObject = s.toHtmlObject; so that i can later on get it by id and do some changing in its style var ho = document.getElementById("myDiv").style...

Extract regression coefficient values

I have a regression model for some time series data investigating drug utilisation. The purpose is to fit a spline to a time series and work out 95% CI etc. The model goes as follows: id <- ts(1:length(drug$Date)) a1 <- ts(drug$Rate) a2 <- ...

How to determine if string contains specific substring within the first X characters

I want to check whether Value1 below contains "abc" within the first X characters. How would you check this with an if statement? var Value1 = "ddabcgghh"; if (Value1.Contains("abc")) { found = true; } It could be within the first 3, 4 or 5 c...

How to use the curl command in PowerShell?

Am using the curl command in PowerShell to post the comment in bit-bucket pull request page through a Jenkins job. I used the below PowerShell command to execute the curl command, but am getting the error mentioned below. Could anyone please help me ...

How to change background Opacity when bootstrap modal is open

I am using bootstrap modal. When modal is open background content opacity is not changed by default. I tried changing in js using function showModal() { document.getElementById("pageContent").style.opacity = "0.5"; } This is working but whenever...

Set QLineEdit to accept only numbers

I have a QLineEdit where the user should input only numbers. So is there a numbers-only setting for QLineEdit?...

R error "sum not meaningful for factors"

I have a file called rRna_RDP_taxonomy_phylum with the following data : 364 "Firmicutes" 39.31 244 "Proteobacteria" 26.35 218 "Actinobacteria" 23.54 65 "Bacteroidetes" 7.02 22 "Fusobacteria" 2.38 6 ...

Disable all table constraints in Oracle

How can I disable all table constrains in Oracle with a single command? This can be either for a single table, a list of tables, or for all tables....

The simplest possible JavaScript countdown timer?

Just wanted to ask how to create the simplest possible countdown timer. There'll be a sentence on the site saying: "Registration closes in 05:00 minutes!" So, what I want to do is to create a simple js countdown timer that goes from "05:00" t...

Foreach value from POST from form

I post some data over to another page from a form. It's a shopping cart, and the form that's being submitted is being generated on the page before depending on how many items are in the cart. For example, if there's only 1 items then we only have the...

Select statement to find duplicates on certain fields

Can you help me with SQL statements to find duplicates on multiple fields? For example, in pseudo code: select count(field1,field2,field3) from table where the combination of field1, field2, field3 occurs multiple times and from the above state...

How to get complete current url for Cakephp

How do you echo out current URL in Cake's view?...

What is the difference between `Enum.name()` and `Enum.toString()`?

After reading the documentation of String java.lang.Enum.name() I am not sure I understand when to use name() and when to use toString(). Returns the name of this enum constant, exactly as declared in its enum declaration. Most programmers should...

Is there a limit to the length of a GET request?

Is there a limit to the length of a GET request?...

How to remove a web site from google analytics

I am Administrator of several web sites on google analytics. Can i delete some of them? If yes, how? Many of you suggested me to remove my profile. So my doubts are: 1. I am administrator of several items. I want remove just some of them....

How to get Wikipedia content using Wikipedia's API?

I want to get the first paragraph of a Wikipedia article. What is the API query to do so?...

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: dataURLToBlob: function(dataURL) { var BASE64_MARKER...

$(window).height() vs $(document).height

I am having problem of getting wrong height with $(window).height(); and got the similar question here In my case when I try $(document).height(); it seems to return me correct result window height returns 320 while document height return...

Is there a way to check for both `null` and `undefined`?

Since TypeScript is strongly-typed, simply using if () {} to check for null and undefined doesn't sound right. Does TypeScript have any dedicated function or syntax sugar for this?...

How do you determine what SQL Tables have an identity column programmatically

I want to create a list of columns in SQL Server 2005 that have identity columns and their corresponding table in T-SQL. Results would be something like: TableName, ColumnName...

Why use @Scripts.Render("~/bundles/jquery")

How does @Scripts.Render("~/bundles/jquery") differ from just referencing the script from html like this <script src="~/bundles/jquery.js" type="text/javascript"></script> Are there any performance gains?...

Xcode warning: "Multiple build commands for output file"

I am getting an error like this: [WARN]Warning: Multiple build commands for output file /Developer/B/Be/build/Release-iphonesimulator/BB.app/no.png [WARN]Warning: Multiple build commands for output file /Developer/B/Be/build/Release-iphonesimulator/...

Waiting for HOME ('android.process.acore') to be launched

I tried working the Hello World application and the emulator freezes after it flashes the Android start screen. The home page is not shown. The last display on the console is Waiting for HOME ('android.process.acore') to be launched... I tried...

Concatenate two slices in Go

I'm trying to combine the slice [1, 2] and the slice [3, 4]. How can I do this in Go? I tried: append([]int{1,2}, []int{3,4}) but got: cannot use []int literal (type []int) as type int in append However, the documentation seems to indicate thi...

Android - Package Name convention

For the "Hello World" example in android.com, the package name is "package com.example.helloandroid;" Is there any guideline/standard to name this package? (references would be nice)...

JPA or JDBC, how are they different?

I am learning Java EE and I downloaded the eclipse with glassfish for the same. I saw some examples and also read the Oracle docs to know all about Java EE 5. Connecting to a database was very simple. I opened a dynamic web project, created a session...

Create empty data frame with column names by assigning a string vector?

Create an empty data frame: y <- data.frame() Assign x, a string vector, to y as its column names: x <- c("name", "age", "gender") colnames(y) <- x Result: Error in colnames<-(*tmp*, value = c(...

Depend on a branch or tag using a git URL in a package.json?

Say I've forked a node module with a bugfix and I want to use my fixed version, on a feature branch of course, until the bugfix is merged and released. How would I reference my fixed version in the dependencies of my package.json?...

CSS On hover show another element

I want to use CSS to show div id='b' when I hover over div id='a', but I cannot figure out how to do it because the div 'a' is inside another div that div 'b' is not in. <div id='content'> <div id='a'> Hover me </di...

this is error ORA-12154: TNS:could not resolve the connect identifier specified?

I've this code : OracleConnection con = new OracleConnection("data source=localhost;user id=fastecit;password=fastecit"); con.Open(); string sql="Select userId from tblusers"; OracleCommand cmd = new OracleCommand(sql, con); OracleDataReader dr...

Proper usage of Optional.ifPresent()

I am trying to understand the ifPresent() method of the Optional API in Java 8. I have simple logic: Optional<User> user=... user.ifPresent(doSomethingWithUser(user.get())); But this results in a compilation error: ifPresent(java.util.fun...

How to display an image from a path in asp.net MVC 4 and Razor view?

I have the following model: public class Player { public String ImagePath { get { return "~/Content/img/sql_error.JPG"; } } And, this is my .cshtml file: @model SoulMasters.Models.Game.Player @{...

Can I install the "app store" in an IOS simulator?

The IOS simulator in my computer doesn't have app store. I want to use the app store to test a program I wrote on my simulator. Is it possible to install the app store in my simulator?...

Join/Where with LINQ and Lambda

I'm having trouble with a query written in LINQ and Lambda. So far, I'm getting a lot of errors here's my code: int id = 1; var query = database.Posts.Join(database.Post_Metas, post => database.Posts.Where(x => ...

get dictionary value by key

How can I get the dictionary value by key on function my function code is this ( and the command what I try but didn't work ): static void XML_Array(Dictionary<string, string> Data_Array) { String xmlfile = Data_Array.TryGetValue("XML_Fil...

Mercurial: how to amend the last commit?

I'm looking for a counter-part of git commit --amend in Mercurial, i.e. a way to modify the commit which my working copy is linked to. I'm only interested in the last commit, not an arbitrary earlier commit. The requirements for this amend-procedure...

How to open local file on Jupyter?

In[1]: path='/Users/apple/Downloads/train.csv' open(path).readline() Out[1]: FileNotFoundError Traceback (most recent call last) <ipython-input-7-7fad5faebc9b> in <module>() ----> 1 open(path).readline() F...

How do I uninstall a package installed using npm link?

When installing a node package using sudo npm link in the package's directory, how can I uninstall the package once I'm done with development? npm link installs the package as a symbolic link in the system's global package location ('/usr/local/lib`...

Java system properties and environment variables

What's the difference between system properties System.getProperties() and environment variables System.getenv() in a JVM?...

Wordpress - Images not showing up in the Media Library

I have a huge problem with my Wordpress. My uploaded images don't list in the Media Library. It is weird tho, it says I have 75 images, but display none. Take a look yourself. Even weirder, if I go into gallery (the images you uploaded in the pag...

How to create a floating action button (FAB) in android, using AppCompat v21?

I would like to create a floating action button (to add items to a listview), like google calendar, maintaining compatibility with pre-lollipop Android versions (before 5.0). I created this layout: Activity main_activity.xml: <LinearLayout ... ...

Matplotlib figure facecolor (background color)

Can someone please explain why the code below does not work when setting the facecolor of the figure? import matplotlib.pyplot as plt # create figure instance fig1 = plt.figure(1) fig1.set_figheight(11) fig1.set_figwidth(8.5) rect = fig1.patch rec...

What does the explicit keyword mean?

What does the explicit keyword mean in C++?...

Matplotlib - Move X-Axis label downwards, but not X-Axis Ticks

I'm using Matplotlib to plot a histogram. Using tips from my previous question: Matplotlib - label each bin, I've more or less go the kinks worked out. There's one final issue - previously - the x-axis label ("Time (in milliseconds)") was being rend...

How can I create an object and add attributes to it?

I want to create a dynamic object (inside another object) in Python and then add attributes to it. I tried: obj = someobject obj.a = object() setattr(obj.a, 'somefield', 'somevalue') but this didn't work. Any ideas? edit: I am setting the attr...

Leader Not Available Kafka in Console Producer

I am trying to use Kafka. All configurations are done properly but when I try to produce message from console I keep getting the following error WARN Error while fetching metadata with correlation id 39 : {4-3-16-topic1=LEADER_NOT_AVAILABLE} (...

Proper way to get page content

I have to get specific page content (like page(12)) I used that : <?php $id=47; $post = get_page($id); echo $post->post_content; ?> Work nice execpt for compatibility with translations, it returns both French and English text But t...

Why am I getting AttributeError: Object has no attribute

I have a class MyThread. In that I have a method sample. I am trying to run it from within the same object context. Please have a look at the code: class myThread (threading.Thread): def __init__(self, threadID, name, counter, redisOpsObj): ...

How to Call VBA Function from Excel Cells?

I am a VBA newbie, and I am trying to write a function that I can call from Excel cells, that can open a workbook that's closed, look up a cell value, and return it. So far I know how to write a macro like this: Sub OpenWorkbook() Dim path As S...

How to combine paths in Java?

Is there a Java equivalent for System.IO.Path.Combine() in C#/.NET? Or any code to accomplish this? This static method combines one or more strings into a path....

DataGridView changing cell background color

I have the following code : private void dgvStatus_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) { foreach (DataGridViewRow row in dgvStatus.Rows) { row.Cells[color.Index].Style.BackColor = Color.FromArgb...

How to conditional format based on multiple specific text in Excel

I have a spreadsheet that i use to determine when/what clients to contact when an issue arises. in the first workbook i insert a column every day and paste in information about any questionable habits from clients, including a client ID. unfortunatel...

Round up value to nearest whole number in SQL UPDATE

I'm running SQL that needs rounding up the value to the nearest whole number. What I need is 45.01 rounds up to 46. Also 45.49 rounds to 46. And 45.99 rounds up to 46, too. I want everything up one whole digit. How do I achieve this in an UPDATE st...

Number input type that takes only integers?

I'm using the jQuery Tools Validator which implements HTML5 validations through jQuery. It's been working great so far except for one thing. In the HTML5 specification, the input type "number" can have both integers and floating-point numbe...

error C2220: warning treated as error - no 'object' file generated

I have below class class Cdata12Mnt { public: char IOBname[ID1_IOB_PIOTSUP-ID1_IOB_TOP][BOADNAM_MAX + 4]; char ExIOBname[ID1_MAX_INF-ID1_EXIOB_U1TOP][BOADNAM_MAX + 4]; char cflpath[256]; char basetext[256]; UINT database[ID1_MAX_...

How to delete large data of table in SQL without log?

I have a large data table. There are 10 million records in this table. What is the best way for this query Delete LargeTable where readTime < dateadd(MONTH,-7,GETDATE()) ...

Why should I use an IDE?

In another question, Mark speaks highly of IDEs, saying "some people still just dont know "why" they should use one...". As someone who uses vim for programming, and works in an environment where most/all of my colleagues use either vim or emacs for...

X-Frame-Options Allow-From multiple domains

I have an ASP.NET 4.0 IIS7.5 site which I need secured using the X-Frame-Options header. I also need to enable my site pages to be iframed from my same domain as well as from my facebook app. Currently I have my site configured with a site headed o...

Node JS Promise.all and forEach

I have an array like structure that exposes async methods. The async method calls return array structures that in turn expose more async methods. I am creating another JSON object to store values obtained from this structure and so I need to be caref...

Windows batch script to move files

I need to move files from one directory to another in windows, and I need to write this in a batch script. We have written a SQL job where backup files will be created every 4 hours on the D: drive and last 4 backup files will be saved and others wi...

Counting repeated elements in an integer array

I have an integer array crr_array and I want to count elements, which occur repeatedly. First, I read the size of the array and initialize it with numbers read from the console. In the array new_array, I store the elements that are repeated. The arra...

How to make the HTML link activated by clicking on the <li>?

I have the following markup, <ul id="menu"> <li><a href="#">Something1</a></li> <li><a href="#">Something2</a></li> <li><a href="#">Something3</a></...

Turning Sonar off for certain code

Is it possible to turn off sonar (www.sonarsource.org) measurements for specific blocks of code, which one doesn't want to be measured? An example is the "Preserve Stack Trace" warning which Findbugs outputs. When leaving the server, I might well w...

javascript regex for password containing at least 8 characters, 1 number, 1 upper and 1 lowercase

I am trying to write a regular expression to validate a password which must meet the following criteria: Contain at least 8 characters contain at least 1 number contain at least 1 lowercase character (a-z) contain at least 1 uppercase character (A...

Changing Vim indentation behavior by file type

Could someone explain to me in simple terms the easiest way to change the indentation behavior of Vim based on the file type? For instance, if I open a Python file it should indent with 2 spaces, but if I open a Powershell script it should use 4 spac...

Aligning text and image on UIButton with imageEdgeInsets and titleEdgeInsets

I would like to place an icon left of the two lines of text such that there's about 2-3 pixels of space between the image and the start of text. The control itself is Center aligned horizontally (set through Interface Builder) The button would resem...

Evenly distributing n points on a sphere

I need an algorithm that can give me positions around a sphere for N points (less than 20, probably) that vaguely spreads them out. There's no need for "perfection", but I just need it so none of them are bunched together. This question provided go...

MySQL - Make an existing Field Unique

I have an already existing table with a field that should be unique but is not. I only know this because an entry was made into the table that had the same value as another, already existing, entry and this caused problems. How do I make this field...

RecyclerView expand/collapse items

I want to expand/collapse the items of my recyclerView in order to show more info. I want to achieve the same effect of the SlideExpandableListView. Basically in my viewHolder I have a view that is not visible and I want to do a smooth expand/colla...

Rollback transaction after @Test

First of all, I've found a lot of threads on StackOverflow about this, but none of them really helped me, so sorry to ask possibly duplicate question. I'm running JUnit tests using spring-test, my code looks like this @RunWith(SpringJUnit4ClassRunn...

Pythonic way to find maximum value and its index in a list?

If I want the maximum value in a list, I can just write max(List), but what if I also need the index of the maximum value? I can write something like this: maximum=0 for i,value in enumerate(List): if value>maximum: maximum=value ...

Bootstrap alert in a fixed floating div at the top of page

I have a web application which uses Bootstrap (2.3.2 - corporate policy, we cannot upgrade to 3.0 without lots of testing across several web applications). We have several long pages within this application that require validation of forms and tables...

How to create User/Database in script for Docker Postgres

I have been trying to set up a container for a development postgres instance by creating a custom user & database. I am using the official postgres docker image. In the documentation it instructs you to insert a bash script inside of the /docker-...

change cursor to finger pointer

I have this a and I don't know that I need to insert into the "onmouseover" so that the cursor will change to finger pointer like a regular link: <a class="menu_links" onclick="displayData(11,1,0,'A')" onmouseover=""> A </a> I read som...

How to remove td border with html?

html <table border="1"> <tr> <td>one</td> <td>two</td> </tr> <tr> <td>one</td> <td>two</td> </tr> </table> This will output borders like this...

Change the location of the ~ directory in a Windows install of Git Bash

I am not even sure I am asking the right question. Let me explain my situation: This is about Git on Windows 7. My company sets up the Windows user directory on a network drive, not on the local hard drive (for backup and other purposes beyond...

Difference between Fact table and Dimension table?

When reading a book for business objects, I came across the term- fact table and dimension table. I am trying to understand what is the different between Dimension table and Fact table? I read couple of articles on the internet but I was not able ...

enum to string in modern C++11 / C++14 / C++17 and future C++20

Contrary to all other similar questions, this question is about using the new C++ features. 2008 c Is there a simple way to convert C++ enum to string? 2008 c Easy way to use variables of enum types as string in C? 2008 c++ How to easily map c++ enu...

mysql command for showing current configuration variables

Can not find a command that displays the current configuration of mysql from within the database. I know I could look at /etc/mysql/my.cnf but that is not what I need....

Download files from server php

I have a URL where I save some projects from my work, they are mostly MDB files, but some JPG and PDF are there too. What I need to do is to list every file from that directory (already done) and give the user the option to download it. How is that...

What's the difference between StaticResource and DynamicResource in WPF?

When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources <Rectangle Fill="{StaticResource MyBrush}" /> or as a DynamicResource <ItemsControl ItemTemplate="{DynamicResource MyItem...

On - window.location.hash - Change?

I am using Ajax and hash for navigation. Is there a way to check if the window.location.hash changed like this? http://example.com/blah#123 to http://example.com/blah#456 It works if I check it when the document loads. But if I have #hash based ...

How to check if an array value exists?

How can I check if $something['say'] has the value of 'bla' or 'omg'? $something = array('say' => 'bla', 'say' => 'omg'); ...

Java integer to byte array

I got an integer: 1695609641 when I use method: String hex = Integer.toHexString(1695609641); system.out.println(hex); gives: 6510f329 but I want a byte array: byte[] bytearray = new byte[] { (byte) 0x65, (byte)0x10, (byte)0xf3, (byte)0x29}...

Get current user id in ASP.NET Identity 2.0

I just switched over to using the new 2.0 version of the Identity Framework. In 1.0 I could get a user object by using manager.FindByIdAsync(User.Identity.GetUserId()). The GetUserId() method does not seem to exists in 2.0. Now all I can figure ou...

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 what I would like to do ideally } I can't use Ctr...

When is each sorting algorithm used?

What are the use cases when a particular sorting algorithm is preferred over others - merge sort vs QuickSort vs heapsort vs 'intro sort', etc? Is there a recommended guide in using them based on the size, type of data structure, available memory an...

React Native fixed footer

I try to create react native app that looks like existing web app. I have a fixed footer at bottom of window. Do anyone have idea how this can be achieved with react native? in existing app it's simple: .footer { position: fixed; bottom: 0; } ...

failed to lazily initialize a collection of role

Hi I have two classes like this: public class Indicator implements Serializable { ... @OneToMany(mappedBy = "indicator",fetch=FetchType.LAZY) private List<IndicatorAlternateLabel> indicatorAlternateLabels; public List<Indicat...

Maven- No plugin found for prefix 'spring-boot' in the current project and in the plugin groups

I am trying to build a springboot project I built with Spring Tools Suite. I get the following error when I execute $mvn spring-boot:run Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml Downloading: https://rep...

TabLayout tab selection

How should I select a tab in TabLayout programmatically? TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); ...

Reloading a ViewController

I have a View controller displaying some information (not table views). I have an update call to a remote server which fills my data base. I would like to completely reload my ViewController after the update call is done. What should I do?...

How can I scale the content of an iframe?

How can I scale the content of an iframe (in my example it is an HTML page, and is not a popup) in a page of my web site? For example, I want to display the content that appears in the iframe at 80% of the original size....

TypeError: ObjectId('') is not JSON serializable

My response back from MongoDB after querying an aggregated function on document using Python, It returns valid response and i can print it but can not return it. Error: TypeError: ObjectId('51948e86c25f4b1d1c0d303c') is not JSON serializable Pri...

Is it safe to clean docker/overlay2/

I got some docker containers running on AWS EC2, the /var/lib/docker/overlay2 folder grows very fast in disk size. I'm wondering if it is safe to delete its content? or if docker has some kind of command to free up some disk usage. UPDATE: I act...

How to get current route in Symfony 2?

How do I get the current route in Symfony 2? For example, routing.yml: somePage: pattern: /page/ defaults: { _controller: "AcmeBundle:Test:index" } How can I get this somePage value?...

Oracle SQL query for Date format

I always get confused with date format in ORACLE SQL query and spend minutes together to google, Can someone explain me the simplest way to tackle when we have different format of date in database table ? for instance i have a date column as ES_DATE...

How to validate a credit card number

I just want to validate a credit card number in the JavaScript code. I have used a regular expression for digit numbers, but I don't know why it is not working! Here is my function as per below: function validate_creditcardnumber() { var re16di...

How can I get stock quotes using Google Finance API?

I'm looking for access to financial data from Google services. I found this URL that gets the stock data for Microsoft. What are all the possible parameters that Google allows for this kind of HTTP request? I'd like to see all the different inform...

CSS change button style after click

I was wondering if there was a way to change a button's style, in css, after it's been clicked, so not a element:active. Thanks!...

How to open, read, and write from serial port in C?

I am a little bit confused about reading and writing to a serial port. I have a USB device in Linux that uses the FTDI USB serial device converter driver. When I plug it in, it creates: /dev/ttyUSB1. I thought itd be simple to open and read/write f...

Very simple log4j2 XML configuration file using Console and File appender

I'd like a very simple XML configuration file with a console and a file appender using log4j2. (The Apache Website is killing me with much Information.)...

Hashing a string with Sha256

I try to hash a string using SHA256, I'm using the following code: using System; using System.Security.Cryptography; using System.Text; public class Hash { public static string getHashSha256(string text) { byte[] bytes = Encodin...

Maven plugins can not be found in IntelliJ

After updating IntelliJ from version 12 to 13, the following Maven-related plugins cannot be resolved: org.apache.maven.plugins:maven-clean-plugin:2.4.1 org.apache.maven.plugins:maven-deploy-plugin org.apache.maven.plugins:maven-install-plugin org.ap...

How to launch another aspx web page upon button click?

I have an asp.net application, where the user would click a button and launch another page (within the same application). The issue I am facing is that the original page and the newly launched page should both be launched. I tried response.redire...

Show a div as a modal pop up

I have the following div: <div id="divAlert"> <div id='divAlertText'>You must select a language.</div> <div id='divAlertButton' class='btn blue' onclick="HideAlert();">Ok</div> </div> Is this HTML page t...

Animate an element's width from 0 to 100%, with it and it's wrapper being only as wide as they need to be, without a pre-set width, in CSS3 or jQuery

http://jsfiddle.net/nicktheandroid/tVHYg/ When hovering .wrapper, it's child element .contents should animate from 0px to it's natural width. Then when the mouse is removed from .wrapper, it should animate back down to 0px. The .wrapper element shou...

Using Address Instead Of Longitude And Latitude With Google Maps API

I've heard that it is possible to submit an Address instead of Longitude and Latitude and this would be much more feasible for my system. The user has to input their address when creating their profile and their profile afterwards will then display a...

Select unique values with 'select' function in 'dplyr' library

Is it possible to select all unique values from a column of a data.frame using select function in dplyr library? Something like "SELECT DISTINCT field1 FROM table1" in SQL notation. Thanks!...

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

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

Calling a Variable from another Class

How can I access a variable in one public class from another public class in C#? I have: public class Variables { static string name = ""; } I need to call it from: public class Main { } Thanks in advance for the help. I am working in a C...

Joda DateTime to Timestamp conversion

I am trying to change the value of Timestamp by DateTimeZone in Joda : DateTime dt = new DateTime(rs.getTimestamp("anytimestampcolumn"), DateTimeZone.forID("anytimezone")); Timestamp ts = new Timestamp(dt.getMillis()...

How can I pretty-print JSON using Go?

Does anyone know of a simple way to pretty-print JSON output in Go? The stock http://golang.org/pkg/encoding/json/ package does not seem to include functionality for this (EDIT: it does, see accepted answer) and a quick google doesn't turn up anythi...

Check if a row exists, otherwise insert

I need to write a T-SQL stored procedure that updates a row in a table. If the row doesn't exist, insert it. All this steps wrapped by a transaction. This is for a booking system, so it must be atomic and reliable. It must return true if the transa...

How to hide Table Row Overflow?

I have some html tables where the textual data is too large to fit. So, it expands the cell vertically to accommodate for this. So now rows that have the overflow are twice as tall as rows with smaller amounts of data. This is unacceptable. How c...

Transitions on the CSS display property

I'm currently designing a CSS 'mega dropdown' menu - basically a regular CSS-only dropdown menu, but one that contains different types of content. At the moment, it appears that CSS 3 transitions don't apply to the 'display' property, i.e., you...

How do I rename all folders and files to lowercase on Linux?

I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter). Bonus points for ignoring CVS and Subversion version control files/folders. The preferred way would b...

UIDevice uniqueIdentifier deprecated - What to do now?

It has just come to light that the UIDevice uniqueIdentifier property is deprecated in iOS 5 and unavailable in iOS 7 and above. No alternative method or property appears to be available or forthcoming. Many of our existing apps are tightly dependen...

Parsing PDF files (especially with tables) with PDFBox

I need to parse a PDF file which contains tabular data. I'm using PDFBox to extract the file text to parse the result (String) later. The problem is that the text extraction doesn't work as I expected for tabular data. For example, I have a file whic...

How can I check if some text exist or not in the page using Selenium?

I'm using Selenium WebDriver, how can I check if some text exist or not in the page? Maybe someone recommend me useful resources where I can read about it. Thanks...

Why is Tkinter Entry's get function returning nothing?

I'm trying to use an Entry field to get manual input, and then work with that data. All sources I've found claim I should use the get() function, but I haven't found a simple working mini example yet, and I can't get it to work. I hope someone can ...

How do I get the latest version of my code?

I'm using Git 1.7.4.1. I want to get the latest version of my code from the repository, but I'm getting errors: $ git pull …. M selenium/ant/build.properties …. M selenium/scripts/linux/get_latest_updates.sh M selenium/scripts/windows/start...

Python MySQLdb TypeError: not all arguments converted during string formatting

Upon running this script: #! /usr/bin/env python import MySQLdb as mdb import sys class Test: def check(self, search): try: con = mdb.connect('localhost', 'root', 'password', 'recordsdb'); cur = con.cursor()...

Loop through Map in Groovy?

I have a very simple task I am trying to do in Groovy but cannot seem to get it to work. I am just trying to loop through a map object in groovy and print out the key and value but this code does not work. // A simple map def map = [ iPhone ...

Mockito How to mock and assert a thrown exception?

I'm using mockito in a junit test. How do you make an exception happen and then assert that it has (generic pseudo-code)...

Error: vector does not name a type

I'm having lots of errors in my final project (a poker and black jack sim). I'm using a vector to implement the "hands" in the blackJack class, and I'm using a structured data type declared in another class, which is publicly inherited. The error I'm...

How to get images in Bootstrap's card to be the same height/width?

So here is my code, it displays 6 cards, three across and two rows. I would like for the images to all be the same size without having to manually resize the images. The responsiveness does work, I use "img-fluid" as a class and when I go to a mobile...

How to dynamically add a style for text-align using jQuery

I'm trying to correct the usual IE bugs around CSS 2.1 and need a way to alter an elements style properties to add a custom text-align style. Currently in jQuery you can do something like $(this).width() or $(this).height() but I can't seem to f...

Call a "local" function within module.exports from another function in module.exports?

How do you call a function from within another function in a module.exports declaration? app.js var bla = require('./bla.js'); console.log(bla.bar()); bla.js module.exports = { foo: function (req, res, next) { return ('foo'); }, bar:...

Difference between Inheritance and Composition

Are Composition and Inheritance the same? If I want to implement the composition pattern, how can I do that in Java?...

CSS overflow-x: visible; and overflow-y: hidden; causing scrollbar issue

Suppose you have some style and the markup: _x000D_ _x000D_ ul_x000D_ {_x000D_ white-space: nowrap;_x000D_ overflow-x: visible;_x000D_ overflow-y: hidden;_x000D_ /* added width so it would work in the snippet */_x000D_ width: 100px; _x000D_ ...

How to redirect to another page in node.js

I have a login and a signup page. When random user wants to login, and login is successful, I want to redirect him to another .ejs page (for example UserHomePage.ejs), however, nothing I've tried have worked so far. if (loggedIn) { conso...

How to access full source of old commit in BitBucket?

I can't figure out or find the documentation on how to access the source of an old commit in the new Bit Bucket format. Is this even possible anymore?...

Date Difference in php on days?

Is there a quick way to calculate date difference in php? For example: $date1 = '2009-11-12 12:09:08'; $date2 = '2009-12-01 08:20:11'; And then do a calculation, $date2 minus $date1 I read php.net documentation, but no luck. Is there a quick way ...

Array vs ArrayList in performance

Which one is better in performance between Array of type Object and ArrayList of type Object? Assume we have a Array of Animal objects : Animal animal[] and a arraylist : ArrayList list<Animal> Now I am doing animal[10] and l...

Can I change the color of Font Awesome's icon color?

I have to wrap my icon within an <a> tag for some reason. Is there any possible way to change the color of a font-awesome icon to black? or is it impossible as long as it wrapped within an <a> tag? Font awesome is supposed to be font not ...

Git "error: The branch 'x' is not fully merged"

Here are the commands I used from the master branch git branch experiment git checkout experiment Then I made some changes to my files, committed the changes, and pushed the new branch to GitHub. git commit . -m 'changed files' git push -u origin ex...

MySQL: Get column name or alias from query

I'm not asking for the SHOW COLUMNS command. I want to create an application that works similarly to heidisql, where you can specify an SQL query and when executed, returns a result set with rows and columns representing your query result. The colum...

StringUtils.isBlank() vs String.isEmpty()

I ran into some code that has the following: String foo = getvalue("foo"); if (StringUtils.isBlank(foo)) doStuff(); else doOtherStuff(); This appears to be functionally equivalent to the following: String foo = getvalue("foo"); if (foo.i...

How to convert Base64 String to javascript file object like as from file input form?

I want to convert Base64String extracted from file(ex: "AAAAA....~") to a javascript file object. The javascript file object what I mean is like this code: HTML: <input type="file" id="selectFile" > JS: $('#selectFile').on('change', fun...

How to terminate a window in tmux?

How to terminate a window in tmux? Like the Ctrlak shortcut in screen with Ctrla being the prefix....

C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?

C++11 introduced a standardized memory model, but what exactly does that mean? And how is it going to affect C++ programming? This article (by Gavin Clarke who quotes Herb Sutter) says that, The memory model means that C++ code now has a stand...

CSS : center form in page horizontally and vertically

How can i center the form called form_login horizontally and vertically in my page ? Here is the HTML I'm using right now: <body> <form id="form_login"> <p> <input type="text" id="username" placeholder="...

Remove padding or margins from Google Charts

_x000D_ _x000D_ // Load the Visualization API and the piechart package._x000D_ google.load('visualization', '1.0', {'packages':['corechart']});_x000D_ _x000D_ // Set a callback to run when the Google Visualization API is loaded._x000D_ google.setOnLo...

Lightweight Javascript DB for use in Node.js

Anybody know of a lightweight yet durable database, written in Javascript, that can be used with Node.js. I don't want the 'weight' of (great) solutions like Mongo or Couch. A simple, in memory JS database with the capability to persist to disk as ...

Textfield with only bottom border

How can I create a Text field that has a transparent or no background, no top,left and right border? I am only using CSS and HTML....

Reading images in python

I am trying to read a png image in python. The imread function in scipy is being deprecated and they recommend using imageio library. However, I am would rather restrict my usage of external libraries to scipy, numpy and matplotlib libraries. Thus,...

adb doesn't show nexus 5 device

Android Studio 0.3.6 Fedora 18 3.11.7-100.fc18.x86_64 Nexus 5 Kitkat Hello, I have been using my Samsung Galaxy Tab 3 7.0 running Android 4.1.2 everything works fine with adb. However, I have just bought a new Nexus 5 device, and when I do the fo...

Can I set a TTL for @Cacheable

I am trying out the @Cacheable annotation support for Spring 3.1 and wondering if there is any way to make the cached data clear out after a time by setting a TTL? Right now from what I can see I need to clear it out myself by using the @CacheEvict, ...

pip3: command not found but python3-pip is already installed

I can't use pip3 though python3-pip has already been installed. How to solve the problem? sudo pip3 install virtualenv sudo: pip3: command not found sudo apt-get install python3-pip Reading package lists... Done Building dependency tree Read...

Xampp Access Forbidden php

I'm a windows user. I've been using xampp for quite a while but suddenly none of my .php files are working now! I get this error message: Access forbidden! You don't have permission to access the requested object. It is either read-protected or n...

How to terminate script execution when debugging in Google Chrome?

When stepping through JavaScript code in Google Chrome debugger, how do I terminate script execution if I do not want to continue? The only way I found is closing the browser window. Pressing "Reload this page" runs the rest of the code and even sub...

How to open Android Device Monitor in latest Android Studio 3.1

Recently I updated my android studio, after the update, I am unable to find android device monitor option in the tools section. In the previous update it was there in tools->android->android device monitor. But now in the updated version, it is not p...

Exporting the values in List to excel

Hi I am having a list container which contains the list of values. I wish to export the list values directly to Excel. Is there any way to do it directly?...

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use

While I am trying to insert a row to my table, I'm getting the following errors: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''filename') ...

react-router getting this.props.location in child components

As I understand <Route path="/" component={App} /> will gives App routing-related props like location and params. If my App component has many nested child components, how do I get the child component to have access to these props without: pa...

Get all variables sent with POST?

I need to insert all variables sent with post, they were checkboxes each representing an user. If I use GET I get something like this: ?19=on&25=on&30=on I need to insert the variables in the database. How do I get all variables sent wit...

How to obtain Signing certificate fingerprint (SHA1) for OAuth 2.0 on Android?

I'm trying to register my android app following the steps in https://developers.google.com/console/help/#installed_applications which leads me to follow http://developer.android.com/tools/publishing/app-signing.html. However, I'm not sure how to g...

how to copy only the columns in a DataTable to another DataTable?

how to copy only the columns in a DataTable to another DataTable?...

Is there a JSON equivalent of XQuery/XPath?

When searching for items in complex JSON arrays and hashes, like: [ { "id": 1, "name": "One", "objects": [ { "id": 1, "name": "Response 1", "objects": [ // etc. }] } ] Is there some kind of query language I can ...

intl extension: installing php_intl.dll

I'm trying to locate php_intl.dll and install it. Does anyone have any tips?...

Assign output to variable in Bash

I'm trying to assign the output of cURL into a variable like so: #!/bin/sh $IP=`curl automation.whatismyip.com/n09230945.asp` echo $IP sed s/IP/$IP/ nsupdate.txt | nsupdate However, when I run the script the following happens: ./update.sh: 3: =[...

Div height 100% and expands to fit content

I have a div element on my page with its height set to 100%. The height of the body is also set to 100%. The inner div has a background and all that and is different from the body background. This works for making the div height 100% of the browser ...

Why binary_crossentropy and categorical_crossentropy give different performances for the same problem?

I'm trying to train a CNN to categorize text by topic. When I use binary cross-entropy I get ~80% accuracy, with categorical cross-entropy I get ~50% accuracy. I don't understand why this is. It's a multiclass problem, doesn't that mean that I have ...

Common xlabel/ylabel for matplotlib subplots

I have the following plot: fig,ax = plt.subplots(5,2,sharex=True,sharey=True,figsize=fig_size) and now I would like to give this plot common x-axis labels and y-axis labels. With "common", I mean that there should be one big x-axis label below the...

How to set a CMake option() at command line

I created a CMakeLists.txt that contains the following project(P4V) cmake_minimum_required(VERSION 2.6) option(BUILD_STATIC_LIBS "Build the static library" ON) option(BUILD_SHARED_LIBS "Build the shared library" ON) option(BUILD_TESTS "Build test p...

Batch Script to Run as Administrator

I'm writing a client/server checking program but it needs to run as Administrator. I want this to run silently on my network and users, and I don't want the "Run as" Administrator" prompt. Is there any beginning code that I can place into the batch ...

SQL Server - transactions roll back on error?

We have client app that is running some SQL on a SQL Server 2005 such as the following: BEGIN TRAN; INSERT INTO myTable (myColumns ...) VALUES (myValues ...); INSERT INTO myTable (myColumns ...) VALUES (myValues ...); INSERT INTO myTable (myColumns ...

Why do 64-bit DLLs go to System32 and 32-bit DLLs to SysWoW64 on 64-bit Windows?

I would like to know when do we need to place a file under C:\Windows\System32 or C:\Windows\SysWOW64, on a 64-bits windows system. I had two DLL's, one for 32-bit, one for 64-bit. Logically, I thought I'd place the 32-bit DLL under C:\Windows\Sy...

CodeIgniter: How to get Controller, Action, URL information

I have these URLs: http://backend.domain.com/system/setting/edit/12 http://backend.domain.com/product/edit/1 How to get controller name, action name from these URLs. I'm CodeIgniter newbie. Are there any helper function to get this info Ex: $p...

How to add new column to MYSQL table?

I am trying to add a new column to my MYSQL table using PHP. I am unsure how to alter my table so that the new column is created. In my assessment table I have: assessmentid | q1 | q2 | q3 | q4 | q5 Say I have a page with a textbox and I type q6 in...

How to do what head, tail, more, less, sed do in Powershell?

On windows, using Powershell, what are the equivalent commands to linux's head, tail, more, less and sed?...

Getting the "real" Facebook profile picture URL from graph API

Facebook graph API tells me I can get a profile picture of a user using http://graph.facebook.com/517267866/picture?type=large which works fine. However, when you type above URL into a browser, the actual address of the image is http://profile.ak....

Microsoft Advertising SDK doesn't deliverer ads

So I have a Windows Phone solution that has an ad in it. When my Solution References Microsoft.Advertising.SDK Advertising.Mobile Advertising.Mobile.UI Everything works fine and I get ads. Unfortunately this has multiple references to the same DL...

In C can a long printf statement be broken up into multiple lines?

I have the following statement: printf("name: %s\targs: %s\tvalue %d\tarraysize %d\n", sp->name, sp->args, sp->value, sp->arraysize); I want to break it up. I tried the following but it doesn't work. printf("name: %s\t args: %s\t val...

How do I get the backtrace for all the threads in GDB?

Is there an equivalent command in GDB to that of WinDbg's "!process 0 7"? I want to extract all the threads in a dump file along with their backtraces in GDB. "info threads" doesn't output the stack traces. So, is there a command that does?...

Avoid printStackTrace(); use a logger call instead

In my application, I am running my code through PMD.It shows me this message: Avoid printStackTrace(); use a logger call instead. What does that mean?...

How to set time to a date object in java

I created a Date object in Java. When I do so, it shows something like: date=Tue Aug 09 00:00:00 IST 2011. As a result, it appears that my Excel file is lesser by one day (27 feb becomes 26 feb and so on) I think it must be because of time. How can I...

Switch php versions on commandline ubuntu 16.04

I have installed php 5.6 and and php 7.1 on my Ubuntu 16.04 I know with Apache as my web server, I can do a2enmod php5.6 #to enable php5 a2enmod php7.1 #to enable php7 When I disable php7.1 in Apache modules and enable php 5.6, Apache recognizes the...

How does paintComponent work?

This might be a very noob question. I'm just starting to learn Java I don't understand the operation of paintComponent method. I know if I want to draw something, I must override the paintComponent method. public void paintComponent(Graphics g) { ...

Get full path of a file with FileUpload Control

I am working on a web application which uses the FileUpload control. I have an xls file in the full filepath 'C:\Mailid.xls' that I am attempting to upload. When I use the command FileUpload1.PostedFile.FileName I cannot get the full filepath f...

What is the purpose of .PHONY in a Makefile?

What does .PHONY mean in a Makefile? I have gone through this, but it is too complicated. Can somebody explain it to me in simple terms?...

What are the "standard unambiguous date" formats for string-to-date conversion in R?

Please consider the following $ R --vanilla > as.Date("01 Jan 2000") Error in charToDate(x) : character string is not in a standard unambiguous format But that date clearly is in a standard unambiguous format. Why the error message? Worse...

JQuery / JavaScript - trigger button click from another button click event

I have this HTML which looks like this: <input type="submit" name="savebutton" class="first button" /> <input type="submit" name="savebutton" class="second button" /> and JS: jQuery("input.second").click(function(){ // trigger seco...

Transfer files to/from session I'm logged in with PuTTY

I'm logged into a remote host using PuTTY. What is the command to transfer files from my local machine to the machine I'm logged into on PuTTY?...

jquery <a> tag click event

I am building a code which displays user information on search. User information, is then displayed in a fieldset, and a image, first name, last name and few profile info. is shown, and in the bottom of the fieldset, there's a add as friend hyperlin...

Regex replace uppercase with lowercase letters

I'm trying to replace uppercase letters with corresponding lowercase letters using regex. So that EarTH: 1, MerCury: 0.2408467, venuS: 0.61519726, becomes earth: 1, mercury: 0.2408467, venus: 0.61519726, in Sublime Text. How can I downc...

What exceptions should be thrown for invalid or unexpected parameters in .NET?

What types of exceptions should be thrown for invalid or unexpected parameters in .NET? When would I choose one instead of another? Follow-up: Which exception would you use if you have a function expecting an integer corresponding to a month and y...

RegEx pattern any two letters followed by six numbers

Please assist with the proper RegEx matching. Any 2 letters followed by any combination of 6 whole numbers. These would be valid: RJ123456 PY654321 DD321234 These would not DDD12345 12DDD123 ...

What .NET collection provides the fastest search

I have 60k items that need to be checked against a 20k lookup list. Is there a collection object (like List, HashTable) that provides an exceptionly fast Contains() method? Or will I have to write my own? In otherwords, is the default Contains() meth...

How can I iterate over files in a given directory?

I need to iterate through all .asm files inside a given directory and do some actions on them. How can this be done in a efficient way?...

Attach parameter to button.addTarget action in Swift

I am trying to pass an extra parameter to the buttonClicked action, but cannot work out what the syntax should be in Swift. button.addTarget(self, action: "buttonClicked:", forControlEvents: UIControlEvents.TouchUpInside) Any my buttonClicked meth...

JQuery/Javascript: check if var exists

Possible Duplicate: How can I check whether a variable is defined in JavaScript? Is there a standard function to check for null, undefined, or blank variables in JavaScript? I have a script that occurs in two parts. The first part sets ...

Using Spring 3 autowire in a standalone Java application

Here is my code: public class Main { public static void main(String[] args) { Main p = new Main(); p.start(args); } @Autowired private MyBean myBean; private void start(String[] args) { ApplicationContex...

Convert a object into JSON in REST service by Spring MVC

I'm trying to create a REST service using Spring MVC and it's working if I'm returning a plain string. My requirement is to return a JSON string of the Java object. Don't know how to achieve this by implicit conversion. Here is my code: StudentServ...

How to retrieve a user environment variable in CMake (Windows)

I know how to retrieve a normal machine wide environment variable in CMAKE using $ENV{EnvironmentVariableName} but I can not retrieve a user specific environment variable. Is it possible and how?...

How to convert a std::string to const char* or char*?

How can I convert an std::string to a char* or a const char*?...

Best way to load module/class from lib folder in Rails 3?

Since the latest Rails 3 release is not auto-loading modules and classes from lib anymore, what would be the best way to load them? From github: A few changes were done in this commit: Do not autoload code in *lib* for applications (now you need ...

What use is find_package() if you need to specify CMAKE_MODULE_PATH anyway?

I'm trying to get a cross-plattform build system working using CMake. Now the software has a few dependencies. I compiled them myself and installed them on my system. Some example files which got installed: -- Installing: /usr/local/share/SomeLib/S...

How to make an embedded video not autoplay

I'm embedding a Flash video into an HTML and would like the user to have to click it to begin playing. According to the Adobe <object> / <embed> element documentation, there are variety of methods to do this: 1) Add a Flash parameter ins...

How to find the 'sizeof' (a pointer pointing to an array)?

First off, here is some code: int main() { int days[] = {1,2,3,4,5}; int *ptr = days; printf("%u\n", sizeof(days)); printf("%u\n", sizeof(ptr)); return 0; } Is there a way to find out the size of the array that ptr is pointin...

HTML text input allow only numeric input

Is there a quick way to set an HTML text input (<input type=text />) to only allow numeric keystrokes (plus '.')?...

The first day of the current month in php using date_modify as DateTime object

I can get the Monday of this week with: $monday = date_create()->modify('this Monday'); I would like to get with the same ease the 1st of this month. How can I achieve that?...

How to convert minutes to hours/minutes and add various time values together using jQuery?

There are a couple parts to this question. I am not opposed to using a jQuery plugin if anyone knows of one that will accomplish what I want done. Q1 - How do I convert minutes into hours and vise versa? For example how would I convert 90 minutes in...

Vue.js data-bind style backgroundImage not working

I'm trying to bind the src of an image in an element, but it doesn't seem to work. I'm getting an "Invalid expression. Generated function body: { backgroundImage:{ url(image) }". The documentation says to use either 'Kebab-case' or 'camel-case'. &...

VMware Workstation and Device/Credential Guard are not compatible

I have been running VMware for the last year no problems, today I opened it up to start one of my VM and get an error message, see screen shot. I did follow the link and went through the steps, on step 4 I need to mount a volume using "mountvol". ...

Java - Convert String to valid URI object

I am trying to get a java.net.URI object from a String. The string has some characters which will need to be replaced by their percentage escape sequences. But when I use URLEncoder to encode the String with UTF-8 encoding, even the / are replaced wi...

Excel - extracting data based on another list

I have an Excel worksheet with two columns (name/ID) and then another list that is a subset of the names only from the larger aforementioned list. I want to go through the subset list and then pull the data from the larger list (name/ID) and put it s...

How can I exclude multiple folders using Get-ChildItem -exclude?

I need to generate a configuration file for our Pro/Engineer CAD system. I need a recursive list of the folders from a particular drive on our server. However I need to EXCLUDE any folder with 'ARCHIVE' in it including the various different cases. I...

Access multiple viewchildren using @viewchild

I have created a custom component which i have placed in a for loop e.g <div *ngFor="let view of views"> <customcomponent></customcomponent> </div> The output of which will be: <customcomponent></customcomp...

how to get rid of notification circle in right side of the screen?

I've looked online but wasn't able to find anything: how do I get rid of this notification circle that is being displayed over the movie I'm watching? ...

Timer function to provide time in nano seconds using C++

I wish to calculate the time it took for an API to return a value. The time taken for such an action is in the space of nano seconds. As the API is a C++ class/function, I am using the timer.h to caculate the same: #include <ctime> #include...

Exception : mockito wanted but not invoked, Actually there were zero interactions with this mock

I have interface Interface MyInterface { myMethodToBeVerified (String, String); } And implementation of interface is class MyClassToBeTested implements MyInterface { myMethodToBeVerified(String, String) { ……. } } I have another ...

Open soft keyboard programmatically

I have an activity with no child widgets for it and the corresponding xml file is, <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/myLayout" android:orientatio...

How do I make a batch file terminate upon encountering an error?

I have a batch file that's calling the same executable over and over with different parameters. How do I make it terminate immediately if one of the calls returns an error code of any level? Basically, I want the equivalent of MSBuild's ContinueOnE...

How does one generate a random number in Apple's Swift language?

I realize the Swift book provided an implementation of a random number generator. Is the best practice to copy and paste this implementation in one's own program? Or is there a library that does this that we can use now?...

How to easily initialize a list of Tuples?

I love tuples. They allow you to quickly group relevant information together without having to write a struct or class for it. This is very useful while refactoring very localized code. Initializing a list of them however seems a bit redundant. var t...

How to show all privileges from a user in oracle?

Can someone please tell me how to show all privileges/rules from a specific user in the sql-console?...

What is the JavaScript equivalent of var_dump or print_r in PHP?

I would like to see the structure of object in JavaScript (for debugging). Is there anything similar to var_dump in PHP?...

Converting Long to Date in Java returns 1970

I have list with long values (for example: 1220227200, 1220832000, 1221436800...) which I downloaded from web service. I must convert it to Dates. Unfortunately this way, for example: Date d = new Date(1220227200); returns 1 Jan 1970. Anyone know ...

How to pass a value to razor variable from javascript variable?

How to pass a value to razor variable from javascript variable, is it possible asp.net mvc razor view engine? @{ int a = 0; } <script> var b = ... @a = b; </script> ...

How do I convert a javascript object array to a string array of the object attribute I want?

Possible Duplicate: Accessing properties of an array of objects Given: [{ 'id':1, 'name':'john' },{ 'id':2, 'name':'jane' }........,{ 'id':2000, 'name':'zack' }] What's the best way to get: ['john', 'jane', ........

How can I horizontally align my divs?

For some reason my divs won't center horizontally in a containing div: _x000D_ _x000D_ .row {_x000D_ width: 100%;_x000D_ margin: 0 auto;_x000D_ }_x000D_ .block {_x000D_ width: 100px;_x000D_ float: left;_x000D_ }_x000D_ <div class="row">...

NodeJS: How to get the server's port?

You often see example hello world code for Node that creates an Http Server, starts listening on a port, then followed by something along the lines of: console.log('Server is listening on port 8000'); But ideally you'd want this instead: console....

How to replace comma with a dot in the number (or any replacement)

I could not found a solution yet, for replacing , with a dot. var tt="88,9827"; tt.replace(/,/g, '.') alert(tt) //88,9827 i'm trying to replace a comma a dot thanks in advance...

Print a string as hex bytes?

I have this string: Hello world !! and I want to print it using Python as 48:65:6c:6c:6f:20:77:6f:72:6c:64:20:21:21. hex() works only for integers. How can it be done?...

When should I use GC.SuppressFinalize()?

In .NET, under which circumstances should I use GC.SuppressFinalize()? What advantage(s) does using this method give me?...

How to prevent a file from direct URL Access?

I'm using Apache and I have a sample web folder on my Local Host, like: http://localhost/test/ Files in the test folder: index.html sample.jpg .htaccess Sample source of index.html: <html> <body&...

How do I find which rpm package supplies a file I'm looking for?

As an example, I am looking for a mod_files.sh file which presumably would come with the php-devel package. I guessed that yum would install the mod_files.sh file with the php-devel x86_64 5.1.6-23.2.el5_3 package, but the file appears to not to be i...

How to split a single column values to multiple column values?

I have a problem splitting single column values to multiple column values. For Example: Name ------------ abcd efgh ijk lmn opq asd j. asdjja asb (asdfas) asd asd and I need the output something like this: first_name last_name ------...

C++ compile error: has initializer but incomplete type

I am coding in Eclipse and have something like the following: #include <ftream> #include <iostream> void read_file(){ char buffer[1025]; std::istringstream iss(buffer); } However, when I try to build, I get the following error...

How to add new line into txt file

I'd like to add new line with text to my date.txt file, but instead of adding it into existing date.txt, app is creating new date.txt file.. TextWriter tw = new StreamWriter("date.txt"); // write a line of text to the file tw.WriteLine(DateTime.Now...

How to connect to MySQL Database?

New to C# programming, I'd like to be able to access MySQL Databases. I know MySQL connector/NET and MySQL for Visual Studio are required for C# development. Do I need to install them into my app? Is it possible I can just release the connector DL...

Return a `struct` from a function in C

Today I was teaching a couple of friends how to use C structs. One of them asked if you could return a struct from a function, to which I replied: "No! You'd return pointers to dynamically malloced structs instead." Coming from someone who ...

<ng-container> vs <template>

ng-container is mentioned in the official documentation but I'm still trying to understand how it works and what are use cases. It is particularly mentioned in ngPlural and ngSwitch directives. Does <ng-container> do the same thing as <templ...

Update select2 data without rebuilding the control

I am converting an <input type="hidden"> to a select2 dropdown and feeding it data through the query method $('#inputhidden').select2({ query: function( query ) { query.callback( data ); // the data is in the format select2 exp...

Is there a Python equivalent of the C# null-coalescing operator?

In C# there's a null-coalescing operator (written as ??) that allows for easy (short) null checking during assignment: string s = null; var other = s ?? "some default value"; Is there a python equivalent? I know that I can do: s = None other = s...

Extract the maximum value within each group in a dataframe

I have a data frame with a grouping variable ("Gene") and a value variable ("Value"): Gene Value A 12 A 10 B 3 B 5 B 6 C 1 D 3 D 4 For each level of my grouping variable, I wish to extract the maximum valu...

Do Facebook Oauth 2.0 Access Tokens Expire?

I am playing around with the Oauth 2.0 authorization in Facebook and was wondering if the access tokens Facebook passes out ever expire. If so, is there a way to request a long-life access token?...

Git checkout: updating paths is incompatible with switching branches

My problem is related to Fatal Git error when switching branch. I try to fetch a remote branch with the command git checkout -b local-name origin/remote-name but I get this error message: fatal: git checkout: updating paths is incompatible wi...

Developing for Android in Eclipse: R.java not regenerating

I've found out that my R.java is never updated, so it doesn't contain information about my new resources, so I decided to delete it and thought that Eclipse would generate a new one. But that didn't happen, and I don't have R.java now. How can I rege...

MS Access - execute a saved query by name in VBA

How do I execute a saved query in MS Access 2007 in VBA? I do not want to copy and paste the SQL into VBA. I rather just execute the name of the query. This doesn't work ... VBA can't find the query. CurrentDb.Execute queryname ...

PHPMailer AddAddress()

I don't know how the data should be formatted for AddAddress PHPMailer function; I need the email to be sent to multiple recipients so I tried $to = "[email protected],[email protected],[email protected]"; $obj->AddAddress($to); but with no success. Any ...

htaccess Access-Control-Allow-Origin

I'm creating a script that loads externally on other sites. It loads CSS and HTML and works fine on my own servers. However, when I try it on another website it displays this awful error: Access-Control-Allow-Origin Here you can see it loads perf...

Insert null/empty value in sql datetime column by default

How do I create a table in SQL server with the default DateTime as empty, not 1900-01-01 00:00:00.000 that I get? I mean, if there is no value inserted, the default value should be null, empty, etc....

How can I indent multiple lines in Xcode?

When I select multiple lines of code and want to indent them as usual with TAB key, it just deletes them all. I come from Eclipse where I always did it that way. How's that done in Xcode? I hope not line by line ;)...

Better way to Format Currency Input editText?

I have an editText, starting value is $0.00. When you press 1, it changes to $0.01. Press 4, it goes to $0.14. Press 8, $1.48. Press backspace, $0.14, etc. That works, the problem is, if somebody manually positions the cursor, problems occur in the ...

urllib2 and json

can anyone point out a tutorial that shows me how to do a POST request using urllib2 with the data being in JSON format?...

How to search in a List of Java object

I have a List of object and the list is very big. The object is class Sample { String value1; String value2; String value3; String value4; String value5; } Now I have to search for a specific value of an object in the list. S...

iterating over and removing from a map

I was doing: for (Object key : map.keySet()) if (something) map.remove(key); which threw a ConcurrentModificationException, so i changed it to: for (Object key : new ArrayList<Object>(map.keySet())) if (something) ma...

What's the difference between @JoinColumn and mappedBy when using a JPA @OneToMany association

What is the difference between: @Entity public class Company { @OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY) @JoinColumn(name = "companyIdRef", referencedColumnName = "companyId") private List<Branch> branches; ...

How do I revert all local changes in Git managed project to previous state?

I have a project in which I ran git init. After several commits, I did git status which told me everything was up to date and there were no local changes. Then I made several consecutive changes and realized I wanted to throw everything away and ge...

How to verify if a file exists in a batch file?

I have to create a .BAT file that does this: If C:\myprogram\sync\data.handler exists, exit; If C:\myprogram\html\data.sql does not exist, exit; In C:\myprogram\sync\ delete all files and folders except (test, test3 and test2) Copy C:\myprogram\htm...

How to access URL segment(s) in blade in Laravel 5?

I have a url : http://localhost:8888/projects/oop/2 I want to access the first segment --> projects I've tried <?php echo $segment1 = Request::segment(1); ?> I see nothing print out in my view when I refresh my page. Any helps / sugge...

What should I do if the current ASP.NET session is null?

In my web application, I do something like this to read the session variables: if (HttpContext.Current.Session != null && HttpContext.Current.Session["MyVariable"] != null) { string myVariable= (string)HttpContext.Current.Session["MyVar...

How to pass optional parameters while omitting some other optional parameters?

Given the following signature: export interface INotificationService { error(message: string, title?: string, autoHideAfter?: number); } How can I call the function error() not specifying the title parameter, but setting autoHideAfter to say 1...

Angular Material: mat-select not selecting default

I have a mat-select where the options are all objects defined in an array. I am trying to set the value to default to one of the options, however it is being left selected when the page renders. My typescript file contains: public options2 = [ ...

Force Intellij IDEA to reread all maven dependencies

How to force intellij idea to reread/update all dependencies specified in the pom file ?...

Fetch API request timeout?

I have a fetch-api POST request: fetch(url, { method: 'POST', body: formData, credentials: 'include' }) I want to know what is the default timeout for this? and how can we set it to a particular value like 3 seconds or indefinite seconds?...

Eclipse/Java code completion not working

I've downloaded, unzipped and setup Eclipse 3.4.2 with some plugins (noteable, EPIC, Clearcase, QuantumDB, MisterQ). Now I find when I'm editing Java projects the code completion is not working. If I type String. and press ctrl+space a popup shows...

Drop a temporary table if it exists

I have two lines of code in SQL that create two tables on the fly, i need to do something like IF TABLE EXISTS DROP IT AND CREATE IT AGAIN ELSE CREATE IT my lines are the following ones CREATE TABLE ##CLIENTS_KEYWORD(client_id int) ...

Multiprocessing: How to use Pool.map on a function defined in a class?

When I run something like: from multiprocessing import Pool p = Pool(5) def f(x): return x*x p.map(f, [1,2,3]) it works fine. However, putting this as a function of a class: class calculate(object): def run(self): def f(x): ...

Escaping ampersand character in SQL string

I am trying to query a certain row by name in my sql database and it has an ampersand. I tried to set an escape character and then escape the ampersand, but for some reason this isn't working and I'm uncertain as to what exactly my problem is. Set e...

How are "mvn clean package" and "mvn clean install" different?

What exactly are the differences between mvn clean package and mvn clean install? When I run both of these commands, they both seem to do the same thing. ...

Check if a radio button is checked jquery

I have this HTML: <input type="radio" name="test" id="test" value="1"><br> <input type="radio" name="test" id="test" value="2"><br> <input type="radio" name="test" id="test" value="3"><br> <input type="button"...

Conditional Logic on Pandas DataFrame

How to apply conditional logic to a Pandas DataFrame. See DataFrame shown below, data desired_output 0 1 False 1 2 False 2 3 True 3 4 True My original data is show in the 'data' column and...

How do I resolve "Please make sure that the file is accessible and that it is a valid assembly or COM component"?

I am building a project with OpenCV in C#. It requires a dll file called cvextern.dll. but, when adding this file as a reference, this message appears :- a reference "cvextern.dll" can't be added, Please make sure that the file is accessible and tha...

How to import other Python files?

How do I import other files in Python? How exactly can I import a specific python file like import file.py? How can I import a folder instead of a specific file? I want to load a Python file dynamically at runtime, based on user input. I want to kn...

How to delete from a table where ID is in a list of IDs?

if I have a list of IDs (1,4,6,7) and a db table where I want to delete all records where ID is in this list, what is the way to do that?...

Can a CSS class inherit one or more other classes?

I feel dumb for having been a web programmer for so long and not knowing the answer to this question, I actually hope it's possible and I just didn't know about rather than what I think is the answer (which is that it's not possible). My question is...

How to check if an element is off-screen

I need to check with jQuery if a DIV element is not falling off-screen. The elements are visible and displayed according CSS attributes, but they could be intentionally placed off-screen by: position: absolute; left: -1000px; top: -1000px; I cou...

How to read text file in JavaScript

I am trying to load a text file into my JavaScript file and then read the lines from that file in order to get information, and I tried the FileReader but it does not seem to be working. Can anyone help? function analyze(){ var f = new FileReader...

How to prevent user from typing in text field without disabling the field?

I tried: $('input').keyup(function() { $(this).attr('val', ''); }); but it removes the entered text slightly after a letter is entered. Is there anyway to prevent the user from entering text completely without resorting to disabling the text ...

Systrace for Windows

I'm looking for a Windows equivalent of Systrace or at least strace. I'm aware of StraceNT, but wondering if there are any more alternatives out there. Specifically, I'm looking for a specific way to programmatically enforce system call policies, th...

How do I print the content of a .txt file in Python?

I'm very new to programming (obviously) and really advanced computer stuff in general. I've only have basic computer knowledge, so I decided I wanted to learn more. Thus I'm teaching myself (through videos and ebooks) how to program. Anyways, I'm w...

What is the unix command to see how much disk space there is and how much is remaining?

I'm looking for the equivalent of right clicking on the drive in windows and seeing the disk space used and remaining info....

Using SimpleXML to create an XML object from scratch

Is it possible to use PHP's SimpleXML functions to create an XML object from scratch? Looking through the function list, there's ways to import an existing XML string into an object that you can then manipulate, but if I just want to generate an XML...

How to get the separate digits of an int number?

I have numbers like 1100, 1002, 1022 etc. I would like to have the individual digits, for example for the first number 1100 I want to have 1, 1, 0, 0. How can I get it in Java?...

Manually map column names with class properties

I am new to the Dapper micro ORM. So far I am able to use it for simple ORM related stuff but I am not able to map the database column names with the class properties. For example, I have the following database table: Table Name: Person person_id ...

Flattening a shallow list in Python

Is there a simple way to flatten a list of iterables with a list comprehension, or failing that, what would you all consider to be the best way to flatten a shallow list like this, balancing performance and readability? I tried to flatten such a lis...

How can I switch my git repository to a particular commit

In my git repository, I made 5 commits, like below in my git log: commit 4f8b120cdafecc5144d7cdae472c36ec80315fdc Author: Michael Date: Fri Feb 4 15:26:38 2011 -0800 commit b688d46f55db1bc304f7f689a065331fc1715079 Author: Michael Date: Mon Jan...