Questions Tagged with #Default package

How to import a class from default package

Possible Duplicate: How to access java-classes in the default-package? I am using Eclipse 3.5 and I have created a project with some package structure along with the default package. I have one..

How to automatically allow blocked content in IE?

I am using below code for sample menu. <html> <head> <title>Tree Demo</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/ja..

Hashing with SHA1 Algorithm in C#

I want to hash given byte[] array with using SHA1 Algorithm with the use of SHA1Managed. The byte[] hash will come from unit test. Expected hash is 0d71ee4472658cd5874c5578410a9d8611fc9aef (case sens..

Resolve promises one after another (i.e. in sequence)?

Consider the following code that reads an array of files in a serial/sequential manner. readFiles returns a promise, which is resolved only once all files have been read in sequence. var readFile = fu..

how to read a text file using scanner in Java?

This is my code to read a text file. When I run this code, the output keeps saying "File not found.", which is the message of FileNotFoundException. I'm not sure what is the problem in this code. App..

Convert XML to JSON (and back) using Javascript

How would you convert from XML to JSON and then back to XML? The following tools work quite well, but aren't completely consistent: xml2json Has anyone encountered this situation before?..

Java :Add scroll into text area

How can i add the scroll bar to my text area. i have tried with this code but it's not working. middlePanel=new JPanel(); middlePanel.setBorder(new TitledBorder(new EtchedBorder()..

How do you get the currently selected <option> in a <select> via JavaScript?

How do you get the currently selected <option> of a <select> element via JavaScript?..

Set position / size of UI element as percentage of screen size

I'm trying to work out if it's possible to use percentage positions/sizes when creating a layout. What I want is something like this... ^ | | | 68% | | v Gallery (height equivalent of 16% total scree..

jQuery - How to dynamically add a validation rule

I'm trying to dynamically add a validation rule to some dynamic controls: $("input[id*=Hours]").rules("add", "required"); However this line gives me the following error: $.data(element.form, "vali..


I've got a messages table in MySQL which records messages between users. Apart from the typical ids and message types (all integer types) I need to save the actual message text as either VARCHAR or TE..

How to return data from PHP to a jQuery ajax call

I am posting some data using ajax. I want to manipulate that data and return to to the calling jQuery script. Here is my jQuery: $.ajax({ type: "POST", url: "somescript.php", datatype: "html"..

HTTP Error 404 when running Tomcat from Eclipse

I have installed Eclipse and Tomcat 7. The error is that when I run Tomcat from Eclipse it starts, but after that, when I open localhost:8080 in Google Chrome I get HTTP Error 404(). How can I solve t..

SELECT list is not in GROUP BY clause and contains nonaggregated column

Receiving the following error: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column '' which is not functionally dependent on columns in GROUP BY..

javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"Group")

unexpected element (uri:"", local:"Group"). Expected elements are <{}group> Meet an exception when unmarshalling from xml JAXBContext jc = JAXBContext.newInstance(Group.class); Unmarshaller ..

How can I programmatically generate keypress events in C#?

How can I programmatically create an event that would simulate a key being pressed on the keyboard?..

mysql_fetch_array() expects parameter 1 to be resource problem

Possible Duplicate: “Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given” error while trying to create a php shopping cart I don't get it, I see no mi..

jQuery '.each' and attaching '.click' event

I am not a programer but I enjoy building prototypes. All of my experience comes from actionScript2. Here is my question. To simplify my code I would like to figure out how to attach '.click' events ..

dropdownlist set selected value in MVC3 Razor

Here is my model: public class NewsCategoriesModel { public int NewsCategoriesID { get; set; } public string NewsCategoriesName { get; set; } } My controller: public ActionResult N..

How to fix the "508 Resource Limit is reached" error in WordPress?

508 Resource Limit is reached - Wordpress This error occurs again and again, and I can't post a single post without seeing this error: The website is temporarily unable to service your reques..

How to commit and rollback transaction in sql server?

I have a huge script for creating tables and porting data from one server. So this sceipt basically has - Create statements for tables. Insert for porting the data to these newly created tables. Cr..

How to open a website when a Button is clicked in Android application?

I am designing an app, with several button for users to click on. Once button is clicked, user is directed to appropriate website. How do I accomplish this?..

getting the last item in a javascript object

If I have an object like: { 'a' : 'apple', 'b' : 'banana', 'c' : 'carrot' } If I don't know in advance that the list goes up to 'c', other than looping through the object, is there a way to get th..

CORS header 'Access-Control-Allow-Origin' missing

I'm calling this function from my form and getting following error on firebug console while calling ajax. Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote ..

How to run Unix shell script from Java code?

It is quite simple to run a Unix command from Java. Runtime.getRuntime().exec(myCommand); But is it possible to run a Unix shell script from Java code? If yes, would it be a good practice to run a..

How do I pause my shell script for a second before continuing?

I have only found how to wait for user input. However, I only want to pause so that my while true doesn't crash my computer. I tried pause(1), but it says -bash: syntax error near unexpected token '..

Print second last column/field in awk

I want to print the second last column or field in awk. The number of fields is variable. I know that I should be able to use $NF but not sure how it can be used. And this does not seem to work: awk..

How large is a DWORD with 32- and 64-bit code?

In Visual C++ a DWORD is just an unsigned long that is machine, platform, and SDK dependent. However, since DWORD is a double word (that is 2 * 16), is a DWORD still 32-bit on 64-bit architectures?..

Android: remove left margin from actionbar's custom layout

I am using a custom actionbar view, and as you can see in the screenshot below, there is a blank gray space in the actionbar. I want to remove it. What have I done: res/values-v11/styles.xml ..

Right to Left support for Twitter Bootstrap 3

There have been questions about this before: Twitter Bootstrap CSS that support from RTL languages But all the answers are good for Bootstrap 2.x I'm working on a project that is in Arabic (rtl), a..

JPG vs. JPEG image formats

I often use JPEG images, and I have noticed that there are two very similar file extensions: .jpg, which my mobile's camera and the Preview application use, and .jpeg, with which Image Capture saves t..

postgresql return 0 if returned value is null

I have a query that returns avg(price) select avg(price) from( select *, cume_dist() OVER (ORDER BY price desc) from web_price_scan where listing_Type='AARM' and u_kbalikepart..

GoTo Next Iteration in For Loop in java

Is there a token in java that skips the rest of the for loop? Something like VB's Continue in java...

Check if an element is present in an array

The function I am using now to check this is the following: function inArray(needle,haystack) { var count=haystack.length; for(var i=0;i<count;i++) { if(haystack[i]===needle){r..

Getting number of elements in an iterator in Python

Is there an efficient way to know how many elements are in an iterator in Python, in general, without iterating through each and counting?..

SASS and @font-face

I have the following CSS - how would I describe it in SASS? I've tried reverse compiling it with css2sass, and just keep getting errors.... is it my CSS (which works ;-) )? @font-face { font-family..

PHP header() redirect with POST variables

I'm working with PHP, and I'm making an action page which a form posts to. The page checks for errors, then if everything is fine, it redirects them to the page where the data has been posted. If not,..

What is the difference between URL parameters and query strings?

I don't see much of a difference between the parameters and the query strings, in the URL. So what is the difference and when should one be used over the other?..

Java better way to delete file if exists

We need to call file.exists() before file.delete() before we can delete a file E.g. File file = ...; if (file.exists()){ file.delete(); } Currently in all our project we create a static m..

Add text to Existing PDF using Python

I need to add some extra text to an existing PDF using Python, what is the best way to go about this and what extra modules will I need to install. Note: Ideally I would like to be able to run this o..

Where is the syntax for TypeScript comments documented?

Is the syntax for TypeScript comments documented anywhere? And by any chance, does it now support the C# /// system?..

Differences between dependencyManagement and dependencies in Maven

What is the difference between dependencyManagement and dependencies? I have seen the docs at Apache Maven web site. It seems that a dependency defined under the dependencyManagement can be used in it..

Multidimensional Array [][] vs [,]

double[][] ServicePoint = new double[10][9]; // <-- gives an error (1) double[,] ServicePoint = new double[10,9]; // <-- ok (2) What's their difference? (1) yields an error, what's the reason?..

SQL Server Convert Varchar to Datetime

I have this date format: 2011-09-28 18:01:00 (in varchar), and I want to convert it to datetime changing to this format 28-09-2011 18:01:00. How can I do it?..

Converting bool to text in C++

Maybe this is a dumb question, but is there any way to convert a boolean value to a string such that 1 turns to "true" and 0 turns to "false"? I could just use an if statement, but it would be nice t..

How do I get the project basepath in CodeIgniter

I have created a folder as user in the root directory. My project base path is: /var/www/myproject/ When I want to access the base path as BASEPATH from a controller it's showing: /var/www/myproj..

Iterating through all the cells in Excel VBA or VSTO 2005

I need to simply go through all the cells in a Excel Spreadsheet and check the values in the cells. The cells may contain text, numbers or be blank. I am not very familiar / comfortable working with..

How do you run a command for each line of a file?

For example, right now I'm using the following to change a couple of files whose Unix paths I wrote to a file: cat file.txt | while read in; do chmod 755 "$in"; done Is there a more elegant, safer ..

Order a List (C#) by many fields?

I want to order a List of objects in C# by many fields, not just by one. For example, let's suppose I have a class called X with two Attributes, A and B, and I have the following objects, in that orde..

Error 80040154 (Class not registered exception) when initializing VCProjectEngineObject (Microsoft.VisualStudio.VCProjectEngine.dll)

I'm trying to run this tool in order to convert a Visual C++ project to makefile. The project I'm trying to convert project is written in VS2008, so I'm using a reference to Microsoft.VisualStudio.VCP..

Error message "Unable to install or run the application. The application requires stdole Version 7.0.3300.0 in the GAC"

When one user tries to run the application, our ClickOnce application is reporting: Unable to install or run the application. The application requires stdole Version 7.0.3300.0 in the GAC. It's ..

How to Solve Max Connection Pool Error

I have a application in 3.5 and Database is Sql server 2005. "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all p..

How do HashTables deal with collisions?

I've heard in my degree classes that a HashTable will place a new entry into the 'next available' bucket if the new Key entry collides with another. How would the HashTable still return the correct V..

How to Install gcc 5.3 with yum on CentOS 7.2?

I am using CentOS 7.2 When I use yum groupinstall "Development Tools", gcc version is 4.8.5, like this: I would like to install gcc 5.3 How to approach this with yum?..

React - Display loading screen while DOM is rendering?

This is an example from Google Adsense application page. The loading screen displayed before the main page showed after. I don't know how to do the same thing with React because if I make loading s..

How to store arbitrary data for some HTML tags

I'm making a page which has some interaction provided by javascript. Just as an example: links which send an AJAX request to get the content of articles and then display that data in a div. Obviously ..

What is makeinfo, and how do I get it?

I'm trying to build GNU grep, and when I run make, I get: [snip] /bin/bash: line 9: makeinfo: command not found What is makeinfo, and how do I get it? (This is Ubuntu, if it makes a difference)..

AngularJS: Can't I set a variable value on ng-click?

I have a modal that uses ng-show="prefs" to determine visibility. My desire is to use the close button in the modal to set $scope.prefs to false and to use an anchor tag to set the value to true. How..

How to check if the docker engine and a docker container are running?

In a script, I need to check: a) Is the docker engine running? b) Given a container name, is that docker container running? [the initial wording of this question was ambiguous, with some people interp..

Java error: Only a type can be imported. XYZ resolves to a package

I get the error: "Only a type can be imported. XYZ resolves to a package." Someone has explained the cause here but I am not sure what I supposed to do to fix this. FYI: I am using Eclipse. I have ad..

In-memory size of a Python structure

Is there a reference for the memory size of Python data stucture on 32- and 64-bit platforms? If not, this would be nice to have it on SO. The more exhaustive the better! So how many bytes are used b..

How do I get the XML root node with C#?

I know that it's possible to get any XML node using C# if you know the node name, but I want to get the root node so that I can find out the name. Is this possible? Update: I'm using XMLTextReader to..

Set markers for individual points on a line in Matplotlib

I have used Matplotlib to plot lines on a figure. Now I would now like to set the style, specifically the marker, for individual points on the line. How do I do this? To clarify my question, I want t..

Get the current language in device

How can we get the current language selected in the Android device?..

Converting HTML string into DOM elements?

Is there a way to convert HTML like: <div> <a href="#"></a> <span></span> </div> or any other HTML string into DOM element? (So that I could use appendChild()). ..

Using VBA to get extended file attributes

Trying to use Excel VBA to capture all the file attributes from files on disk, including extended attributes. Was able to get it to loop through the files and capture the basic attributes (that come f..

Swift - Split string over multiple lines

How could I split a string over multiple lines such as below? var text:String = "This is some text over multiple lines" ..

How can I avoid getting this MySQL error Incorrect column specifier for column COLUMN NAME?

How can I avoid getting this MySQL error Incorrect column specifier for column topic_id ? MySQL Error... #1063 - Incorrect column specifier for column 'topic_id' SQL Schema... CREATE TABLE disc..

Find the most frequent number in a NumPy array

Suppose I have the following NumPy array: a = np.array([1,2,3,1,2,1,1,1,3,2,2,1]) How can I find the most frequent number in this array?..

Replace multiple whitespaces with single whitespace in JavaScript string

I have strings with extra whitespaces, each time there's more than only one whitespace I'd like it be only one. Anyone? I tried searching google, but nothing worked for me. Thanks..

How add class='active' to html menu with php

I want to put my html navigation in a separate php file so when I need to edit it, I only have to edit it once. The problem starts when I want to add the class active to the active page. I've got th..

The difference between bracket [ ] and double bracket [[ ]] for accessing the elements of a list or dataframe

R provides two different methods for accessing the elements of a list or data.frame: [] and [[]]. What is the difference between the two, and when should I use one over the other?..

casting Object array to Integer array error

What's wrong with the following code? Object[] a = new Object[1]; Integer b=1; a[0]=b; Integer[] c = (Integer[]) a; The code has the following error at the last line : Exception in thread "main..

Sending websocket ping/pong frame from browser

I keep reading about ping/pong messages in websockets to keep the connection alive, but I'm not sure what they are. Is it a distinct frame type? (I don't see any methods on a javascript WebSocket obj..

How do I print the percent sign(%) in c

I am a beginner in C, and I was wondering why this program does not print % sign? The code is: #include<stdio.h> main() { printf("%"); getch(); } ..

How do I convert strings in a Pandas data frame to a 'date' data type?

I have a Pandas data frame, one of the column contains date strings in the format YYYY-MM-DD For e.g. '2013-10-28' At the moment the dtype of the column is object. How do I convert the column values t..

How to git reset --hard a subdirectory?

UPDATE²: With Git 2.23 (August 2019), there's a new command git restore that does this, see the accepted answer. UPDATE: This will work more intuitively as of Git 1.8.3, see my own answer. ..

Calculating how many days are between two dates in DB2?

I need to get the difference in days between two dates in DB2. I tried a couple of different queries but nothing seems to be working. So basically what i need to get is something like this. SELECT D..

How to copy and edit files in Android shell?

The Android shell does not have the cp command. Android shell also has no sed or grep or vi. I have no adb daemon available. There is mv command but it rejects to work if source is on a read-only devi..

How do I automatically scroll to the bottom of a multiline text box?

I have a textbox with the .Multiline property set to true. At regular intervals, I am adding new lines of text to it. I would like the textbox to automatically scroll to the bottom-most entry (the n..

Using Google Translate in C#

I have to translate some text with Google's translate service. All code I've found doesn't work. I think because they have changed their service. If someone has working code, I would be very glad...

How to set up datasource with Spring for HikariCP?

Hi I'm trying to use HikariCP with Spring for connection pool. I'm using jdbcTempLate and JdbcdaoSupport. This is my spring configuration file for datasource: <bean id="dataSource" class="com.zax..

Add a reference column migration in Rails 4

A user has many uploads. I want to add a column to the uploads table that references the user. What should the migration look like? Here is what I have. I'm not sure if I should use (1) :user_id, :i..

Spring Boot access static resources missing scr/main/resources

I am working on a Spring Boot application. I need to parse an XML file (countries.xml) on start. The problem is that I do not understand where to put it so that I could access it. My folders structur..

How to get a list of programs running with nohup

I am accessing a server running CentOS (linux distribution) with an SSH connection. Since I can't always stay logged in, I use "nohup [command] &" to run my programs. I couldn't find how to get a..

Call a stored procedure with parameter in c#

I'm able to delete, insert and update in my program and I try to do an insert by calling a created stored procedure from my database. This button insert I made works well. private void btnAdd_Click(ob..

Use a.empty, a.bool(), a.item(), a.any() or a.all()

import random import pandas as pd heart_rate = [random.randrange(45,125) for _ in range(500)] blood_pressure_systolic = [random.randrange(140,230) for _ in range(500)] blood_pressure_dyastolic = [ran..

How to wait for a process to terminate to execute another process in batch file

How to wait for a process to terminate before executing another process in a batch file? Let's say I have a process notepad.exe that I need to kill before executing wordpad.exe. Then, when wordpad.exe..

How to get the correct range to set the value to a cell?

I want to set text or number in Google Sheet from script. I want to set Hello or number 9 in cell F2. I found this code so far: SpreadsheetApp.getActiveRange().setValue('hello'); but that doesn..

How to repair COMException error 80040154?

Moving a working C# project from a 64-bit Windows 7 machine to a 32-bit XP machine caused the following error: Retrieving the COM class factory for component with CLSID {681EF637-F129-4AE9-94BB-61..

CSS Image size, how to fill, but not stretch?

I have an image, and I want to set it a specific width and height (in pixels) But If I set width and height using css (width:150px; height:100px), image will be stretched, and It may be ugly. How to..

How to select a directory and store the location using tkinter in Python

I am creating a GUI with a browse button which I only want to return the path. I've been looking at solutions using code like below. Tkinter.Button(subframe, text = "Browse", command = self.loadtemp..

Disable click outside of bootstrap modal area to close modal

I am making a bootstrap website, with a couple of Bootstrap 'Modals'. I'm trying to customize some of the default features. Problem is this; You can close the modal by clicking on the background. Is ..

Array or List in Java. Which is faster?

I have to keep thousands of strings in memory to be accessed serially in Java. Should I store them in an array or should I use some kind of List ? Since arrays keep all the data in a contiguous chunk..

Get value from SimpleXMLElement Object

I have something like this: $url = ""; $url .= rawurlencode($city[$i]); $xml = simplexml_load_file($url); echo $url."\n"; $cityC..

Swift GET request with parameters

I'm very new to swift, so I will probably have a lot of faults in my code but what I'm trying to achieve is send a GET request to a localhost server with paramters. More so I'm trying to achieve it gi..

Django - after login, redirect user to his custom page -->

By default after login django redirects the user to an accounts/profile page or if you edit the LOGIN_REDIRECT_URL you can send the user to another page you specify in the This is great ..

Remove duplicates from a list of objects based on property in Java 8

I am trying to remove duplicates from a List of objects based on some property. can we do it in a simple way using java 8 List<Employee> employee Can we remove duplicates from it based on id..

Echoing the last command run in Bash?

I am trying to echo the last command run inside a bash script. I found a way to do it with some history,tail,head,sed which works fine when commands represent a specific line in my script from a parse..

How to select the first, second, or third element with a given class name?

How can I select a certain element in a list of elements? I have the following: <div class="myclass">my text1</div> <!-- some other code follows --> <div> <p>stuff&l..

Firebase TIMESTAMP to date and Time

I am using firebase for my chat application. In chat object I am adding time stamp using Firebase.ServerValue.TIMESTAMP method. I need to show the message received time in my chat application using t..

Start script missing error when running npm start

I'm receiving this error when trying to debug my node application using the npm start command. Error: npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "..

Why em instead of px?

I heard you should define sizes and distances in your stylesheet with em instead of in pixels. So the question is why should I use em instead of px when defining styles in css? Is there a good example..

Make file echo displaying "$PATH" string

I am trying to force make file to display next string: "Please execute next commands: setenv PATH /usr/local/greenhills/mips5/linux86:$PATH" The problem is with "$PATH". Command @echo "setenv PATH..

Wait until all jQuery Ajax requests are done?

How do I make a function wait until all jQuery Ajax requests are done inside another function? In short, I need to wait for all Ajax requests to be done before I execute the next. But how?..

How to delete a row from GridView?

I am using GridView control in 2005 c# using . How can I delete a particular row from GridView. I have written the following code. But it's not working... DataRow dr = dtPrf_Mstr.NewRow(); ..

What is difference between mutable and immutable String in java

As per my knowledge, a mutable string can be changed, and an immutable string cannot be changed. Here I want to change the value of String like this, String str="Good"; str=str+" Morning"; and ot..

How can I hide the Adobe Reader toolbar when displaying a PDF in the .NET WebBrowser control?

I am trying to load a PDF document inside a .NET web browser control. In versions of Adobe Reader prior to v10 (aka "X"), the PDF loaded without the toolbar displayed—you would just see the PDF docu..

Error converting data types when importing from Excel to SQL Server 2008

Every time that I try to import an Excel file into SQL Server I'm getting a particular error. When I try to edit the mappings the default value for all numerical fields is float. None of the fields ..

Testing if a site is vulnerable to Sql Injection

I was reading about sql injection and i understand how it works if there is a form where the user can enter his username and login. What i dont get is how websites without a login page can be vulnerab..

SQLAlchemy insert or update example

In Python, using SQLAlchemy, I want to insert or update a row. I tried this: existing = db.session.query(Toner) for row in data: new = Toner(row[0], row[1], row[2]) It does not work. How do I..

How to set web.config file to show full error message

I deployed my MVC-3 application on windows Azure. But now when I am requesting it through staging url it shows me (Sorry, an error occurred while processing your request.). Now I want to see the full ..

Setting the JVM via the command line on Windows

Is it possible to specify the JVM to use when you call "java jar jar_name.jar" . I have two JVM installed on my machine. I can not change JAVA_HOME as it may break code that is all ready running. Kin..

SQL Group By with an Order By

I have a table of tags and want to get the highest count tags from the list. Sample data looks like this id (1) tag ('night') id (2) tag ('awesome') id (3) tag ('night') using SELECT COUNT(*), `T..

How to work with complex numbers in C?

How can I work with complex numbers in C? I see there is a complex.h header file, but it doesn't give me much information about how to use it. How to access real and imaginary parts in an efficient wa..

Seeing the underlying SQL in the Spring JdbcTemplate?

I am learning about the wonders of JdbcTemplate and NamedParameterJdbcTemplate. I like what I see, but is there any easy way to see the underlying SQL that it ends up executing? I'd like to see this f..

pandas python how to count the number of records or rows in a dataframe

Obviously new to Pandas. How can i simply count the number of records in a dataframe. I would have thought some thing as simple as this would do it and i can't seem to even find the answer in searche..

Error creating bean with name 'entityManagerFactory

I am trying to run a dbtest but I get the following error : "Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in c..

What should I set JAVA_HOME environment variable on macOS X 10.6?

Many Java applications that use shell scripts to configure their environment use the JAVA_HOME environment variable to start the correct version of Java, locate JRE JARs, and so on. In macOS X 10.6, ..

jQuery click events firing multiple times

I'm attempting to write a video poker game in Javascript as a way of getting the basics of it down, and I've run into a problem where the jQuery click event handlers are firing multiple times. They'r..

How can I disable the default console handler, while using the java logging API?

Hi I am trying to implement the java logging in my application. I want to use two handlers. A file handler and my own console handler. Both of my handlers work fine. My logging is send to a file and t..

Which regular expression operator means 'Don't' match this character?

*, ?, + characters all mean match this character. Which character means 'don't' match this? Examples would help...

Option to ignore case with .contains method?

Is there an option to ignore case with .contains() method? I have an ArrayList of DVD object. Each DVD object has a few elements, one of them is a title. And I have a method that searches for a speci..

SQL conditional SELECT

I would like to create a stored procedure with parameters that indicate which fields should be selected. E.g. I would like to pass two parameters "selectField1" and "selectField2" each as bools. The..

Difference between datetime and timestamp in sqlserver?

What is the difference between Timestamp and Datetime SQL Server? I thought Both formats are capable of storing date + time. Then, Where the difference is lying between them? But Timestamp is not ca..

How do I parse command line arguments in Bash?

Say, I have a script that gets called with this line: ./myscript -vfd ./foo/bar/someFile -o /fizz/someOtherFile or this one: ./myscript -v -f -d -o /fizz/someOtherFile ./foo/bar/someFile What's the..

Scraping data from website using vba

Im trying to scrape data from website: via vba, like real-time price, i.e. German 5 YR Bobl, US 30Y T-Bond, i have tried excel web query but it on..

How do I POST XML data with curl

I want to post XML data with cURL. I don't care about forms like said in How do I make a post request with curl. I want to post XML content to some webservice using cURL command line interface. Somet..

How to hide a TemplateField column in a GridView

How can I hide a TemplateField column in a GridView? I tried the following: <asp:TemplateField ShowHeader="False" Visible='<%# MyBoolProperty %>' > <ItemTemplate> <asp:LinkB..

How to scroll page in flutter

My code for a page is like this. i need to scroll part below appbar. @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar(... ), body: new Stack( ..

Why does GitHub recommend HTTPS over SSH?

On the GitHub site there is a link... ... and it states... If you have decided not to use the recommended HTTPS method, we can use SSH keys..

What good are SQL Server schemas?

I'm no beginner to using SQL databases, and in particular SQL Server. However, I've been primarily a SQL 2000 guy and I've always been confused by schemas in 2005+. Yes, I know the basic definition ..

Linux / Bash, using ps -o to get process by specific name?

I am trying to use the ps -o command to get just specific info about processes matching a certain name. However, I am having some issues on this, when I try to use this even to just get all processes,..

ComboBox: Adding Text and Value to an Item (no Binding Source)

In C# WinApp, how can I add both Text and Value to the items of my ComboBox? I did a search and usually the answers are using "Binding to a source".. but in my case I do not have a binding source read..

test attribute in JSTL <c:if> tag

I saw some code like the following in a JSP <c:if test="<%=request.isUserInRole(RoleEnum.USER.getCode())%>"> <li>user</li> </c:if> My confusion is over the "=" tha..

What Process is using all of my disk IO

If I use "top" I can see what CPU is busy and what process is using all of my CPU. If I use "iostat -x" I can see what drive is busy. But how do I see what process is using all of the drive's throug..

How do you check for permissions to write to a directory or file?

I got a program that writes some data to a file using a method like the one below. public void ExportToFile(string filename) { using(FileStream fstream = new FileStream(filename,FileMode.Create..

Passing parameters to a JQuery function

I'm creating HTML with a loop that has a column for Action. That column is a Hyperlink that when the user clicks calls a JavaScript function and passes the parameters... example: <a href="#" OnCl..

What is the default font of Sublime Text?

I was looking and could not find an answer on this one. Which is Sublime Text's default font type? ..

Regular Expression for password validation

I currently use this regular expression to check if a string conforms to a few conditions. The conditions are string must be between 8 and 15 characters long. string must contain at least one numbe..

Singleton design pattern vs Singleton beans in Spring container

As we all know we have beans as singleton by default in Spring container and if we have a web application based on Spring framework then in that case do we really need to implement Singleton design pa..

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

How can I make all images of different height and width the same via CSS?

I am trying to create an image wall consisting of product photos. Unfortunately, all of them are of different height and width. How can I use css to make all images look the same size? preferably 10..

Spring,Request method 'POST' not supported

First of all say apology to ask this repeated Question.. Actually in my spring Application i have user.jsp and professional.jsp here is my User.jsp: <form:form action="profile/user" modelAttri..

How do ports work with IPv6?

Conventional IPv4 dotted quad notation separates the address from the port with a colon, as in this example of a webserver on the loopback interface: but with IPv6 notation the address..

Difference between numpy.array shape (R, 1) and (R,)

In numpy, some of the operations return in shape (R, 1) but some return (R,). This will make matrix multiplication more tedious since explicit reshape is required. For example, given a matrix M, if we..

With ' N ' no of nodes, how many different Binary and Binary Search Trees possible?

For Binary trees: There's no need to consider tree node values, I am only interested in different tree topologies with 'N' nodes. For Binary Search Tree: We have to consider tree node values...

How to resolve git status "Unmerged paths:"?

I merged branch dog into animal. When I go to commit, I get the following: Unmerged paths: (use "git reset HEAD <file>..." to unstage) (use "git add <file>..." to mark..

How do I clone a single branch in Git?

I have a local Git repository called 'skeleton' that I use for storing project skeletons. It has a few branches, for different kinds of projects: casey@agave [~/Projects/skeleton] git branch * master..

How to convert a plain object into an ES6 Map?

For some reason I can't find this simple thing in the MDN docs (maybe I'm just missing it). I expected this to work: const map = new Map({foo: 'bar'}); map.get('foo'); // 'bar' ...but the first l..

How to use a calculated column to calculate another column in the same view

I am hoping you can help with this question. I am using Oracle SQL (SQL Developer for this view)... If I have a table with the following columns: ColumnA (Number) ColumnB (Number) ColumnC (Numbe..

ASP.NET 5 MVC: unable to connect to web server 'IIS Express'

What I'm doing: Opening Visual Studio Community 2015 File -> New -> Project Under Visual C#: Web -> ASP.NET Web Application Web Application And press f5 for the popup error "unable to connect to web..

Inline for loop

I'm trying to learn neat pythonic ways of doing things, and was wondering why my for loop cannot be refactored this way: q = [1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5] vm = [-1, -1, -1, -1] for v in vm: ..

WebSocket with SSL

Is it possible to have WebSockets with HTTPS? When switching to HTTPS, my WebSocket returns a security error and works perfectly with regular HTTP. Below, a snippet; socket = new WebSocket("ws://my..

How do I install and use curl on Windows?

I am having trouble getting curl to run on Windows. I have downloaded a curl zip file from here, but it seems to contain source code, not an executable. Do I need to compile curl to run it? If yes, ..

Alternative for PHP_excel

Is there any alternative for PHP_excel which can "Export to XLSX/XLS" file in a customized format? This is a General Reference question for the php tag ..

Count number of occurences for each unique value

Let's say I have: v = rep(c(1,2, 2, 2), 25) Now, I want to count the number of times each unique value appears. unique(v) returns what the unique values are, but not how many they are. > uniq..

PHP cURL GET request and request's body

i'm trying using cURL for a GET request like this: function connect($id_user){ $ch = curl_init(); $headers = array( 'Accept: application/json', 'Content-Type: application/json', ..

Why is Tkinter Entry's get function returning nothing?

I'm trying to use an Entry field to get manual input, and then work with that data. All sources I've found claim I should use the get() function, but I haven't found a simple working mini example yet..

How to unload a package without restarting R

I'd like to unload a package without having to restart R (mostly because restarting R as I try out different, conflicting packages is getting frustrating, but conceivably this could be used in a progr..

How to group pandas DataFrame entries by date in a non-unique column

A Pandas DataFrame contains column named "date" that contains non-unique datetime values. I can group the lines in this frame using: data.groupby(data['date']) However, this splits the data by the..

Javascript Cookie with no expiration date

I would like to set up a cookie that never expires. Would that even be possible? document.cookie = "name=value; expires=date; path=path;domain=domain; secure"; I don't want to make the date really..

How to include a quote in a raw Python string

Consider: >>> r"what"ever" SyntaxError: invalid syntax >>> r"what\"ever" 'what\\"ever' So how do we get the quote, but not the slash? And please don't suggest r'what"ever', becau..

How to get the selected index of a RadioGroup in Android

Is there an easy way to get the selected index of a RadioGroup in Android or do I have to use OnCheckedChangeListener to listen for changes and have something that holds the last index selected? exam..

Boolean checking in the 'if' condition

Which one is better Java coding style? boolean status = true; if (!status) { //do sth } else { //do sth } or: if (status == false) { //do sth } else { //do sth } ..

How to vertically align an image inside a div

How can you align an image inside of a containing div? Example In my example, I need to vertically center the <img> in the <div> with class ="frame": <div class="frame&qu..

jQuery Ajax calls and the Html.AntiForgeryToken()

I have implemented in my app the mitigation to CSRF attacks following the informations that I have read on some blog post around the internet. In particular these post have been the driver of my imple..

filtering NSArray into a new NSArray in Objective-C

I have an NSArray and I'd like to create a new NSArray with objects from the original array that meet certain criteria. The criteria is decided by a function that returns a BOOL. I can create an NSMu..

How to draw a custom UIView that is just a circle - iPhone app

How would I go about drawing a custom UIView that is literally just a ball (a 2D circle)? Would I just override the drawRect method? And can someone show me the code for drawing a blue circle? Also,..

Notepad++: Multiple words search in a file (may be in different lines)?

How can we perform multiple search for multiple words and the line containing them. These words can be in same or different lines. For example: 1.The CAT goes up and down the ROAD. 2. The DOG goes u..

What is a "callback" in C and how are they implemented?

From the reading that I have done, Core Audio relies heavily on callbacks (and C++, but that's another story). I understand the concept (sort of) of setting up a function that is called by another ..

Convert Java Array to Iterable

I have an Array of primitives, for example for int, int[] foo. It might be a small sized one, or not. int foo[] = {1,2,3,4,5,6,7,8,9,0}; What is the best way to create an Iterable<Integer> fr..

Live Video Streaming with PHP

I have a PHP/AJAX/MYSQL chat application. I want to add video chatting to my application. How can I create live video streaming to be used for live video conferences/chatting in a PHP application. Wha..

How can I do time/hours arithmetic in Google Spreadsheet?

How do I do time/hour arithmetic in a Google spreadsheet? I have a value that is time (e.g., 36:00:00) and I want to divide it by another time (e.g., 3:00:00) and get 12. If I divide just one by the..

Given a starting and ending indices, how can I copy part of a string in C?

In C, how can I copy a string with begin and end indices, so that the string will only be partially copied (from begin index to end index)? This would be like 'C string copy' strcpy, but with a begi..

How do I use a regex in a shell script?

I am trying to match a string with a regex in a shell script. This string is a parameter of the script ( $1 ) and it is a date (MM/DD/YYYY) The regex I'm trying to use is : ^\d{2}[\/\-]\d{2}[\/\-]\d..

How to exclude *AutoConfiguration classes in Spring Boot JUnit tests?

I tried: @RunWith(SpringJUnit4ClassRunner.class) @EnableAutoConfiguration(exclude=CrshAutoConfiguration.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration public..

MySQL OPTIMIZE all tables?

MySQL has an OPTIMIZE TABLE command which can be used to reclaim unused space in a MySQL install. Is there a way (built-in command or common stored procedure) to run this optimization for every table..

get jquery `$(this)` id

How can I get the id of the element that triggered the jQuery .change() function? The function itself works properly, but I need a specific action for a selector with id="next". $("select").change(fu..

How do I extract data from JSON with PHP?

This is intended to be a general reference question and answer covering many of the never-ending "How do I access data in my JSON?" questions. It is here to handle the broad basics of decoding JSON..

How do I set 'semi-bold' font via CSS? Font-weight of 600 doesn't make it look like the semi-bold I see in my Photoshop file

I'm doing a Photoshop-to-XHTML conversion, and the website designer used the Myriad Pro Semi-bold font which looks good in the photoshop file, but when I try the semi-bold option in CSS, it looks pret..

TypeError: sequence item 0: expected string, int found

I am attempting to insert data from a dictionary into a database. I want to iterate over the values and format them accordingly, depending on the data type. Here is a snippet of the code I am using: ..

Convert from MySQL datetime to another format with PHP

I have a datetime column in MySQL. How can I convert it to the display as mm/dd/yy H:M (AM/PM) using PHP?..

What's the difference between getRequestURI and getPathInfo methods in HttpServletRequest?

I'm making a simple, very lightweight front-controller. I need to match request paths to different handlers (actions) in order to choose the correct one. On my local machine HttpServletRequest.getPat..

In Mongoose, how do I sort by date? (node.js)

let's say I run this query in Mongoose: Room.find({}, (err,docs) => { }).sort({date:-1}); This doesn't work!..

Detecting Browser Autofill

How do you tell if a browser has auto filled a text-box? Especially with username & password boxes that autofill around page load. My first question is when does this occur in the page load seque..

Return value in a Bash function

I am working with a bash script and I want to execute a function to print a return value: function fun1(){ return 34 } function fun2(){ local res=$(fun1) echo $res } When I execute fun2, it d..

What is output buffering?

What is output buffering and why is one using it in PHP?..

Simple Pivot Table to Count Unique Values

This seems like a simple Pivot Table to learn with. I would like to do a count of unique values for a particular value I'm grouping on. For instance, I have this: ABC 123 ABC 123 ABC 123 DEF ..

Filter multiple values on a string column in dplyr

I have a data.frame with character data in one of the columns. I would like to filter multiple options in the data.frame from the same column. Is there an easy way to do this that I'm missing? Exampl..

Python Timezone conversion

I am looking for a quick way to type in a time and then python convert it into other timezones ( maybe up to 10 different timezones ) Sorry. I am not familar with time in python at all, if someone co..

error code 1292 incorrect date value mysql

I have a table `CREATE TABLE IF NOT EXISTS `PROGETTO`.`ALBERGO` ( `ID` INT(11) NOT NULL COMMENT 'identificativo dell\' albergo' , `nome` VARCHAR(45) NULL COMMENT 'Il nome dell\'albergo' , `viale` ..

How do I get the full path to a Perl script that is executing?

I have Perl script and need to determine the full path and filename of the script during execution. I discovered that depending on how you call the script $0 varies and sometimes contains the fullpath..

Difference between View and ViewGroup in Android

What is the difference between a View and a ViewGroup in Android programming?..

Where to place $PATH variable assertions in zsh?

I love zsh, but I am not sure where to place my $PATH and other variable assertions? I find that they are scattered between the files .zshrc .zprofile .bashrc .bash_profile, and sometimes doubled. I ..

Microsoft Visual C++ Compiler for Python 3.4

I know that there is a "Microsoft Visual C++ Compiler for Python 2.7" but is there, currently or planned, a Microsoft Visual C++ Compiler for Python 3.4 or eve Microsoft Visual C++ Compiler for Python..

Java collections maintaining insertion order

Why do some collection data structures not maintain the order of insertion? What is the special thing achieved compared to maintaining order of insertion? Do we gain something if we don't maintain th..

Getting min and max Dates from a pandas dataframe

How do I get the min and max Dates from a dataframe's major axis? value Date 2014-03-13 10000.000 2014-03-21 2000.000 2014-03-27 2000.000 ..

Sorting data based on second column of a file

I have a file of two columns and n number of rows. column 1 contains names and column2 age. I want to sort the content of this file in ascending order based on the age (in second column). The resul..

New Array from Index Range Swift

How can I do something like this? Take the first n elements from an array: newNumbers = numbers[0..n] Currently getting the following error: error: could not find an overload for 'subscript' that ..

AttributeError: 'numpy.ndarray' object has no attribute 'append'

I am trying to run the code presented on the second page: