Questions Tagged with #Flashlog

Differences between fork and exec

What are the differences between fork and exec?..

Inner join vs Where

Is there a difference in performance (in oracle) between Select * from Table1 T1 Inner Join Table2 T2 On T1.ID = T2.ID And Select * from Table1 T1, Table2 T2 Where T1.ID = T2.ID ?..

How can I see the size of files and directories in linux?

How can I see the size of files and directories in Linux? If use df -m, then it shows the size of all the directory at the top level, but, for the directories and files inside the directory, how do I ..

Is it possible to access to google translate api for free?

Google only gives access to their translate API with payment but I want free access. Is it possible to use Google's translate API for free? What are the alternatives?..

Splitting a string into separate variables

I have a string, which I have split using the code $CreateDT.Split(" "). I now want to manipulate two separate strings in different ways. How can I separate these into two variables?..

How to open a web page from my application?

I want to make my WPF application open the default browser and go to a certain web page. How do I do that?..

package javax.mail and javax.mail.internet do not exist

When I compile a simple code that has the following 2 import statements: import javax.mail.* import javax.mail.internet.* I get the following message: package javax.mail does not exist package j..

EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) on dispatch_semaphore_dispose

I am getting EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) on dispatch_semaphore_dispose but don't really know how to track down the root cause of this. My code makes use of dispatch_async, ..

How to specify multiple conditions in an if statement in javascript

