Poular Questions

How to insert new cell into UITableView in Swift

I'm working on a project where I have two UITableViews and two UITextFields, when the user presses the button the data in the first textField should go into the tableView and the second go into the second tableView. My problem is that I don't know ho...

How to get a list of installed Jenkins plugins with name and version pair

How can I get a list of installed Jenkins plugins? I searched the Jenkins Remote Access API document, but it was not found. Should I use Jenkins' CLI? Is there a document or example?...

Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down?

I've been reading the other posts on tracking down the reasons for getting a SIGSEGV in an Android app. I plan to scour my app for possible NullPointers related to Canvas use, but my SIGSEGV barfs up a different memory address each time. Plus I've se...

Center image using text-align center?

Is the property text-align: center; a good way to center an image using CSS? img { text-align: center; } ...

Keyboard shortcut to change font size in Eclipse?

It is relatively straightforward to change font sizes in Eclipse through preferences (and answered several times in this forum). However I'd like to change font size quickly (e.g., with Ctrl++ and Ctrl+- like in Linux terminal or Ctrl+mouse wheel i...

"Object doesn't support this property or method" error in IE11

I am getting the error Critical Error: Object doesn't support this property or method addeventlistener while accessing the InfoPath form page (using InfoPath enabled list form e.g. displayifs.aspx) in IE 11 browser. This error is specific to ...

Dictionary of dictionaries in Python?

