Questions Tagged with #Setdlldirectory

Adds a directory to the search path used to locate DLLs for the application.

Round to at most 2 decimal places (only if necessary)

I'd like to round at most 2 decimal places, but only if necessary. Input: 10 1.7777777 9.1 Output: 10 1.78 9.1 How can I do this in JavaScript? ..

:touch CSS pseudo-class or something similar?

I am trying to make a button, such that when the user clicks on it, it changes its style while the mouse button is being held down. I also want it to change its style in a similar way if it is touched..

Why have header files and .cpp files?

Why does C++ have header files and .cpp files?..

How to apply slide animation between two activities in Android?

I want to achieve a sliding effect from left to right when I move from one activity to another. For that I am using the following code, but I am not getting any results. Please correct me. In java bo..

Why is it bad practice to call System.gc()?

After answering a question about how to force-free objects in Java (the guy was clearing a 1.5GB HashMap) with System.gc(), I was told it's bad practice to call System.gc() manually, but the comments ..

Programmatically change input type of the EditText from PASSWORD to NORMAL & vice versa

In my application, I have an EditText whose default input type is set to android:inputType="textPassword" by default. It has a CheckBox to its right, which is when checked, changes the input..

Android Starting Service at Boot Time , How to restart service class after device Reboot?

I need to start a service at boot time. I searched a lot. They are talking about Broadcastreceiver. As I am new to android development, I didn't get a clear picture about services on Android. Please p..

Excel VBA: Copying multiple sheets into new workbook

I have an error message of 'Object Required' when I run this sub. I have a version for copying each specific sheet, which works fine, but this sub is for all sheets within the WB ie to copy each one'..

Decompile .smali files on an APK

I downloaded APK Manager that lets me unpack APK files. But it only unpacks it and doesn't decompile the .smali file to .java. Is it possible to decompile the .smali to .java?..

What's wrong with nullable columns in composite primary keys?

ORACLE does not permit NULL values in any of the columns that comprise a primary key. It appears that the same is true of most other "enterprise-level" systems. At the same time, most systems also al..

Send mail via CMD console

Hi i want to send mail via microsoft cmd console. I tried many way, but i didnt succeed. i tried this article sendmail "[email protected] bcc:[email protected]" T..

How to run .APK file on emulator

Possible Duplicate: How do you install an APK file in the Android emulator? I download an APK file and I want to run it on an Android emulator but I don't know how. Please help me. Thanks..

Change type of varchar field to integer: "cannot be cast automatically to type integer"

I have a small table and a certain field contains the type "character varying". I'm trying to change it to "Integer" but it gives an error that casting is not possible. Is there a way around this or ..

strange error in my Animation Drawable

A strange error when trying to start Activity. i think the error in my Animation Drawable LogCat: 12-31 06:37:45.138: E/AndroidRuntime(922): FATAL EXCEPTION: main 12-31 06:37:45.138: E/Andr..

How to convert an iterator to a stream?

I am looking for a concise way to convert an Iterator to a Stream or more specifically to "view" the iterator as a stream. For performance reason, I would like to avoid a copy of the iterator in a ne..

Best way to determine user's locale within browser

I have a website (Flash) localized into a dozen of languages and I want to auto-define a default value depending on the user's browser settings in order to minimize the steps to access the content. F..

How can I get screen resolution in java?

How can one get the screen resolution (width x height) in pixels? I am using a JFrame and the java swing methods...

Java Replace Line In Text File

How do I replace a line of text found within a text file? I have a string such as: Do the dishes0 And I want to update it with: Do the dishes1 (and vise versa) How do I accomplish this? Actio..

Intermediate language used in scalac?

In the GCC compiler we see several 'intermediate languages': RTL, GENERIC and GIMPLE. This answer hints at the idea of an intermediate representation in scalac. My question is: is there an 'interm..

Click in OK button inside an Alert (Selenium IDE)

I need to click the 'Ok' button inside an alert window with a Selenium command. I've tried assertAlert or verifyAlert but they don't do what I want. It's possible the click the 'Ok' button? If so, ca..

OAuth 2.0 Authorization Header

I want to develop a SDK that encapsules the OAuth 2.0 functions. I have checked the differences between OAuth 1.0 & 2.0, and I have some confusion on Authorization Header (1.0 and 2.0), OAuth 1...

What does "Error: object '<myvariable>' not found" mean?

I got the error message: Error: object 'x' not found Or a more complex version like Error in mean(x) : error in evaluating the argument 'x' in selecting a method for function 'mean..

How to reduce the image size without losing quality in PHP

I am trying to develop an image-based web site. I am really confused about the best image type for faster page loading speeds and best compression practices. Please advise me on the best way to compre..

Specifying width and height as percentages without skewing photo proportions in HTML

I was wondering if in the width and height <img> attributes, I could specify width and height as percentages? Well, I guess that is obvious, because when I try so, it resizes, but it appears to..

Local file access with JavaScript