Here is how I mention two conditions if this or this if (Type == 2 && PageCount == 0) || (Type == 2 && PageCount == '') PageCount= document.getElementById('<%=hfPageCount.Clie..

How to get the nvidia driver version from the command line?

For debugging CUDA code and checking compatibilities I need to find out what nvidia driver version for the GPU I have installed. I found How to get the cuda version? but that does not help me here...

How to write a file or data to an S3 object using boto3

In boto 2, you can write to an S3 object using these methods: Key.set_contents_from_string() Key.set_contents_from_file() Key.set_contents_from_filename() Key.set_contents_from_stream() Is there a..

How to display and hide a div with CSS?

In my script there are three divs. I want to display div with class="ab" when I hover on first line and display div with class="abc", when hover on second line. Otherwise I want to display div with cl..

How to add a reference programmatically

I've written a program that runs and messages Skype with information when if finishes. I need to add a reference for Skype4COM.dll in order to send a message through Skype. We have a dozen or so compu..

jQuery - Detecting if a file has been selected in the file input

Possible Duplicate: jQuery: get the file name selected from <input type=“file” /> I have a standard file input box <input type="file" name="imafile"> I also have ..

Set Google Maps Container DIV width and height 100%

I loaded Google Maps API v3 and print Google Map in div. But when set width & height to 100% and auto I can't see the Map. Here is HTML code snippet. <!-- Maps Container --> <div id="ma..

HTML5 <video> element on Android

According to: http://developer.android.com/sdk/android-2.0-highlights.html Android 2.0 should support the HTML5 video element. I haven't been able to get this to work using a Motorola Droid, and hav..

Merge, update, and pull Git branches without using checkouts

I work on a project that has 2 branches, A and B. I typically work on branch A, and merge stuff from branch B. For the merging, I would typically do: git merge origin/branchB However, I would also ..

How to bind Dataset to DataGridView in windows application

I have created Windows Application. In this, I have multiple tables in dataset, now I want to bind that to a single DataGridView. Can anybody help me?..

Npm Please try using this command again as root/administrator

I've been desperately trying to install modules using node.js but it always fails getting packages with npm. I logged in as Administrator and used powershell/cmd with "run as administrator". I also h..

What exactly does += do in python?

I need to know what += does in Python. It's that simple. I also would appreciate links to definitions of other shorthand tools in Python...

How to uncheck checked radio button

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

Cordova : Requirements check failed for JDK 1.8 or greater

I am using Cordova 6.4.0 in Windows 7 OS, but I get this error once I tried to build the android version : The Java Home variable is setted correctly to the JDK path, but I don't know why I am get..

What is the difference between `git merge` and `git merge --no-ff`?

Using gitk log, I could not spot a difference between the two. How can I observe the difference (with a git command or some tool)?..

Using GroupBy, Count and Sum in LINQ Lambda Expressions

I have a collection of boxes with the properties weight, volume and owner. I want to use LINQ to get a summarized list (by owner) of the box information e.g. **Owner, Boxes, Total Weight, Total Vol..

Check if a variable is a string in JavaScript

How can I determine whether a variable is a string or something else in JavaScript?..

How can I create a self-signed cert for localhost?

I've gone through the steps detailed in How do you use https / SSL on localhost? but this sets up a self-signed cert for my machine name, and when browsing it via https://localhost I receive the IE wa..

How to get annotations of a member variable?

I want to know a class's some member variable's annotations , I use BeanInfo beanInfo = Introspector.getBeanInfo(User.class) to introspect a class , and use BeanInfo.getPropertyDescriptors() , to find..

What is "android.R.layout.simple_list_item_1"?

I've started learning Android development and am following a todolist example from a book: // Create the array list of to do items final ArrayList<String> todoItems = new ArrayList<String>..

How do I truly reset every setting in Visual Studio 2012?

I am trying to reset every single setting inside Visual Studio as I have completely lost all IntelliSense. I tried the Tools -> Import/Export settings -> Reset, but that is not clearing all the settin..

Monad in plain English? (For the OOP programmer with no FP background)

In terms that an OOP programmer would understand (without any functional programming background), what is a monad? What problem does it solve and what are the most common places it's used? Update To c..

How to unit test abstract classes: extend with stubs?

I was wondering how to unit test abstract classes, and classes that extend abstract classes. Should I test the abstract class by extending it, stubbing out the abstract methods, and then test all the..

Use Fieldset Legend with bootstrap

I'm using Bootstrap for my JSP page. I want to use <fieldset> and <legend> for my form. This is my code. <fieldset class="scheduler-border"> <legend class="scheduler-border"..

How to create byte array from HttpPostedFile

I'm using an image component that has a FromBinary method. Wondering how do I convert my input stream into a byte array HttpPostedFile file = context.Request.Files[0]; byte[] buffer = new byte[file.C..

PuTTY Connection Manager download?

Where can I still download PuTTY Connection Manager? I am a PuTTY user and finally decided I need to upgrade to a tabbed SSH environment. I found a lot of threads/sites talking about PuTTY Connection..

CSS media queries for screen sizes

I am currently trying to design a layout which will be compatible for multiple screen sizes. The screen sizes I am designing for are listed below: Screen Sizes: 640x480 800x600 1024x768 1280x1024 ..

How to Empty Caches and Clean All Targets Xcode 4 and later

Jonathan suggest here: Xcode Includes .xib files that have been deleted! that cleaning all targets and empty the caches will fix the problem with Xcode including deleted .xib files but I cannot find a..

Sending credentials with cross-domain posts?

According to Requests with credentials, Firefox will only send credentials along with cross-domain posts if invocation.withCredentials = "true"; is set… But it doesn't seem like jQuery's Ajax AP..

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

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

HTML Tags in Javascript Alert() method

I wanted to know if it's possible to add HTML tags to JavaScript alert() method, such as: <b> <ul> <li> etc. Thanks for your help..

How can I import a database with MySQL from terminal?

How can I import a database with mysql from terminal? I cannot find the exact syntax...

Change UITextField and UITextView Cursor / Caret Color

I'm wondering about changing the color of the cursor / caret in a UITextField (And UITextView if its the same answer) in iOS. I've seen answers for OSX development, but nothing for iOS. Is this even ..

Key Presses in Python

Is it possible to make it appear to a system that a key was pressed, for example I need to make A key be pressed thousands of times, and it is much to time consuming to do it manually, I would like t..

Blocking device rotation on mobile web pages

Is it possible to detect on my page, for example using Javascript, when user visit it using mobile device in portrait mode, and stop orientation changing when user rotate its phone to landscape? There..

How to run html file using node js

I have a simple html page with angular js as follows: //Application name var app = angular.module("myTmoApppdl", []); app.controller("myCtrl", function ($scope) { //Sample login ..

Relative paths in Python

I'm building a simple helper script for work that will copy a couple of template files in our code base to the current directory. I don't, however, have the absolute path to the directory where the te..

Can I escape html special chars in javascript?

I want to display a text to HTML by a javascript function. How can I escape html special chars in JS? Is there an API ?..

C# Help reading foreign characters using StreamReader

I'm using the code below to read a text file that contains foreign characters, the file is encoded ANSI and looks fine in notepad. The code below doesn't work, when the file values are read and shown ..

Add Items to ListView - Android

This is my first experience with android. I'm trying to add items to my ListView. I use Tabs, and the only way to see that the item was added is to change tab and then come back to the first tab. I s..

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

How to initialize a dict with keys from a list and empty value in Python?

I'd like to get from this: keys = [1,2,3] to this: {1: None, 2: None, 3: None} Is there a pythonic way of doing it? This is an ugly way to do it: >>> keys = [1,2,3] >>> dict(..

Read text from response

HttpWebRequest request = WebRequest.Create("http://google.com") as HttpWebRequest; request.Accept = "application/xrds+xml"; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); W..

Browse files and subfolders in Python

I'd like to browse through the current folder and all its subfolders and get all the files with .htm|.html extensions. I have found out that it is possible to find out whether an object is a dir or fi..

how to take user input in Array using java?

how to take user input in Array using Java? i.e we are not initializing it by ourself in our program but the user is going to give its value.. please guide!!..