From another function, I have tuples like this ('falseName', 'realName', positionOfMistake), eg. ('Milter', 'Miller', 4). I need to write a function that make a dictionary like this: D={realName:{falseName:[positionOfMistake], falseName:[positionOfM...

what is the difference between uint16_t and unsigned short int incase of 64 bit processor?

I came to use a variable of type uint16_t, but am unable to use that data type because of my project limitations. Is it possible to unsigned short int instead of uint16_t? I don't know the difference between both of them. Could anybody clarify please...

How can I control the width of a label tag?

The label tag doesn't have the property 'width', so how should I control the width of a label tag?...

When to use AtomicReference in Java?

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

How to read pdf file and write it to outputStream

I need to read a pdf file with filepath "C:\file.pdf" and write it to outputStream. What is the easiest way to do that? @Controller public class ExportTlocrt { @Autowired private PhoneBookService phoneBookSer; private void setResponseHeaderTlocrtP...

Detecting user leaving page with react-router

I want my ReactJS app to notify a user when navigating away from a specific page. Specifically a popup message that reminds him/her to do an action: "Changes are saved, but not published yet. Do that now?" Should i trigger this on react-router ...

Cannot connect to local SQL Server with Management Studio

I'm having an issue with SQL Server, I have 2005 installed on my desktop as well as having SQL Server Management Studio installed.. I've checked and can see "SQL Server (SQLEXPRESS)" started in services. I've tried to connect to "Local" and "SQLEXP...

Bootstrap 3 - disable navbar collapse

This is my simple navbar: <div class="navbar navbar-fixed-top myfont" role="navigation"> <div class=""> <ul class="nav navbar-nav navbar-left"> <li> <a class="navbar-brand" href="#"&...

What causes java.lang.IncompatibleClassChangeError?

I'm packaging a Java library as a JAR, and it's throwing many java.lang.IncompatibleClassChangeErrors when I try to invoke methods from it. These errors seem to appear at random. What kinds of problems could be causing this error?...

How to fix itunes could not connect to the iphone because an invalid response was received from the device?

I have jailbroken device using Absinthe, 2 days back I removed the jailbreak. Now I am not able to connect my iPhone 4 to iTunes. It says "iTunes could not connect to the iPhone because an invalid response was received from the device". I have tried ...

How to capture a list of specific type with mockito

Is there a way to capture a list of specific type using mockitos ArgumentCaptore. This doesn't work: ArgumentCaptor<ArrayList<SomeType>> argument = ArgumentCaptor.forClass(ArrayList.class); ...

Installation failed with message Invalid File

Installation failed with message Invalid File: K:\project\app\build\intermediates\split-apk\with_ImageProcessor\debug\slices\slice_0.apk. It is possible that this issue is resolved by uninstalling an existing version of the apk if it is pres...

How to concatenate columns in a Postgres SELECT?

I have two string columns a and b in a table foo. select a, b from foo returns values a and b. However, concatenation of a and b does not work. I tried : select a || b from foo and select a||', '||b from foo Update from comments: both column...

Select first occurring element after another element

I've got the following HTML code on a page: <h4>Some text</h4> <p> Some more text! </p> In my .css I've got the following selector to style the h4 element. The HTML code above is just a small part of the entire code; there ...

SQL Query - SUM(CASE WHEN x THEN 1 ELSE 0) for multiple columns

I'm looking to see if there is a better approach to the query below. What I'm trying to do is create a summary report, compiling stats by date. SELECT CAST(Detail.ReceiptDate AS DATE) AS 'DATE' , SUM(CASE WHEN Detail.Type = 'TotalMailed' THEN 1 EL...

TypeScript typed array usage

I have a TypeScript class definition that starts like this; module Entities { export class Person { private _name: string; private _possessions: Thing[]; private _mostPrecious: Thing; constructor (name...

How to pass arguments to a Button command in Tkinter?

Suppose I have the following Button made with Tkinter in Python: import Tkinter as Tk win = Tk.Toplevel() frame = Tk.Frame(master=win).grid(row=1, column=1) button = Tk.Button(master=frame, text='press', command=action) The method action is called...

How to use adb command to push a file on device without sd card

How to push a file from computer to an Android device having no SD Card in it. I tried: C:\anand>adb push anand.jpg /data/local 3399 KB/s (111387 bytes in 0.032s) C:\anand>adb push anand.jpg /data/opt 3199 KB/s (111387 bytes in 0.034s) C:\ana...

Convert DateTime to a specified Format

I have this date format yy/MM/dd HH:mm:ss ex: 12/02/21 10:56:09. The problem is, when i try to convert it to different format using this code: CDate("12/02/21 10:56:09").ToString("MMM. dd, yyyy HH:mm:ss") It displays Dec. 12, 2021 10:56:09. How ...

How to find the type of an object in Go?

How do I find the type of an object in Go? In Python, I just use typeof to fetch the type of object. Similarly in Go, is there a way to implement the same ? Here is the container from which I am iterating: for e := dlist.Front(); e != nil; e = e.Ne...

How to close an iframe within iframe itself

How do I use javascript or jQuery to close an iframe within iframe itself? I've tried <a href="javascript:self.close()"> but it didn't work....

CSS scale down image to fit in containing div, without specifing original size

I want to have a website where I can upload images of different sizes to be displayed in a jquery slider. I can't seem to fit (scaling down) the image in a containing div. Here's how I'm intending to do it <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...

SQL: Insert all records from one table to another table without specific the columns

I want to insert all the record from the back up table foo_bk into foo table without specific the columns. if i try this query INSERT INTO foo SELECT * FROM foo_bk i'll get error "Insert Error: Column name or number of supplied values does not m...

Use of "global" keyword in Python

What I understand from reading the documentation is that Python has a separate namespace for functions, and if I want to use a global variable in that function, I need to use global. I'm using Python 2.7 and I tried this little test >>> su...

How can I create a progress bar in Excel VBA?

I'm doing an Excel app that needs a lot data updating from a database, so it takes time. I want to make a progress bar in a userform and it pops up when the data is updating. The bar I want is just a little blue bar moves right and left and repeats t...

What are "named tuples" in Python?

Reading the changes in Python 3.1, I found something... unexpected: The sys.version_info tuple is now a named tuple: I never heard about named tuples before, and I thought elements could either be indexed by numbers (like in tuples and lists) o...

How to check String in response body with mockMvc

I have simple integration test @Test public void shouldReturnErrorMessageToAdminWhenCreatingUserWithUsedUserName() throws Exception { mockMvc.perform(post("/api/users").header("Authorization", base64ForTestUser).contentType(MediaType.APPLICATIO...

Oracle SQL Where clause to find date records older than 30 days

I want to find records in a (Oracle SQL) table using the creation date field where records are older than 30 days. It would be nice to find records using a operators like > but if anyone can suggest quick SQL where clause statement to find records ol...

Prevent row names to be written to file when using write.csv

Commands: t <- data.frame(v = 5:1, v2 = 9:5) write.csv(t, "t.csv") Resulting file: # "","v","v2" # "1",5,9 # "2",4,8 # "3",3,7 # "4",2,6 # "5",1,5 How do I prevent first column with row index from being written to the file?...

React Native version mismatch

Getting the following message when I init a new project and then launch the Xcode emulator: React-Native Version Mismatch Javascript Version 0.50.1 Native version: 0.50.0 Make sure you have rebuilt the native code. ... Does anyone ...

How to use global variable in node.js?

For example I want to use custom logger: logger = require('basic-logger'), logger.setLevel('info') var customConfig = { showMillis: true, showTimestamp: true } var log = new logger(customConfig) How to use this logger in other modules instead of...

When to use references vs. pointers

I understand the syntax and general semantics of pointers versus references, but how should I decide when it is more-or-less appropriate to use references or pointers in an API? Naturally some situations need one or the other (operator++ needs a ref...

How to create a sticky navigation bar that becomes fixed to the top after scrolling

I'm attempting to make a nav bar that appears at the bottom of the viewable page when the site is first loaded, then as the user scrolls down, the nav bar scrolls up, and eventually becomes fixed to the top. I'm using Bootstrap, just like this site,...

pdftk compression option

I use pdftk to compress a pdf using the following command line pdftk file1.pdf output file2.pdf compress It works as the weight of my file decreased. Are there [options] to change the compression??? Or maybe other solutions to compress my file?...

Test if characters are in a string

I'm trying to determine if a string is a subset of another string. For example: chars <- "test" value <- "es" I want to return TRUE if "value" appears as part of the string "chars". In the following scenario, I would want to return false: ...

How to print full stack trace in exception?

For example, in one place... //---------------a try { // some network call } catch(WebException we) { throw new MyCustomException("some message ....", we); } ...and in another place... //--------------b try { // invoke code above } ca...

Fill remaining vertical space with CSS using display:flex

In a 3-row layout: the top row should be sized according to its contents the bottom row should have a fixed height in pixels the middle row should expand to fill the container The problem is that as the main content expands, it squishes the heade...

How to exit an Android app programmatically?

I am sure this question has been asked number of times because I read a few. My client wants me to put a button into his app where users can click and exit. I have read this and found calling finish() will do it. But, finish is only closing the curre...

Change Timezone in Lumen or Laravel 5

I am using Lumen framework. How can I change Timezone to Europe/Paris CEST? I added a varaible in my .env file: APP_TIMEZONE=Europe/Paris But this doesnt work. What is the right way to update timezone?...

I'm getting an error "invalid use of incomplete type 'class map'

I am making a basic text based RPG sorry if my question is stupid because im new to c++. So basically I have a small combat class that i have to link back and forth to from the map class so I had to forward declare my map class and it comes up with t...

What is a word boundary in regex, does \b match hyphen '-'?

I'm trying to use regexes to match space-separated numbers. I can't find a precise definition of \b ("word boundary"). I had assumed that -12 would be an "integer word" (matched by \b\-?\d+\b) but it appears that this does not wo...

convert '1' to '0001' in JavaScript

Possible Duplicate: Is there a JavaScript function that can pad a string to get to a determined length? How can I convert convert '1' to '0001' in JavaScript without using any 3rd party libraries. I have done this in php using spritf: $tim...

jQuery - multiple $(document).ready ...?

Question: If I link in two JavaScript files, both with $(document).ready functions, what happens? Does one overwrite the other? Or do both $(document).ready get called? For example, <script type="text/javascript" src="http://ajax.googleapis.com...

Difference between one-to-many and many-to-one relationship

What is the real difference between one-to-many and many-to-one relationship? It is only reversed, kind of? I can't find any 'good-and-easy-to-understand' tutorial about this topic other than this one: SQL for Beginners: Part 3 - Database Relationsh...

Configuring IntelliJ IDEA for unit testing with JUnit

I decided to try out IntelliJ this morning via the trial version and installed the JUnit plugin. I made a new Java project and I want to write a test case for it. How do I add the junit.jar file to my project? (I actually want to add it to every jav...

How to show a confirm message before delete?

I want to get a confirm message on clicking delete (this maybe a button or an image). If the user selects 'Ok' then delete is done, else if 'Cancel' is clicked nothing happens. I tried echoing this when the button was clicked, but echoing stuff mak...

How to comment lines in rails html.erb files?

Am a newbie to rails , please let me know the way to comment out a single line and also to comment out a block of lines in *.html.erb files....

https connection using CURL from command line

I am new to Curl and Cacerts world and facing a problem while connecting to a server. Basically, I need to test connectivity over https from one machine to another machine. I have a URL to which I need to connect from Machine A (a linux machine) I tr...

How to find a number in a string using JavaScript?

Suppose I have a string like - "you can enter maximum 500 choices". I need to extract 500 from the string. The main problem is the String may vary like "you can enter maximum 12500 choices". So how to get the integer part?...

Execute php file from another php

I want to call a PHP file that starts like <?php function connection () { //Statements } I call from the PHP like this: <?php exec ('/opt/lampp/htdocs/stuff/name.php'); ?> I get: line1-> cannot open ?: No such file line 3 //Con...

Github "Updates were rejected because the remote contains work that you do not have locally."

I created a new repo, cloned it, added files to the directory, added them with add -A, committed changes, and when I try to push using git push <repo name> master I get: hint: Updates were rejected because the remote contains work that you do ...

Angularjs simple file download causes router to redirect

HTML: <a href="mysite.com/uploads/asd4a4d5a.pdf" download="foo.pdf"> Uploads get a unique file name while there real name is kept in database. I want to realize a simple file download. But the code above redirects to / because of: $routePro...

WindowsError: [Error 126] The specified module could not be found

I am loading a dll in python using following code: if os.path.exists(dll_path): my_dll = ctypes.cdll.LoadLibrary(dll_path) But I am continuously getting the following error WindowsError: [Error 126] The specified module could not be found d...

Excel doesn't update value unless I hit Enter

I have a very annoying problem in one of my worksheets in a workbook. I am using EXCEL 2007. Any cell's value will not be updated unless I hit ENTER. Either if the formula in the cell includes an if condition, or a VLOOKUP function or even an AVERAGE...

MySQL Daemon Failed to Start - centos 6

EDIT: Look at the checkmarked answer comments to get your issue solved. Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following: service mysqld start Also When I...

How can I find the length of a number?

I'm looking to get the length of a number in JavaScript or jQuery? I've tried value.length without any success, do I need to convert this to a string first?...

Use ASP.NET MVC validation with jquery ajax?

I have simple ASP.NET MVC action like this : public ActionResult Edit(EditPostViewModel data) { } The EditPostViewModel have validation attributes like this : [Display(Name = "...", Description = "...")] [StringLength(100, MinimumLength = 3, E...

Multiple Image Upload PHP form with one input

I've been trying to make this work for quite some time now. But I can't seem to make it work. I wanted to have a multiple image upload form with only using one input. this is my upload.php <?php include("../include/session.php"); session_start...

JavaScript: Passing parameters to a callback function

I'm trying to pass some parameter to a function used as callback, how can I do that? function tryMe (param1, param2) { alert (param1 + " and " + param2); } function callbackTester (callback, param1, param2) { callback (param1, param2); } c...

Use of "this" keyword in C++

Possible Duplicate: Is excessive use of this in C++ a code smell When should you use the "this" keyword in C++? Is there any reason to use this-> In C++, is the keyword this usually omitted? For example: Person::Person(int age) { _a...

IndexError: tuple index out of range ----- Python

Please Help me. I'm running a simple python program that will display the data from mySQL database in a tkinter form... from Tkinter import * import MySQLdb def button_click(): root.destroy() root = Tk() root.geometry("600x500+10+10") root.tit...

Multiple axis line chart in excel

I'm looking for a multiple axis line chart similar to the one in the image below, (which is a javascript chart made by amcharts). Does excel have an option to draw charts line these? Note there are 3 Y axes, and 3 line charts allowing you to compare...

How to select last two characters of a string

I need to select last two characters from the variable, whether it is digit or letters. For example: var member = "my name is Mate"; I would like to show last two letters from the string in the member variable....

How to select records from last 24 hours using SQL?

I am looking for a where clause that can be used to retrieve records for the last 24 hours?...

How to call a method defined in an AngularJS directive?

I have a directive, here is the code : .directive('map', function() { return { restrict: 'E', replace: true, template: '<div></div>', link: function($scope, element, attrs) { var center =...

How to play only the audio of a Youtube video using HTML 5?

Is it possible to play only the audio from a YouTube video using HTML 5 and Javascript?...

Stop executing further code in Java

I have looked in the Javadoc but couldn't find information related to this. I want the application to stop executing a method if code in that method tells it to do so. If that sentence was confusing, here's what I want to do in my code: public voi...

css overflow - only 1 line of text

I have div with the following css style: width:335px; float:left; overflow:hidden; padding-left:5px; When I insert, into that div, a long line of text, it's breaking to a new line and displays all the text. What I want is to have only one line of...

Compile c++14-code with g++

I'm using g++ 4.8.4 on Ubuntu 14.04 LTS. When trying to compile with '-std=c++14', I get this error: g++: error unrecognized command line option '-std=c++14' Compiling with '-std=c++11' works fine, so I'm not sure what's going on. Does g++ really ...

Enabling error display in PHP via htaccess only

I am testing a website online. Right now, the errors are not being displayed (but I know they exist). I have access to only the .htaccess file. How do I make all errors to display using my .htaccess file? I added these lines to my .htaccess fil...

Display a jpg image on a JPanel

What would be the most appropriate image type to display a jpg image (loaded from a local folder) on a JPanel? Cheers....

How to do a LIKE query with linq?

How can i perform an LIKE query within Linq? I have the following query i would like to execute. var results = from c in db.costumers where c.FullName LIKE "%"+FirstName+"%,"+LastName select c; ...

How do I wait for an asynchronously dispatched block to finish?

I am testing some code that does asynchronous processing using Grand Central Dispatch. The testing code looks like this: [object runSomeLongOperationAndDo:^{ STAssert… }]; The tests have to wait for the operation to finish. My current soluti...

How to parse data in JSON format?

My project is currently receiving a JSON message in python which I need to get bits of information out of. For the purposes of this, let's set it to some simple JSON in a string: jsonStr = '{"one" : "1", "two" : "2", "three" : "3"}' So far I've be...

Java parsing XML document gives "Content not allowed in prolog." error

I am writing a program in Java that takes a custom XML file and parses it. I'm using the XML file for storage. I am getting the following error in Eclipse. [Fatal Error] :1:1: Content is not allowed in prolog. org.xml.sax.SAXParseException: Content ...

C function that counts lines in file

When I try to run my program, I get the wrong number of lines printed. LINES: 0 This is the output although I have five lines in my .txt file Here is my program: #include<stdio.h> #include<stdlib.h> int countlines(char *filename); ...

Server returned HTTP response code: 401 for URL: https

I'm using Java to access a HTTPS site which returns the display in an XML format. I pass the login credentials in the URL itself. Here is the code snippet: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.n...

Handling MySQL datetimes and timestamps in Java

In a java application what would a good compromise in terms of extracing and inputting date information with a MySQL database using a mix of datetimes and timestamps? ...

How can a divider line be added in an Android RecyclerView?

I am developing an android application where I am using RecyclerView. I need to add a divider in RecyclerView. I tried to add - recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST)...

Get generic type of class at runtime

How can I achieve this? public class GenericClass<T> { public Type getMyType() { //How do I return the type of T? } } Everything I have tried so far always returns type Object rather than the specific type used....

How to split a data frame?

I want to split a data frame into several smaller ones. This looks like a very trivial question, however I cannot find a solution from web search....

How to align td elements in center

I have created a simple table and want to align the td elements in center but align:center in css doesn't seem to work .cTable td{ align:center; } <table border='1' id='mytable' class="cTable"> <tbody> <tr><th>Claim ID</...

Bootstrap 4 datapicker.js not included

I'm using Bootstrap V4 for my new website seeing that it is in Alpha. However I cannot see that it has datepicker.js in its build. Does anyone know if this will be included in V4? If not can anyone recommend a good datepicker?...

Understanding INADDR_ANY for socket programming

I am trying to program some sockets and so, on the server side, I use htonl(INADDR_ANY). To the extent I understood, it seems to me that this function generates a random IP (am I correct ?). In fact, I want to bind my socket with my localhost. But if...

How to compute precision, recall, accuracy and f1-score for the multiclass case with scikit learn?

I'm working in a sentiment analysis problem the data looks like this: label instances 5 1190 4 838 3 239 1 204 2 127 So my data is unbalanced since 1190 instances are labeled with 5. For the classification Im...

MySQL's now() +1 day

I'm using now() in MySQL query. INSERT INTO table SET data = '$data', date = now() But I want to add 1 day to this date (so that date should contain tomorrow). Is it possible?...

Propagate all arguments in a bash shell script

I am writing a very simple script that calls another script, and I need to propagate the parameters from my current script to the script I am executing. For instance, my script name is foo.sh and calls bar.sh foo.sh: bar $1 $2 $3 $4 How can I do...

JavaScript equivalent of PHP’s die

Is there something like "die" in JavaScript? I've tried with "break", but doesn't work :)...

Writelines writes lines without newline, Just fills the file

I have a program that writes a list to a file. The list is a list of pipe delimited lines and the lines should be written to the file like this: 123|GSV|Weather_Mean|hello|joe|43.45 122|GEV|temp_Mean|hello|joe|23.45 124|GSI|Weather_Mean|hello|Mike|...

Efficient way to rotate a list in python

What is the most efficient way to rotate a list in python? Right now I have something like this: >>> def rotate(l, n): ... return l[n:] + l[:n] ... >>> l = [1,2,3,4] >>> rotate(l,1) [2, 3, 4, 1] >>> rotate(l...

How to get the current working directory using python 3?

When I run the following script in IDLE import os print(os.getcwd()) I get output as D:\testtool but when I run from cmd prompt, I get c:\Python33>python D:\testtool\current_dir.py c:\Python33 How do I get same result which I got using ID...

Python "\n" tag extra line

I am trying to build a simple board in command line. Problem: When i use "\n" for ending current line, it adds an extra blank line. How can i fix that? Code: def drawBoard(): board = [ [0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0], ...

How to save image in database using C#

I want to save user image into a database in C#. How do I do that?...

Is there a difference between using a dict literal and a dict constructor?

Using PyCharm, I noticed it offers to convert a dict literal: d = { 'one': '1', 'two': '2', } into a dict constructor: d = dict(one='1', two='2') Do these different approaches differ in some significant way? (While writing this que...

What do the makefile symbols $@ and $< mean?

CC=g++ CFLAGS=-c -Wall LDFLAGS= SOURCES=main.cpp hello.cpp factorial.cpp OBJECTS=$(SOURCES:.cpp=.o) EXECUTABLE=hello all: $(SOURCES) $(EXECUTABLE) $(EXECUTABLE): $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) -o $@ .cpp.o: $(CC) $(CFLAGS) $< -o...

How to add List<> to a List<> in asp.net

Is there a short way to add List<> to List<> instead of looping in result and add new result one by one? var list = GetViolations(VehicleID); var list2 = GetViolations(VehicleID2); list.Add(list2); ...

how to calculate percentage in python

This is my program print" Welcome to NLC Boys Hr. Sec. School " a=input("\nEnter the Tamil marks :") b=input("\nEnter the English marks :") c=input("\nEnter the Maths marks :") d=input("\nEnter the Science marks :") e=input("\nEnter the Social scien...

How to compare files from two different branches?

I have a script that works fine in one branch and is broken in another. I want to look at the two versions side-by-side and see what's different. Are there any ways to do this? To be clear I'm not looking for a compare tool (I use Beyond Compare). I...

Is there a way to "limit" the result with ELOQUENT ORM of Laravel?

Is there a way to "limit" the result with ELOQUENT ORM of Laravel? SELECT * FROM `games` LIMIT 30 , 30 And with Eloquent ? ...

Can I do a max(count(*)) in SQL?

Here's my code: select yr,count(*) from movie join casting on casting.movieid=movie.id join actor on casting.actorid = actor.id where actor.name = 'John Travolta' group by yr Here's the question Which were the busiest years for 'John Trav...

Can Google Chrome open local links?

I am linking on an intranet page to a local file on a shared drive: <a href="file:///s:/test.xls"> Test</a> This works in IE and Firefox with an addon called local link. How can I get this to open in Google Chrome?...

How do I load an url in iframe with Jquery

I want to load an iframe on click, this is what I have so far: $("#frame").click(function () { $('this').load("http://www.google.com/"); }); It doesn't work. This is the complete code: JS Bin...

How to use the divide function in the query?

I want to show the percentage for the Overshipment column. My sample query select (SPGI09_EARLY_OVER_T – (SPGI09_OVER_WK_EARLY_ADJUST_T) / (SPGI09_EARLY_OVER_T + SPGR99_LATE_CM_T + SPGR99_ON_TIME_Q)) from CSPGI09_OVERSHIPMENT Table Name - CS...

How to create a custom attribute in C#

I have tried lots of times but still I am not able to understand the usage of custom attributes (I have already gone through lots of links). Can anyone please explain to me a very basic example of a custom attribute with code?...

How to add parameters to an external data query in Excel which can't be displayed graphically?

I often use MS Excel's Get External Data to create simple reports - running queries against databases and displaying nicely in Excel. Excel's great features like filtering and pivot tables and familiar interface for users make it quite good for this....

Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6

I am writing scripts in Python2.6 with use of pyVmomi and while using one of the connection methods: service_instance = connect.SmartConnect(host=args.ip, user=args.user, ...

How to call an async method from a getter or setter?

What'd be the most elegant way to call an async method from a getter or setter in C#? Here's some pseudo-code to help explain myself. async Task<IEnumerable> MyAsyncMethod() { return await DoSomethingAsync(); } public IEnumerable MyList ...

Group by with multiple columns using lambda

How can I group by with multiple columns using lambda? I saw examples of how to do it using linq to entities, but I am looking for lambda form....

How do you fadeIn and animate at the same time?

Using jQuery I'm creating a basic 'tooltip' animation so that the tooltip will appear in a little animation in which it fades into view as well as move vertically. So far I have this: $('.tooltip').fadeIn('slow'); $('.tooltip').animate({ top: "-10p...

Html.HiddenFor value property not getting set

I could have used @Html.HiddenFor(x=> ViewData["crn"]) but, I get, <input id="ViewData_crn_" name="ViewData[crn]" type="hidden" value="500" /> To somehow circumvent that issue(id=ViewData_crn_ and name=ViewData[crn]), I tried doing the...

How to use PowerShell select-string to find more than one pattern in a file?

I would like to search for more than one string in the files in a directory, however using "select-string -pattern" didn't help. Could anyone show me how to do it? Example: Search all files in C:\Logs that contain the words "VendorEnquiry" and "Fail...

What is the best way to compare floats for almost-equality in Python?

It's well known that comparing floats for equality is a little fiddly due to rounding and precision issues. For example: https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ What is the recommended way to deal...

How to delete all data from solr and hbase

How do I delete all data from solr by command? We are using solr with lily and hbase. How can I delete data from both hbase and solr? http://lucene.apache.org/solr/4_10_0/tutorial.html#Deleting+Data...

How can I delay a :hover effect in CSS?

Is there a way to delay the :Hover event without using JavaScript? I know there is a way to delay animations, but I haven't seen anything on delaying the :hover event. I'm building a son-of-suckerfish like menu. I'd like to simulate what hoverIntent...

Regular Expression to get a string between parentheses in Javascript

I am trying to write a regular expression which returns a string which is between parentheses. For example: I want to get the string which resides between the strings "(" and ")" I expect five hundred dollars ($500). would return $500 Found Reg...

Printing Even and Odd using two Threads in Java

I tried the code below. I took this piece of code from some other post which is correct as per the author. But when I try running, it doesn't give me the exact result. This is mainly to print even and odd values in sequence. public class PrintEven...

How do I return the SQL data types from my query?

I've a SQL query that queries an enormous (as in, hundreds of views/tables with hard-to-read names like CMM-CPP-FAP-ADD) database that I don't need nor want to understand. The result of this query needs to be stored in a staging table to feed a repo...

Using Linq to get the last N elements of a collection?

Given a collection, is there a way to get the last N elements of that collection? If there isn't a method in the framework, what would be the best way to write an extension method to do this?...

Passing data to a bootstrap modal

I've got a couple of hyperlinks that each have an ID attached. When I click on this link, I want to open a modal ( http://twitter.github.com/bootstrap/javascript.html#modals ), and pass this ID to the modal. I searched on google, but I couldn't find ...

Which command in VBA can count the number of characters in a string variable?

Let's say I have this variable: word = "habit" which command in VBA will allow me to count how many characters are there in this variable (in my case it's 5). Important: the variable "word" contains only one word, no spaces, but may have contain ...

selected value get from db into dropdown select box option using php mysql error

I need to get selected value from db into select box. please, tell me how to do it. Here is the code. Note: 'options' value depends on the category. <?php $sql = "select * from mine where username = '$user' "; $res = mysql_query($sql); w...

XAMPP Port 80 in use by "Unable to open process" with PID 4

XAMPP won't work it says Port 80 in use by "Unable to open process" with PID 4! 6:32:24 PM [Apache] Apache WILL NOT start without the configured ports free! 6:32:24 PM [Apache] You need to uninstall/disable/reconfigure the blocking applicat...

Running JAR file on Windows 10

I have made a Jar file, but I cant make it to run by double clicking. It works fine using java -jar name.jar or by making a batch file. I have already reinstalled jdk1.8.0_102, set the JAVA_HOME variable and javaw.exe in the jre folder is already the...

Convert RGB to Black & White in OpenCV

I would like to know how to convert an RGB image into a black & white (binary) image. After conversion, how can I save the modified image to disk?...

What is best way to start and stop hadoop ecosystem, with command line?

I see there are several ways we can start hadoop ecosystem, start-all.sh & stop-all.sh Which say it's deprecated use start-dfs.sh & start-yarn.sh. start-dfs.sh, stop-dfs.sh and start-yarn.sh, stop-yarn.sh hadoop-daemon.sh namenode/datanode...

Remove android default action bar

Possible Duplicate: How to hide the title bar for an Activity in XML with existing custom theme i remove the action bar by requestWindowFeature(Window.FEATURE_NO_TITLE); however, when the app starts, the action bar appears in a ver...

Encrypt Password in Configuration Files?

I have a program that reads server information from a configuration file and would like to encrypt the password in that configuration that can be read by my program and decrypted. Requirments: Encrypt plaintext password to be stored in the file De...

How can I quickly delete a line in VIM starting at the cursor position?

I want to be able to delete the remainder of the line I'm on starting at the cursor's position in VIM. Is there an easy command to do this? To help illustrate, this is before the command. The quick brown dog jumps over the lazy fox. ^ |--...

What is the height of iPhone's onscreen keyboard?

The height in portrait and the height in landscape measured in points....

How can I alias a default import in JavaScript?

Using ES6 modules, I know I can alias a named import: import { foo as bar } from 'my-module'; And I know I can import a default import: import defaultMember from 'my-module'; I'd like to alias a default import and I had thought the following would ...

Get current date in milliseconds

Can any one give me an idea how to get the current date in milliseconds?...

Creating an object: with or without `new`

Possible Duplicate: What is difference between instantiating an object using new vs. without This is probably a basic question, and might have already been asked (say, here); yet I still don't understand it. So, let me ask it. Consider th...

Disable button in angular with two conditions?

Is this possible in angular ? <button type="submit" [disabled]="!validate && !SAForm.valid">Add</button> I expect that if both of the conditions are true they will enable the button. I've already tried the ab...

Origin is not allowed by Access-Control-Allow-Origin

I'm making an Ajax.request to a remote PHP server in a Sencha Touch 2 application (wrapped in PhoneGap). The response from the server is the following: XMLHttpRequest cannot load http://nqatalog.negroesquisso.pt/login.php. Origin http://localhos...

How to create an installer for a .net Windows Service using Visual Studio

How do I create an installer for a Windows Service that I have created using Visual Studio?...

Build unsigned APK file with Android Studio

I'm developing an Android app with the Android Developer Tool. Now I tried the new Android Studio, everything works fine if connect my smartphone with the PC and directly run the program in the Android Studio. But now I want to test the program with ...

Working with UTF-8 encoding in Python source

Consider: $ cat bla.py u = unicode('d…') s = u.encode('utf-8') print s $ python bla.py File "bla.py", line 1 SyntaxError: Non-ASCII character '\xe2' in file bla.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.ht...

How do I deal with installing peer dependencies in Angular CLI?

I've found myself in an almost endless cycle of errors when trying to update my Angular CLI and NPM. Every time I update, I am met with WARN messages telling me to install peer dependencies (see below), but each time I install a dependency, I am met ...

Circular dependency in Spring

How does Spring resolve this: bean A is dependent on bean B, and bean B on bean A....

Add a new item to recyclerview programmatically?

I'm still trying to get my head around recyclerview. I have an arraylist, that I use to initialize a recycler view with. How can I add new items to the recycler view post setting an adapter and layoutmanager? private void initData() { mIte...

How best to read a File into List<string>

I am using a list to limit the file size since the target is limited in disk and ram. This is what I am doing now but is there a more efficient way? readonly List<string> LogList = new List<string>(); ... var logFile = File.ReadAllLines(...

error C2039: 'string' : is not a member of 'std', header file problem

I am having problems with a class I am writing. I have split the class into a .h file that defines the class and an .cpp file that implements the class. I receive this error in Visual Studio 2010 Express: error C2039: 'string' : is not a member of ...

Getting the object's property name

I was wondering if there was any way in JavaScript to loop through an object like so. for(var i in myObject) { // ... } But get the name of each property like this. for(var i in myObject) { separateObj[myObject[i].name] = myObject[i]; } ...

List and kill at jobs on UNIX

I have created a job with the at command on Solaris 10. It's working now but I want to kill it but I don't know how I can find the job number and how to kill that job or process....

How do I tell what type of value is in a Perl variable?

How do I tell what type of value is in a Perl variable? $x might be a scalar, a ref to an array or a ref to a hash (or maybe other things)....

Proper MIME type for .woff2 fonts

Today I updated Font Awesome package to 4.3.0 and noticed that woff2 font was added. That file is linked in CSS so I need to configure nginx to serve woff2 files properly. Currently I have this block in nginx config for fonts: location ~* \.(otf|eo...

Is there a cross-domain iframe height auto-resizer that works?

I tried a few solutions but wasn't successful. I'm wondering if there is a solution out there preferably with an easy-to-follow tutorial....

How to use OR condition in a JavaScript IF statement?

I understand that in JavaScript you can write: if (A && B) { do something } But how do I implement an OR such as: if (A OR B) { do something } ...

What is the meaning of 'No bundle URL present' in react-native?

When I run a react-native project, I get a error no bundle URL present , but I don't know what mistakes I do, I was very confused. ...

Limit Decimal Places in Android EditText

I'm trying to write an app that helps you manage your finances. I'm using an EditText Field where the user can specify an amount of money. I set the inputType to numberDecimal which works fine, except that this allows people to enter numbers such a...

Getting rid of \n when using .readlines()

I have a .txt file with values in it. The values are listed like so: Value1 Value2 Value3 Value4 My goal is to put the values in a list. When I do so, the list looks like this: ['Value1\n', 'Value2\n', ...] The \n is not needed. Here is my cod...

How can I add a box-shadow on one side of an element?

I need to create a box-shadow on some block element, but only (for example) on its right side. The way I do it is to wrap the inner element with box-shadow into an outer one with padding-right and overflow:hidden; so the three other sides of the shad...

The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

Occasionally I get this error when working on remote computers. It's hit or miss on which computer I get it on. But I am able to ping the computer and test-connection pans out. For example, the computer I got this error on today I was able to get ...

How can I avoid Java code in JSP files, using JSP 2?

I'm new to Java EE and I know that something like the following three lines <%= x+1 %> <%= request.getParameter("name") %> <%! counter++; %> is an old school way of coding and in JSP version 2 there exists a method to avo...

adb command not found in linux environment

While implementing the BluetoothChat application .apk inside G1 device, it always pops up a message: $adb install -r /home/parveen/workspace/BluetoothChat/bin/BluetoothChat.apk -bash: adb: command not found I am not getting clearly why this error...

How to control the line spacing in UILabel

Is it possible to reduce the gap between text, when put in multiple lines in a UILabel? We can set the frame, font size and number of lines. I want to reduce the gap between the two lines in that label....

java.lang.NoClassDefFoundError: Could not initialize class XXX

public class PropHolder { public static Properties prop; static { //code for loading properties from file } } // Referencing the class somewhere else: Properties prop = PropHolder.prop; class PropHolder is a class of my own. The class r...

Using group by and having clause

Using the following schema: Supplier (sid, name, status, city) Part (pid, name, color, weight, city) Project (jid, name, city) Supplies (sid, pid, jid**, quantity) Get supplier numbers and names for suppliers of parts supplied to at least two dif...

How do I interpret precision and scale of a number in a database?

I have the following column specified in a database: decimal(5,2) How does one interpret this? According to the properties on the column as viewed in SQL Server Management studio I can see that it means: decimal(Numeric precision, Numeric scale). ...

Pandas read in table without headers

How can I read in a .csv file (with no headers) and when I only want a subset of the columns (say 4th and 7th out of a total of 20 columns), using pandas? I cannot seem to be able to do usecols...

How can I convert a zero-terminated byte array to string?

I need to read [100]byte to transfer a bunch of string data. Because not all of the strings are precisely 100 characters long, the remaining part of the byte array is padded with 0s. If I convert [100]byte to string by: string(byteArray[:]), the tail...

Java - how do I write a file to a specified directory

I want to write a file results.txt to a specific directory on my machine (Z:\results to be precise). How do I go about specifying the directory to BufferedWriter/FileWriter? Currently, it writes the file successfully but to the directory where my so...

How to pass List<String> in post method using Spring MVC?

I need to pass a list of values in the request body of POST method but I get 400: Bad Request error. Below is my sample code: @RequestMapping(value = "/saveFruits", method = RequestMethod.POST, consumes = "application/json") @ResponseBody publ...

Angular redirect to login page

I come from the Asp.Net MVC world where users trying to access a page they are not authorized are automatically redirected to the login page. I am trying to reproduce this behavior on Angular. I came accross the @CanActivate decorator, but it result...

"Untrusted App Developer" message when installing enterprise iOS Application

I'm developing an enterprise application. When I was testing it in iOS8 beta I saw the following alert view: Untrusted App Developer Do you trust the developer "iPhone Distribution: ---" to run apps on you iPad? It only appears the first time. Can...

HTML5 record audio to file

What I ultimately want to do is record from the user's microphone, and upload the file to the server when they're done. So far, I've managed to make a stream to an element with the following code: var audio = document.getElementById("audio_preview"...

How to add favicon.ico in ASP.NET site

The solution structure of my application is: Now I am in Login.aspx and I am willing to add favicon.ico, placed in the root, in that page. What I am doing is: <link id="Link1" runat="server" rel="shortcut icon" href="../favicon.ico" type="ima...

Android scale animation on view

I want to use ScaleAnimation (programmatically not in xml) to change height to view from 0 to 60% of parent height. Width of view is constant and is 50px. View is empty only background color is set. Can someone give me code for scaleAnim using Scal...

Page unload event in asp.net

Is it possible to call a write a Page_Unload event in code behind similar to Page_Load event? I wanted to call a method on Page Unload. How do I achieve that?...

How to do this using jQuery - document.getElementById("selectlist").value

In jQuery, what is the equivalent to document.getElementById("selectlist").value ? I am trying to get the value of a select list item. Thanks....

How to run Java program in command prompt

I created a Java project to call a Web service. It has one Main java file and another class file. I have used some jar files for HTTP client. In Eclipse it runs fine. I need to run the Java program in command prompt by passing some arguments. In comm...

What does LPCWSTR stand for and how should it be handled with?

First of all, what is it exactly? I guess it is a pointer (LPC means long pointer constant), but what does "W" mean? Is it a specific pointer to a string or a pointer to a specific string? For example I want to close a Window named "TestWindow". H...

Go to first line in a file in vim?

How do I go to first line in a file in vim ?...

How can I get the ID of an element using jQuery?

<div id="test"></div> <script> $(document).ready(function() { alert($('#test').id); }); </script> Why doesn't the above work, and how should I do this?...

What is the difference between String.slice and String.substring?

Does anyone know what the difference is between these two methods? String.prototype.slice String.prototype.substring ...

Use "ENTER" key on softkeyboard instead of clicking button

Hello I've got a searched EditText and search Button. When I type the searched text, I'd like to use ENTER key on softkeyboard instead of search Button to activate search function. Thanks for help in advance....

c++ string array initialization

I know I can do this in C++: string s[] = {"hi", "there"}; But is there anyway to delcare an array this way without delcaring string s[]? e.g. void foo(string[] strArray){ // some code } string s[] = {"hi", "there"}; // Works foo(s); // Works...

What are the differences between using the terminal on a mac vs linux?

I've been using Ubuntu for the last four years. I have a basic knowledge of shell commands and I prefer working in a terminal rather than using a GUI. Recently I've started using a Mac. I've tried a few terminal commands (that I use on Ubuntu) in ...

How do I pass the this context to a function?

I thought this would be something I could easily google, but maybe I'm not asking the right question... How do I set whatever "this" refers to in a given javascript function? for example, like with most of jQuery's functions such as: $(selector)...

Regular Expression to match string starting with a specific word

How do I create a regular expression to match a word at the beginning of a string. We are looking to match stop at the beginning of a string and anything can follow it. For example the expression should match: stop stop random stopping Thanks....

Where/how can I download (and install) the Microsoft.Jet.OLEDB.4.0 for Windows 8, 64 bit?

I've got a 32 bit .net 2.0 app that uses the Jet OLEDB 4.0. It runs fin on Windows 8 32 bit, but not on the 64 bit. on 64 bit I'm getting an error: 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. at System.Data....

mysql update query with sub query

Can anyone see what is wrong with the below query? When I run it I get: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'a where a.CompetitionID = Co...

How To Add An "a href" Link To A "div"?

I need to know how to add an a href link to a div? Do you put the a href tag arounf the entire "buttonOne" div? Or should it be around or inside the "linkedinB" div? Here's my HTML: <div id="buttonOne"> <div id="linkedinB"> <im...

Javascript: How to remove the last character from a div or a string?

I have a div with a string of content in it. The content is not stored in a variable and I would like to remove the last character of the text in this div. Any help please? More info: I have a text field, and upon entering text into the text fiel...

`getchar()` gives the same output as the input string

I am confused by a program mentioned in K&R that uses getchar(). It gives the same output as the input string: #include <stdio.h> main(){ int c; c = getchar(); while(c != EOF){ putchar(c); c = getchar(); ...

How to keep a git branch in sync with master

At the moment git is doing my head in, I cannot come up with the best solution for the following. There are two branches, one called master and one called mobiledevicesupport. I want to keep mobiledevicesupport as a continuous branch that will be me...

border-radius not working

I'm working on a basic div and for some peculiar reason, border-radius: 7px isn't applying to it. .panel { float: right; width: 120px; height: auto; background: #fff; border-radius: 7px; // not working } ...

Change package name for Android in React Native

I used react-native init MyApp to initialise a new React Native app. This created among others an Android project with the package com.myapp. What's the best way to change this package name, for example to: com.mycompany.myapp? I tried changing it ...

How do I properly force a Git push?

I've set up a remote non-bare "main" repo and cloned it to my computer. I made some local changes, updated my local repository, and pushed the changes back to my remote repo. Things were fine up to that point. Now, I had to change something in the r...

Java Switch Statement - Is "or"/"and" possible?

I implemented a font system that finds out which letter to use via char switch statements. There are only capital letters in my font image. I need to make it so that, for example, 'a' and 'A' both have the same output. Instead of having 2x the amount...

The page cannot be displayed because an internal server error has occurred on server

I've installed website on my local machine using IIS 7 successfully. But when I've deployed it on live server, I got the following error: "The page cannot be displayed because an internal server error has occurred" Nothing else. Using the sam...

Twitter Bootstrap Responsive Background-Image inside Div

How i can modify #bg image so it would be responsive, resizable and proportional in all browser? HTML: <div class="container"> <div class="row"> <div class="col-md-2"></div> <div class="col-...

When should I really use noexcept?

The noexcept keyword can be appropriately applied to many function signatures, but I am unsure as to when I should consider using it in practice. Based on what I have read so far, the last-minute addition of noexcept seems to address some important i...

Spring 3 MVC accessing HttpRequest from controller

I would like to handle request and session attributes myself rather then leave it to spring @SessionAttributes, for login of cookies handling for example. I just cant figure out how could I access the HttpRequest from within a controller, I need a ...

How do I get my Maven Integration tests to run

I have a maven2 multi-module project and in each of my child modules I have JUnit tests that are named Test.java and Integration.java for unit tests and integration tests respectively. When I execute: mvn test all of the JUnit tests *Test.java ...

Days between two dates?

What's the shortest way to see how many full days have passed between two dates? Here's what I'm doing now. math.floor((b - a).total_seconds()/float(86400)) ...

Click through div to underlying elements

I have a div that has background:transparent, along with border. Underneath this div, I have more elements. Currently, I'm able to click the underlying elements when I click outside of the overlay div. However, I'm unable to click the underlying el...

google console error `OR-IEH-01`

i am trying to upload an android application on google play store (google play developer console). i am adding a new visa card and press pay and it gives me this error: An unexpected error has occurred. Please try again later. [OR-IEH-01] any h...

How do I disable and re-enable a button in with javascript?

I can easily disable a javascript button, and it works properly. My issue is that when I try to re-enable that button, it does not re-enable. Here's what I'm doing: <script type="text/javascript"> function startCombine(startButton) { ...

Install IPA with iTunes 11

I have an IPA signed for ad-hoc distribution. I can install it fine with Xcode Organizer by dragging it to the device. It also worked with iTunes <=10 by dragging onto the device name. I'd like to install it via iTunes 11 though. Dragging it onto ...

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

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

How to update one file in a zip archive

Is it possible to replace a file in a zip file without unzipping deleting the old file adding the new file and rezipping it back? Reason is I have a zip file which is really big there is one xml inside the zip file that I have to update sometimes. ...

Trusting all certificates using HttpClient over HTTPS

Recently posted a question regarding the HttpClient over Https (found here). I've made some headway, but I've run into new issues. As with my last problem, I can't seem to find an example anywhere that works for me. Basically, I want my client to ac...

Get the current script file name

If I have PHP script, how can I get the filename from inside that script? Also, given the name of a script of the form jquery.js.php, how can I extract just the "jquery.js" part?...

CSS: On hover show and hide different div's at the same time?

Here is CSS example how to show hidden div (on hover): <div class="showhim">HOVER ME<div class="showme">hai</div></div> and .showme{ display: none; } .showhim:hover .showme{ display : block; } Can I show one div and hid...

Bootstrap Modal immediately disappearing

I'm working on a website using bootstrap. Basically, I wanted to use a modal in the home page, summoned by the button in the Hero Unit. Button code: <button type="button" class="btn btn-warning btn-large" data-toggle="modal" data-...

How to add an empty column to a dataframe?

What's the easiest way to add an empty column to a pandas DataFrame object? The best I've stumbled upon is something like df['foo'] = df.apply(lambda _: '', axis=1) Is there a less perverse method?...

How to execute a command prompt command from python

I tried something like this, but with no effect: command = "cmd.exe" proc = subprocess.Popen(command, stdin = subprocess.PIPE, stdout = subprocess.PIPE) proc.stdin.write("dir c:\\") ...

How do I invoke a text editor from the terminal?

In the Windows command prompt, I can type notepad helloworld.cpp which will then create a .cpp file with the name helloworld and open up Notepad for me. Is there a similar function for Mac Terminal, preferably with Textmate or Textedit? I'm running...

How to configure a HTTP proxy for svn

I want to check code from the repository http://code.sixapart.com/svn/perlbal/ . I can only access the the repository url by setting a proxy. I guess if I want to get the code from the same URL by svn I need to configure a proxy, too. So does anyone ...

validation of input text field in html using javascript

<script type='text/javascript'> function required() { var empt = document.forms["form1"]["Name"].value; if (empt == "") { alert("Please input a Value"); return false; } } </script> <f...

Changing image on hover with CSS/HTML

I have this problem where I have set an image to display another image when the mouse hovers over, however the first image still appears and the new one doesn't change height and width and overlaps the other one. I'm still pretty new to HTML/CSS so I...

MySQL: Enable LOAD DATA LOCAL INFILE

I'm running Mysql 5.5 on Ubuntu 12 LTS. How should I enable LOAD DATA LOCAL INFILE in my.cnf? I've tried adding local-infile in my config at various places but I'm still getting the "The used command is not allowed with this MySQL version"...

Python error message io.UnsupportedOperation: not readable

I made a simple program but It shows the following error when I run it: line1 = [] line1.append("xyz ") line1.append("abc") line1.append("mno") file = open("File.txt","w") for i in range(3): file.write(line1[i]) file.write("\n") for line i...

Reducing video size with same format and reducing frame size

This question might be very basic Is there a way to reduce the frame size/rate of Lossy compressed (WMV, MPEG) format, to get a smaller video, of lesser size, with same format. Are there any open source or proprietary apis for this?...

Setting environment variable in react-native?

I am using react-native to build a cross-platform app, but I do not know how to set the environment variable so that I can have different constants for different environments. Example: development: BASE_URL: '', API_KEY: '', staging: BASE_U...

UNC path to a folder on my local computer

What's the UNC path to a folder on my local computer, and how can I access it? I have tried: Security for the folder -- set to Everyone Full Control (for now!) Sharing permissions -- set to Everyone Full Control (for now!) I can see the folder in...

scroll image with continuous scrolling using marquee tag

I am using a <marquee> tag for continues moving of image horizontally. Suppose I have a 5 images than it moving fine but after completion of last image move there is a big gap to start scrolling from 1 st image.How can i mange this? My code i...

T-SQL string replace in Update

I need to update the values of a column, with a substring replace being done on the existing values. Example: Data contains [email protected], [email protected] etc. I need to update the values such that @domain2 is replaced with @domain1....

SQL: sum 3 columns when one column has a null value?

SELECT sum(TotalHoursM) + (TotalHoursT) + (TotalHoursW) + (TotalHoursTH) + (TotalHoursF) AS TOTAL FROM LeaveRequest ...

php resize image on upload

I got a form where the user is inserting some data and also uploading an image. To deal with the image, I got the following code: define("MAX_SIZE", "10000"); $errors = 0; $image = $_FILES["fileField"]["name"]; $uploadedfile = $_FILES['fileField'][...

Get today date in google appScript

How do I get the Today date on google appscript? I need to write a code to input today´s date in a cell. function changeDate(){ var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(GA_CONFIG); var date = //Today´s date!?!?!!? va...

App crashing when trying to use RecyclerView on android 5.0

I'm trying to mess with the new RecyclerView and whenever I try to run it, my app immediately crashes. It gives me NullPointerException for trying to access methods from android.support.v7.widget.RecyclerView. I've looked at other posts and saw that ...

Overcoming "Display forbidden by X-Frame-Options"

I'm writing a tiny webpage whose purpose is to frame a few other pages, simply to consolidate them into a single browser window for ease of viewing. A few of the pages I'm trying to frame forbid being framed and throw a "Refused to display document ...

Splitting String and put it on int array

I have to input a string with numbers ex: 1,2,3,4,5. That's a sample of the input, then I have to put that in an array of INT so I can sort it but is not working the way it should work. package array; import java.util.Scanner; public class Array {...

Python: create dictionary using dict() with integer keys?

In Python, I see people creating dictionaries like this: d = dict( one = 1, two = 2, three = 3 ) What if my keys are integers? When I try this: d = dict (1 = 1, 2 = 2, 3 = 3 ) I get an error. Of course I could do this: d = { 1:1, 2:2, 3:3 } ...

How to discard all changes made to a branch?

I'm working in a branch (i.e. design) and I've made a number of changes, but I need to discard them all and reset it to match the repository version. I thought git checkout design would do it, but it just tells me I'm already in branch design and tha...

How to break out of a loop in Bash?

I want to write a Bash script to process text, which might require a while loop. For example, a while loop in C: int done = 0; while(1) { ... if(done) break; } I want to write a Bash script equivalent to that. But what I usually used and as ...

How to dock "Tool Options" to "Toolbox"?

The "Tool Options" and the "Toolbox" used to be in the same window, but it somehow broke apart. Can somebody give some hints as how to bring them together as one again? ...

WCF Service Client: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding

I've got a WCF Service running on my local IIS server. I've added it as a service reference to a C# Website Project and it adds fine and generates the proxy classes automatically. However, when I try and call any of the service contracts, I get the ...

Adding elements to a collection during iteration

Is it possible to add elements to a collection while iterating over it? More specifically, I would like to iterate over a collection, and if an element satisfies a certain condition I want to add some other elements to the collection, and make sure ...

Any way (or shortcut) to auto import the classes in IntelliJ IDEA like in Eclipse?

In Eclipse, while coding in Java and press Ctrl + Shift + O auto import all the Classes automatically. In NetBeans, this is done with Ctrl + Shift + I. Is any way to do this in IntelliJ IDEA? I searched an equivalent shortcut in google, StackOverfl...

Parsing arguments to a Java command line program

What if I wanted to parse this: java MyProgram -r opt1 -S opt2 arg1 arg2 arg3 arg4 --test -A opt3 And the result I want in my program is: regular Java args[] of size=4 org.apache.commons.cli.Options[] of size=3 org.apache.commons.cli.Options[] ...

CSS image overlay with color and transparency

I am trying to figure out if I can add an overlay to an image like a tint and change the opacity without adding background color. I had no luck so I thought I would ask here. I would like to make it red with that opacity. here is what I have so far. ...

default web page width - 1024px or 980px?

When developing web applications, in the past the choice has been 800px or 1024px to fit within the monitor of the user. I've been researching responsive web design and fluid designs, and it seems a lot of them define the 980px width. With the addi...

Add new value to an existing array in JavaScript

In PHP, I'd do something like: $array = array(); $array[] = "value1"; $array[] = "value2"; $array[] = "value3"; How would I do the same thing in JavaScript?...

AngularJS + JQuery : How to get dynamic content working in angularjs

I am working on a Ajax app using both jQuery and AngularJS. When I update content (which contains AngularJS bindings) of a div using jQuery's html function, the AngularJS bindings doesn't work. Following is code of what I am trying to do: _x000D_...

How to prevent scientific notation in R?

My plot is showing values on the y-axis in the form of e notation. Which command should I use to get the values in the numeric form. The values in the file used are in the numeric form? Thanks...

Counting Number of Letters in a string variable

I'm trying to count the number of letters in a string variable. I want to make a Hangman game, and I need to know how many letters are needed to match the amount in the word....

HTML meta tag for content language

What is the difference between the following two HTML meta tags, for specifying spanish web page content: <meta name="language" content="Spanish"> and <meta http-equiv="content-language" content="es"> ...

Building executable jar with maven?

I am trying to generate an executable jar for a small home project called "logmanager" using maven, just like this: How can I create an executable JAR with dependencies using Maven? I added the snippet shown there to the pom.xml, and ran mvn assemb...

Annotation-specified bean name conflicts with existing, non-compatible bean def

I'm having a problem with some Spring bean definitions. I have a couple of context xml files that are being loaded by my main() method, and both of them contain almost exclusively a tag. When my main method starts up, I get this error from Spring: ...

What does elementFormDefault do in XSD?

What does elementFormDefault do, and when should it be used? So I found some definitions for elementFormDefault values: qualified - elements and attributes are in the targetNamespace of the schema unqualified - elements and attribute...

Deleting row from datatable in C#

I'm having a problem deleting rows from a datatable. In my program, I am reading info from a database into a datatable using an sql query. I use an oledb connection and the code dt.Load(command.ExecuteReader()); to do this. Later, I want to delete ro...

Error running android: Gradle project sync failed. Please fix your project and try again

Android Studio (1.2 RC0) keeps telling me Error running android: Gradle project sync failed. Please fix your project and try again. How can I find out what the problem is? Unfortunately the solutions from this SO thread did not help....

Google.com and clients1.google.com/generate_204

I was looking into google.com's Net activity in firebug just because I was curious and noticed a request was returning "204 No Content." It turns out that a 204 No Content "is primarily intended to allow input for actions to take place without causi...

Nested or Inner Class in PHP

I'm building a User Class for my new website, however this time I was thinking to build it little bit differently... C++, Java and even Ruby (and probably other programming languages) are allowing the use of nested/inner classes inside the main clas...

How do I convert NSInteger to NSString datatype?

How does one convert NSInteger to the NSString datatype? I tried the following, where month is an NSInteger: NSString *inStr = [NSString stringWithFormat:@"%d", [month intValue]]; ...

What is the meaning of "__attribute__((packed, aligned(4))) "

It is C language.It is written that: typedef struct __attribute__((packed, aligned(4))) Ball { float2 delta; float2 position; //float3 color; float size; //int arcID; //float arcStr; } Ball_t; Ball_t *balls; Please tell me ...

How to obtain the location of cacerts of the default java installation?

I am looking on how how to obtain the location of cacerts of the default java installation, when you do not have JAVA_HOME or JRE_HOME defined. I need a solution that works at least for OS X and Linux. Yes. java -v is assumed to work :)...

How to see tomcat is running or not

Which command is used to find tomcat is running or not in windows? How do we know if JVM crashes suddenly? After googling I posted it, I am not able to find expected result....

I am getting an "Invalid Host header" message when connecting to webpack-dev-server remotely

I am using as an environment, a Cloud9.io ubuntu VM Online IDE and I have reduced by troubleshooting this error to just running the app with Webpack dev server. I launch it with: webpack-dev-server -d --watch --history-api-fallback --host $IP --po...

How do I 'git diff' on a certain directory?

git diff actually runs a diff on all source code. How do I do this on a certain directory, so that I can view modifications on files underneath it?...

Python - Convert a bytes array into JSON format

I want to convert a bytes array to JSON format. This is the source I have: my_bytes_value = b'[{\'Date\': \'2016-05-21T21:35:40Z\', \'CreationDate\': \'2012-05-05\', \'LogoType\': \'png\', \'Ref\': 164611595, \'Classe\': [\'Email addresses\', \'Passw...

TypeError: p.easing[this.easing] is not a function

When trying to show a div element with jQuery, i got this error: [23:50:35.971] TypeError: p.easing[this.easing] is not a function @ file:///D:/html5%20puzzle/jquery.js:2 The relevant function is this: function showWithAnimation(){ ...

val() doesn't trigger change() in jQuery

I'm trying to trigger the change event on a text box when I change its value with a button, but it doesn't work. Check this fiddle. If you type something in the text boxes and click somewhere else, change is triggered. However, if you click the butt...

Is it still valid to use IE=edge,chrome=1?

I read Chrome Frame closed last month, I thus tried to understand what it'd mean for the X-UA tag and after 3 hours of research I still didn't find the answer I'm looking for, my question is the following : Is it still valid nowdays to use IE=edge,c...

Replace all 0 values to NA

I have a dataframe with some numeric columns. Some row has a 0 value which should be considered as null in statistical analysis. What is the fastest way to replace all the 0 value to NULL in R? ...

How to close this ssh tunnel?

I opened a ssh tunnel as described in this post: Zend_Db: How to connect to a MySQL database over SSH tunnel? But now I don't know what I actually did. Does this command affect anything on the server? And how do I close this tunnel, because now I ca...

How to get child element by class name?

I'm trying to get the child span that has a class = 4. Here is an example element: <div id="test"> <span class="one"></span> <span class="two"></span> <span class="three"></span> <span class="four">...

How do I convert hex to decimal in Python?

I have some Perl code where the hex() function converts hex data to decimal. How can I do it on Python?...

What are good ways to prevent SQL injection?

I have to program an application management system for my OJT company. The front end will be done in C# and the back end in SQL. Now I have never done a project of this scope before; in school we had only basic lessons about SQL. Somehow our teacher...

Android Service Stops When App Is Closed

I am starting a service from my main Android activity as follows: final Context context = base.getApplicationContext(); final Intent intent = new Intent(context, MyService.class); startService(intent); When I close the activity page by swiping it ...

How to make a GridLayout fit screen size

The GridLayout API docs is very difficult to learn ...... is there any one who can teach me how to set child Views to have something like "weight" of LinearLayout ? Right now it looks like all are placed on the left hand side, I have tried many time...

See last changes in svn

I paused development on a project before going on holidays. Now after a few weeks I'd like to know what were the last things in source I was working on? Is there a chance to see e.g. in WebSVN the last changes in the whole repository?...

Excel VBA, error 438 "object doesn't support this property or method

I have this code in which I've been getting help with a bit, but I've run into an issue, or what I think is an issue. The last lookup, I am being told that the object doesn't support this property or method. I know it's probably something easy, but m...

Chrome says "Resource interpreted as script but transferred with MIME type text/plain.", what gives?

In FF and all, my javascript works fine. But in Chrome it gives this message: Resource interpreted as script but transferred with MIME type text/plain. I have checked all the script tags and they all have the MIME type="text/javascript". It ev...

What's the difference between console.dir and console.log?

In Chrome the console object defines two methods that seem to do the same thing: console.log(...) console.dir(...) I read somewhere online that dir takes a copy of the object before logging it, whereas log just passes the reference to the console,...

Does bootstrap 4 have a built in horizontal divider?

Does bootstrap 4 have a built in horizontal divider? I can do this, <style type="text/css"> .h-divider{ margin-top:5px; margin-bottom:5px; height:1px; width:100%; border-top:1px solid gray; } </style> But I want to use the built i...

React - changing an uncontrolled input

I have a simple react component with the form which I believe to have one controlled input: import React from 'react'; export default class MyForm extends React.Component { constructor(props) { super(props); this.state = {} ...

Expand/collapse section in UITableView in iOS

Could somebody tell me the way to perform UITableView expandable/collapsible animations in sections of UITableView as below? or ...

Why Does OAuth v2 Have Both Access and Refresh Tokens?

Section 4.2 of the draft OAuth 2.0 protocol indicates that an authorization server can return both an access_token (which is used to authenticate oneself with a resource) as well as a refresh_token, which is used purely to create a new access_token: ...

How does BitLocker affect performance?

I'm an ASP.NET / C# developer. I use VS2010 all the time. I am thinking of enabling BitLocker on my laptop to protect the contents, but I am concerned about performance degradation. Developers who use IDEs like Visual Studio are working on lots and l...

Get current scroll position of ScrollView in React Native

Is it possible to get the current scroll position, or the current page of a <ScrollView> component in React Native? So something like: <ScrollView horizontal={true} pagingEnabled={true} onScrollAnimationEnd={() => { // get ...

How to make <input type="file"/> accept only these types?

I want my uploader only allows these types: doc, docx. xls, xlsx. ppt, pptx. txt. pdf. Image types. How can I achieve this? What should I put in the accept attribute? Thanks for your help. EDIT!!! I have one more thing to ask. When the popup ap...

Open Url in default web browser

I am new in react-native and i want to open url in default browser like Chrome in Android and iPhone both. We open url via intent in Android same like functionality i want to achieve. I have search many times but it will give me the result of Deepk...

How do I set headers using python's urllib?

I am pretty new to python's urllib. What I need to do is set a custom header for the request being sent to the server. Specifically, I need to set the Content-type and Authorizations headers. I have looked into the python documentation, but I have...

how to open *.sdf files?

I used to open sdf (sqlCE) files with visual-studio? or sql-server? I really don't remember. Now I can't open this sdf file. With what program do I need to open it?...

Update an outdated branch against master in a Git repo

I have a Git repository that has branch (local and remote) that has become outdated. I would like to bring this branch up to date with the master branch, but I don't know how to do this. There will also probably be many merge conflicts. How can I b...

Flutter Countdown Timer

How can I do to put the value passed in the construction, to make a timer that rounds to the first decimal and shows at the child text of my RaisedButton? I've tried but without luck. I manage to make work the callback function with a simple Timer bu...

How do I fix a compilation error for unhandled exception on call to Thread.sleep()?

I am new to Java and kind of new to programming (I know diving straight into Java probably wasn't the greatest idea.) and I've been getting an error consistently no matter how I try to add a pause in my program. I am doing a simple counting program a...

How to specify font attributes for all elements on an html web page?

When I set the font family, font size, color etc. it seems that some nested elements override these with ugly browser defaults. Must I really specify those a dozens of times for any kind of element on my page, or is there a way to set them globally ...

Why do I keep getting Delete 'cr' [prettier/prettier]?

I am using vscode with Prettier 1.7.2 and Eslint 1.7.0. After every newline I get: [eslint] Delete 'cr' [prettier/prettier] This is the .eslintrc.json: { "extends": ["airbnb", "plugin:prettier/recommended"], "env": { "jest": true, "br...

vertical alignment of text element in SVG

Let's say I have the SVG file: <svg width="1024" height="768" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <text x='20' y='60' style="font-size: 60px">b</text> <text x='100' y='60' style...

Variables not showing while debugging in Eclipse

I am running Eclipse Galileo for developers. When I run in debug mode, the current variables and their values are not coming up in the Variables window. The window remains empty when I step through my code after a breakpoint. Last night it was work...

Setting PayPal return URL and making it auto return?

This is a follow up question to: PHP: Easy way to start PayPal checkout? So, my problem is that I am specifying the return url. However, after paying with PayPal, I end up at a a screen that says: You just completed your payment. XXXX, you just ...

java.sql.SQLException: Exhausted Resultset

I get the error java.sql.SQLException: Exhausted ResultSet to run a query against an Oracle database. The connection is via a connection pool defined in Websphere. The code executed is as follows: if (rs! = null) ( while ...

what is an illegal reflective access

There are a lot of questions about illegal reflective access in Java 9. I have found plenty of discussion about working around the error messages, but I would love to know what an illegal reflective access actually is. So my question is: What defines...

Why do we use Base64?

Wikipedia says Base64 encoding schemes are commonly used when there is a need to encode binary data that needs be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remains intact withou...

How to get href value using jQuery?

I'm trying to get href value using jQuery: <html> <head> <title>Jquery Test</title> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script ty...

jquery background-color change on focus and blur

I have the following problem: I have a form with three text input fields, and I want to change the background-color when one of the fields has focus, and get it set back when it loses focus. I have come up with the following code: HTML (simplified):...

How to open a new tab in GNOME Terminal from command line?

I'm using Ubuntu 9.04 x64 and when I write: gnome-terminal --tab At the terminal, I expect it to open a new tab in the same terminal window. But it opens a new window instead. I found out that its intention is to open a new tab in a new window, i...

Getting a map() to return a list in Python 3.x

I'm trying to map a list into hex, and then use the list elsewhere. In python 2.6, this was easy: A: Python 2.6: >>> map(chr, [66, 53, 0, 94]) ['B', '5', '\x00', '^'] However, in Python 3.1, the above returns a map object. B: Python 3.1...

Convert String array to ArrayList

I want to convert String array to ArrayList. For example String array is like: String[] words = new String[]{"ace","boom","crew","dog","eon"}; How to convert this String array to ArrayList?...

How to convert URL parameters to a JavaScript object?

I have a string like this: abc=foo&def=%5Basf%5D&xyz=5 How can I convert it into a JavaScript object like this? { abc: 'foo', def: '[asf]', xyz: 5 } ...

Calendar Recurring/Repeating Events - Best Storage Method

I am building a custom events system, and if you have a repeating event that looks like this: Event A repeats every 4 days starting on March 3, 2011 or Event B repeats every 2 weeks on Tuesday starting on March 1, 2011 How can I store that in a ...

how to prevent css inherit

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

Postman: How to make multiple requests at the same time

I want to POST data from Postman Google Chrome extension. I want to make 10 requests with different data and it should be at the same time. Is it possible to do such in Postman? If yes, can anyone explain to me how can this be achieved?...

How do I execute a PowerShell script automatically using Windows task scheduler?

I have one PowerShell script which sends emails. I want to execute that script automatically, every 1 minute. How can I do it, using task scheduler? Currently I have created a task and provided the path of my script. But that scheduler opens my scri...

How to convert std::chrono::time_point to calendar datetime string with fractional seconds?

How to convert std::chrono::time_point to calendar datetime string with fractional seconds? For example: "10-10-2012 12:38:40.123456" ...

How to read file using NPOI

I found NPOI is very good to write Excel files with C#. But I want to open, read and modify Excel files in C#. How can I do this?...

Read and write to binary files in C?

Does anyone have an example of code that can write to a binary file. And also code that can read a binary file and output to screen. Looking at examples I can write to a file ok But when I try to read from a file it is not outputting correctly....

Export SQL query data to Excel

I have a query that returns a very large data set. I cannot copy and paste it into Excel which I usually do. I have been doing some research on how to export directly to an Excel sheet. I am running SQL SERVER 2008 on a server running Microsoft Serve...

How can I run Android emulator for Intel x86 Atom without hardware acceleration on Windows 8 for API 21 and 19?

I have not enabled Hyper V or hardware acceleration and don't want to either. Is there any way that I can start android emulator for Intel x86 Atom Without hardware acceleration on Windows 8 I have created AVDs with every combination possible and ...

How do I write a custom init for a UIView subclass in Swift?

Say I want to init a UIView subclass with a String and an Int. How would I do this in Swift if I'm just subclassing UIView? If I just make a custom init() function but the parameters are a String and an Int, it tells me that "super.init() isn't call...

Objective-C declared @property attributes (nonatomic, copy, strong, weak)

Can someone explain to me in detail when I must use each attribute: nonatomic, copy, strong, weak, and so on, for a declared property, and explain what each does? Some sort of example would be great also. I am using ARC....

Difference between Constructor and ngOnInit

Angular provides life cycle hook ngOnInit by default. Why should ngOnInit be used, if we already have a constructor?...

What is the opposite of :hover (on mouse leave)?

Is there any way to do the opposite of :hover using only CSS? As in: if :hover is on Mouse Enter, is there a CSS equivalent to on Mouse Leave? Example: I have a HTML menu using list items. When I hover one of the items, there is a CSS color animati...

Cannot open backup device. Operating System error 5

Below is the query that I am using to backup (create a .bak) my database. However, whenever I run it, I always get this error message: Msg 3201, Level 16, State 1, Line 1 Cannot open backup device 'C:\Users\Me\Desktop\Backup\MyDB.Bak'. Operat...

How to cast int to enum in C++?

How do I cast an int to an enum in C++? For example: enum Test { A, B }; int a = 1; How do I convert a to type Test::A?...

How to run Gulp tasks sequentially one after the other

in the snippet like this: gulp.task "coffee", -> gulp.src("src/server/**/*.coffee") .pipe(coffee {bare: true}).on("error",gutil.log) .pipe(gulp.dest "bin") gulp.task "clean",-> gulp.src("bin", {read:false}) .p...

Google OAuth 2 authorization - Error: redirect_uri_mismatch

On the website https://code.google.com/apis/console I have registered my application, set up generated Client ID: and Client Secret to my app and tried to log in with Google. Unfortunately, I got the error message: Error: redirect_uri_mismatch The r...

How to create nested directories using Mkdir in Golang?

I am trying to create a set of nested directories from a Go executable such as 'dir1/dir2/dir3'. I have succeeded in creating a single directory with this line: os.Mkdir("." + string(filepath.Separator) + c.Args().First(),0777); However, I have no...

Creating a random string with A-Z and 0-9 in Java

As the title suggest I need to create a random, 17 characters long, ID. Something like "AJB53JHS232ERO0H1". The order of letters and numbers is also random. I thought of creating an array with letters A-Z and a 'check' variable that randoms to 1-2. A...

Android: Get checked checkbox values

I need to get checked checkbox values when button clicked. Java Code: dualcamera1 = (CheckBox)findViewById(R.id.Camera1_DualDisplay); dualcamera2 = (CheckBox)findViewById(R.id.Camera2_DualDisplay); dualcamera3 = (CheckBox)findViewById(R.id.Camera3_D...

JavaScript: How to get parent element by selector?

Example: <div someAttr="parentDiv. We need to get it from child."> <table> .... <td> <div id="myDiv"></div> </td> ... </table> </div> I want to get parent by some selector from inner ...

Using number_format method in Laravel

I am fairly new in Laravel and Blade templating. Can anyone help show me how to do this? I have a view like this: @foreach ($Expenses as $Expense) <tr> <td>{{{ $Expense->type }}}</td> <td>{{{ $Expens...

UNION with WHERE clause

I'm doing a UNION of two queries on an Oracle database. Both of them have a WHERE clause. Is there a difference in the performance if I do the WHERE after UNIONing the queries compared to performing the UNION after WHERE clause? For example: SELECT...

How to set the size of button in HTML

I have some buttons on my pure HTML/JS page. When the page is opened in browser, the button size is normal. But on refresh/reloading page, the button size is reduced. In fact, I have not set the button text value. The button's text is blank. How shou...

How to block calls in android

I want to block calls from few numbers, for that I want to write a app of my own. So what are the APIs which I should be using? Basically I want to get notified when a call comes, i want to compare numbers if it is what i want to block, i want to cu...

Iterate through pairs of items in a Python list

Possible Duplicates: Iterate a list as pair (current, next) in Python Iterating over every two elements in a list Is it possible to iterate a list in the following way in Python (treat this code as pseudocode)? a = [5, 7, 11, 4, 5] for...

'python3' is not recognized as an internal or external command, operable program or batch file

I am using Python 3.5.2 version on Windows 7 and tried using python3 app.py. I am getting this error message: 'python3' is not recognized as an internal or external command, operable program or batch file. Is there any specific cause about why the ...

Slide up/down effect with ng-show and ng-animate

I'm trying to use ng-animate to get a behavior similar to JQuery's slideUp() and slideDown(). Only I'd rather use ng-show I'm looking at the ng-animate tutorial here - http://www.yearofmoo.com/2013/04/animation-in-angularjs.html, and I can reproduc...

How can I jump to class/method definition in Atom text editor?

Is there an easy way to do this? On Aptana I used Control+click and I wish there was a way to do something similar on Atom....

Where can I find the TypeScript version installed in Visual Studio?

Maybe it's obvious, but I checked everywhere (besides the right place) and googled it. Nothing....

php refresh current page?

I have a page which, If a variable is set(in a session) it will do an action, then it unsets the session. Now it has to refresh itself. This is where i am stuck. Is there a way to get the exact url to the current page? or is there a function to ...

VueJs get url query

I'm developing a website with vuejs and at this moment I'm in trouble, I need to get the url query (page) from a url like this websitename.com/user/?page=1 but the this.$router.query.page gives me an error (Uncaught TypeError: Cannot read property 'p...

SQL Server® 2016, 2017 and 2019 Express full download

All previous version of SQL Server Express were available in both web and full downloads. But I cannot find full download of SQL Server® 2016 Express. Does it exist? Asked the same question on MSDN forums, not much luck: https://social.msdn.microso...

Use of Custom Data Types in VBA

I am trying to create a custom data type in VBA for Excel. Let's call this data type "truck". Each truck has the following attributes: NumberOfAxles (this is an integer) AxleWeights (this is an array of doubles) AxleSpacings (this is an array of dou...

A non well formed numeric value encountered

I have a form that passes two dates (start and finish) to a PHP script that will add those to a DB. I am having problems validating this. I keep getting the following errors A non well formed numeric value encountered This is when I use the follow...

Laravel - Form Input - Multiple select for a one to many relationship

One of the requirements in an application that I am building is for a form input which takes in a varying number of items for a single field. For instance, sports that I play are ('Soccer','Tennis','Croquet'). There are a finite number of sports one ...

Call a python function from jinja2

I am using jinja2, and I want to call a python function as a helper, using a similar syntax as if I were calling a macro. jinja2 seems intent on preventing me from making a function call, and insists I repeat myself by copying the function into a tem...

Remove Top Line of Text File with PowerShell

I am trying to just remove the first line of about 5000 text files before importing them. I am still very new to PowerShell so not sure what to search for or how to approach this. My current concept using pseudo-code: set-content file (get-content ...

How to label each equation in align environment?

I wonder how to label each equation in align environment? For example \begin{align} \label{eq:lnnonspbb} \lambda_i + \mu_i = 0 \\ \mu_i \xi_i = 0 \\ \lambda_i [y_i( w^T x_i + b) - 1 + \xi_i] = 0 \end{align} only label the first equation and only ...

Unix command to check the filesize

I need to check the display the files my server with their sizes.Which command that I need to use. Any variants of ls command?...

standard size for html newsletter template

i'm wanting to create an html newsletter template to be emailed out, however, i'm unsure of standard dimensions for it. would a 800w be good? or should i go w/ something smaller? for webpages my standard is usually 970w, but wasn't sure what would b...

How to Execute a Python File in Notepad ++?

I prefer using Notepad ++ for developing, How do I execute the files in Python through Notepad++?...

How can I get the "network" time, (from the "Automatic" setting called "Use network-provided values"), NOT the time on the phone?

I would like in my application to find a way to synch the date and time with something given by an external source. I don't want to use the phone time because I might get a difference of maybe 5 minutes around real time. and 5 minutes extra or less ...

Regex expressions in Java, \\s vs. \\s+

What's the difference between the following two expressions? x = x.replaceAll("\\s", ""); x = x.replaceAll("\\s+", ""); ...

What are the pros and cons of parquet format compared to other formats?

Characteristics of Apache Parquet are : Self-describing Columnar format Language-independent In comparison to Avro, Sequence Files, RC File etc. I want an overview of the formats. I have already read : How Impala Works with Hadoop File Formats ,...

How to enable scrolling on website that disabled scrolling?

How to quickly re-enable scrolling on a website that has disabled scrolling with Javascript? window.scrollBy(0, 100) works fine just can't seem to figure out how to bind this to keys or mouse scroll....

SameSite warning Chrome 77

Since the last update, I'm having an error with cookies, related with SameSite attribute. The cookies are from third party developers (Fontawesome, jQuery, Google Analytics, Google reCaptcha, Google Fonts, etc.) The errors in the Chrome console are...

Reset/remove CSS styles for element only

I'm sure this must have been mentioned/asked before but have been searching for an age with no luck, my terminology must be wrong! I vaguely remember a tweet I saw a while ago that suggested that there was a css rule available that would remove any ...

Get a CSS value with JavaScript

I know I can set a CSS value through JavaScript such as: document.getElementById('image_1').style.top = '100px'; But, can I get a current specific style value? I've read where I can get the entire style for the element, but I don't want to have to...

Correct way to pass multiple values for same parameter name in GET request

I'm looking into what is the correct way to pass multiple values for the same parameter name in a GET request. I've seen URLs like this: http://server/action?id=a&id=b And I've seen URLs like this: http://server/action?id=a,b My understand...

How does one reorder columns in a data frame?

How would one change this input (with the sequence: time, in, out, files): Time In Out Files 1 2 3 4 2 3 4 5 To this output (with the sequence: time, out, in, files)? Time Out In Files 1 3 2 4 2 ...

Interesting 'takes exactly 1 argument (2 given)' Python error

For the error: TypeError: takes exactly 1 argument (2 given) With the following class method: def extractAll(tag): ... and calling it: e.extractAll("th") The error seems very odd when I'm giving it 1 argument, the method should take only ...

To switch from vertical split to horizontal split fast in Vim

How can you switch your current windows from horizontal split to vertical split and vice versa in Vim? I did that a moment ago by accident but I cannot find the key again....

Word wrap for a label in Windows Forms

How can one get word wrap functionality for a Label for text which goes out of bounds?...

How to start an application without waiting in a batch file?

Is there any way to execute an application without waiting in batch file? I have tried the start command but it just creates a new command window....

How to return JSON with ASP.NET & jQuery

I cannot get how I can return JSON data with my code. JS $(function () { $.ajax({ type: "POST", url: "Default.aspx/GetProducts", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", ...

jQuery date/time picker

I've been looking around for a decent jQuery plugin that can handle both dates and times. The core UI DatePicker is great, but unfortunately I need to be able to take time in as well. I've found a few hacks for the DatePicker to work with times, bu...

Is it possible to embed animated GIFs in PDFs?

Is it possible to embed animated GIFs in PDFs? And how might I go about such a thing? are there any dangers I should be aware of? For some more details on why I think it's a good thing and how it helps feel free to see this post. I didn't think it wa...

How to delete $_POST variable upon pressing 'Refresh' button on browser with PHP?

When I press the 'refresh' button on my browser, it seems that $_POST variable is preserved across the refresh. If I want to delete the contents of $_POST what should I do? Using unset for the fields of $_POST did not help. Help? Thanks!...

Unable to start debugging on the web server. Could not start ASP.NET debugging VS 2010, II7, Win 7 x64

I am running Visual Studio 2010 (as Admin), IIS 7 on Windows 7 x64. I am able to run the ASP.NET web site in IIS 7 without debugging just fine, but when I press F5 to debug it, I get: Unable to start debugging on the web server. Could not start A...

What happens when a duplicate key is put into a HashMap?

If I pass the same key multiple times to HashMap’s put method, what happens to the original value? And what if even the value repeats? I didn’t find any documentation on this. Case 1: Overwritten values for a key Map mymap = new HashMap(); myma...

How can I execute Python scripts using Anaconda's version of Python?

I recently downloaded the Anaconda distribution for Python. I noticed that if I write and execute a Python script (by double-clicking on its icon), my computer (running on Windows 8) will execute it using my old version of Python rather than Anaconda...

Logical operators for boolean indexing in Pandas

I'm working with boolean index in Pandas. The question is why the statement: a[(a['some_column']==some_number) & (a['some_other_column']==some_other_number)] works fine whereas a[(a['some_column']==some_number) and (a['some_other_column']==so...

Proxy Basic Authentication in C#: HTTP 407 error

I am working with a proxy that requires authentication, i.e., in a browser if I try to open a page it will immediately ask for credentials. I supplied same credentials in my program but it fails with HTTP 407 error. Here is my code: HttpWebRequest ...

InvalidKeyException : Illegal Key Size - Java code throwing exception for encryption class - how to fix?

I've been trying to get some working Java code to use for encrypting Paypal buttons. This is no easy task! Even when I get some code, from Paypal, I'm faced with errors..ugh.. So here is what I have so far, that I think will work eventually. I down...

Select top 2 rows in Hive

I'm trying to retrieve top 2 tables from my employee list based on salary in hive (version 0.11). Since it doesn't support TOP function, is there any alternatives? Or do we have define a UDF?...

Eloquent ->first() if ->exists()

I want to get the first row in table where condition matches: User::where('mobile', Input::get('mobile'))->first() It works well, but if the condition doesn't match, it throws an Exception: ErrorException Trying to get property of non-object ...

Best way to create enum of strings?

What is the best way to have a enum type represent a set of strings? I tried this: enum Strings{ STRING_ONE("ONE"), STRING_TWO("TWO") } How can I then use them as Strings?...

builder for HashMap

Guava provides us with great factory methods for Java types, such as Maps.newHashMap(). But are there also builders for java Maps? HashMap<String,Integer> m = Maps.BuildHashMap. put("a",1). put("b",2). build(); ...

How to use Python's pip to download and keep the zipped files for a package?

If I want to use the pip command to download a package (and its dependencies), but keep all of the zipped files that get downloaded (say, django-socialregistration.tar.gz) - is there a way to do that? I've tried various command-line options, but it ...

Postman: sending nested JSON object

I am using ASP.NET Web API: http://xyzdomain.com:16845/api/returns/returns How do I send a POST request to the endpoint using Postman Chrome extension, given Items is a collection: [ { "Items": [ { "sku": "9257", "Price"...

mysql.h file can't be found

i'm trying to install connection between c++ and mysql in ubuntu 12.04. i've installed mysql-client, mysql-server, libmysqlclient15-dev, libmysql++-dev. but when i try to compile the code i got the error: mysql.h there is no such file. i looked in th...

You must add a reference to assembly 'netstandard, Version=2.0.0.0

The project is an ASP.NET MVC Web App targeting the .NET Framework 4.6.1. All of a sudden (some NuGet packages were upgraded) I started to get the following error during runtime: CS0012: The type 'System.Object' is defined in an assembly that is...

Convert serial.read() into a useable string using Arduino?

I'm using two Arduinos to sent plain text strings to each other using newsoftserial and an RF transceiver. Each string is perhaps 20-30 characters in length. How do I convert Serial.read() into a string so I can do if x == "testing statements", etc....

How to listen for a WebView finishing loading a URL?

I have a WebView that is loading a page from the Internet. I want to show a ProgressBar until the loading is complete. How do I listen for the completion of page loading of a WebView?...

Remote Connections Mysql Ubuntu

For some reason, I've been unable to connect remotely to my MySQL server. I've tried everything and I'm still getting errors. [email protected]:/home/administrator# mysql -u monty -p -h www.ganganadores.cl Enter password: ERROR 1045 (28000): Access denie...

How do I append text to a file?

What is the easiest way to append text to a file in Linux? I had a look at this question, but the accepted answer uses an additional program (sed) I'm sure there should be an easier way with echo or similar....

Convert all strings in a list to int

In Python, I want to convert all strings in a list to integers. So if I have: results = ['1', '2', '3'] How do I make it: results = [1, 2, 3] ...

How to read specific lines from a file (by line number)?

I'm using a for loop to read a file, but I only want to read specific lines, say line #26 and #30. Is there any built-in feature to achieve this?...

insert data into database using servlet and jsp in eclipse

I am trying to add or insert values into table of database using servlet and jsp and MySQL Workbench as database. These are the following details: 1.> Register.java package register.com; import java.io.IOException; import java.io.PrintWriter; imp...

css ellipsis on second line

CSS text-overflow: ellipsis on second line, is this possible? I can't find it on the net. example: what I want is like this: I hope someone could help me. I need an ellipsis on the second line of... but what's happening is this: I hope someone...

javascript regex : only english letters allowed

Quick question: I need to allow an input to only accept letters, from a to z and from A to Z, but can't find any expression for that. I want to use the javascript test() method....

How can I check if a string is null or empty in PowerShell?

Is there a built-in IsNullOrEmpty-like function in order to check if a string is null or empty, in PowerShell? I could not find it so far and if there is a built-in way, I do not want to write a function for this....

trigger click event from angularjs directive

How can i trigger a click event for li elements specifying their index from the angularjs directive? I have tried using $first for triggering click for the first element, but its not working. Thanks for any help....

PHP Checking if the current date is before or after a set date

Im pulling a date from a database which is formatted like dd-mm-YYYY. What I want to do is check the current date; if the current date is before the date coming from the database then it needs to print the database date if its after then it needs to...

Jump into interface implementation in Eclipse IDE

You know how in Eclipse, pressing F3 over a method will take you to its declaration? Well I have a method that is part of an interface; clicking F3 over this naturally takes me to the declaring interface. Obviously there is an object implementing th...

Add bottom line to view in SwiftUI / Swift / Objective-C / Xamarin

I would like to keep the border at the bottom part only in UITextField. But I don't know how we can keep it on the bottom side. Can you please advise me?...

How do I get AWS_ACCESS_KEY_ID for Amazon?

I'm totally new to AWS. I downloaded some sample code from Amazon and I need to set a number of constants: AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY MERCHANT_ID MARKETPLACE_ID I just created an AWS account. I want some type of sandbox account so ...

HttpClient 4.0.1 - how to release connection?

I have a loop over a bunch of URLs, for each one I'm doing the following: private String doQuery(String url) { HttpGet httpGet = new HttpGet(url); setDefaultHeaders(httpGet); // static method HttpResponse response = httpClient.execute(httpGet...

How to remove a variable from a PHP session array

I have PHP code that is used to add variables to a session: <?php session_start(); if(isset($_GET['name'])) { $name = isset($_SESSION['name']) ? $_SESSION['name'] : array(); $name[] = $_GET['name']; $_SESSION['...

Step out of current function with GDB

Those who use Visual Studio will be familiar with the Shift + F11 hotkey, which steps out of a function, meaning it continues execution of the current function until it returns to its caller, at which point it stops. Is there an equivalent in GDB?...

Passing ArrayList through Intent

I am trying to pass an arrayList to another activity using intents. Here is the code in the first activity. case R.id.editButton: Toast.makeText(this, "edit was clicked", Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, ed...

Reverse Contents in Array

I have an array of numbers that I am trying to reverse. I believe the function in my code is correct, but I cannot get the proper output. The output reads: 10 9 8 7 6. Why can't I get the other half of the numbers? When I remove the "/2" from count,...

Design Patterns web based applications

I am designing a simple web-based application. I am new to this web-based domain.I needed your advice regarding the design patterns like how responsibility should be distributed among Servlets, criteria to make new Servlet, etc. Actually, I have few...

Where should I put the CSS and Javascript code in an HTML webpage?

While designing a webpage, where should I put the following code? <link rel=stylesheet type="text/css" href="css/layout.css"> Should I put it in the <head> or should I put it in the <body>? Please clarify the following questions:...

How to get first two characters of a string in oracle query?

Suppose I have a column name OrderNo with value AO025631 in a table shipment. I am trying to query the table so that I can get only first two character of column value i.e. AO. Can I do this in the SQL query itself? ...

The Eclipse executable launcher was unable to locate its companion launcher jar windows

I am facing a small issue and need help on it. I had to re-install Windows on my laptop. After that I installed Java, extracted Eclipse and set the environment variables, namely Path to the Java bin directory and also created a JAVA_HOME variable an...

How can I get city name from a latitude and longitude point?

Is there a way to get a city name from a latitude and longitude point using the google maps api for javascript? If so could I please see an example?...

Multi-gradient shapes

I'd like to create a shape that's like the following image: Notice the top half gradients from color 1 to color 2, but theres a bottom half that gradients from color 3 to color 4. I know how to make a shape with a single gradient, but I'm not sur...

Extract images from PDF without resampling, in python?

How might one extract all images from a pdf document, at native resolution and format? (Meaning extract tiff as tiff, jpeg as jpeg, etc. and without resampling). Layout is unimportant, I don't care were the source image is located on the page. I'm u...

error : expected unqualified-id before return in c++

when I want to compile I get : Probléme : expected unqualified-id before "return" return 0; about last line : erreur:expexted declaration before { token I left the code unchanged just the middle part I changed... whats the problem??? here is my cod...

An array of List in c#

I want to have an array of Lists. In c++ I do like: List<int> a[100]; which is an array of 100 Lists. each list can contain many elements. I don't know how to do this in c#. Can anyone help me?...

jQuery - Call ajax every 10 seconds

I have a mysql feedback database constructed like this: name | location | feedback Ryan | England | great support Obviously there's more entries than that. I am trying to build a feedback div, where it displays a new feedback item eve...

How to convert hex string to Java string?

For logging purpose we are converting the logs to byte array and then to hex string. I want to get it back in a Java String, but I am not able to do so. The hex string in log file looks something like fd00000aa8660b5b010006acdc01000001010001000100...

$_POST Array from html form

I am trying to send data from multiple checkboxes (id[]) and create an array "info" in php to allow me to run a script for each value (however the quantity of values may change each time) however first I am trying to display the content of each array...

How can I recognize touch events using jQuery in Safari for iPad? Is it possible?

Is it possible to recognize touch events on the iPad's Safari browser using jQuery? I used mouseOver and mouseOut events in a web application. Are there any similar events for the iPad's Safari browser since there are no events like mouseOut and mo...

When to use std::size_t?

I'm just wondering should I use std::size_t for loops and stuff instead of int? For instance: #include <cstdint> int main() { for (std::size_t i = 0; i < 10; ++i) { // std::size_t OK here? Or should I use, say, unsigned int instea...

Getting 400 bad request error in Jquery Ajax POST

I am trying to send an Ajax POST request using Jquery but I am having 400 bad request error. Here is my code: $.ajax({ type: 'POST', url: "http://localhost:8080/project/server/rest/subjects", data: { "subject:title":"Test Name", "subj...

Aligning text and image on UIButton with imageEdgeInsets and titleEdgeInsets

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

How to move up a directory with Terminal in OS X

When I launch a new Terminal window, it starts me in 'Macintosh HD/Users/MyName'. How can I back out of my user directory, back up to the top level?...

C# generic list <T> how to get the type of T?

I'm working on a reflection project, and now I'm stuck. If I have an object of myclass that can hold a List<SomeClass>, does anyone know how to get the type as in the code below if the property myclass.SomList is empty? List<myclass> my...

Display image as grayscale using matplotlib

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

How to display JavaScript variables in a HTML page without document.write

I am trying to display some JavaScript variable on my HTML page. I was first using document.write() but it use to overwrite the current page when the function was called. After searching around, the general consensus was that document.write() isn...

Encrypt & Decrypt using PyCrypto AES 256

I'm trying to build two functions using PyCrypto that accept two parameters: the message and the key, and then encrypt/decrypt the message. I found several links on the web to help me out, but each one of them has flaws: This one at codekoala uses ...

Scatter plot with error bars

How can I generate the following plot in R? Points, shown in the plot are the averages, and their ranges correspond to minimal and maximal values. I have data in two files (below is an example). x y 1 0.8773 1 0.8722 1 0.8816 1 0.8834 1 ...

Execute action when back bar button of UINavigationController is pressed

I need to execute an action (emptying an array), when the back button of a UINavigationController is pressed, while the button still causes the previous ViewController on the stack to appear. How could I accomplish this using swift? ...

How to implement zoom effect for image view in android?

I have to implement image zooming, I have tried with so many codes.But i didnt get full idea of gesture events. I want to implement when we apply double tap, image will be zooming according to the touch place(event x and y).I have to implement only z...

How to get row count in an Excel file using POI library?

Guys I'm currently using the POI 3.9 library to work with excel files. I know of the getLastRowNum() function, which returns a number of rows in an Excel file. The only problem is getLastRowNum() returns a number with the count starting from 0. So ...

How to make a <div> always full screen?

No matter how its content is like. Is it possible to do this?...

Strip out HTML and Special Characters

I'd like to use any php function or whatever so that i can remove any HTML code and special characters and gives me only alpha-numeric output $des = "Hello world)<b> (*&^%$#@! it's me: and; love you.<p>"; I want the output ...

Convert bytes to int?

I'm currently working on an encryption/decryption program and I need to be able to convert bytes to an integer. I know that: bytes([3]) = b'\x03' Yet I cannot find out how to do the inverse. What am I doing terribly wrong?...

Combine two or more columns in a dataframe into a new column with a new name

For example if I have this: n = c(2, 3, 5) s = c("aa", "bb", "cc") b = c(TRUE, FALSE, TRUE) df = data.frame(n, s, b) n s b 1 2 aa TRUE 2 3 bb FALSE 3 5 cc TRUE Then how do I combine the two columns n and s into a new column named x su...

An invalid form control with name='' is not focusable

In Google Chrome some customers are not able to proceed to my payment page. When trying to submit a form I get this error: An invalid form control with name='' is not focusable. This is from the JavaScript console. I read that the problem could be ...

Working with SQL views in Entity Framework Core

For example, I have such model: public class Blog { public int BlogId { get; set; } public string Url { get; set; } public BlogImage BlogImage { get; set; } } public class BlogImage { public int BlogImageId { get; set; } public...

Can't find bundle for base name /Bundle, locale en_US

I'm using a library that has a dependency on JSF. When I try to run my project, it show following exception massage.. java.util.MissingResourceException: Can't find bundle for base name /Bundle, locale en_US at java.util.ResourceBundle.throwMissin...

Align items in a stack panel?

I was wondering if I can have 2 controls in a horizontal-oriented StackPanel so that the right item should be docked to the right side of the StackPanel. I tried the following but it didn't work: <StackPanel Orientation="Horizontal"> <...

Stored procedure - return identity as output parameter or scalar

When you insert a record into a table with an identity column, you can use SCOPE_IDENTITY() to get that value. Within the context of a stored procedure, which would be the recommended way to return the identity value: As an output parameter SET @R...

jQuery Refresh/Reload Page if Ajax Success after time

I use Jquery to make an Ajax request. The server returns Json object with value "true or false" like this: return Json(new { success = false, JsonRequestBehavior.AllowGet }); Is there any way to refresh page after 5 seconds if the server r...

How to list branches that contain a given commit?

How can I query git to find out which branches contain a given commit? gitk will usually list the branches, unless there are too many, in which case it just says "many (38)" or something like that. I need to know the full list, or at least whether ce...

Trying to git pull with error: cannot open .git/FETCH_HEAD: Permission denied

Help me please, I am trying to run this in my terminal: [email protected]:~/CollegePortal$ git pull error: cannot open .git/FETCH_HEAD: Permission denied Then I try this one [email protected]:~/CollegePortal$ sudo git pull Permission de...

Sort a list of lists with a custom compare function

I know there are several questions named like this, but they don't seem to work for me. I have a list of lists, 50 times 5 elements. I want to sort this list by applying a custom compare function to each element. This function calculates the fitness...

C# RSA encryption/decryption with transmission

I've seen plenty of encryption/decryption tutorials and examples on the net in C# that use the System.Security.Cryptography.RSACryptoServiceProvider, but what I'm hoping to be able to do is: Create an RSA public/private keypair Transmit the public ...

C# HttpClient 4.5 multipart/form-data upload

Does anyone know how to use the HttpClient in .Net 4.5 with multipart/form-data upload? I couldn't find any examples on the internet....

Check if a number is int or float

Here's how I did it: inNumber = somenumber inNumberint = int(inNumber) if inNumber == inNumberint: print "this number is an int" else: print "this number is a float" Something like that. Are there any nicer looking ways to do this?...

HttpServletRequest - how to obtain the referring URL?

I need to log URLs that are linking to my site in a Java Servlet....

Programmatically shut down Spring Boot application

How can I programmatically shutdown a Spring Boot application without terminating the VM? In other works, what is the opposite of new SpringApplication(Main.class).run(args); ...

Is it possible to find out the users who have checked out my project on GitHub?

I'm wondering if there is any way to know who has checked out my project hosted on GitHub? This would include people who have forked the project directly on GitHub, as well as people who may have cloned the repository using standard git clone command...

Does JSON syntax allow duplicate keys in an object?

Is this valid json? { "a" : "x", "a" : "y" } http://jsonlint.com/ says yes. http://www.json.org/ doesn't say anything about it being forbidden. But obviously it doesn't make much sense, does it? Most implementations probably use a hashta...

PHP sessions that have already been started

In my PHP code, if a session has already started, and I try to start a new one, I get the following Notice: Notice: A session had already been started - ignoring session_start() How can I avoid this?...

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 provide some source code....

Best way to make WPF ListView/GridView sort on column-header clicking?

There are lots of solutions on the internet attempting to fill this seemingly very-basic omission from WPF. I'm really confused as to what would be the "best" way. For example... I want there to be little up/down arrows in the column header to indica...

The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'Negotiate,NTLM'

I've looked through a ton of SO articles, and even other sites, but can't seem to get this service working. I have a SOAP service I'm trying to hit and it's configured like this: <system.serviceModel> <bindings> <basicHttp...

How do I clear/delete the current line in terminal?

If I'm using terminal and typing in a line of text for a command, is there a hotkey or any way to clear/delete that line? For example, if my current line/command is something really long like: > git log --graph --all --blah..uh oh i want to canc...

How to have click event ONLY fire on parent DIV, not children?

I have a DIV with a classed foobar, and a few DIVs inside that DIV that are unclassed, but I suppose they are inheriting the foobar class: $('.foobar').on('click', function() { /*...do stuff...*/ }); I want that to fire off only when clicking some...

How to compare dates in datetime fields in Postgresql?

I have been facing a strange scenario when comparing dates in postgresql(version 9.2.4 in windows). I have a column in my table say update_date with type 'timestamp without timezone'. Client can search over this field with only date (i.e: 2013-05-0...

How to trim a list in Python

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

How to use pagination on HTML tables?

I am trying to use this Pagination library in my HTML table page (specifically light theme) but somehow I am not able to understand how to plugin this library in such a way in my HTML page so that I can have pagination code working in my HTML table.....

How to solve WAMP and Skype conflict on Windows 7?

I have Windows 7 (32-bit) installed on laptop. I downloaded WAMP server and installed it with it's default options. However, I noticed that Apache does not work (while MySQL does work!). I tried to install it via Apache ? Service ? Install Servic...

Why I am getting Cannot pass parameter 2 by reference error when I am using bindParam with a constant value?

I'm using this code and I'm beyond frustration: try { $dbh = new PDO('mysql:dbname=' . DB . ';host=' . HOST, USER, PASS); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbh->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAN...

Printing an int list in a single line python3

I'm new to python and I'm trying to scan multiple numbers separated by spaces (let's assume '1 2 3' as an example) in a single line and add it to a list of int. I did it by using: #gets the string string = input('Input numbers: ') #converts the str...

Using ng-if as a switch inside ng-repeat?

I am working on Angular app. I tried to use ng-if and switch inside ng-repeat but didn't succeed. I have data like: **[{"_id":"52fb84fac6b93c152d8b4569", "post_id":"52fb84fac6b93c152d8b4567", "user_id":"52df9ab5c6b93c8e2a8b4567", ...

SET NOCOUNT ON usage

Inspired by this question where there are differing views on SET NOCOUNT... Should we use SET NOCOUNT ON for SQL Server? If not, why not? What it does Edit 6, on 22 Jul 2011 It suppresses the "xx rows affected" message after any DML. This is a...

HTML tag inside JavaScript

I am trying to use some HTML tag inside JavaScript, but the HTML tag does not work. How can U use an HTML tag inside JavaScript? I wanted to use h1 but did not work. if (document.getElementById('number1').checked) { <h1>Hello member</h1>...

java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

I have Hadoop 2.7.1 and apache-hive-1.2.1 versions installed on ubuntu 14.0. Why this error is occurring ? Is any metastore installation required? When we typing hive command on terminal how the xml's internally called, what is the flow of those x...

Numpy converting array from float to strings

I have an array of floats that I have normalised to one (i.e. the largest number in the array is 1), and I wanted to use it as colour indices for a graph. In using matplotlib to use grayscale, this requires using strings between 0 and 1, so I wanted ...

How to apply Hovering on html area tag?

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

Android Color Picker

I am looking for a Color Picker framework which can return color HEX on selection. I have looked at this wondering if there is some other library I can use....

Found conflicts between different versions of the same dependent assembly that could not be resolved

When I clean and then build my solution that has several projects, the output window reports that the build succeeded. However, when I view the Error List Window, it shows me this warning: Found conflicts between different versions of the same de...

Error in spring application context schema

I have a maven-spring project in Eclipse and I have this annoying error message in one of my spring contexts: Referenced file contains errors (jar:file:/M2_HOME/repository/org/springframework/spring-beans/3.1.2.RELEASE/spring-beans-3.1.2.RELEASE....

Should I use <i> tag for icons instead of <span>?

Facebook's HTML and Twitter Bootstrap HTML (before v3) both use the <i> tag to display icons. However, from the HTML5 spec: The I element represents a span of text in an alternate voice or mood, or otherwise offset from the normal prose, such ...

How to print a number with commas as thousands separators in JavaScript

I am trying to print an integer in JavaScript with commas as thousands separators. For example, I want to show the number 1234567 as "1,234,567". How would I go about doing this? Here is how I am doing it: function numberWithCommas(x) { x = x....

How to invoke function from external .c file in C?

My files are // main.c #include "add.c" int main(void) { int result = add(5,6); printf("%d\n", result); } and // add.c int add(int a, int b) { return a + b; } ...

How to save data file into .RData?

I want to save data into an .RData file. For instance, I'd like to save into 1.RData with two csv files and some information. Here, I have two csv files 1) file_1.csv contains object city[[1]] 2) file_2.csv contains object city[[2]] and additio...

Reducing the gap between a bullet and text in a list item

How can I reduce default gap between bullet and text in an <li>? Item 1 Item 2 Item 3 I want to reduce gap between the bullet and "I"....

Python Unicode Encode Error

I'm reading and parsing an Amazon XML file and while the XML file shows a ' , when I try to print it I get the following error: 'ascii' codec can't encode character u'\u2019' in position 16: ordinal not in range(128) From what I've read online th...

Error when checking Java version: could not find java.dll

why do I get this? How can I fix it? C:\Users\ash>java version Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion' has value '1.7.0_01', but '1.7' is required. Error: could not find java.dll Error: Could not find Java...

How do I get SUM function in MySQL to return '0' if no values are found?

Say I have a simple function in MySQL: SELECT SUM(Column_1) FROM Table WHERE Column_2 = 'Test' If no entries in Column_2 contain the text 'Test' then this function returns NULL, while I would like it to return 0. I'm aware that a similar questio...

Difference between @Mock and @InjectMocks

What is the difference between @Mock and @InjectMocks in Mockito framework?...

Convert canvas to PDF

Is it possible to directly convert canvas to pdf using JavaScript (pdf.js or something like that)? Is there another possible way like canvas to img and then img to pdf? Can you give me an example?...

How to use WebRequest to POST some data and read response?

Need to have the server make a POST to an API, how do I add POST values to a WebRequest object and how do I send it and get the response (it will be a string) out? I need to POST TWO values, and sometimes more, I see in these examples where it says ...

How to insert &nbsp; in XSLT

How can I insert &nbsp; Into an XSLT stylesheet, I keep getting this error: XML Parsing Error: undefined entity Essentially I want a non breaking space character in the XSLT Template....

What is the total amount of public IPv4 addresses?

Yes, I am needing to know what the total number possible IPs in the public IPv4 space. I'm not sure where to even get a neat list of all the IP address ranges, so could someone point me to a resource to calculate this myself or calculate the total ...

How to create a XML object from String in Java?

I am trying to write a code that helps me to create a XML object. For example, I will give a string as input to a function and it will return me a XMLObject. XMLObject convertToXML(String s) {} When I was searching on the net, generally I saw exam...

How to crop(cut) text files based on starting and ending line-numbers in cygwin?

I have few log files around 100MBs each. Personally I find it cumbersome to deal with such big files. I know that log lines that are interesting to me are only between 200 to 400 lines or so. What would be a good way to extract relavant log lines f...

How to use componentWillMount() in React Hooks?

In the official docs of React it mentions - If you’re familiar with React class lifecycle methods, you can think of useEffect Hook as componentDidMount, componentDidUpdate, and componentWillUnmount combined. My question is - how can we ...

Close window automatically after printing dialog closes

I have a tab open when the user clicks a button. On the onload I have it bring up the print dialog, but the user asked me whether it was possible that after it sends to the printer to print, if the tab could close itself. I am not sure whether this c...

Excel VBA Check if directory exists error

I have a spreadsheet that upon clicking a button will duplicate itself by copying/pasting everything to a new workbook and save the file with a name that is dependent upon some variable values (taken from cells on the spreadsheet). My current goal is...

Is there a way to get rid of accents and convert a whole string to regular letters?

Is there a better way for getting rid of accents and making those letters regular apart from using String.replaceAll() method and replacing letters one by one? Example: Input: orcpžsíáýd Output: orcpzsiayd It doesn't need to include all lette...

Remove duplicates from an array of objects in JavaScript

I have an object that contains an array of objects. things = new Object(); things.thing = new Array(); things.thing.push({place:"here",name:"stuff"}); things.thing.push({place:"there",name:"morestuff"}); things.thing.push({place:"there",name:"more...

View a specific Git commit

Possible Duplicate: Get Information about a SHA-1 commit object? I needed to check when a specific change was added to a file I'm working on, so I used the git blame command. From that I obtained the hash of the relevant commit. Is there a...

jQuery UI Alert Dialog as a replacement for alert()

I'm using alert() to output my validation errors back to the user as my design does not make provision for anything else, but I would rather use jQuery UI dialog as the alert dialog box for my message. Since errors are not contained in a (html) div...

Where to get "UTF-8" string literal in Java?

I'm trying to use a constant instead of a string literal in this piece of code: new InputStreamReader(new FileInputStream(file), "UTF-8") "UTF-8" appears in the code rather often, and would be much better to refer to some static final variable ins...

How to throw a C++ exception

I have a very poor understanding of exception handling(i.e., how to customize throw, try, catch statements for my own purposes). For example, I have defined a function as follows: int compare(int a, int b){...} I'd like the function to throw an exc...

Eclipse can't find / load main class

My Eclipse (Indigo) was running just fine. I created a simple class Hello. It is placed in package cont in the folder ch13. However, when I try to run it from Eclipse I get info from Java Virtual Machine Launcher: Could not find the main class: ...

Found 'OR 1=1/* sql injection in my newsletter database

I found the following in the "e-mail" field of my newsletter subscriber database: ' OR 1=1/* I know it's a SQL injection, but that's it. I've googled it a little bit, but I'm still on clear on what exactly it's trying to achieve. This occurred early...

How to open in default browser in C#

I am designing a small C# application and there is a web browser in it. I currently have all of my defaults on my computer say google chrome is my default browser, yet when I click a link in my application to open in a new window, it opens internet e...

no pg_hba.conf entry for host

I get following error when I try to connect using DBI DBI connect('database=chaosLRdb;host=192.168.0.1;port=5433','postgres',...) failed: FATAL: no pg_hba.conf entry for host "192.168.0.1", user "postgres", database "chaosLRdb", SSL off Here is...

Video file formats supported in iPhone

What are the the video file formats supported by the iPhone OS? Thanks...

Split string with PowerShell and do something with each token

I want to split each line of a pipe on spaces, and then print each token on its own line. I realise that I can get this result using: (cat someFileInsteadOfAPipe).split(" ") But I want more flexibility. I want to be able to do just about anything...

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

I been strugling with this for 2 days now without comming any closer to solution. I have read 20-30 threads alteast and stil can not resolve this. Please help me out. I have disable anonymous authentication, enable asp.net impersonation. I have ad...

Automating running command on Linux from Windows using PuTTY

I have a scenario where I need to run a linux shell command frequently (with different filenames) from windows. I am using PuTTY and WinSCP to do that (requires login name and password). The file is copied to a predefined folder in the linux machine...

Getting a random value from a JavaScript array

Consider: var myArray = ['January', 'February', 'March']; How can I select a random value from this array using JavaScript?...

How do I rotate the Android emulator display?

How can I rotate the Android emulator display to see it in landscape mode?...

How to format a URL to get a file from Amazon S3?

I am having some trouble figuring out how to access a file from Amazon S3. Lets say that the bucket that the file lives in is BUCKET_NAME, the file is FILE_NAME, etc. I have tried the following two URLs: https://s3.amazonaws.com/BUCKET_NAME/FILE_NAM...

Multiple argument IF statement - T-SQL

How do I write an IF statement with multiple arguments in T-SQL? Current source error: DECLARE @StartDate AS DATETIME DECLARE @EndDate AS DATETIME SET @StartDate = NULL SET @EndDate = NULL IF (@StartDate IS NOT NULL AND @EndDate IS NOT NULL) ...

C++ pointer to objects

In C++ do you always have initialize a pointer to an object with the new keyword? Or can you just have this too: MyClass *myclass; myclass->DoSomething(); I thought this was a pointer allocated on the stack instead of the heap, but since obje...

How to unpack an .asar file?

I have packed my Electron application using the following command: asar pack app app.asar Now, I need to unpack it and get the whole code back. Is there any way to do so?...

How to remove numbers from string using Regex.Replace?

I need to use Regex.Replace to remove all numbers and signs from a string. Example input: 123- abcd33 Example output: abcd...

What does "\r" do in the following script?

I am using following script to reboot my router using Telnet: #!/usr/bin/env python import os import telnetlib from time import sleep host = "192.168.1.1" user = "USER" password = "PASSWORD" cmd = "system restart" tn = telnetlib.Telnet(host) slee...