Is there local file manipulation that's been done with JavaScript? I'm looking for a solution that can be accomplished with no install footprint like requiring Adobe AIR. Specifically, I'd like to re..

Postgresql 9.2 pg_dump version mismatch

I am trying to dump a Postgresql database using the pg_dump tool. $ pg_dump books > books.out How ever i am getting this error. pg_dump: server version: 9.2.1; pg_dump version: 9.1.6 pg_dump:..

Recommended Fonts for Programming?

What fonts do you use for programming, and for what language/IDE? I use Consolas for all my Visual Studio work, any other recommendations?..

how to fix groovy.lang.MissingMethodException: No signature of method:

I am trying to use this method without a closure def copyAndReplaceText(source, dest, targetText, replaceText){ dest.write(source.text.replaceAll(targetText, replaceText)) } def source = new Fi..

What does href expression <a href="javascript:;"></a> do?

I have seen the following href used in webpages from time to time. However, I don't understand what this is trying to do or the technique. Can someone elaborate please? <a href="javascript:;">..

How can I add new dimensions to a Numpy array?

I'm starting off with a numpy array of an image. In[1]:img = cv2.imread('test.jpg') The shape is what you might expect for a 640x480 RGB image. In[2]:img.shape Out[2]: (480, 640, 3) However, thi..

Making Python loggers output all messages to stdout in addition to log file

Is there a way to make Python logging using the logging module automatically output things to stdout in addition to the log file where they are supposed to go? For example, I'd like all calls to logge..

How to assign an exec result to a sql variable?

How do you assign the result of an exec call to a variable in SQL? I have a stored proc called up_GetBusinessDay, which returns a single date. Can you do something like this: exec @PreviousBusine..

Reloading the page gives wrong GET request with AngularJS HTML5 mode