Current date and time as string

I wrote a function to get a current date and time in format: DD-MM-YYYY HH:MM:SS. It works but let's say, its pretty ugly. How can I do exactly the same thing but simpler? string currentDateToString(..

Eclipse error: R cannot be resolved to a variable

I am getting this classic error in Eclipse IDE. I am bored of Eclipse's bugs. They driving me mad. I almost tried everything which suggested as solution (by Googling). None of them worked. My projec..

How Do I Replace/Change The Heading Text Inside <h3></h3>, Using jquery?

How do I change/replace the <h3> text: "Featured Offers" using javascript to say "Public Offers" instead? </div> <!-- FEATURED OFFERS --> <div class="panel"> <div class..

A valid provisioning profile for this executable was not found... (again)

I know this has been asked and answered multiple times but I'm tearing my hair out as none of the proposed solutions appears to work. I receive the above error, despite having a valid provisioning ..

ImportError: No module named six

I'm trying to build OpenERP project, done with dependencies. It's giving this error now Traceback (most recent call last): File "openerp-client.py", line 105, in <module> File "modules\__in..

Android YouTube app Play Video Intent

I have created a app where you can download YouTube videos for android. Now, I want it so that if you play a video in the YouTube native app you can download it too. To do this, I need to know the Int..

Create a git patch from the uncommitted changes in the current working directory

Say I have uncommitted changes in my working directory. How can I make a patch from those without having to create a commit?..

What is your single most favorite command-line trick using Bash?

We all know how to use <ctrl>-R to reverse search through history, but did you know you can use <ctrl>-S to forward search if you set stty stop ""? Also, have you ever tried running bind ..

Android: How to bind spinner to custom object list?

In the user interface there has to be a spinner which contains some names (the names are visible) and each name has its own ID (the IDs are not equal to display sequence). When the user selects the na..

What is a wrapper class?

What is a wrapper class? How are such classes useful?..

Find the max of two or more columns with pandas

I have a dataframe with columns A,B. I need to create a column C such that for every record / row: C = max(A, B). How should I go about doing this?..

making a paragraph in html contain a text from a file

I have an html paragraph (inside a div) in which I want to display a simple fixed text. The text is a bit long so I'd rather the text will be in a seperate txt file. something like <div><p ..

Split string into array

