Questions Tagged with #Page state

When to use AtomicReference in Java?

When do we use AtomicReference? Is it needed to create objects in all multithreaded programs? Provide a simple example where AtomicReference should be used...

Pylint "unresolved import" error in Visual Studio Code

I am using the following setup macOS v10.14 (Mojave) Python 3.7.1 Visual Studio Code 1.30 Pylint 2.2.2 Django 2.1.4 I want to use linting to make my life a bit easier in Visual Studio Code. However,..

Setting selection to Nothing when programming Excel

When I create a graph after using range.copy and range.paste it leaves the paste range selected, and then when I create a graph a few lines later, it uses the selection as the first series in the plot..

Deserialize JSON with Jackson into Polymorphic Types - A Complete Example is giving me a compile error

I am attempting to work through a tutorial from Programmer Bruce that is supposed to allow the deserialization of polymorphic JSON. The complete list can be found here Programmer Bruce tutorials (Gr..

how to add a jpg image in Latex

I want to insert a .jpg image(that is in my current folder, where the .tex file is) after a paragraph. How can I do it in Latex? What should I include / what commands should I use?..

How do I calculate power-of in C#?

I'm not that great with maths and C# doesn't seem to provide a power-of function so I was wondering if anyone knows how I would run a calculation like this: var dimensions = ((100*100) / (100.00^3.00..

jQuery changing font family and font size

I am trying to change font family and font size of the text that appears in a textarea and a container by choosing the font from the list, font size should be fixed. I am also trying to change color o..

Why does PEP-8 specify a maximum line length of 79 characters?

Why in this millennium should Python PEP-8 specify a maximum line length of 79 characters? Pretty much every code editor under the sun can handle longer lines. What to do with wrapping should be the ..

ERROR Android emulator gets killed

After updating to Android Studio 2 when I try to run my application and choose an emulator, I wait for the emulator to start and it suddenly gets killed. I can see emulator process for some minutes bu..

Control flow in T-SQL SP using IF..ELSE IF - are there other ways?

I need to branch my T-SQL stored procedure (MS SQL 2008) control flow to a number of directions: CREATE PROCEDURE [fooBar] @inputParam INT AS BEGIN IF @inputParam = 1 BEGIN ... END ELS..

How to control the width of select tag?

I have a list of countries, some with a very long name: <select name=countries> <option value=af>Afghanistan</option> <option value=ax>Ă…land Islands</option> ... &l..

Polymorphism: Why use "List list = new ArrayList" instead of "ArrayList list = new ArrayList"?

Possible Duplicate: Why should the interface for a Java class be prefered? When should I use List<Object> list = new ArrayList<Object>(); ArrayList inherits from List, so if..

SQL Current month/ year question

So I have a table that has the month and year broken down, for example field called Month has the number 7 in it (this month) and the Year field has 2011. Theres also additional months years, etc. How..

What is a good regular expression to match a URL?

Currently I have an input box which will detect the URL and parse the data. So right now, I am using: var urlR = /^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+) (?::(\d+))?(?:\/([^?#]*))?(?..

How to escape "&" in XML?

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

Add animated Gif image in Iphone UIImageView

I need to load an animated Gif image from a URL in UIImageview. When I used the normal code, the image didn't load. Is there any other way to load animated Gif images?..

How to iterate through a list of objects in C++

I'm very new to C++ and struggling to figure out how I should iterate through a list of objects and access there members. I've been trying this where data is the list and student a class. std::list&..

How to remove square brackets from list in Python?

LIST = ['Python','problem','whatever'] print(LIST) When I run this program I get [Python, problem, whatever] Is it possible to remove that square brackets from output?..

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip

I am trying to install django-heroku using pip, but it keeps running into an error. I have seen suggestions telling me to make sure my Python version in Heroku is up to date. I have already done that...

Google Play on Android 4.0 emulator

How can I install the Google Play .apk onto my Android 4.0 emulator?..

How to compare values which may both be null in T-SQL

I want to make sure I'm not inserting a duplicate row into my table (e.g. only primary key different). All my fields allow NULLS as I've decided null to mean "all values". Because of nulls, the foll..

How do I compare two files using Eclipse? Is there any option provided by Eclipse?

How do I compare two files using Eclipse? (Currently I am using WinMerge.)..

How to change root logging level programmatically for logback

I have the following logback.xml file: <configuration debug="true"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{HH:mm:ss.SS..

What is the difference between require() and library()?

What is the difference between require() and library()?..

$watch'ing for data changes in an Angular directive

How can I trigger a $watch variable in an Angular directive when manipulating the data inside (e.g., inserting or removing data), but not assign a new object to that variable? I have a simple dataset..

Check if a given key already exists in a dictionary

I wanted to test if a key exists in a dictionary before updating the value for the key. I wrote the following code: if 'key1' in dict.keys(): print "blah" else: print "boo" I think this is not ..

How to implement reCaptcha for ASP.NET MVC?

How do I implement reCaptcha in ASP.NET MVC and C#?..

Compilation error - missing zlib.h

I am trying to compile software on Blue Gene Q using IBM XL compilers and I got this error message: "iostreams/zlib.cpp", line 19.10: 1540-0836 (S) The #include file "zlib.h" is not found. make[3]: *..

To delay JavaScript function call using jQuery

JavaScript: $(document).ready(function(){ function sample() { alert("This is sample function"); } $("#button").click(function(){ t = setTimeout(&q..

Running Tensorflow in Jupyter Notebook

I am trying to do some deep learning work. For this, I first installed all the packages for deep learning in my Python environment. Here is what I did. In Anaconda, I created an environment called..

phpexcel to download

hello i am new to phpexcel, and i was wondering if there is some way send the excel i have created to the clients download without saving it on my server or to delete it right after he downloads it ..

How do I compare two hashes?

I am trying to compare two Ruby Hashes using the following code: #!/usr/bin/env ruby require "yaml" require "active_support" file1 = YAML::load('./en_20110207.yml')) file2 = YAML::load(Fi..

Using IS NULL or IS NOT NULL on join conditions - Theory question

Theory question here: Why does specifying table.field IS NULL or table.field IS NOT NULL not work on a join condition (left or right join for instance) but only in the where condition? Non working E..

Run PHP Task Asynchronously

I work on a somewhat large web application, and the backend is mostly in PHP. There are several places in the code where I need to complete some task, but I don't want to make the user wait for the re..

Add day(s) to a Date object

Possible Duplicate: How to add number of days to today's date? I'm confused, I found so many different approaches, and which of them is actually correct? So what is the correct way to..

how to fix the issue "Command /bin/sh failed with exit code 1" in iphone

I used a cocoa static library in my application. When I compile my library I got the following error: Shell Script invocation error:can't open input file: /Users/sijuthomas/Library/Developer/Xcode/De..

Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`

Recently, when I compile my scss files I get an error. The error message says: Browserslist: caniuse-lite is outdated. Please run next command npm update caniuse-lite browserslist First, as the ..

How to make a view with rounded corners?

I am trying to make a view in android with rounded edges. The solution I found so far is to define a shape with rounded corners and use it as the background of that view. Here is what I did, define a..

How do I echo and send console output to a file in a bat script?

I have a batch script that executes a task and sends the output to a text file. Is there a way to have the output show on the console window as well? For Example: c:\Windows>dir > windows-dir..

MySQLi prepared statements error reporting

I'm trying to get my head around MySQli and I'm confused by the error reporting. I am using the return value of the MySQLi 'prepare' statement to detect errors when executing SQL, like this: $stmt_te..

Git Bash doesn't see my PATH

When I use Git Bash (on Windows), I cannot run any executable without specifying its full path, although it is located in a folder which is in my PATH variable. Looks like bash doesn't recognize it. W..

how to prevent css inherit

Below are the sample code block i use. I have two set of css, and want to apply onto two UL component. however, the result come out, the inner "UL" will hold some of the css which defined for its pare..

How do I call Objective-C code from Swift?

In Swift, how does one call Objective-C code? Apple mentioned that they could co-exist in one application, but does this mean that one could technically re-use old classes made in Objective-C whilst ..

AngularJS: ng-repeat list is not updated when a model element is spliced from the model array

I have two controllers and share data between them with an app.factory function. The first controller adds a widget in the model array (pluginsDisplayed) when a link is clicked. The widget is pushed ..

How to enumerate an object's properties in Python?

I C# we do it through reflection. In Javascript it is simple as: for(var propertyName in objectName) var currentPropertyValue = objectName[propertyName]; How to do it in Python?..

Turn off warnings and errors on PHP and MySQL

I am getting expected notices and warnings and would like to turn them off in my PHP file. The error is: Warning: fsockopen() And the notice are: Notice: A non well formed numeric value encountere..

Convert integer to hex and hex to integer

So I have this query working (where signal_data is a column) in Sybase but it doesn't work in Microsoft SQL Server: HEXTOINT(SUBSTRING((INTTOHEX(signal_data)),5,2)) as Signal I also have it in Exce..

How to check if one of the following items is in a list?

I'm trying to find a short way to see if any of the following items is in a list, but my first attempt does not work. Besides writing a function to accomplish this, is the any short way to check if on..

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

Can you do greater than comparison on a date in a Rails 3 search?

I have this search in Rails 3: Note.where(:user_id =>, :notetype => p[:note_type], :date => p[:date]).order('date ASC, created_at ASC') But I need the :date => p[:date] ..

unbound method f() must be called with fibo_ instance as first argument (got classobj instance instead)

In Python, I'm trying to run a method in a class and I get an error: Traceback (most recent call last): File "C:\Users\domenico\Desktop\py\", line 8, in <module> fibo.f() TypeErr..

How to save password when using Subversion from the console

I was wondering if there is a way to save my Subversion password when doing svn operations from the console. The console is the only option that I have. When I try to do any Subversion action, e.g. sv..

VSCode Change Default Terminal

I am using Visual Studio Code on my Windows 10 PC. I want to change my default terminal from Windows PowerShell to Bash on Ubuntu (on Windows). How can I do that?..

Change background color for selected ListBox item

This is my XAML so far. <ScrollViewer Grid.Column="1" Grid.RowSpan="2"> <ListBox Background="Black" ItemsSource="{Binding Path=ActiveLog}" > ..

indexOf and lastIndexOf in PHP?

In Java, we can use indexOf and lastIndexOf. Since those functions don't exist in PHP, what would be the PHP equivalent of this Java code? if(req_type.equals("RMT")) pt_password = message.substri..

Fragments within Fragments

I'm wondering if this is actually a bug in the Android API: I have a setup like so: +--------------+ | | | | 1 | 2 | | |+-------+| | || || | || 3 || +-----------..

How to get input from user at runtime

I want to take runtime input from user in Oracle 10g PL/SQL blocks (i.e. interactive communication with user). Is it possible? declare x number; begin x=&x; end this code gives error as & ca..

CreateProcess error=2, The system cannot find the file specified

I am writing a program in java which would execute winrar and unzip a jar file for me placed in h:\myjar.jar into the folder h:\new. My java code goes something like this import; import ..

Check if multiple strings exist in another string

How can I check if any of the strings in an array exists in another string? Like: a = ['a', 'b', 'c'] str = "a123" if a in str: print "some of the strings found in str" else: print "no strings f..

How to index into a dictionary?

I have a Dictionary below: colors = { "blue" : "5", "red" : "6", "yellow" : "8", } How do I index the first entry in the dictionary? colors[0] will return a KeyError for obvious reason..

Java: set timeout on a certain block of code?

Is it possible to force Java to throw an Exception after some block of code runs longer than acceptable?..

powerpoint loop a series of animation

I am currently working on a slide with an animation of sunrise to sunset as a background. Then there are some pictures fade in and fade out. Now, I am having difficult to loop the series of animation..

setMaxResults for Spring-Data-JPA annotation?

I am trying to incorporate Spring-Data-JPA into my project. One thing that confuses me is how do I achieve setMaxResults(n) by annotation ? for example, my code: public interface UserRepository extend..

How do you handle a form change in jQuery?

In jQuery, is there a simple way to test if ANY of a form's elements have changed? EDIT: I should have added that I only need to check on a click() event. EDIT: Sorry I really should have been more ..

What is the maximum size of an array in C?

I understand that hardware will limit the amount of memory allocated during program execution. However, my question is without regard to hardware. Assuming that there was no limit to the amount of mem..

Error sending json in POST to web API service

I'm creating a web service using Web API. I implemented a simple class public class ActivityResult { public String code; public int indexValue; public int primaryCodeReference; } And th..

wget command to download a file and save as a different filename

I am downloading a file using the wget command. But when it downloads to my local machine, I want it to be saved as a different filename. For example: I am downloading a file from

What's the fastest way to loop through an array in JavaScript?

I learned from books that you should write for loop like this: for(var i=0, len=arr.length; i < len; i++){ // blah blah } so the arr.length will not be calculated each time. Others say th..

Add/Delete table rows dynamically using JavaScript

I'm trying to add/delete table rows following this example and this example. Here's my code: HTML Form <div id="POItablediv"> <input type="button" id="addPOIbutton" value="Add P..

Matplotlib color according to class labels

I have two vectors, one with values and one with class labels like 1,2,3 etc. I would like to plot all the points that belong to class 1 in red, to class 2 in blue, to class 3 in green etc. How can ..

Convert string to int array using LINQ

I have a function (tointarray) to convert a string into an array of ints, but I am not very satisfied with it. It does the job, but there must be a more elegant way to do this, and perhaps LINQ could ..

No process is on the other end of the pipe (SQL Server 2012)

I've got this error: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the..

What exactly is the function of Application.CutCopyMode property in Excel

Well first of all I found couple of answers while googling but most of the forums are blocked in my Office Network hence asking this question here! One more intention is to get an answer in plain Engl..

An error has occured. Please see log file - eclipse juno

Whenever I start up Eclipse Juno, it gives me an error saying: An error had occured. Please see the log file: C:\Program Files\eclipse\configuration\1362989254411.log. Some websites say to ..

List all files in one directory PHP

What would be the best way to list all the files in one directory with PHP? Is there a $_SERVER function to do this? I would like to list all the files in the usernames/ directory and loop over that r..

Javascript to display the current date and time

I have the following test Script to display the current date & time :- document.getElementById("para1").innerHTML = formatAMPM(); function formatAMPM() { var date = new Date(); var hours..

How to insert the current timestamp into MySQL database using a PHP insert query

In my MySQL database, I have a table with structure username - varchar insert_time - timestamp This table was created in MySQL using the phpMyAdmin tool and for the insert_time column, I have menti..

When should I use a trailing slash in my URL?

When should a trailing slash be used in a URL? For example - should my URL look like /about-us/ or like /about-us? I am fully aware of the SEO-related issues - duplicate content and the canonical thi..

Download and open PDF file using Ajax

I have an action class that generates a PDF. The contentType is set appropriately. public class MyAction extends ActionSupport { public String execute() { ... ... File report = signed..

Vim autocomplete for Python

I am trying to incorporate an autocomplete feature in Vim. I have used the omnicompletion of Vim as well as Pydiction. But in both the cases this message pops up: Omni completion (^O^N^P) Pattern not..

Difference between SurfaceView and View?

When is it necessary, or better to use a SurfaceView instead of a View?..

Python os.path.join() on a list

I can do >>> os.path.join("c:/","home","foo","bar","some.txt") 'c:/home\\foo\\bar\\some.txt' But, when I do >>> s = "c:/,home,foo,bar,some.txt".split(",") >>>

Manually type in a value in a "Select" / Drop-down HTML list?

In a Windows Forms application, a drop-down selector list also gives the user the option of typing an alternate value into that same field (assuming the developer has left this option enabled on the c..

Log4j output not displayed in Eclipse console

For some reason my Eclipse console no longer displays Log4j INFO and DEBUG statements when I run JUnit tests. In terms of code there hasn't been any change, so it must something to do with the Eclipse..

jQuery first child of "this"

I'm trying to pass "this" from a clicked span to a jQuery function that can then execute jQuery on that clicked element's first child. Can't seem to get it right... <p onclick="toggleSection($(thi..

Test if a property is available on a dynamic variable

My situation is very simple. Somewhere in my code I have this: dynamic myVariable = GetDataThatLooksVerySimilarButNotTheSame(); //How to do this? if (myVariable.MyProperty.Exists) //Do stuff So..

Return Index of an Element in an Array Excel VBA

I have an array prLst that is a list of integers. The integers are not sorted, because their position in the array represents a particular column on a spreadsheet. I want to know how I find a particu..

Problem in running .net framework 4.0 website on iis 7.0

Hey I got problem in running .NET framework 4.0 website on IIS7.0. the error I got is like: HTTP Error 404.2 - Not Found "The page you are requesting cannot be served because of the ISAPI and CGI Res..

Get gateway ip address in android

How to get gateway IP details , There is option using wifimanager but. If there is no wify how to find gateway,dns and other details in android device when connected using usb tethering...

SQL query to get the deadlocks in SQL SERVER 2008

Possible Duplicate: Help with deadlock in Sql Server 2008 SQLServer automatically logs all deadlocks. Can anyone help me to get sql query which will capture deadlocks data that is being co..

MySQL Update Inner Join tables query

I have no idea what the problem is. Using MySQL 5.0 I get a compile error when attempting to run the following MySQL update query: UPDATE b SET b.mapx = g.latitude, b.mapy = g.longitude FROM busi..

Case Insensitive String comp in C

I have two postcodes char* that I want to compare, ignoring case. Is there a function to do this? Or do I have to loop through each use the tolower function and then do the comparison? Any idea how ..

Using intents to pass data between activities

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

If...Then...Else with multiple statements after Then

a very easy question: considering an If...Then...Else instruction in VBA, how can I separate multiple instructions after Then? In other words, should I write something like If condition [ Then ] ..

How do I update the element at a certain position in an ArrayList?

I have one ArrayList of 10 Strings. How do I update the index 5 with another String value?..

Adding an image to a PDF using iTextSharp and scale it properly

here's my code. It correctly adds the pictures I want and everything works except that the images are using their native resolution, so if the image is big it's being cropped to fit the page. Is ther..

How to leave/exit/deactivate a Python virtualenv

I'm using virtualenv and the virtualenvwrapper. I can switch between virtualenv's just fine using the workon command. me@mymachine:~$ workon env1 (env1)me@mymachine:~$ workon env2 (env2)me@mymachine..

Create a CSV File for a user in PHP

I have data in a MySQL database. I am sending the user a URL to get their data out as a CSV file. I have the e-mailing of the link, MySQL query, etc. covered. How can I, when they click the link, ha..

IsNumeric function in c#

I know it's possible to check whether the value of a text box or variable is numeric using try/catch statements, but IsNumeric is so much simpler. One of my current projects requires recovering value..

Draw in Canvas by finger, Android

I need to build a project for drawing on canvas by fingers, to get the touch event and motion event of my finger, and thence draw. Any one can advice me how to get start in project, and what is bes..

How to remove non-alphanumeric characters?

I need to remove all characters from a string which aren't in a-z A-Z 0-9 set or are not spaces. Does anyone have a function to do this?..

Pass a PHP array to a JavaScript function

I am trying to get a PHP array variable into a JavaScript variable. This is my code: <html> <head> <script type="text/javascript"> function drawChart(row,..

How to easily get network path to the file you are working on?

In Excel 2003 there used to be a command that I added to my toolbar that was called Address (if I remember correctly) and it would show the fully-qualified network path to the file I had open. For ex..

[Vue warn]: Property or method is not defined on the instance but referenced during render

var MainTable = Vue.extend({ template: "<ul>" + "<li v-for='(set,index) in settings'>" + "{{index}}) " + "{{set.title}}" + "<button @click='changeSetting(index)'> I..

Parsing JSON array into java.util.List with Gson

I have a JsonObject named "mapping" with the following content: { "client": "", "servers": [ "", "", "", "" ..

How to ping an IP address

I am using this part of code to ping an ip address in java but only pinging localhost is successful and for the other hosts the program says the host is unreachable. I disabled my firewall but still ..

How to force IE to reload javascript?

I'm using IE 8 on Vista, and everytime I change a javascript file and then start debugging, I have to hit Ctrl+F5 to have it reload my javascript. Is there any way to make it automatically reload java..

How to show full height background image?

I have a photo type (not landscape) background image with 979px width by 1200px height. I would like to set it to float left and show 100% full image height fixed, without the need to scroll up/down (..

How to slice an array in Bash

Looking the "Array" section in the bash(1) man page, I didn't find a way to slice an array. So I came up with this overly complicated function: #!/bin/bash # @brief: slice a bash array # @arg1: ou..

Enabling CORS in Cloud Functions for Firebase

I'm currently learning how to use new Cloud Functions for Firebase and the problem I'm having is that I can't access the function I wrote through an AJAX request. I get the "No 'Access-Control-Allow-O..


Could someone give me some guidance on when I should use WITH (NOLOCK) as opposed to SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED What are the pros/cons of each? Are there any unintended consequ..

Non-numeric Argument to Binary Operator Error in R

The issue I believe is how CurrentDay is entered. It was previously created as: Transaction <- function(PnL, Day) results <- list(a = PnL, b = Day) return(results) Both PnL and Day are nu..

How to change text and background color?

I want every character to be a different color. for example, cout << "Hello world" << endl; H would be red e would be blue l would be orange and so on. I know this can be done, I ju..

Angular2 *ngIf check object array length in template

Refered to and stack How to check empty object in angular 2 template using *ngIf still getting syntax error self context undefined. If I re..

How to instantiate a File object in JavaScript?

There's a File object in JavaScript. I want to instantiate one for testing purposes. I have tried new File(), but I get an "Illegal constructor" error. Is it possible to create a File object ? F..

How to upgrade OpenSSL in CentOS 6.5 / Linux / Unix from source?

How do I upgrade OpenSSL in CentOS 6.5? I have used these commands, but nothings happens: cd /usr/src wget tar -zxf openssl-1.0.1g.tar.gz cd o..

Creating all possible k combinations of n items in C++

There are n people numbered from 1 to n. I have to write a code which produces and print all different combinations of k people from these n. Please explain the algorithm used for that. ..

How do you close/hide the Android soft keyboard using Java?

I have an EditText and a Button in my layout. After writing in the edit field and clicking on the Button, I want to hide the virtual keyboard when touching outside the keyboard. I assume that this is ..

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

fast way to copy formatting in excel

I have two bits of code. First a standard copy paste from cell A to cell B Sheets(sheet_).Cells(x, 1).Copy Destination:=Sheets("Output").Cells(startrow, 2) I can do almost the same using Sheets("..

Fatal error: Class 'Illuminate\Foundation\Application' not found

I am getting following error when I open my site which is made using laravel 5 Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\cms\bootstrap\app.php on line 14 I have trie..

checking if a number is divisible by 6 PHP

I want to check if a number is divisible by 6 and if not I need to increase it until it becomes divisible. how can I do that ?..

How to filter Pandas dataframe using 'in' and 'not in' like in SQL

How can I achieve the equivalents of SQL's IN and NOT IN? I have a list with the required values. Here's the scenario: df = pd.DataFrame({'country': ['US', 'UK', 'Germany', 'China']}) countries_to_kee..

What is the difference between Sessions and Cookies in PHP?

What is the distinction between Sessions and Cookies in PHP?..

PHP Warning: mysqli_connect(): (HY000/2002): Connection refused

I am using PHP 5.5 and MAMP (downloaded from here): I have a basic script like this: <?php $servername = ""; $username = "root"; $password = "root"; // Create connection $conn = mysqli_..

jQuery: select an element's class and id at the same time?

I've got some links that I want to select class and id at the same time. This is because I've got 2 different behaviours. When a class of links got one class name they behave in one way, when the sam..

Error Dropping Database (Can't rmdir '.test\', errno: 17)

Basically, I was taught on how to create a root password using the "mysqladmin -u root -p password" command, this was done all through the windows command editor. Now, the next process was to display ..

How to disable Home and other system buttons in Android?

I need to disable Home and other system buttons in my Android application. Example: MX Player (see at Google Play) - you can press "lock" icon at player screen and it locks all hardware and software ..

Mean of a column in a data frame, given the column's name

I'm inside a big function I have to write. In the last part I have to calculate the mean of a column in a data frame. The name of the column I am operating on is given as an argument to the function...

font-family is inherit. How to find out the font-family in chrome developer pane?

In the Chrome's developer pane, I can see these css settings of an element. As far as I can see, every single font-family value is inherit. How can I find what is the actual value of the font fam..

How can JavaScript save to a local file?

There's already a solution for writing file JSON online but I want to save json file locally. I've tried to use this example It creates a link to download the file, using..

Passing arguments forward to another javascript function

I've tried the following with no success: function a(args){ b(arguments); } function b(args){ // arguments are lost? } a(1,2,3); In function a, I can use the arguments keyword to access a..

Block direct access to a file over http but allow php script access

I'm loading my files (pdf, doc, flv, etc) into a buffer and serving them to my users with a script. I need my script to be able to access the file but not allow direct access to it. Whats the best w..

How to always show scrollbar

The scrollbar in my scrollview is only visible when I start scrolling. How can I always show it?..

How to sort a data frame by alphabetic order of a character variable in R?

I would like to sort a data frame by alphabetic order of a character variable in R. I've tried to do it with the order() function but it transforms my data frame into a list. Does anyone has a clue ?..

node: command not found

I am in the process of setting up node.js in order to work with a framework like Meteor, Derby, or Ember, but am running into some problems early on. Following these instructions (http://www.nodebegin..

Linux command (like cat) to read a specified quantity of characters

Is there a command like cat in linux which can return a specified quantity of characters from a file? e.g., I have a text file like: Hello world this is the second line this is the third line And ..

selecting from multi-index pandas

I have a multi-index data frame with columns 'A' and 'B'. Is there is a way to select rows by filtering on one column of the multi-index without resetting the index to a single column index? For ..

How is attr_accessible used in Rails 4?

attr_accessible seems to no longer work within my model. What is the way to allow mass assignment in Rails 4?..

Getting full-size profile picture

Is there anyway to get the full-size profile picture using any facebook api?{ID}/picture?type=large is way to small. Thanks :)..

Force flex item to span full row width

I'm trying to retain the first 2 child elements on the same row while the third element is in its own below at full width, all while using flex. I'm particularly interested in using the flex-grow and..

Reporting Services permissions on SQL Server R2 SSRS

I'm getting the error below when I try and access SSRS on SQL Server 2008 R2 I'm not sure how many others have started using SQL 2008 R2 SSRS, but I am having an issue with getting the error below wh..

Force div element to stay in same place, when page is scrolled

I created a div element, that I placed all the way on the right of my site. The only problem is that its at the top of the site, so if i scroll down it remains there. How can I force it to remain in ..

get basic SQL Server table structure information

I can get the number of columns in an SQL Server database with this: SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'Address' But is there any way (for an unknown number of colu..

How can I convert integer into float in Java?

I have two integers x and y. I need to calculate x/y and as outcome I would like to get float. For example as an outcome of 3/2 I would like to have 1.5. I thought that easiest (or the only) way to do..

How to restore the permissions of files and directories within git if they have been modified?

I have a git checkout. All the file permissions are different than what git thinks they should be therefore they all show up as modified. Without touching the content of the files (just want to modif..

JavaScript validation for empty input field

I have this input field <input name="question"/> I want to call IsEmpty function when submit clicking submit button. I tried the code below but did not work. any advice? _x000D_ _x000D_ <h..

Do copyright dates need to be updated?

Every now and then I see a web site that has an old copyright date. In my mind, I always think "Look at the sucker who forgot to update his copyright year!" Then, while I was hard-coding a copyright y..

Using os.walk() to recursively traverse directories in Python

I want to navigate from the root directory to all other directories within and print the same. Here's my code: #!/usr/bin/python import os import fnmatch for root, dir, files in os.walk("."): ..

Xcode process launch failed: Security

I have been developing an app for 1 or 2 weeks now and just yesterday I have updated my iPhone 5S to the iOS 8 GM. Everything worked fine and I could test on my device as well until I deleted the app ..

How do you calculate program run time in python?

How do you calculate program run time in python?..

Sleep/Wait command in Batch

I want to add time delay in my batch file. The batch file will be running silently at backgorund. Please help me...

HTML input arrays

<input name="foo[]" ... > I've used these before, but I'm wondering what it is called and if there is a specification for it? I couldn't find it in the HTML 4.01 Spec and results in various G..

Should I size a textarea with CSS width / height or HTML cols / rows attributes?

Every time I develop a new form that includes a textarea I have the following dilemma when I need to specify its dimensions: Use CSS or use the textarea's attributes cols and rows? What are the pros..

Running windows shell commands with python

How can we interact with OS shell using Python ? I want to run windows cmd commands via python. How can it be achieved ?..

How to print the full NumPy array, without truncation?

When I print a numpy array, I get a truncated representation, but I want the full array. Is there any way to do this? Examples: >>> numpy.arange(10000) array([ 0, 1, 2, ..., 9997,..

How can prevent a PowerShell window from closing so I can see the error?

I'm creating a local PowerShell module downloader script. The module and the script are held on a network share. The script is invoke using: & '\\net\DSFShare\Shared Data\Powershell Modules\Ins..

How to assign a heredoc value to a variable in Bash?

I have this multi-line string (quotes included): abc'asdf" $(dont-execute-this) foo"bar"'' How would I assign it to a variable using a heredoc in Bash? I need to preserve newlines. I don't want t..

jQuery Find and List all LI elements within a UL within a specific DIV

I have 3 Columns of ULs each a Dynamic UL container that can have anywhere from 0-9 LI containers (eventually more). All my LI elements have an attribute "rel" which I am trying to ultimately find tha..

Where do I find old versions of Android NDK?

Does anyone know where I can find older versions of the Android NDK? Our code doesn't build with r6. Surely there must be archived versions somewhere...

Copy all values in a column to a new column in a pandas dataframe

This is a very basic question, I just can not seem to find an answer. I have a dataframe like this, called df: A B C a.1 b.1 c.1 a.2 b.2 c.2 a.3 b.3 c.3 Then I extract all..

Android overlay a view ontop of everything?

Can you overlay a view on top of everything in android? In iPhone I would get the new view set its frame.origin to (0,0) and its width and height to the width and height of self.view. Adding it to se..

Changing minDate and maxDate on the fly using jQuery DatePicker

I'm having a particular issue with the jQuery Datepicker. I can easily add a date range, but I want the selectable range to change depending on the event the user has picked. So if they pick event #1..

How can I format DateTime to web UTC format?

I have a DateTime which I want to format to "2009-09-01T00:00:00.000Z", but the following code gives me "2009-09-01T00:00:00.000+01:00" (both lines): new DateTime(2009, 9, 1, 0, 0, 0, 0, DateTimeKind..

Open File in Another Directory (Python)

I've always been sort of confused on the subject of directory traversal in Python, and have a situation I'm curious about: I have a file that I want to access in a directory essentially parallel to th..

Setting a spinner onClickListener() in Android

I'm trying to get an onClickListener to fire on a Spinner, but I get the following error: Java.lang.RuntimeException is "Don't call setOnClickListener for an AdapterView. You probably want setOnIt..

Find the number of downloads for a particular app in apple appstore

I need to do a market research on specific type of apps. so is there a way for me to know the download count of the app / any app. Is there a way to find the number of downloads for a particular app ..

Android, getting resource ID from string?

I need to pass a resource ID to a method in one of my classes. It needs to use both the id that the reference points to and also it needs the string. How should I best achieve this? For example: R.d..

'MOD' is not a recognized built-in function name

I wanted to use MOD function in SQL Server 2008R2 and followed this link but still got the message: 'MOD' is not a recognized built-in function name. DECLARE @m INT SET @m = MOD(321,11) SELECT..

No default constructor found; nested exception is java.lang.NoSuchMethodException with Spring MVC?

I am working with Spring MVC controller project. Below is my Controller and I have a constructor declared which I am specifically using for testing purpose. @Controller public class TestController { ..

CURL Command Line URL Parameters

I am trying to send a DELETE request with a url parameter using CURL. I am doing: curl -H application/x-www-form-urlencoded -X DELETE http://localhost:5000/locations` -d 'id=3' However, the server ..

Best way to work with dates in Android SQLite

I'm having some trouble working with dates on my Android application that uses SQLite. I have a couple questions: What type should I use to store dates in SQLite (text, integer, ...)? Given the best..

Get a Windows Forms control by name in C#

I have a ToolStripMenuItem called myMenu. How can I access this like so: /* Normally, I would do: */ this.myMenu... etc. /* But how do I access it like this: */ String name = myMenu; ..

Python time measure function

I want to create a python function to test the time spent in each function and print its name with its time, how i can print the function name and if there is another way to do so please tell me def ..

Django - Static file not found

I've seen several posts for this issue but didn't found my solution. I'm trying to serve static files within my Django 1.3 development environment. Here are my settings ... STATIC_ROOT = '/home/gli..

Multiple contexts with the same path error running web service in Eclipse using Tomcat

This is the error that I got when I created my first Axis2 web service using Eclipse. After I wrote the class, I created the web service with Apache Axis2. When I click the start server button in ecli..

How to store Configuration file and read it using React

I am new on react.js I have implemented one component in which I am fetching the data from server and use it like, CallEnterprise:function(TenantId){ fetchData('

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

MySQL Query GROUP BY day / month / year

Is it possible to make a simple query to count how many records I have in a determined period of time like a year, month, or day, having a TIMESTAMP field, like: SELECT COUNT(id) FROM stats WHERE re..

checking if number entered is a digit in jquery

I have a simple textbox in which users enter number. Does jQuery have a isDigit function that will allow me to show an alert box if users enter something other than digits? The field can have decimal..

How do I send a POST request with PHP?

Actually I want to read the contents that come after the search query, when it is done. The problem is that the URL only accepts POST methods, and it does not take any action with GET method... I hav..

how to create a Java Date object of midnight today and midnight tomorrow?

In my code I need to find all my things that happened today. So I need to compare against dates from today at 00:00am (midnight early this morning) to 12:00pm (midnight tonight). I know ... Date to..

How to perform grep operation on all files in a directory?

Working with xenserver, and I want to perform a command on each file that is in a directory, grepping some stuff out of the output of the command and appending it in a file. I'm clear on the command ..

Error: Could not find or load main class

I am having trouble compiling and running my Java code, intended to allow me to interface Java with a shared object for Vensim, a simulation modeling package. The following code compiles without erro..

Check if program is running with bash shell script?

This is an example of a bash script which checks for some running process (daemon or service) and does specific actions (reload, sends mail) if there is no such process running. check_process(){ ..

Why is @font-face throwing a 404 error on woff files?

I'm using @font-face on my company's site and it works/looks great. Except Firefox and Chrome will throw a 404 error on the .woff file. IE does not throw the error. I have the fonts located at the roo..

Validate Dynamically Added Input fields

I have used this jquery validation plugin for the following form. <script src=""></script> <script type="text/javascript" src="http://jzaefferer...

How to copy an object by value, not by reference

I want to make a copy of an object, then after some logic, re-assign the original object the value of the copy. example: User userCopy = //make a copy foreach(...) { user.Age = 1; user.ID = -1;..

C# getting its own class name

If I have a class called MyProgram, is there a way of retrieving "MyProgram" as a string?..

Custom designing EditText

I have custom designed EditText search_page.xml <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:p..

Angular JS break ForEach

I have an angular foreach loop and i want to break from loop if i match a value. The following code does not work. angular.forEach([0,1,2], function(count){ if(count == 1){ break; } }); How..

Convert Json String to C# Object List

I want to convert a json string to a Object list. Please help me. it would be more helpful if done by NewtonJson. I tried, but its not working. I dont want all the values of that json. just which are..

Make flex items take content width, not width of parent container

I have a container <div> with display: flex. It has a child <a>. How can I make the child appear "inline"? Specifically, how can I make the child's width determined by its content, an..

Python 3: EOF when reading a line (Sublime Text 2 is angry)

while True: reply = input('Enter text') if reply == 'stop': break print(reply.upper()) The result was: Enter text:Traceback (most recent call last): File "C:\PythonProjects\", li..

concat scope variables into string in angular directive expression

I am using a scope method in an angular ng-click directive like so: <a ng-click="$navigate.go('#/path/obj.val1/obj.val2')">{{obj.val1}}, {{obj.val2}}</a> The trouble here is that

Instagram API - How can I retrieve the list of people a user is following on Instagram

I would like to know how I can retrieve the list of people a user is following on Instagram. This is given that this particular user is someone that I follow. So I have access to his/her photos and hi..

tap gesture recognizer - which object was tapped?

I'm new to gesture recognizers so maybe this question sounds silly: I'm assigning tap gesture recognizers to a bunch of UIViews. In the method is it possible to find out which of them was tapped someh..

Python datetime strptime() and strftime(): how to preserve the timezone information

See the following code: import datetime import pytz fmt = '%Y-%m-%d %H:%M:%S %Z' d ="America/New_York")) d_string = d.strftime(fmt) d2 = datetime.datetime.strp..

Display image as grayscale using matplotlib

I'm trying to display a grayscale image using matplotlib.pyplot.imshow(). My problem is that the grayscale image is displayed as a colormap. I need the grayscale because I want to draw on top of the..

Creating a fixed sidebar alongside a centered Bootstrap 3 grid

I'd like to create a fixed sidebar that exists outside my centered Bootstrap Grid. The challenge I face when attempting to do this is determining what additional styles to apply/overwrite to my .conta..