I want to enable HTML5 mode for my app. I have put the following code for the configuration, as shown here: return app.config(['$routeProvider','$locationProvider', function($routeProvider,$locationP..

How to get the first 2 letters of a string in Python?

Let's say I have a string Str1 = "TN 81 NZ 0025" str2 = "DL 11C AA 1111" two = first2(str1) print(two) >>>TN How do I get the first two letters of these strings. I need the first2 functi..

What are Aggregates and PODs and how/why are they special?

This FAQ is about Aggregates and PODs and covers the following material: What are Aggregates? What are PODs (Plain Old Data)? How are they related? How and why are they special? What changes for..

javac not working in windows command prompt

I'm trying to use javac with the windows command prompt, but it's not working. After adding the directory "C:\Program Files\Java\jdk1.6.0_16\bin\" to the end of the PATH environment variable, the jav..

find -exec with multiple commands

I am trying to use find -exec with multiple commands without any success. Does anybody know if commands such as the following are possible? find *.txt -exec echo "$(tail -1 '{}'),$(ls '{}')" \; Ba..

AngularJS open modal on button click

I am trying to learn to open a modal dialog box at the click of the button in AngularJS but unable to do so. I checked the chrome console but there are no errors. Also, since I am learning AngularJS, ..

How to put a jpg or png image into a button in HTML

I want a button with an image in it. I am using this: <input type="submit" name="submit" src="images/stack.png" /> But it does not show the image. I want the whole button to be the image...

Pytesseract : "TesseractNotFound Error: tesseract is not installed or it's not in your path", how do I fix this?

I'm trying to run a basic and very simple code in python. from PIL import Image import pytesseract im ="sample1.jpg") text = pytesseract.image_to_string(im, lang = 'eng') print(text) ..

Importing CSV data using PHP/MySQL

I'm having a bit of a problem trying to import data from a CSV and have a couple of questions on it that I haven't managed to solve myself yet. First off here's my code to help put things in perspect..

Setting a checkbox as checked with Vue.js

I have been googling and playing with every combination I know but I cannot get my checkboxes to be initialised as checked. Example: <ul class="object administrator-checkbox-list"> <li ..

Why am I getting a " Traceback (most recent call last):" error?

I'm sorry for asking, but I can't find why I'm getting this errors, especially after the program is running. The erros to be exact are: >>> Welcome! This program will convert measures for ..

Git push rejected after feature branch rebase

OK, I thought this was a simple git scenario, what am I missing? I have a master branch and a feature branch. I do some work on master, some on feature, and then some more on master. I end up with so..

Python FileNotFound

I am fairly new to python. I am trying to make a script that will read sudoku solutions and determent if they are correct or not. Things I need: 1] Prompt the user to enter a file/file path which i..

Which .NET Dependency Injection frameworks are worth looking into?

Which C#/.NET Dependency Injection frameworks are worth looking into? And what can you say about their complexity and speed...

How to set the title of UIButton as left alignment?

I need to display the email address from left side of a UIButton, but it is being positioned in the centre. Is there any way to set the alignment to the left side of a UIButton? This is my current ..

how to show progress bar(circle) in an activity having a listview before loading the listview with data

I have a ListView in my second activity.OnItemClick of it I called a webservice and trying to fetch data. And after that I am moving to third activity which also have a ListView having description of ..

Display back button on action bar

I'm trying to display a Back button on the Action bar to move previous page/activity or to the main page (first opening). And I can not do it. my code. ActionBar actionBar = getActionBar(); actionBa..

phpMyAdmin - configuration?

With this configuration i found the error The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. To find out why click here. W..

Clearing an HTML file upload field via JavaScript

I want to reset a file upload field when the user selects another option. Is this possible via JavaScript? I'm suspecting that the file upload element is treated differently because it interacts with..

gdb fails with "Unable to find Mach task port for process-id" error

My app runs fine but gdb fails to debug it with the following error (gdb) run Starting program: /path/to/app Unable to find Mach task port for process-id 83767: (os/kern) failure (0x5). I am on OS..

Create a new line in Java's FileWriter

I have coded the following FileWriter: try { FileWriter writer = new FileWriter(new File("file.txt"), false); String sizeX = jTextField1.getText(); String sizeY = jTextField2.getText(); ..

How to create a temporary directory and get the path / file name in Python

how to create a temporary directory and get the path / file name in python..

How to label scatterplot points by name?

I am trying to figure out how to get labels to show on either Google sheets, Excel, or Numbers. I have information that looks like this name|x_val|y_val ---------------- a | 1| 1 b | 2|..

Refresh a page using JavaScript or HTML

How can I refresh a page using JavaScript or HTML?..

How to write a Unit Test?

I have a Java class. How can I unit test it? In my case, I have class does a binary sum. It takes two byte[] arrays, sums them, and returns a new binary array...

Can't create handler inside thread that has not called Looper.prepare()

What does the following exception mean; how can I fix it? This is the code: Toast toast = Toast.makeText(mContext, "Something", Toast.LENGTH_SHORT); This is the exception: java.lang.RuntimeExcept..

how to check for null with a ng-if values in a view with angularjs?

i have this situation <div ng-repeat="test in current"> <div ng-if="test.view == null"> <i class="icon ion-checkmark"></i> </div> </div> but test..

Git push rejected "non-fast-forward"

I am fairly new to git, yet currently using it to manage our code in a team environment. I had some rebasing issues, and I fixed them using: git checkout --ours filename.txt git add filename.txt git r..

List all files and directories in a directory + subdirectories

I want to list every file and directory contained in a directory and subdirectories of that directory. If I chose C:\ as the directory, the program would get every name of every file and folder on the..

Print multiple arguments in Python

This is just a snippet of my code: print("Total score for %s is %s ", name, score) But I want it to print out: "Total score for (name) is (score)" where name is a variable in a list and scor..

Fixing slow initial load for IIS

IIS has an annoying feature for low traffic websites where it recycles unused worker processes, causing the first user to the site after some time to get an extremely long delay (30+ seconds). I've b..

SessionTimeout: web.xml vs session.maxInactiveInterval()

I'm trying to timeout an HttpSession in Java. My container is WebLogic. Currently, we have our session timeout set in the web.xml file, like this <session-config> <session-timeout>1..

What is the format for the PostgreSQL connection string / URL?

What is the format for the PostgreSQL connection string (URL postgres://...) when the host is not the localhost?..

Apply CSS styles to an element depending on its child elements

Is it possible to define a CSS style for an element, that is only applied if the matching element contains a specific element (as the direct child item)? I think this is best explained using an examp..

Const in JavaScript: when to use it and is it necessary?

I've recently come across the const keyword in JavaScript. From what I can tell, it is used to create immutable variables, and I've tested to ensure that it cannot be redefined (in Node.js): const x ..

Spark - SELECT WHERE or filtering?

What's the difference between selecting with a where clause and filtering in Spark? Are there any use cases in which one is more appropriate than the other one? When do I use DataFrame newdf = df...

Copying files from server to local computer using SSH

I am having trouble copying files from a remote server using SSH. Using PuTTY I log in to the server using SSH. Once I find the file I would like to copy over to my computer, I use the command: scp u..

CentOS 64 bit bad ELF interpreter

I have just installed CentOS 6 64bit version, I'm trying to install a 32-bit application on a 64-bit machine and got this error: /lib/ bad ELF interpreter: No such file or directory ..

How to prevent long words from breaking my div?

Ever since switching from TABLE-layout to DIV-layout, one common problem remains: PROBLEM: you fill your DIV with dynamic text and inevitably there is a super-long word that extends over the edge of ..

How can I have Github on my own server?

Is there anything out there like Github that is for your own local server? I am curious if there is like a PHP script or even a desktop client that mimics Github's functionality, I love Github but it..

Get keys of a Typescript interface as array of strings

I've a lot of tables in Lovefield and their respective Interfaces for what columns they have. Example: export interface IMyTable { id: number; title: string; createdAt: Date; isDeleted: boolea..

Image re-size to 50% of original size in HTML

I'm trying to re-size a image in HTML, it's got width 314px and height 212px. I want to re-size it to 50%... but using this I still get a bigger image instead of a half-size image. <img src="ima..

T-SQL get SELECTed value of stored procedure

In T-SQL, this is allowed: DECLARE @SelectedValue int SELECT @SelectedValue = MyIntField FROM MyTable WHERE MyPrimaryKeyField = 1 So, it's possible to get the value of a SELECT and stuff it in a va..

jQuery: load txt file and insert into div

I want to load a *.txt file and insert the content into a div. Here my code: js: $(document).ready(function() { $("#lesen").click(function() { $.ajax({ url : "helloworld.txt"..

Convert hexadecimal string (hex) to a binary string

I found the following way hex to binary conversion: String binAddr = Integer.toBinaryString(Integer.parseInt(hexAddr, 16)); While this approach works for small hex numbers, a hex number such as th..

How to deal with http status codes other than 200 in Angular 2

Right now the way I do http requests (borrowed from this answer) is this: POST(url, data) { var headers = new Headers(), authtoken = localStorage.getItem('authtoken');

Passing the argument to CMAKE via command prompt

I have a makefile for my project and also I am passing some argument and based on that argument i am seting some flag. I am able to do this . but now I want to do the same using cmake. I have created ..

Lightbox to show videos from Youtube and Vimeo?

I'm looking for a lightbox to show videos from Youtube and Vimeo. Any suggestions? ..

Unable to call the built in mb_internal_encoding method?

I'm trying to install indefero on a CentOS 5.3 VMware 'box' and I ran into a problem. Quite early in the installation I get an error that I've been able to narrow down to this: [root@code /var/www/ht..

How do you check if a string is not equal to an object or other string value in java?

I have been trying to make a clock that the user can set. I wanted the user to be asked questions and they answer in words like yes or no. I have done it for things that don't change using this code s..

Java SSL: how to disable hostname verification

Is there a way for the standard java SSL sockets to disable hostname verfication for ssl connections with a property? The only way I found until now, is to write a hostname verifier which returns true..

.ssh/config file for windows (git)

I've been looking for a solution on how I can use multiple ssh keys and I figured out, that it will work with a config file in the .ssh directory, but it doesn't work on windows. My problem is that I..

Passing $_POST values with cURL

How do you pass $_POST values to a page using cURL?..

Python PIP Install throws TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'

Using pip install for any module apparently on my Ubuntu 16.04 system with python 2.7.11+ throws this error: TypeError: unsupported operand type(s) for -=: 'Retry' and 'int' What is wrong with pip?..

Storing data into list with class

I have the following class: public class EmailData { public string FirstName{ set; get; } public string LastName { set; get; } public string Location{ set; get; } } I then did the follo..

Bash checking if string does not contain other string

I have a string ${testmystring} in my .sh script and I want to check if this string does not contain another string. if [[ ${testmystring} doesNotContain *"c0"* ]];then # testmystring doe..

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 2: ordinal not in range(128)

I am attempting to work with a very large dataset that has some non-standard characters in it. I need to use unicode, as per the job specs, but I am baffled. (And quite possibly doing it all wrong.) ..

Jenkins CI Pipeline Scripts not permitted to use method groovy.lang.GroovyObject

I am Using Jenkins 2 for compiling Java Projects, I want to read the version from a pom.xml, I was following this example: The ex..

How to store values from foreach loop into an array?

Need to store values from foreach loop into an array, need help doing that. The code below does not work, only stores the last value, tried $items .= ..., but that is not doing the trick either, any..

What are access specifiers? Should I inherit with private, protected or public?

I am confused about the meaning of access modifiers with respect to inheritance. What is the difference between inheritance involving the private, protected and public keywords?..

Creating a simple XML file using python

What are my options if I want to create a simple XML file in python? (library wise) The xml I want looks like: <root> <doc> <field1 name="blah">some value1</field1> ..

git - pulling from specific branch

I have cloned a git repository to my dev server and then switched to the dev branch but now I can't do a git pull to update the branch. How do I update the code on the server ?..

android: changing option menu items programmatically

Is it possible to change the option menu items programmatically? Can anyone provide me with an example please? Also, I want to disable certain items, so that they don't listen to the clicks, is it po..

Finding the indices of matching elements in list in Python

I have a long list of float numbers ranging from 1 to 5, called "average", and I want to return the list of indices for elements that are smaller than a or larger than b def find(lst,a,b): result..

How to escape the equals sign in properties files

How can I escape the equals sign (=) in Java property files? I would like to put something as the following in my file: table.whereclause=where id=100 ..

How to set the environmental variable LD_LIBRARY_PATH in linux

I have first executed the command: export LD_LIBRARY_PATH=/usr/local/lib Then I have opened .bash_profile file: vi ~/.bash_profile. In this file, I put: LD_LIBRARY_PATH=/usr/local/lib export LD_LIBR..

substring index range

Code: public class Test { public static void main(String[] args) { String str = "University"; System.out.println(str.substring(4, 7)); } } Output: ers I do not really un..

HTTP Request in Swift with POST method

I'm trying to run a HTTP Request in Swift, to POST 2 parameters to a URL. Example: Link: Params: id = 13 name = Jack What is the simplest way to do that? I don..

RunAs A different user when debugging in Visual Studio

I'm trying to run the program I'm debugging as a different user. Now, this can be done by running the exe and attaching from Visual Studio, but this is cumbersome. What I've tried to do is use the "R..

Print: Entry, ":CFBundleIdentifier", Does Not Exist

When I run react-native run-ios the build succeeds but I get the error below. I've checked all over the place but nothing seems to be working. Using sudo in front of the command does not help either. ..

How to read from a file or STDIN in Bash?

The following Perl script ( can read from either the file on the command line args or from STDIN: while (<>) { print($_); } perl will read from STDIN, while perl a.txt will..

__FILE__ macro shows full path

The standard predefined macro __FILE__ available in C shows the full path to the file. Is there any way to short the path? I mean instead of /full/path/to/file.c I see to/file.c or file.c ..

How to use Apple's new .p8 certificate for APNs in firebase console

With the recent up gradation of the Apple developer accounts, I am facing a difficulty that while trying to create the push notification certificates, it is providing me with (.p8) certificate instead..

Flexbox: 4 items per row

I'm using a flex box to display 8 items that will dynamically resize with my page. How do I force it to split the items into two rows? (4 per row)? Here is a relevant snip: (Or if you prefer jsfiddl..

How to change the default charset of a MySQL table?

There is a MySQL table which has this definition taken from SQLYog Enterprise : Table Create Table ----------------- -----------------------..

How to specify jdk path in eclipse.ini on windows 8 when path contains space

This doesn't work -vm %JAVA_HOME%/bin/javaw.exe How can I replace %JAVA_HOME% with full path on Windows 8 when path contains space ("Program Files" directory)..

How can I get the current date and time in the terminal and set a custom command in the terminal for it?

I have to check the time in a Linux terminal. What is the command for getting date and time in a Linux terminal? Is there a way in which we can set a custom function?..

What causes: "Notice: Uninitialized string offset" to appear?

I have a form that users fill out, and on the form there are multiple identical fields, like "project name", "project date", "catagory", etc. Based on how many forms a user is submitting, my goal is t..

ADB No Devices Found

I am attempting to install an Android app on my brand new Nexus 10. I have a .apk file. I have downloaded the Android SDK, installed "Android SDK Tools", "Android SDK Platform-tools", and Google USB D..

What is the purpose of backbone.js?

I tried to understand the utility of backbone.js from its site, but I still couldn't figure out much. Can anybody help me by explaining how it works and how c..

Jquery UI tooltip does not support html content

Today, I upgraded all of my jQuery plugs-in with jQuery 1.9.1. And I started to use jQueryUI tooltip with jquery.ui.1.10.2. Everything was good. But when I used HTML tags in the content (in the title ..

Adding a column after another column within SQL

How do I add a column after another column within MS SQL by using SQL query? TempTable ID int, Type nvarchar(20), Active bit NewTable ID int, Type nvarchar(20), Description text, ..

Split Spark Dataframe string column into multiple columns

I've seen various people suggesting that Dataframe.explode is a useful way to do this, but it results in more rows than the original dataframe, which isn't what I want at all. I simply want to do the ..

git checkout all the files

How can I get rid of all the changes in all the files of my repository? Say I am in a branch and I did some changes. git status returns a set of files in the "Changes not staged for commit" and I not..

Simple way to check if a string contains another string in C?

I'm pretty new to the language. Let's say I have a string from an HTTP request, such as char * request = "GET /favicon.ico HTTP/1.1"; And I specifically want to know if favicon is in that request, ..

Pycharm does not show plot

Pycharm does not show plot from the following code: import pandas as pd import numpy as np import matplotlib as plt ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000..

Sorting rows in a data table

We have two columns in a DataTable, like so: COL1 COL2 Abc 5 Def 8 Ghi 3 We're trying to sort this datatable based on COL2 in decreasing order. COL1 COL2 ghi 8 a..

Install-Module : The term 'Install-Module' is not recognized as the name of a cmdlet

I was trying to install Azure using Install-Module Azure in PowerShell. I got the following error: PS C:\Windows\system32> Install-Module Azure Install-Module : The term 'Install-Module' is not re..

Laravel - Route::resource vs Route::controller

I read the docs on the Laravel website, Stack Overflow, and Google but still don't understand the difference between Route::resource and Route::controller. One of the answers said Route::resource wa..

How to check if an NSDictionary or NSMutableDictionary contains a key?

I need to check if an dict has a key or not. How?..

Which browsers support <script async="async" />?

On December 1, 2009, Google announced support for asynchronous Google Analytics tracking. The asynchronous tracking is achieved using the async directive for the <script> tag. Which browsers s..

How can I style a PHP echo text?

I have the following code; <?php function countryCityFromIP($ipAddr) { $url = "

Join/Where with LINQ and Lambda

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


I am getting an error net::ERR_INSECURE_RESPONSE in the Chrome console when fetching some data from my API This error usually occurs as a result of an unsigned certificate; however, it is not an issu..

Submit form and stay on same page?

I have a form that looks like this <form action="" method="post"> <input name="signed" type="checkbox"> <input value="Save" type="submit"> </form> and I would..

Overriding fields or properties in subclasses

I have an abstract base class and I want to declare a field or a property that will have a different value in each class that inherits from this parent class. I want to define it in the baseclass so..

How to choose multiple files using File Upload Control?

I have a file upload control.Now on clicking on that, I want to select multiple files. How can I do so?..

Getting the minimum of two values in SQL

I have two variables, one is called PaidThisMonth, and the other is called OwedPast. They are both results of some subqueries in SQL. How can I select the smaller of the two and return it as a value t..

RichTextBox (WPF) does not have string property "Text"

I am trying to set/get the text of my RichTextBox, but Text is not among list of its properties when I want to get test.Text... I am using code behind in C# (.net framework 3.5 SP1) RichTextBox test..

Get and set position with jQuery .offset()

How to get and set the position of an element with the jQuery .offset method? Let's say I have a div layer1 and another layer2. How can I get the position of layer1 and set the same position to layer..

jQuery Ajax Request inside Ajax Request

Is it possible to make an ajax request inside another ajax request? because I need some data from first ajax request to make the next ajax request. First I'm using Google Maps API to get LAT & LN..

Accessing clicked element in angularjs

I'm relatively new to AngularJS and suspect I'm not grasping a concept. I'm also using Twitter Bootstrap and I've got jQuery loaded. Workflow: User clicks a link from a list, "master" section is upda..

How to make --no-ri --no-rdoc the default for gem install?

I don't use the RI or RDoc output from the gems I install in my machine or in the servers I handle (I use other means of documentation). Every gem I install installs RI and RDoc documentation by defa..

what exactly is device pixel ratio?

this is mentioned every article about mobile web, but nowhere I can found an explanation of what exactly does this attribute measure. Can anyone please elaborate what does queries like this check? @m..

Fastest way to copy a file in Node.js

The project that I am working on (Node.js) implies lots of operations with the file system (copying, reading, writing, etc.). Which methods are the fastest?..

Python 2: AttributeError: 'list' object has no attribute 'strip'

I have a small problem with list. So i have a list called l: l = ['Facebook;Google+;MySpace', 'Apple;Android'] And as you can see I have only 2 strings in my list. I want to separate my list l by '..

How to cancel a Task in await?

I'm playing with these Windows 8 WinRT tasks, and I'm trying to cancel a task using the method below, and it works to some point. The CancelNotification method DOES get called, which makes you think t..

Jquery, set value of td in a table?

I create dynamic a table with <tr> and <td> tags. One of the td tags gets the id "detailInfo". I have an onclick function on some button. I would like to set some value in the td "detailIn..

pyplot scatter plot marker size

In the pyplot document for scatter plot: matplotlib.pyplot.scatter(x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, ..

what is the difference between GROUP BY and ORDER BY in sql

When do you use which in general? Examples are highly encouraged! I am referring so MySql, but can't imagine the concept being different on another DBMS..

Oracle date difference to get number of years

Is there a way to calculate the number of years between dates. Not sure how to do this while accounting for leap and what not. Is it possible to do an IF statement maybe in the SELECT? Thanks..

getCurrentPosition() and watchPosition() are deprecated on insecure origins

I am getting this error on my website which requests Geolocation data from the user: getCurrentPosition() and watchPosition() are deprecated on insecure origins, and support will be removed in the..

Format string to a 3 digit number

Instead of doing this, I want to make use of string.format() to accomplish the same result: if (myString.Length < 3) { myString = "00" + 3; } ..

VBA macro that search for file in multiple subfolders

I have macro, if I put in cell E1 name of the file, macro search trough C:\Users\Marek\Desktop\Makro\ directory, find it and put the needed values in specific cells of my original file with macro. ..

How do I set the default font size in Vim?

I am trying to configure the default settings for my GUI with Vim. I already made research on the web, but all the solutions I found and tried did not work. Here are some of the things I tried (in th..

How do you remove Subversion control for a folder?

I have a folder, c:\websites\test, and it contains folders and files that were checked out from a repository that no longer exists. How do I get Subversion to stop tracking that folder and any of the ..

Code formatting shortcuts in Android Studio for Operation Systems

I have started developing with Android Studio. In Eclipse I was using Ctrl + Shift + F, but in Android Studio it does not work. It will be different. How can I jump to any method in a .java file? I w..

Threading Example in Android

I want some simple example on thread creation and invoking of threads in android. ..

Bootstrap: Open Another Modal in Modal

So, I'm using this code to open another modal window in a current opened modal window: <a onclick=\"$('#login').modal('hide');$('#lost').modal('show');\" href='#'>Click</a> What happens..

JavaScript moving element in the DOM

Let's say I have three <div> elements on a page. How can I swap positions of the first and third <div>? jQuery is fine...

How to reset or change the passphrase for a GitHub SSH key?

I have forgoten my passphrase in Git. How do I reset it? I found two solutions on Stack Overflow, but I want to know what process to follow to reset it or to get it...

SVG fill color transparency / alpha?

Is it possible to set a transparency or alpha level on SVG fill colours? I've tried adding two values to the fill tag (changing it from fill="#044B94" to fill="#044B9466"), but this doesn't work...

How to add a line to a multiline TextBox?

How can i add a line of text to a multi-line TextBox? e.g. pseudocode; textBox1.Clear(); textBox1.Lines.Add("1000+"); textBox1.Lines.Add("750-999"); textBox1.Lines.Add("400-749"); ...snip... textBox..

Why isn't .ico file defined when setting window's icon?

When I tried to change the window icon in the top left corner from the ugly red "TK" to my own favicon using the code below, Python threw an error: from tkinter import * root = Tk() #some buttons, w..

How do I calculate the normal vector of a line segment?

Suppose I have a line segment going from (x1,y1) to (x2,y2). How do I calculate the normal vector perpendicular to the line? I can find lots of stuff about doing this for planes in 3D, but no 2D stuf..

What are the rules for calling the superclass constructor?

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

Filtering DataSet

I have a DataSet full of costumers. I was wondering if there is any way to filter the dataset and only get the information I want. For example, to get CostumerName and CostumerAddress for a costumer t..

Use Invoke-WebRequest with a username and password for basic authentication on the GitHub API

With cURL, we can pass a username with an HTTP web request as follows: $ curl -u <your_username> The -u flag accepts a username for authentication, and then cURL ..

How to get the server path to the web directory in Symfony2 from inside the controller?

The question is as follows: How can I get the server path to the web directory in Symfony2 from inside the controller (or from anywhere else for that reason) What I've already found (also, by search..

In log4j, does checking isDebugEnabled before logging improve performance?

I am using Log4J in my application for logging. Previously I was using debug call like: Option 1: logger.debug("some debug text"); but some links suggest that it is better to check isDebugEnabled(..

Searching a list of objects in Python

Let's assume I'm creating a simple class to work similar to a C-style struct, to just hold data elements. I'm trying to figure out how to search a list of objects for objects with an attribute equali..

Get pixel color from canvas, on mousemove

Is it possible to get the RGB value pixel under the mouse? Is there a complete example of this? Here's what I have so far: function draw() { var ctx = document.getElementById('canvas').getContex..

How to scp in Python?

What's the most pythonic way to scp a file in Python? The only route I'm aware of is os.system('scp "%s" "%s:%s"' % (localfile, remotehost, remotefile) ) which is a hack, and which doesn't work o..

ldconfig error: is not a symbolic link

When running: sudo /sbin/ldconfig the following error appears: /sbin/ldconfig: /usr/local/lib/ is not a symbolic link When I run file: file /usr/local/lib/ /usr/local/lib/: dire..

Perl - Multiple condition if statement without duplicating code?

This is a Perl program, run using a terminal (Windows Command Line). I am trying to create an "if this and this is true, or this and this is true" if statement using the same block of code f..

Does Notepad++ show all hidden characters?

In Notepad++ I have set "replace tab with 2 spaces". When coding in Python I copy-pasted some code from the web and it appeared indented correctly. But running the code resulted in indentation errors..

How to parse JSON boolean value?

I have a JSON object JSONObject jsonObject = new JSONObject(); I'm able to populate the object successfully but, when I try to parse a boolean JSON value I get an error: 08-28 15:06:15.809: E/B..

How to implement the Android ActionBar back button?

I have an activity with a listview. When the user click the item, the item "viewer" opens: List1.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterVi..

Using DISTINCT inner join in SQL

I have three tables, A, B, C, where A is many to one B, and B is many to one C. I'd like a list of all C's in A. My tables are something like this: A[id, valueA, lookupB], B[id, valueB, lookupC], C[..

How to combine results of two queries into a single dataset

I have two queries : Queries Simplified excluding Joins Query 1 : select ProductName,NumberofProducts (in inventory) from Table1.....; Query 2 : select ProductName, NumberofProductssold from Table2....

javascript regex - look behind alternative?

Here is a regex that works fine in most regex implementations: (?<!filename)\.js$ This matches .js for a string which ends with .js except for filename.js Javascript doesn't have regex lookbehi..

Change Background color (css property) using Jquery

I want to Change the background colour on click . This is my code work that i tried.pls help me out :) <script src=""> $(docu..

Twitter bootstrap scrollable table

I would like to have a table on my website. The problem is that this table will have about 400 lines. How can I limit the table's height, and apply scrollbar to it? This is my code: <div class="sp..

How to save a data.frame in R?

I made a data.frame in R that is not very big, but it takes quite some time to build. I would to save it as a file, which I can than again open in R?..

Laravel password validation rule

How to added password validation rule in the validator? Validation rule: The password contains characters from at least three of the following five categories: English uppercase characters (A – ..

How to get height and width of device display in angular2 using typescript?

I found this solution. Is it valid? import {Component} from '@angular/core'; import {Platform} from 'ionic-angular'; @Component({...}) export MyApp { constructor(platform: Platform) { platform.rea..

Compare two dates in Java

I need to compare two dates in java. I am using the code like this: Date questionDate = question.getStartDate(); Date today = new Date(); if(today.equals(questionDate)){ System.out.println("Both..

How to get the hostname of the docker host from inside a docker container on that host without env vars

What are the ways get the docker host's hostname from inside a container running on that host besides using environment variables? I know I can pass the hostname as an environment variable to the cont..

How do I split a string by a multi-character delimiter in C#?

What if I want to split a string using a delimiter that is a word? For example, This is a sentence. I want to split on is and get This and a sentence. In Java, I can send in a string as a delimiter..

Auto populate columns in one sheet from another sheet

I would like to populate columns in sheet2 from sheet1. If I have column A in Sheet1 I want A in Sheet2 to have the same information. I tried using =sheet1!A1 but it only returns the value from A1 in..

Any way to declare an array in-line?

Let's say I have a method m() that takes an array of Strings as an argument. Is there a way I can just declare this array in-line when I make the call? i.e. Instead of: String[] strs = {"blah", "he..

Call PowerShell script PS1 from another PS1 script inside Powershell ISE

I want call execution for a myScript1.ps1 script inside a second myScript2.ps1 script inside Powershell ISE. The following code inside MyScript2.ps1, works fine from Powershell Administration, but do..

Sending SMS from PHP

How to send an SMS from a web server written in PHP?..

How to validate domain name in PHP?

Is it possible without using regular expression? For example, I want to check that a string is a valid domain: domain-name abcd example Are valid domains. These are invalid of course: domaia@name..

Android marshmallow request permission?

I am currently working on an application that requires several "dangerous" permissions. So I tried adding "ask for permission" as required in Android Marshmallow(API Level 23), but couldn't find how t..

How do I pass a string into subprocess.Popen (using the stdin argument)?

If I do the following: import subprocess from cStringIO import StringIO subprocess.Popen(['grep','f'],stdout=subprocess.PIPE,stdin=StringIO('one\ntwo\nthree\nfour\nfive\nsix\n')).communicate()[0] I..

How to extract svg as file from web page

I want to save SVG as file from this page Is there any Chrome extension or other way to do this?..

How to initialize an array in Kotlin with values?

In Java an array can be initialized such as: int numbers[] = new int[] {10, 20, 30, 40, 50} How does Kotlin's array initialization look like?..

Use of Java's Collections.singletonList()?

What is the use of Collections.singletonList() in Java? I understand that it returns a list with one element. Why would I want to have a separate method to do that? How does immutability play a role h..

How to scroll HTML page to given anchor?

I’d like to make the browser to scroll the page to a given anchor, just by using JavaScript. I have specified a name or id attribute in my HTML code: <a name="anchorName">..</a> or ..

Grep for beginning and end of line?

I have a file where I want to grep for lines that start with either -rwx or drwx AND end in any number. I've got this, but it isnt quite right. Any ideas? grep [^.rwx]*[0-9] usrLog.txt ..

How to calculate the time interval between two time strings

I have two times, a start and a stop time, in the format of 10:33:26 (HH:MM:SS). I need the difference between the two times. I've been looking through documentation for Python and searching online ..

How to use UTF-8 in resource properties with ResourceBundle

I need to use UTF-8 in my resource properties using Java's ResourceBundle. When I enter the text directly into the properties file, it displays as mojibake. My app runs on Google App Engine. Can any..

Format date and time in a Windows batch script

In a Windows (Windows XP) batch script I need to format the current date and time for later use in files names, etc. It is similar to Stack Overflow question How to append a date in batch files,..

Passing parameters to JavaScript files

Often I will have a JavaScript file that I want to use which requires certain variables be defined in my web page. So the code is something like this: <script type="text/javascript" src="file.js"..

Why does an image captured using camera intent gets rotated on some devices on Android?

I'm capturing an image and setting it to image view. public void captureImage() { Intent intentCamera = new Intent(""); File filePhoto = new File(Environmen..

PostgreSQL unnest() with element number

When I have a column with separated values, I can use the unnest() function: myTable id | elements ---+------------ 1 |ab,cd,efg,hi 2 |jk,lm,no,pq 3 |rstuv,wxyz select id, unnest(string_to_array(..

Passing capturing lambda as function pointer

Is it possible to pass a lambda function as a function pointer? If so, I must be doing something incorrectly because I am getting a compile error. Consider the following example using DecisionFn = b..