In JS if you would like to split user entry into an array what is the best way of going about it? For example: entry = prompt("Enter your name") for (i=0; i<entry.length; i++) { entryArray[i] =..

Case insensitive string as HashMap key

I would like to use case insensitive string as a HashMap key for the following reasons. During initialization, my program creates HashMap with user defined String While processing an event (network ..

How to read strings from a Scanner in a Java console application?

import java.util.Scanner; class MyClass { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int employeeId, supervisorId; String name; ..

How do I count the number of rows and columns in a file using bash?

Say I have a large file with many rows and many columns. I'd like to find out how many rows and columns I have using bash...

What is the iPad user agent?

From what I gather, the iPad is using iPhone OS, but with a different screen resolution from the iPhone and iPod touch. So many sites may have to change their user agent detection to adapt to the iPad..

Appending a vector to a vector

Assuming I have 2 standard vectors: vector<int> a; vector<int> b; Let's also say the both have around 30 elements. How do I add the vector b to the end of vector a? The dirty way wo..

Start a fragment via Intent within a Fragment

I want to launch a new fragment to view some data. Currently, I have a main activity that has a bunch of actionbar tabs, each of which is a fragment. So, within a tab fragment, I have a button, charts..

jQuery Clone table row

I have a table with an Add button on the end. When you click this button I want a new table row to be created underneath the current one. I also want the input fields on this row to be blank. I am try..

Determine if char is a num or letter

How do I determine if a char in C such as a or 9 is a number or a letter? Is it better to use: int a = Asc(theChar); or this? int a = (int)theChar ..

Change default text in input type="file"?

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

Android Studio SDK location

I see there a lot of similar topics pertaining to this issue but I did not find a solution for me among those posts. I just installed Android Studio v0.8.14 and it won't let me create a new project be..

Forward declaring an enum in C++

I'm trying to do something like the following: enum E; void Foo(E e); enum E {A, B, C}; which the compiler rejects. I've had a quick look on Google and the consensus seems to be "you can't do it..

AngularJS view not updating on model change

i'm trying to figure out how Angular works and am having trouble getting my view to update when the model changes.. HTML <div ng-app="test"> <p ng-controller="TestCtrl"> ..

How do you make Vim unhighlight what you searched for?

I search for "nurple" in a file. I found it, great. But now, every occurrence of "nurple" is rendered in sick black on yellow. Forever. Forever, that is, until I search for something I know won't be ..

How to query DATETIME field using only date in Microsoft SQL Server?

I have a table TEST with a DATETIME field, like this: ID NAME DATE 1 TESTING 2014-03-19 20:05:20.000 What I need a query returning this row and every row with date 03/19/2014, no matter what the time..

Issue with background color in JavaFX 8

Looks like there is an issue with setting background colors for panels in JavaFX 8. I had been trying the below, but none of them set the appropriate background colors. VBox panel = new VBox(); pane..

Using FolderBrowserDialog in WPF application

I have a WPF application that I need to have users access directories in. I have searched to the end of the world on how to integrate windows forms into WPF and have found all kinds of information on..

Angular 2: Get Values of Multiple Checked Checkboxes

My problem is really simple: I have a list of checkboxes like this: <div class="form-group"> <label for="options">Options :</label> <label *ngFor="#option of options" cla..

How to run test methods in specific order in JUnit4?

I want to execute test methods which are annotated by @Test in specific order. For example: public class MyTest { @Test public void test1(){} @Test public void test2(){} } I want to ensure..

How to create a HashMap with two keys (Key-Pair, Value)?

I have a 2D array of Integers. I want them to be put into a HashMap. But I want to access the elements from the HashMap based on Array Index. Something like: For A[2][5], map.get(2,5) which returns a..

Failed to load JavaHL Library

After updating to Snow Lion I started receiving these errors in Flash Builder / Eclipse when trying to use SVN: Failed to load JavaHL Library. These are the errors that were encountered: no libsvnja..

Join two sql queries

I have two SQL queries, where the first one is: select Activity, SUM(Amount) as "Total Amount 2009" from Activities, Incomes where Activities.UnitName = ? AND Incomes.ActivityId = Activities.Ac..

How to run (not only install) an android application using .apk file?

Is there any command on cmd.exe that would allow me to start the main activity of a particular android application using the .apk file of that application. Please note that I know this command which o..

Check if a string contains an element from a list (of strings)

For the following block of code: For I = 0 To listOfStrings.Count - 1 If myString.Contains(lstOfStrings.Item(I)) Then Return True End If Next Return False The output is: Case 1: m..

Finding the index of an item in a list

Given a list ["foo", "bar", "baz"] and an item in the list "bar", how do I get its index (1) in Python?..

Execution Failed for task :app:compileDebugJavaWithJavac in Android Studio

I am developing an Android App in Android Studio. Not quite sure what went wrong. I was successfully building a few days ago. Any help would be great. Here is the error: Error:Execution failed for t..

Pandas Merging 101

How to perform a (INNER| (LEFT|RIGHT|FULL) OUTER) JOIN with pandas? How do I add NaNs for missing rows after merge? How do I get rid of NaNs after merging? Can I merge on the index? How do I merge mu..

Get filename from input [type='file'] using jQuery

This is the uploaded form. <form class="alert alert-info"> <div> <b id = "select_file" class="span3" style="font-weight: bold; cursor: pointer; ">Please select image<..

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

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

node.js require all files in a folder?

How do I require all files in a folder in node.js? need something like: files.forEach(function (v,k){ // require routes require('./routes/'+v); }}; ..

SQL Query to search schema of all tables

I am working on a SQL Server 2008 Db that has many tables in it (around 200). Many of these tables contain a field by the name "CreatedDate". I am trying to identify all the table schema with this par..

Select From all tables - MySQL

I have a mySQL database called listDB that contain several tables with column name Product etc. I want to SELECT from all tables where Product Like %XYZ%, and display the search result in a separate t..

How to hide close button in WPF window?

I'm writing a modal dialog in WPF. How do I set a WPF window to not have a close button? I'd still like for its WindowState to have a normal title bar. I found ResizeMode, WindowState, and WindowStyl..

java.lang.ClassNotFoundException on working app

I have created and published my first Android app. It's very simple. It works fine on simulator and some phones, but I am getting this error: java.lang.RuntimeException: Unable to instantiate applica..

ASP MVC href to a controller/view

I have this: <li><a href="/Users/Index)" class="elements"><span>Clients</span></a></li> Which works fine. But if I am already on this page or on the controller e..

Why can't I change my input value in React even with the onChange listener

I am quite new to React and after going through some tutorials, I was trying the below code of mine. I made one component, passed props to it from a store, on componentWillMount I make a new state for..

ssh connection refused on Raspberry Pi

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

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

I'm compiling a project in Eclipse using m2eclipse. I set the JDK path in Eclipse like this: Windows-->preferences-->installed jres--> jdk1.7.xx path But this is showing an error [ERROR]..

Applying an ellipsis to multiline text

Is there a solution to add ellipsis on last line inside a div with a fluid height (20%)? I found the -webkit-line-clamp function in CSS, but in my case the line number will be depending on window siz..

"android.view.WindowManager$BadTokenException: Unable to add window" on buider.show()

From my main activity, I need to call an inner class and in a method within the class, I need to show AlertDialog. After dismissing it, when the OK button is pressed, forward to Google Play for purcha..

List of lists into numpy array

How do I convert a simple list of lists into a numpy array? The rows are individual sublists and each row contains the elements in the sublist...

Can we update primary key values of a table?

Can we update primary key values of a table?..

Remove from the beginning of std::vector

I have a vector of the following data structure struct Rule { int m_id = -1; std::wstring name; double angle; }; std::vector<Rule>& topPriorityRules; and I am..

Running Node.Js on Android

So I know this has been questioned quite a lot. To be exact for example in these questions: Run NodeJs server in Android How to run my node.js project on android? and NodeJS on IOS/Android ..

Where do I find some good examples for DDD?

I'm learning about Domain Driven Design, however there are some practical issues that are confusing to me that I think seeing some good samples might clear up. Does anyone know of some good working c..

How to trim a list in Python

Suppose I have a list with X elements [4,76,2,8,6,4,3,7,2,1...] I'd like the first 5 elements. Unless it has less than 5 elements. [4,76,2,8,6] How to do that?..

SQL selecting rows by most recent date with two unique columns

Using the following query and results, I'm looking for the most recent entry where the ChargeId and ChargeType are unique. select chargeId, chargeType, serviceMonth from invoice CHARGEID CHAR..

using lodash .groupBy. how to add your own keys for grouped output?

I have this sample data returned from an API. I'm using Lodash's _.groupBy to convert the data into an object I can use better. The raw data returned is this: [ { "name": "jim", ..

update listview dynamically with adapter

This tutorial uses a SimpleAdapter which works fine, but I need to update the arrays in the adapter when new data is entered. Could you please guide me on how to update a ListView using something oth..

What are the benefits of learning Vim?

As a programmer I spend a lot of hours at the keyboard and I've been doing it for the last 12 years, more or less. If there's something I've never gotten used to during all this time, it's these annoy..

jQuery Scroll to Div

I am making an FAQ page and have buttons across the top to jump to a category (it jumps to the p tag that I use as the category label, ex. <p id="general"> for my general category). Instead of j..

Best way to convert string to bytes in Python 3?

There appear to be two different ways to convert a string to bytes, as seen in the answers to TypeError: 'str' does not support the buffer interface Which of these methods would be better or ..

How do you create a remote Git branch?

I created a local branch which I want to 'push' upstream. There is a similar question here on Stack Overflow on how to track a newly created remote branch. However, my workflow is slightly different..

What is the shortcut to Auto import all in Android Studio?

Is there any way of auto importing (like in Eclipse Shift+Ctrl+O) in Android Studio? I have found only Ctrl+Alt+O which ask for each thing, and I have to press Alt+Enter to accept it. No way to do ..

Switch/toggle div (jQuery)

I wish to accomplish a fairly simple task (I hope!) I got two div tags and one anchor tags, like this: <a href="javascript:void(0);">forgot password?</a> <div id="login-form"></..

Why would anybody use C over C++?

Although people seem to like to complain about C++, I haven't been able to find much evidence as to why you would want to choose C over C++. C doesn't seem to get nearly as much flak and if C++ has al..

Android. Fragment getActivity() sometimes returns null

In developer console error reports sometimes I see reports with NPE issue. I do not understand what is wrong with my code. On emulator and my device application works good without forcecloses, howeve..

Android : How to set onClick event for Button in List item of ListView

I want to add onClick event for buttons used in item of Listview. How can I give onClick event for buttons in List Item...

What does Docker add to lxc-tools (the userspace LXC tools)?

If you take a look at Docker's features, most of them are already provided by LXC. So what does Docker add? Why would I use Docker over plain LXC?..

How can I turn a JSONArray into a JSONObject?

Basically I have: JSONArray j = new JSONArray(); j.add(new JSONObject()); //JSONObject has a bunch of data in it j.add(new JSONArray()); //JSONArray has a bunch of data in it And now I would like ..

Is there a MySQL option/feature to track history of changes to records?

I've been asked if I can keep track of the changes to the records in a MySQL database. So when a field has been changed, the old vs new is available and the date this took place. Is there a feature or..

Package structure for a Java project?

Whats the best practice for setting up package structures in a Java Web Application? How would you setup your src, unit test code, etc?..

Creating a UITableView Programmatically

I have an application in Xcode 4.6 which uses storyboards. I added a UITableView to a view controller class, which worked as expected. However, when I tried deleting the UITableView in the storyboard ..

How can I store and retrieve images from a MySQL database using PHP?

How can I insert an image in MySQL and then retrieve it using PHP? I have limited experience in either area, and I could use a little code to get me started in figuring this out...

Add Bootstrap Glyphicon to Input Box

How can I add a glyphicon to a text type input box? For example I want to have 'icon-user' in a username input, something like this: ..

Using a string variable as a variable name

Possible Duplicate: How do I do variable variables in Python? I have a variable with a string assigned to it and I want to define a new variable based on that string. foo = "bar" foo = "s..

Elegant ways to support equivalence ("equality") in Python classes

When writing custom classes it is often important to allow equivalence by means of the == and != operators. In Python, this is made possible by implementing the __eq__ and __ne__ special methods, resp..

RestSharp JSON Parameter Posting

I am trying to make a very basic REST call to my MVC 3 API and the parameters I pass in are not binding to the action method. Client var request = new RestRequest(Method.POST); request.Resource = "..

How to get the mouse position without events (without moving the mouse)?

Is it possible to get the mouse position with JavaScript after page loads without any mouse movement event (without moving the mouse)?..

How to suppress binary file matching results in grep

When using grep in linux, the result often contains a lot of "binary file XXX matches", which I do not care about. How to suppress this part of the results, or how to exclude binary files in grep?..

Does JavaScript guarantee object property order?

If I create an object like this: var obj = {}; obj.prop1 = "Foo"; obj.prop2 = "Bar"; Will the resulting object always look like this? { prop1 : "Foo", prop2 : "Bar" } That is, will the propertie..

Passing data from controller to view in Laravel

I am new to laravel and I have been trying to store all records of table 'student' to a variable and then pass that variable to a view so that I can display them. I have a controller - ProfileContro..

Hiding elements in responsive layout?

Looking through bootstrap it looks like they support collapsing the menubar items for smaller screens. Is there something similar for other items on the page? For example, I have a along with nav-pi..

javascript unexpected identifier

I am trying to compress my JavaScript code to get less traffic on my site. It has been working fine, but now I came across an error I can't resolve. I turned my ajax function into one line: function..

Scala how can I count the number of occurrences in a list

val list = List(1,2,4,2,4,7,3,2,4) I want to implement it like this: list.count(2) (returns 3)...

How can building a heap be O(n) time complexity?

Can someone help explain how can building a heap be O(n) complexity? Inserting an item into a heap is O(log n), and the insert is repeated n/2 times (the remainder are leaves, and can't violate the ..

Multiple file extensions in OpenFileDialog

How can I use multiple file extensions within one group using OpenFileDialog? I have Filter = "BMP|*.bmp|GIF|*.gif|JPG|*.jpg|PNG|*.png|TIFF|*.tiff" and I want to create groups so JPG are *.jpg and *.j..

How to place object files in separate subdirectory

I'm having trouble with trying to use make to place object files in a separate subdirectory, probably a very basic technique. I have tried to use the information in this page: http://www.gnu.org/softw..

How to use css style in php

Im using php to display data from mysql. Here are my css statements: <style type=”text/css”> table { margin: 8px; } th { font-family: Arial, Helvetica, sans-serif; font-size: ...

CSS align images and text on same line

I have been searching and trying different methods for hours now. I just can't seem to get these two images and text all on one line. I want both the images and both text to all be on one line arrang..

How to set the java.library.path from Eclipse

How can I set the java.library.path for a whole Eclipse Project? I'm using a Java library that relies on OS specific files and need to find a .dll/ .so/ .jnilib. But the Application always exits with ..

drag drop files into standard html file input

These days we can drag & drop files into a special container and upload them with XHR 2. Many at a time. With live progress bars etc. Very cool stuff. Example here. But sometimes we don't want th..

access key and value of object using *ngFor

I am a bit confused about how to get the key and value of an object in angular2 while using *ngFor for iterating over the object. I know in angular 1.x there is a syntax like ng-repeat="(key, value)..

JavaScript/jQuery to download file via POST with JSON data

I have a jquery-based single-page webapp. It communicates with a RESTful web service via AJAX calls. I'm trying to accomplish the following: Submit a POST that contains JSON data to a REST url. If..

How can I match on an attribute that contains a certain string?

I am having a problem selecting nodes by attribute when the attributes contains more than one word. For example: <div class="atag btag" /> This is my xpath expression: //*[@class='atag'] ..

How to convert JSON to CSV format and store in a variable

I have a link that opens up JSON data in the browser, but unfortunately I have no clue how to read it. Is there a way to convert this data using JavaScript in CSV format and save it in JavaScript file..

How to convert dd/mm/yyyy string into JavaScript Date object?

How to convert a date in format 23/10/2015 into a JavaScript Date format: Fri Oct 23 2015 15:24:53 GMT+0530 (India Standard Time) ..

Multi-character constant warnings

Why is this a warning? I think there are many cases when is more clear to use multi-char int constants instead of "no meaning" numbers or instead of defining const variables with same value. When pars..

Query for documents where array size is greater than 1

I have a MongoDB collection with documents in the following format: { "_id" : ObjectId("4e8ae86d08101908e1000001"), "name" : ["Name"], "zipcode" : ["2223"] } { "_id" : ObjectId("4e8ae86d08101..

Return anonymous type results?

Using the simple example below, what is the best way to return results from multiple tables using Linq to SQL? Say I have two tables: Dogs: Name, Age, BreedId Breeds: BreedId, BreedName I want t..

Access denied for root user in MySQL command-line

I've just installed xampp, and am using command line to write mySQL. I am using 'root' with no password and can connect to mysql but cannot CREATE DATABASE as I get the error 1044 access denied for us..

Why is "forEach not a function" for this object?

This is probably something really dumb, but I don't understand why this doesn't work. var a = {"cat":"large"}; a.forEach(function(value, key, map){ console.log(value); }); Uncaught TypeError: ..

Decoding JSON String in Java

I am new to using the json-simple library in Java and I've been through both the encoding and decoding samples. Duplicating the encoding examples was fine, but I have not been able to get the decoding..

Vue.js toggle class on click

How does toggle a class in vue.js? I have the following: <th class="initial " v-on="click: myFilter"> <span class="wkday">M</span> </th> new Vue({ el: '#my-container',..

How do I push a local Git branch to master branch in the remote?

I have a branch called develop in my local repo, and I want to make sure that when I push it to origin it's merged with the origin/master. Currently, when I push it's added to a remote develop branch...

How to compare dates in Java?

How do I compare dates in between in Java? Example: date1 is 22-02-2010 date2 is 07-04-2010 today date3 is 25-12-2010 date3 is always greater than date1 and date2 is always today. How do I veri..

SSH Key: “Permissions 0644 for 'id_rsa.pub' are too open.” on mac

I generate a ssh key pair on my mac and add the public key to my ubuntu server(in fact, it is a virtual machine on my mac),but when I try to login the ubuntu server,it says: @@@@@@@@@@@@@@@@@@@@@@@@@..

Using ng-click vs bind within link function of Angular Directive

In the link function, is there a more "Angular" way to bind a function to a click event? Right now, I'm doing... myApp.directive('clickme', function() { return function(scope, element, attrs) ..

ASP.Net MVC: Calling a method from a view

In my MVC app the controller gets the data (model) from an external API (so there is no model class being used) and passes that to the view. The data (model) has a container in which there are several..

SignalR Console app example

Is there a small example of a console or winform app using signalR to send a message to a .net hub?. I have tried the .net examples and have looked at the wiki but it is not making sense to me the rel..

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

How can I resolve the error: "The command [...] exited with code 1"?

I've read around many questions but I've not been able to find the right answer for me. As I try to compile a project in VS2012 I have this result: The command "....\tools\bin\nuget pack Packages\Li..

How does the "view" method work in PyTorch?

I am confused about the method view() in the following code snippet. class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) ..

delete map[key] in go?

I have a map: var sessions = map[string] chan int{} How do I delete sessions[key]? I tried: sessions[key] = nil,false; That didn't work. Update (November 2011): The special syntax for del..

Get SELECT's value and text in jQuery

Possible Duplicate: Getting the value of the selected option tag in a select box For a SELECT box, how do I get the value and text of the selected item in jQuery? For example, <option ..

What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?

While converting a project that used SlimDX, and therefore has unmanaged code, to .NET 4.0 I ran into the following error: Mixed mode assembly is built against version 'v2.0.50727' of the runtime ..

Removing items from a ListBox in VB.net

I have two ListBox1 and ListBox2. I have inserted items into a ListBox2 with the following code by selecting ListBox1 item: da6 = New SqlDataAdapter("select distinct(component_type) from component wh..

When are static variables initialized?

I am wondering when static variables are initialized to their default values. Is it correct that when a class is loaded, static vars are created (allocated), then static initializers and initializatio..

Java SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") gives timezone as IST

I have SimpleDateFormat constructor as SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") and I am parsing string "2013-09-29T18:46:19Z". I have read that here Z represents the GMT/UTC timezone. but w..

How to execute cmd commands via Java

I am trying to execute command line arguments via Java. For example: // Execute command String command = "cmd /c start cmd.exe"; Process child = Runtime.getRuntime().exec(command); // Get output str..

How do I convert a String to a BigInteger?

I'm trying to read some really big numbers from standard input and add them together. However, to add to BigInteger, I need to use BigInteger.valueOf(long);: private BigInteger sum = BigInteger.valu..

Trim last character from a string

I have a string say "Hello! world!" I want to do a trim or a remove to take out the ! off world but not off Hello...

Postgresql, update if row with some unique value exists, else insert

I have a URLs table. They contain (id int primary key, url character varying unique, content character varying, last analyzed date). I want to create trigger or something(rule may be), so each ..

Get Environment Variable from Docker Container

What's the simplest way to get an environment variable from a docker container that has not been declared in the Dockerfile? For instance, an environment variable that has been set through some docke..

How to have conditional elements and keep DRY with Facebook React's JSX?

How do I optionally include an element in JSX? Here is an example using a banner that should be in the component if it has been passed in. What I want to avoid is having to duplicate HTML tags in th..

Uncaught TypeError: Cannot read property 'appendChild' of null

I'm getting the following error Uncaught TypeError: Cannot read property 'appendChild' of null myRequest.onreadystatechange @ script.js:20 with my following code // index.html <html>..

Calculating the sum of two variables in a batch script

This is my first time on Stack Overflow so please be lenient with this question. I have been experimenting with programming with batch and using DOSbox to run them on my linux machine. Here is the c..

How to obtain values of request variables using Python and Flask

I'm wondering how to go about obtaining the value of a POST/GET request variable using Python with Flask. With Ruby, I'd do something like this: variable_name = params["FormFieldValue"] How would ..

Gradle error: Minimum supported Gradle version is 3.3. Current version is 3.2

When I today update Android Studio it write: Minimum supported Gradle version is 3.3. Current version is 3.2 how can I solve this problem? Here is my build.gradle // Top-level build file where you ..

Angular - How to apply [ngStyle] conditions

I have a div that I want to style based on a condition. If styleOne is true I want a background colour of red. If StyleTwo is true, I want the background colour to be blue. I've got half of it working..

How do I import an existing Java keystore (.jks) file into a Java installation?

So, I am having trouble with LDAP. I have an integration test case that hopefully will work out, but it is currently running into LDAPS security issues with the SSL handshake. I am able to connect t..

How do you rename a MongoDB database?

There's a typo in my MongoDB database name and I'm looking to rename the database. I can copy and delete like so... db.copyDatabase('old_name', 'new_name'); use old_name db.dropDatabase(); Is ther..

Is it possible to capture a Ctrl+C signal and run a cleanup function, in a "defer" fashion?

I want to capture the Ctrl+C (SIGINT) signal sent from the console and print out some partial run totals. Is this possible in Golang? Note: When I first posted the question I was confused about Ctrl..

How to convert a String to Bytearray

How can I convert a string in bytearray using JavaScript. Output should be equivalent of the below C# code. UnicodeEncoding encoding = new UnicodeEncoding(); byte[] bytes = encoding.GetBytes(AnyStrin..

Installing Node.js (and npm) on Windows 10

I had some issues trying to install Node on Windows 10 and found the solution. The error was as follows: C:\Users\Stephan>npm Error: ENOENT, stat 'C:\Users\Stephan\AppData\Roaming\npm' The so..

is there a 'block until condition becomes true' function in java?

I'm writing a listener thread for a server, and at the moment I'm using: while (true){ try { if (condition){ //do something condition=false; } slee..

Error "can't use subversion command line client : svn" when opening android project checked out from svn

I'm new to Android development and the development tools around it. I have checked out a project from svn using TortoiseSVN client (can't manage to do it from within Android Studio), then get this err..

How do I Set Background image in Flutter?

I am trying to set a background image for the home page. I am getting the image place from start of the screen and filling the width but not the height. Am I missing something in my code? Are there i..

How to add target="_blank" to JavaScript window.location?

The following sets the target to _blank: if (key == "smk") { window.location = "http://www.smkproduction.eu5.org"; target = "_blank"; done = 1; } But this doesn't seem to work. How do I..

How to take keyboard input in JavaScript?

I want to take keyboard input in JavaScript, where arrow keys, when pressed, will result in the change in shape of a particular shape. How do I take the input of any of the keys in JavaScript?..

Anaconda Navigator won't launch (windows 10)

Anaconda navigator won't launch, I tried reinstalling it, that did not work either. anancondas' command prompt shows an error message. I've tried googling the answer, I guess I'm bad at it. [this is w..

Bash script processing limited number of commands in parallel

I have a bash script that looks like this: #!/bin/bash wget LINK1 >/dev/null 2>&1 wget LINK2 >/dev/null 2>&1 wget LINK3 >/dev/null 2>&1 wget LINK4 >/dev/null 2>&am..

libxml install error using pip

This is my error: (mysite)zjm1126@zjm1126-G41MT-S2:~/zjm_test/mysite$ pip install lxml Downloading/unpacking lxml Running setup.py egg_info for package lxml Building lxml version 2.3. Build..

jQuery scroll() detect when user stops scrolling

Ok with this.. $(window).scroll(function() { $('.slides_layover').removeClass('showing_layover'); $('#slides_effect').show(); }); I can tell when someone is scrolling from what I understan..

How can I uninstall an application using PowerShell?

Is there a simple way to hook into the standard 'Add or Remove Programs' functionality using PowerShell to uninstall an existing application? Or to check if the application is installed?..