Questions Tagged with #Clipboard pictures

Why should I use var instead of a type?

Possible Duplicate: ReSharper and var After I have installed ReSharper it demands(by warnings) that I use var whenever possible, for example UnhandledExceptionEventArgs ue = (UnhandledExce..

SQL Column definition : default value and not null redundant?

I've seen many times the following syntax which defines a column in a create/alter DDL statement: ALTER TABLE tbl ADD COLUMN col VARCHAR(20) NOT NULL DEFAULT "MyDefault" The question is: since a de..

Argument Exception "Item with Same Key has already been added"

I keep getting an error with the following code: Dictionary<string, string> rct3Features = new Dictionary<string, string>(); Dictionary<string, string> rct4Features = new Dictionary..

Apache and IIS side by side (both listening to port 80) on windows2003

What are some good ways to do this? Is it even possible to do cleanly? Ideally I'd like to use packet headers to decide which server should handle requests. However, if there is an easier/better way..

MySQL Job failed to start

I'm on Kubuntu 12.04, and after installing mysql via an apt-get (mysql ver: 5.5.35), i'm trying to start mysql service, but I got this error: sudo service mysql start start: Job failed to sta..

Named tuple and default values for optional keyword arguments

I'm trying to convert a longish hollow "data" class into a named tuple. My class currently looks like this: class Node(object): def __init__(self, val, left=None, right=None): self.val = ..

How do I auto-hide placeholder text upon focus using css or jquery?

This is done automatically for every browser except Chrome. I'm guessing I have to specifically target Chrome. Any solutions? If not with CSS, then with jQuery? Kind regards...

What is the best Java library to use for HTTP POST, GET etc.?

What is the best Java library to use for HTTP POST, GET etc. in terms of performance, stability, maturity etc.? Is there one particular library that is used more than others? My requirements are subm..

Selection with .loc in python

I saw this code in someone's iPython notebook, and I'm very confused as to how this code works. As far as I understood, pd.loc[] is used as a location based indexer where the format is: df.loc[index,..

Change value of input onchange?

I am trying to create a simple JavaScript function. When someone inserts a number in an input field, the value of another field should change to that value. Here is what I have at the moment: function..

Split string in C every white space

I want to write a program in C that displays each word of a whole sentence (taken as input) at a seperate line. This is what i have done so far: void manipulate(char *buffer); int get_words(char *b..

jQuery checkbox checked state changed event

I want an event to fire client side when a checkbox is checked / unchecked: $('.checkbox').click(function() { if ($(this).is(':checked')) { // Do stuff } }); Basically I want it to happen f..

Notepad++ Setting for Disabling Auto-open Previous Files

How do I stop Notepad++ from loading all files from the past session? Every time I open a file I have 10 other open tabs with all my past files. I don't want that. When I hit the close button I exp..

Java; String replace (using regular expressions)?

As part of a project for school, I need to replace a string from the form: 5 * x^3 - 6 * x^1 + 1 to something like: 5x<sup>3</sup> - 6x<sup>1</sup> + 1 I believe this can..

Java: splitting a comma-separated string but ignoring commas in quotes

I have a string vaguely like this: foo,bar,c;qual="baz,blurb",d;junk="quux,syzygy" that I want to split by commas -- but I need to ignore commas in quotes. How can I do this? Seems like a regexp ap..

/exclude in xcopy just for a file type

I have a batch file to copy over files from Visual Studio to my Web folder. I want to copy all files in my web project, EXCEPT for *.cs files. I can't seem to get this to work: xcopy /r /d /i /s /y..

What is the most efficient way to create HTML elements using jQuery?

Recently I've been doing a lot of modal window pop-ups and what not, for which I used jQuery. The method that I used to create the new elements on the page has overwhelmingly been along the lines of: ..

How to set the allowed url length for a nginx request (error code: 414, uri too large)

I am using Nginx in front of 10 mongrels. When I make a request with size larger then 2900 I get back an: error code 414: uri too large Does anyone know the setting in the nginx configuration f..

How do I make a Mac Terminal pop-up/alert? Applescript?

I want to be able to have my program display an alert, notice, whatever that displays my custom text. How is this done? Also, is it possible to make one with several buttons that sets a variable? Sim..

SDK Manager.exe doesn't work

When I clicked SDK Manager on Program Files or run it in cmd, nothing happened. I did: Installed latest JDK Installed latest Android SDK Set environment JAVA_HOME and put %JAVA_HOME%\bin in path var..

How do I create a dynamic key to be added to a JavaScript object variable

I'm trying something like this, but this example does not work. jsObj = {}; for (var i = 1; i <= 10; i++) { jsObj{'key' + i} = 'example ' + 1; } What can I do to make a dynamic key like thi..

EOFError: EOF when reading a line

I am trying to define a function to make the perimeter of a rectangle. Here is the code: width = input() height = input() def rectanglePerimeter(width, height): return ((width + height)*2) print(r..

No server in Eclipse; trying to install Tomcat

I'm trying to install Tomcat in Eclipse but I can't get a server tab to show up. When I go to Window -> Show View -> Other and type in "server", I don't get any results. When I go to File -> New -> O..

How can I send an email through the UNIX mailx command?

How can I send an email through the UNIX mailx command?..

Delete multiple rows by selecting checkboxes using PHP

I want to delete multiple rows from MYSQL database. I have created this delete.php file to select various links and delete them using checkboxes. <html> <head> <title>Links Page&l..

Run java jar file on a server as background process

I need to run a java jar in server in order to communicate between two applications. I have written two shell scripts to run it, but once I start up that script I can't shut down / terminate the proce..

Android: converting String to int

I'm simply trying to convert a string that is generated from a barcode scanner to an int so that I can manipulate it by taking getting the remainder to generate a set number of integers. So far I hav..

Git resolve conflict using --ours/--theirs for all files

Is there a way to resolve conflict for all files using checkout --ours and --theirs? I know that you can do it for individual files but couldn't find a way to do it for all...

Python: "TypeError: __str__ returned non-string" but still prints to output?

I have this piece of code which creates a new note..WHen I try to print I get the following error even though it prints the output Error: C:\Python27\Basics\OOP\formytesting>python Mem..

Cookies on localhost with explicit domain

I must be missing some basic thing about cookies. On localhost, when I set a cookie on server side and specify the domain explicitly as localhost (or .localhost). the cookie does not seem to be accept..

Preventing multiple clicks on button

I have following jQuery code to prevent double clicking a button. It works fine. I am using Page_ClientValidate() to ensure that the double click is prevented only if the page is valid. [If there are..

UTF-8: General? Bin? Unicode?

I'm trying to figure out what collation I should be using for various types of data. 100% of the content I will be storing is user-submitted. My understanding is that I should be using UTF-8 General ..

D3.js: How to get the computed width and height for an arbitrary element?

I need to know exactly the width and height for an arbitrary g element in my SVG because I need to draw a selection marker around it once the user has clicked it. What I've seen in the internet is so..

How to draw a rectangle around a region of interest in python

I'm having trouble with import cv in my python code. My issue is I need to draw a rectangle around regions of interest in an image. How can this be done in python? I'm doing object detection and woul..

Use Async/Await with Axios in React.js

Following How to use async/await with axios in react I am trying to make a simple get request to my server using Async/Await in a React.js App. The server loads a simple JSON at /data which looks ..

How to create an Explorer-like folder browser control?

Using C# and WinForms in VS2008, I want to create a file browser control that looks and acts like the left pane in Windows Explorer. To my astonishment, such a control does not ship with .NET by defau..

Iteration ng-repeat only X times in AngularJs

How can I use ng-repeat like for in Javascript? example: <div ng-repeat="4">Text</div> I want to iterate with ng-repeat 4 times but how can I do it?..

Explanation of JSONB introduced by PostgreSQL

PostgreSQL just introduced JSONB and it's already trending on hacker news. It would be great if someone could explain how it's different from Hstore and JSON previously present in PostgreSQL. What ar..

How to return an array from a function?

How can I return an array from a method, and how must I declare it? int[] test(void); // ?? ..

Random number c++ in some range

Possible Duplicate: Generate Random numbers uniformly over entire range I want to generate the random number in c++ with in some range let say i want to have number between 25 and 63. How ..

Set environment variables from file of key/value pairs

TL;DR: How do I export a set of key/value pairs from a text file into the shell environment? For the record, below is the original version of the question, with examples. I'm writing a script in b..

Vertically align text next to an image?

Why won't vertical-align: middle work? And yet, vertical-align: top does work. _x000D_ _x000D_ span{ vertical-align: middle; }_x000D_ <div> <img src="" alt=..

Angular 2 @ViewChild annotation returns undefined

I am trying to learn Angular 2. I would like to access to a child component from a parent component using the @ViewChild Annotation. Here some lines of code: In BodyContent.ts I have: import {View..

Understanding dispatch_async

I have question around this code dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSData* data = [NSData dataWithContentsOfURL: kLatestKivaLoansURL]; ..

background-size in shorthand background property (CSS3)

I'm trying to mix background-image and background-size properties in a shorthanded background property. Based on W3C documentation background-size should come after background-position property separa..

How to grep Git commit diffs or contents for a certain word?

In a Git code repository I want to list all commits that contain a certain word. I tried this git log -p | grep --context=4 "word" but it does not necessarily give me back the filename (unless it's..

Why should C++ programmers minimize use of 'new'?

I stumbled upon Stack Overflow question Memory leak with std::string when using std::list<std::string>, and one of the comments says this: Stop using new so much. I can't see any reason you ..

Finding the length of a Character Array in C

What is a way in C that someone could find the length of a Character array? I will happily accept psuedo-code, but am not averse to someone writing it out if they'd like to :)..

How to execute multiple SQL statements from java

I want to execute the multiple queries or job in one execute. Something like this eg: String query="select * from tab1;insert into tab1 values(...);update tab1..;delete from tab1...;" Statement st =..

Make ABC Ordered List Items Have Bold Style

I have an html Ordered list with type set to "A" <ol type="A">...</ol> Thus, each list item will start with A, B, C, etc. I would like to style the A, B, C letters to be bold. I have t..

How do you tell if caps lock is on using JavaScript?

How do you tell if caps lock is on using JavaScript? One caveat though: I did google it and the best solution I could find was to attach an onkeypress event to every input, then check each time if th..

ASP.Net Download file to client browser

I'm writing a simple test page to download a text file from a browser on button click. I am getting a really strange error that I have never seen before. Any thoughts? The error occurs on Response...

Python syntax for "if a or b or c but not all of them"

I have a python script that can receive either zero or three command line arguments. (Either it runs on default behavior or needs all three values specified.) What's the ideal syntax for something li..

How to fix error "Updating Maven Project". Unsupported IClasspathEntry kind=4?

I have imported maven project in STS, when I run update update project I receive: "Updating Maven Project". Unsupported IClasspathEntry kind=4 Is there a workaround for this?..

open new tab(window) by clicking a link in jquery

I have a web app that displays rows with go and delete buttons. If a user clicks go, it should open new tab/window with url built from the row's data. how can I do this in jquery? What I'm doing is ..

Can dplyr package be used for conditional mutating?

Can the mutate be used when the mutation is conditional (depending on the values of certain column values)? This example helps showing what I mean. structure(list(a = c(1, 3, 4, 6, 3, 2, 5, 1), b = ..

Java, reading a file from current directory?

I want a java program that reads a user specified filename from the current directory (the same directory where the .class file is run). In other words, if the user specifies the file name to be "myF..

libpng warning: iCCP: known incorrect sRGB profile

I'm trying to load a PNG image using SDL but the program doesn't work and this error appears in the console libpng warning: iCCP: known incorrect sRGB profile Why does this warning appear? What ..

Parse time of format hh:mm:ss

How can I parse a time of format hh:mm:ss , inputted as a string to obtain only the integer values (ignoring the colons) in java?..

Getting indices of True values in a boolean list

I have a piece of my code where I'm supposed to create a switchboard. I want to return a list of all the switches that are on. Here "on" will equal True and "off" equal False. So now I just want to re..

How to read and write INI file with Python3?

I need to read, write and create an INI file with Python3. FILE.INI default_path = "/path/name/" default_file = "file.txt" Python File: # Read file and and create if it not exists config = ini..

HTML button onclick event

This might be a very basic question; believe me I found very hard to find the answer to this question on the internet. I have 3 HTML pages stored in my server (Tomcat locally) & i want to open t..

How to change the DataTable Column Name?

I have one DataTable which has four columns such as StudentID CourseID SubjectCode Marks ------------ ---------- ------------- -------- 1 ..

Rails create or update magic?

I have a class called CachedObject that stores generic serialised objects indexed by key. I want this class to implement a create_or_update method. If an object is found it will update it, otherwise i..

Replace Default Null Values Returned From Left Outer Join

I have a Microsoft SQL Server 2008 query that returns data from three tables using a left outer join. Many times, there is no data in the second and third tables and so I get a null which I think is ..

How do I minimize the command prompt from my bat file

I have this bat file and I want to minimize the cmd window when I run it: @echo off cd /d C:\leads\ssh call C:\Ruby192\bin\setrbvars.bat ruby C:\leads\ssh\put_leads.rb Basically I want the command..

How to change the output color of echo in Linux

I am trying to print a text in the terminal using echo command. I want to print the text in a red color. How can I do that?..

How to send json data in POST request using C#

I want to send json data in POST request using C#. I have tried few ways but facing lot of issues . I need to request using request body as raw json from string and json data from json file. How can..

How to check whether dynamically attached event listener exists or not?

Here is my problem: is it somehow possible to check for the existence of a dynamically attached event listener? Or how can I check the status of the "onclick" (?) property in the DOM? I have..

Using braces with dynamic variable names in PHP

I'm trying to use dynamic variable names (I'm not sure what they're actually called) But pretty much like this: for($i=0; $i<=2; $i++) { $("file" . $i) = file($filelist[$i]); } var_dump($file..

fastest way to export blobs from table into individual files

What is the fastest way to export files (blobs) stored in a SQL Server table into a file on the hard drive? I have over 2.5 TB of files (90 kb avg) stored as varbinary and I need to extract each one ..

Spring MVC: difference between <context:component-scan> and <annotation-driven /> tags?

Some days ago I began to study this Spring Hello World Tutorial: In this tutorial Spring DispatcherServlet is con..

Filter Java Stream to 1 and only 1 element

I am trying to use Java 8 Streams to find elements in a LinkedList. I want to guarantee, however, that there is one and only one match to the filter criteria. Take this code: public static void main..

How to set text size of textview dynamically for different screens

I am creating a textview and adding to the layout dynamically. I am using textView.setTextSize(18) method to set the text size.I tested it on samsung tablet and found that the font size is too small f..

Run cURL commands from Windows console

Is there a way to install cURL in Windows in order to run cURL commands from the command prompt?..

Constantly print Subprocess output while process is running

To launch programs from my Python-scripts, I'm using the following method: def execute(command): process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ..

eclipse won't start - no java virtual machine was found

Eclipse was running fine yesterday (and has been since I installed it about a year ago). Now all the sudden I'm getting the following error on startup: "A Java Runtime Environment (JRE) or Java Devel..

Visual Studio Code - Convert spaces to tabs

I have both TypeScript and HTML files in my project, in both files tabs are converted to spaces. I want to turn the auto-conversion off and make sure that my project has only tabs. Edit: With this set..

How to draw vertical lines on a given plot in matplotlib

Given a plot of signal in time representation, how to draw lines marking corresponding time index? Specifically, given a signal plot with time index ranging from 0 to 2.6(s), I want to draw vertical ..

Best way to write to the console in PowerShell

I am having a little confusion about the various ways to print (echo) to the console. I have seen that there are multiple ways to write output to the console, such as: Write-Host "Hello world1" "Hell..

How to download folder from putty using ssh client

how to download folder(contains folder inside folder and files) from putty using ssh client i want download entire Dump to local Drive... can any one guide me .....

Is there a null-coalescing (Elvis) operator or safe navigation operator in javascript?

I'll explain by example: Elvis Operator (?: ) The "Elvis operator" is a shortening of Java's ternary operator. One instance of where this is handy is for returning a 'sensible default' valu..

How to read file from relative path in Java project? cannot find the path specified

I have a project with 2 packages: tkorg.idrs.core.searchengines tkorg.idrs.core.searchengines In package (2) I have a text file ListStopWords.txt, in package (1) I have a class FileLoadder. Here ..

Can I access constants in from templates in Django?

I have some stuff in that I'd like to be able to access from a template, but I can't figure out how to do it. I already tried {{CONSTANT_NAME}} but that doesn't seem to work. Is this po..

Retaining file permissions with Git

I want to version control my web server as described in Version control for my web server, by creating a git repo out of my /var/www directory. My hope was that I would then be able to push web cont..

Regex to test if string begins with http:// or https://

I'm trying to set a regexp which will check the start of a string, and if it contains either http:// or https:// it should match it. How can I do that? I'm trying the following which isn't working: ..

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server."

I have couple of update panels and jquery tabs on page. And also I am loading couple user controls on update panels. After user waited for couple of minutes (not checked the time approx 40 mins). when..

Setting HTTP headers

I'm trying to set a header in my Go web server. I'm using gorilla/mux and net/http packages. I'd like to set Access-Control-Allow-Origin: * to allow cross domain AJAX. Here's my Go code: func saveH..

Solve Cross Origin Resource Sharing with Flask

For the following ajax post request for Flask (how can I use data posted from ajax in flask?): $.ajax({ url: "", type: "POST", contentType: "application/json", ..

Fragment onResume() & onPause() is not called on backstack

I have multiple fragment inside an activity. On a button click I am starting a new fragment, adding it to backstack. I naturally expected the onPause() method of current Fragment and onResume() of new..

Counting array elements in Python

How can I count the number of elements in an array, because contrary to logic array.count(string) does not count all the elements in the array, it just searches for the number of occurrences of string..

m2eclipse error

I am developing a web application with Eclipse and I generate the project with a maven archetype. When I enable maven dependency management, Eclipse mark some errors in the pom file, this error is: ..

Authentication issue when debugging in VS2013 - iis express

I'm trying to pick up the windows username when debugging in Visual Studio 2013. I am simply using: If I run this on my Dev Server it works fine, if I run it ..

make a header full screen (width) css

I am trying to extend my header to cover the full page. and I want it look like this one I have been trying everything for hours now. any help would..

how can I check if a file exists?

I want to check to see if a file exists and if it does, I want to open it and read the 1st line, If the file doesn't exist or if the file has no contents then I want to fail silently without letting ..

Boolean.parseBoolean("1") = false...?

sorry to be a pain... I have: HashMap<String, String> o o.get('uses_votes'); // "1" Yet... Boolean.parseBoolean(o.get('uses_votes')); // "false" I'm guessing that ....parseBoolean doesn't ..

X-UA-Compatible is set to IE=edge, but it still doesn't stop Compatibility Mode

I am quite confused. I should be able to set <meta http-equiv="X-UA-Compatible" content="IE=edge" /> and IE8 and IE9 should render the page using the latest rendering engine. However, I just..

How to call a parent class function from derived class function?

How do I call the parent function from a derived class using C++? For example, I have a class called parent, and a class called child which is derived from parent. Within each class there is a print ..

php random x digit number

I need to create a random number with x amount of digits. So lets say x is 5, I need a number to be eg. 35562 If x is 3, then it would throw back something like; 463 Could someone show me how this i..

How can I catch all the exceptions that will be thrown through reading and writing a file?

In Java, is there any way to get(catch) all exceptions instead of catch the exception individually?..

Service will not start: error 1067: the process terminated unexpectedly

We have a custom service that we install with our application. The only problem is that after it is installed, it will not start, generating the error above. I have tried to diagnose what the proble..

ERROR 1067 (42000): Invalid default value for 'created_at'

When I tried to alter the table it showed the error: ERROR 1067 (42000): Invalid default value for 'created_at' I googled for this error but all I found was as if they tried to alter the timestamp ..

Auto-fit TextView for Android

Background Many times we need to auto-fit the font of the TextView to the boundaries given to it. The problem Sadly, even though there are many threads and posts (and suggested solutions) talking a..

Angular 2 - NgFor using numbers instead collections

...for example... <div class="month" *ngFor="#item of myCollection; #i = index"> ... </div> Is possible to do something like... <div class="month" *ngFor="#item of 10; #i = index"&g..

Retrofit 2.0 how to get deserialised error response.body

I'm using Retrofit 2.0.0-beta1. In tests i have an alternate scenario and expect error HTTP 400 I would like to have retrofit.Response<MyError> response but response.body() == null MyError is..

Unresolved external symbol on static class members

Very simply put: I have a class that consists mostly of static public members, so I can group similar functions together that still have to be called from other classes/functions. Anyway, I have def..

django no such table:

I have models in Django set up as below. class Pupil(models.Model): forename = models.CharField(max_length=30) surname = models.CharField(max_length=30) dateofbirth = models.DateField() ..

Very simple log4j2 XML configuration file using Console and File appender

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

Start systemd service after specific service?

I have a general question. How does one start a systemd unit *.service after a particular *.service has started successfully? More specific question is, how do I start website.service only after mong..

How to zoom div content using jquery?

I have a parent <div>. Inside that I place some text and images. Now I need to zoom to a particular portion of that parent <div>. Is it possible?..

What is the difference between DAO and Repository patterns?

What is the difference between Data Access Objects (DAO) and Repository patterns? I am developing an application using Enterprise Java Beans (EJB3), Hibernate ORM as infrastructure, and Domain-Driven ..

Overlaying histograms with ggplot2 in R

I am new to R and am trying to plot 3 histograms onto the same graph. Everything worked fine, but my problem is that you don't see where 2 histograms overlap - they look rather cut off. When I make de..

What is the simplest method of inter-process communication between 2 C# processes?

I want to create a communication between a parent and a child process, both written in C#. It should be asynchronous, event-driven. I don't want to run a thread in every process to handle the very rar..

Adding Access-Control-Allow-Origin header response in Laravel 5.3 Passport

I'm new to Laravel and am doing some Laravel 5.3 Passport project with OAuth2.0 password grant. When I curl the API with the params it responds with token. However, in browser it needs an additional s..

Convert a character digit to the corresponding integer in C

Is there a way to convert a character to an integer in C? For example, from '5' to 5?..

How do I programmatically set device orientation in iOS 7?

I am working on an iPad app, using AutoLayout, where if the user enables a certain mode ("heads-up" mode), I want to support only portrait (or portrait upside down) orientation, and furthermore, if th..

php foreach with multidimensional array

I'm developing a php app that uses a database class to query mySQL. the class is here: I made some tweaks on the class to fit..

Do I need to convert .CER to .CRT for Apache SSL certificates? If so, how?

I need to setup an Apache 2 server with SSL. I have my *.key file, but all the documentation I've found online, *.crt files are specified, and my CA only provided me with a *.cer file. Are *.cer fil..

How to change an Android app's name?

Is there a way to change the name (Launcher App Label) of an app without creating a new project? Note: Name of the App and The label shown on the Launcher Icon on Home Screen on Mobiles can be differ..

When is del useful in Python?

I can't really think of any reason why Python needs the del keyword (and most languages seem to not have a similar keyword). For instance, rather than deleting a variable, one could just assign None t..

How to get first item from a java.util.Set?

I have a Set instance: Set<String> siteIdSet = (Set<String>) pContext.getParent().getPropertyValue(getCatalogProperties().getSitesPropertyName()); The pContext.getParent().getPropertyValu..

Laravel 5.5 ajax call 419 (unknown status)

I do an ajax call but I keep getting this error: 419 (unknown status) No idea what is causing this I saw on other posts it has to do something with csrf token but I have no form so I dont know h..

Pause Console in C++ program

Which is best way to pause the console in C++ programs? using cin.get() or using system("pause") or using C functions like getch() or getchar()? Is it true that use of system("pause") leads to non..

How would you implement an LRU cache in Java?

Please don't say EHCache or OSCache, etc. Assume for purposes of this question that I want to implement my own using just the SDK (learning by doing). Given that the cache will be used in a multithrea..

Find an element in a list of tuples

I have a list 'a' a= [(1,2),(1,4),(3,5),(5,7)] I need to find all the tuples for a particular number. say for 1 it will be result = [(1,2),(1,4)] How do I do that?..

How to check if type of a variable is string?

Is there a way to check if the type of a variable in python is a string, like: isinstance(x,int); for integer values?..

Dropdown using javascript onchange

I have a simple drop down and I want to have it so that if the user selects Have a Baby the message changes to Have a Baby, but for any other selection. The message stays the same (nothing), but this..

How do I include a JavaScript file in another JavaScript file?

Is there something in JavaScript similar to @import in CSS that allows you to include a JavaScript file inside another JavaScript file?..

GROUP BY and COUNT in PostgreSQL

The query: SELECT COUNT(*) as count_all, as post_id FROM posts INNER JOIN votes ON votes.post_id = GROUP BY; Returns n records in Postgresql: count_all | p..

Using Mysql WHERE IN clause in codeigniter

I have the following mysql query. Could you please tell me how to write the same query in Codeigniter's way ? SELECT * FROM myTable WHERE trans_id IN ( SELECT trans_id FROM myTable WHERE co..

jquery function val() is not equivalent to "$(this).value="?

When I try to set a text input to blank (when clicked) using $(this).value="", this does not work. I have to use $(this).val(''). Why? What is the difference? What is the mechanism behind the val fun..

Test for multiple cases in a switch, like an OR (||)

How would you use a switch case when you need to test for a or b in the same case? switch (pageid) { case "listing-page" || "home-page": alert("hello"); break; case "details-page": al..

UITableView Cell selected Color?

I have created a custom UITableViewCell. The table view is showing data fine. What I am stuck in is when user touches cell of tableview, then I want to show the background color of the cell other than..

Update multiple rows in same query using PostgreSQL

I'm looking to update multiple rows in PostgreSQL in one statement. Is there a way to do something like the following? UPDATE table SET column_a = 1 where column_b = '123', column_a = 2 where col..

react hooks useEffect() cleanup for only componentWillUnmount?

Let me explain the result of this code for asking my issue easily. const ForExample = () => { const [name, setName] = useState(''); const [username, setUsername] = useState(''); useEf..

When to use self over $this?

In PHP 5, what is the difference between using self and $this? When is each appropriate?..

How to round a number to significant figures in Python

I need to round a float to be displayed in a UI. E.g, to one significant figure: 1234 -> 1000 0.12 -> 0.1 0.012 -> 0.01 0.062 -> 0.06 6253 -> 6000 1999 -> 2000 Is there a nice way to do this u..

Java way to check if a string is palindrome

I want to check if a string is a palindrome or not. I would like to learn an easy method to check the same using least possible string manipulations..

What is difference between sjlj vs dwarf vs seh?

I can't find enough information to decide which compiler should I use to compile my project. There are several programs on different computers simulating a process. On Linux, I'm using GCC. Everything..

org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class

I replaced j2ee.jar with from my tomcat 6.0 installation directory: And that yields the error below. I'm presently trying to figure out the cause. What might the problem be. I have a ..

Where to download visual studio express 2005?

I'm trying to find download link for VS express 2005 but no luck. I need this version, not 2008...

Subversion stuck due to "previous operation has not finished"?

If I try to update my subversion repo, it says I must run cleanup. If I run cleanup, it says a file is missing. (I deleted a MASSIVE directory of files that failed to commit this morning from my home ..

How to initialize array to 0 in C?

I need a big null array in C as a global. Is there any way to do this besides typing out char ZEROARRAY[1024] = {0, 0, 0, /* ... 1021 more times... */ }; ?..

How to remove all listeners in an element?

I have a button, and I added some eventlistners to it: document.getElementById("btn").addEventListener("click", funcA, false); document.getElementById("btn").addEventListener("click", funcB, false); ..

Test iOS app on device without apple developer program or jailbreak

How can I test an iOS application on my iPod Touch without registering for the Apple Developer Program or jailbreaking my iPod? Neither is a viable option at the moment. I'd like to test on the devi..

C# Iterating through an enum? (Indexing a System.Array)

I have the following code: // Obtain the string names of all the elements within myEnum String[] names = Enum.GetNames( typeof( myEnum ) ); // Obtain the values of all the elements within myEnum A..

Capturing "Delete" Keypress with jQuery

When using the example code from the jQuery documentation for the keypress event handler, I'm unable to capture the Delete key. The snippet below is going to log 0 when the Delete key is pressed in Fi..

How do you get the length of a list in the JSF expression language?

How would I get the length of an ArrayList using a JSF EL expression? #{MyBean.somelist.length} does not work...

if-else statement inside jsx: ReactJS

I need to change render function and run some sub render function when a specific state given, For example: render() { return ( <View style={styles.container}> if (..

How to initialize a JavaScript Date to a particular time zone

I have date time in a particular timezone as a string and I want to convert this to the local time. But, I don't know how to set the timezone in the Date object. For example, I have Feb 28 2013 7:00 ..

Authentication failed to bitbucket

I'm trying to push my project via the https protocol on bitbucket using sourcetree. But I can't connect to bitbucket with my login and password (which work on the website), I have a fatal error : "Aut..

Resize iframe height according to content height in it

I am opening my blog page in my website. The problem is I can give a width to an iframe but the height should be dynamic so that there is no scrollbar in the iframe, and it looks like a single page.....

Convert Pixels to Points

I have a need to convert Pixels to Points in C#. I've seen some complicated explanations about the topic, but can't seem to locate a simple formula. Let's assume a standard 96dpi, how do I calulate th..

Delete last char of string

I am retrieving a lot of information in a list, linked to a database and I want to create a string of groups, for someone who is connected to the website. I use this to test but this is not dynamic, ..

How to get label text value form a html page?

I have a html page , where the html is rendered as : <div id = 'mViB'> <table id = 'myTable'> <tbody> <tr> ...</tr> <tr>...</tr> <tr> ...</tr> &l..

PDF Blob - Pop up window not showing content

I have been working on this problem for the last few days. With no luck on trying to display the stream on <embed src> tag, I just tried to display it on a new window. The new window shows PDF ..

How to get the file ID so I can perform a download of a file from Google Drive API on Android?

I am working on an Android project and I am trying to make use of the Google Drive API and I've got most of it working but I am having an issue in how I perform a download. I can't find anywhere how..

JUnit tests pass in Eclipse but fail in Maven Surefire

I have written some JUnit tests using JUnit 4 and spring-test libraries. When I run the tests inside Eclipse then run fine and pass. But when I run them using Maven (during the build process), they fa..

Android Studio - Emulator - eglSurfaceAttrib not implemented

I have created an application with android studio, never change a single word in any file. when trying to run it on the emulator I got the following error: W/EGL_emulation? eglSurfaceAttrib not imp..

How to calculate distance between two locations using their longitude and latitude value

Here my code I used below code to calculate the distance between two location using their latitude and longitude. It is giving wrong distance. sometimes getting right and sometimes getting irrelevant ..

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

How to remove the underline for anchors(links)?

Is there anyway (in CSS) to avoid the underline for the text and links introduced in the page .. ?..

Best way to clear a PHP array's values

Which is more efficient for clearing all values in an array? The first one would require me to use that function each time in the loop of the second example. foreach ($array as $i => $value) { ..

Git on Windows: How do you set up a mergetool?

I've tried msysGit and Git on Cygwin. Both work just fine in and of themselves and both run gitk and git-gui perfectly. Now how the heck do I configure a mergetool? (Vimdiff works on Cygwin, but pref..

How to start a Process as administrator mode in C#

I have a Visual Studio Windows app project. I've added code to download an installer update file. The installer after it has finished downloading would need administrator privileges to run. I have add..

Query to list all users of a certain group

How can I use a a search filter to display users of a specific group? I've tried the following: (& (objectCategory=user) (memberOf=MyCustomGroup) ) and this: (& (objectCategor..

Reading file using fscanf() in C

I need to read and print data from a file. I wrote the program like below, #include<stdio.h> #include<conio.h> int main(void) { char item[9], status; FILE *fp; if( (fp = fopen("D:\\Sa..

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 print variables in Perl

I have some code that looks like my ($ids,$nIds); while (<myFile>){ chomp; $ids.= $_ . " "; $nIds++; } This should concatenate every line in my myFile, and nIds should be my numbe..

Get value from hashmap based on key to JSTL

I want to get the value of HashMap based on key. HashMap<String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>(); ArrayList<String> arrayList = ne..

What does %>% mean in R

I am following this example, the server.R, file is here. I plan to do a similar filter, but am lost as to what %>% does. # Apply filters m <- all_movies %>% filter( Revie..

Catching errors in Angular HttpClient

I have a data service that looks like this: @Injectable() export class DataService { baseUrl = 'http://localhost' constructor( private httpClient: HttpClient) { } get(url,..

How to reverse a 'rails generate'

I want to delete all the files it created and roll back any changes made, but not necessarily to the database, but more to the config files. I'd like to automatically delete all the resource mappings..

Get month name from number

How can I get the month name from the month number? For instance, if I have 3, I want to return march date.tm_month() How to get the string march?..

Run Command Line & Command From VBS

I need to run a command to copy a file from one location to another through Command Prompt using a vbs file. this is what I have however it keeps throwing an error at me. 'Dim oShell Set oShell = WSc..

Why does Python code use len() function instead of a length method?

I know that python has a len() function that is used to determine the size of a string, but I was wondering why it's not a method of the string object. Update Ok, I realized I was embarrassingly mis..

Why is nginx responding to any domain name?

I have nginx up and running with a Ruby/Sinatra app and all is well. However, I'm now trying to have a second application running from the same server and I noticed something weird. First, here's my n..

How to find serial number of Android device?

I need to use a unique ID for an Android app and I thought the serial number for the device would be a good candidate. How do I retrieve the serial number of an Android device in my app ?..

file_put_contents(meta/services.json): failed to open stream: Permission denied

I am new to Laravel. I was trying to open http://localhost/test/public/ and I got Error in exception handler. I googled around and changed the permission of storage directory using chmod -R 77..

AngularJS POST Fails: Response for preflight has invalid HTTP status code 404

I know there are a lot of questions like this, but none I've seen have fixed my issue. I've used at least 3 microframeworks already. All of them fail at doing a simple POST, which should return the da..

What are the specific differences between .msi and setup.exe file?

I searched a lot, but all are guessed answers. Help me to find the exact answer...

Fetching distinct values on a column using Spark DataFrame

Using Spark 1.6.1 version I need to fetch distinct values on a column and then perform some specific transformation on top of it. The column contains more than 50 million records and can grow larger. ..

String.equals() with multiple conditions (and one action on result)

Is it possible to do something like this in Java for Android (this is a pseudo code) IF (some_string.equals("john" OR "mary" OR "peter" OR "etc."){ THEN do something } ? At the moment this is d..

TypeScript or JavaScript type casting

How does one handle type casting in TypeScript or Javascript? Say I have the following TypeScript code: module Symbology { export class SymbolFactory { createStyle( symbolInfo : Sy..

How to import a single table in to mysql database using command line

I had successfully imported a database using command line, but now my pain area is how to import a single table with its data to the existing database using command line...

fetch gives an empty response body

I have a react/redux application and I'm trying to do a simple GET request to a sever: fetch('', { mode: "no-cors", method: "GET", headers: { "Accept": "applicat..

JAVA - Best approach to parse huge (extra large) JSON file

I'm trying to parse some huge JSON file (like using gson library ( in JAVA. I ..

How do I sort a list of datetime or date objects?

How do I sort a list of date and/or datetime objects? The accepted answer here isn't working for me: from datetime import datetime,date,timedelta a=[, + timedelta(days=1), ..

How to combine 2 plots (ggplot) into one plot?

By using R, is it possible to place 2 ggplot together (i.e., on the same plot)? I wish to show a trend from 2 different data frames and instead of putting them one next to the other, I'd like to integ..

Mvn install or Mvn package

I am new to Maven, I have a Java based web project with maven configured in my MyEclipse. Now if I modified any java files then do I need to do Run as -> Mvn install or Mvn package?..

How to print object array in JavaScript?

I have created an object array in JavaScript. How can I print the object array in the browser window, similar to print_r function in PHP? var lineChartData = [{ date: new Date(2009, 10, 2..

MySQL, create a simple function

I want to create a simple MySQL function, I have this MySQL procedure: CREATE PROCEDURE getUser(gU INT) SELECT * FROM Company WHERE id_number = gU; CALL getUser(2); I need some help making t..

How does DateTime.Now.Ticks exactly work?

In my application I generate files at random opportunities. To ensure a unique naming, I tried to use the nano seconds since 1.1.1970: long time = DateTime.Now.Ticks; String fileName = Convert.ToStri..

Representing null in JSON

What is the preferred method for returning null values in JSON? Is there a different preference for primitives? For example, if my object on the server has an Integer called "myCount" with n..

What is the backslash character (\\)?

What is the string literal \\ backslash? What does it do? I have thought about it but I do not understand it. I also read it on wikipedia. When I try to print the following: System.out.println("Mango..

How to re-create database for Entity Framework?

I have got into a bad state with my ASP.Net MVC 5 project, using Code-First Entity Framework. I don't care about losing data, I just want to be able to start fresh, recreate the database and start usi..

How to create an android app using HTML 5

Can we create android applications using HTML5?..

Using Java to pull data from a webpage?

I'm attempting to make my first program in Java. The goal is to write a program that browses to a website and downloads a file for me. However, I don't know how to use Java to interact with the intern..

Round a floating-point number down to the nearest integer?

I want to take a floating-point number and round it down to the nearest integer. However, if it's not a whole, I always want to round down the variable, regardless of how close it is to the next integ..

The maximum value for an int type in Go

How does one specify the maximum value representable for an unsigned integer type? I would like to know how to initialize min in the loop below that iteratively computes min and max lengths from some..