Examples On Programing Languages

How to disable an input box using angular.js

I am using this field for an edit view and a create view <input data-ng-model="userInf.username" class="span12 editEmail" type="text" placeholder="[email protected]" pattern="[^@]+@[^@]+\.[a-zA-Z]{2,6}" required /> in the controller I have ...

HTML forms - input type submit problem with action=URL when URL contains index.aspx

I have a HTML form that truncates the action parameter after the "?" mark - which is NOT the desired behavior I am looking for. Here is a representative HTML snippet: <form action="http://spufalcons.com/index.aspx?tab=gymnastics&path=gym">...

Pass Javascript variable to PHP via ajax

I am trying to pass a variable from my javascript code over to the server side PHP code. I know this must be done via an ajax call which i believe i have done correctly, however accessing the variable i pass from my ajax into my php is when i run int...

Tainted canvases may not be exported

I want to save my canvas to a img. I have this function: function save() { document.getElementById("canvasimg").style.border = "2px solid"; var dataURL = canvas.toDataURL(); document.getElementById("canvasimg").src = dataURL; documen...

Use multiple css stylesheets in the same html page

How would I use multiple CSS stylesheets in the same HTML page where both stylesheets have a banner class, for instance. How do you specify which class you are referring to?...

Why are C# 4 optional parameters defined on interface not enforced on implementing class?

I noticed that with the optional parameters in C# 4 if you specify an optional parameter on an interface you don,t have to make that parameter optional on any implementing class: public interface MyInterface { void TestMethod(bool flag = false)...

Can we have functions inside functions in C++?

I mean something like: int main() { void a() { // code } a(); return 0; } ...

How to run a Command Prompt command with Visual Basic code?

I'm trying to code something in Visual Basic, more specifically Visual Studio 2010. I want, with a button click, my program to execute a command. Is that possible? ...

Set ImageView width and height programmatically?

How can I set an ImageView's width and height programmatically?...

MySQL IF NOT NULL, then display 1, else display 0

I'm working with a little display complication here. I'm sure there's an IF/ELSE capability I'm just overlooking. I have 2 tables I'm querying (customers, addresses). The first has the main record, but the second may or may not have a record to LE...

Ping with timestamp on Windows CLI

On the Windows command prompt cmd, I use ping -t to 10.21.11.81 Reply from 10.21.11.81: bytes=32 time=3889ms TTL=238 Reply from 10.21.11.81: bytes=32 time=3738ms TTL=238 Reply from 10.21.11.81: bytes=32 time=3379ms TTL=238 Are there any possibilit...

Git error: src refspec master does not match any error: failed to push some refs

I am trying to add a file to my repository on BitBucket and I am having trouble. I am using GIT and this is what I type in $ cd lis4368/assignments $ git remote $ git remote -v $ git remote rm origin and then I type this in (this is what BitBuck...

How do I assert my exception message with JUnit Test annotation?

I have written a few JUnit tests with @Test annotation. If my test method throws a checked exception and if I want to assert the message along with the exception, is there a way to do so with JUnit @Test annotation? AFAIK, JUnit 4.7 doesn't provide t...

Check if string ends with one of the strings from a list

What is the pythonic way of writing the following code? extensions = ['.mp3','.avi'] file_name = 'test.mp3' for extension in extensions: if file_name.endswith(extension): #do stuff I have a vague memory that the explicit declaration o...

Path of assets in CSS files in Symfony 2

Problem I have a CSS file with some paths in it (for images, fonts, etc.. url(..)). My path structure is like this: ... +-src/ | +-MyCompany/ | +-MyBundle/ | +-Resources/ | +-assets/ | +-css/ | +-stylesheets... +-web/ | ...

How can I create directory tree in C++/Linux?

I want an easy way to create multiple directories in C++/Linux. For example I want to save a file lola.file in the directory: /tmp/a/b/c but if the directories are not there I want them to be created automagically. A working example would be pe...

Why is "1000000000000000 in range(1000000000000001)" so fast in Python 3?

It is my understanding that the range() function, which is actually an object type in Python 3, generates its contents on the fly, similar to a generator. This being the case, I would have expected the following line to take an inordinate amount of...

Changing the width of Bootstrap popover

I am designing a page using Bootstrap 3. I am trying to use a popover with placement: right on an input element. The new Bootstrap ensures that if you use form-control you basically have a full-width input element. The HTML code looks something like...

Bytes of a string in Java

In Java, if I have a String x, how can I calculate the number of bytes in that string?...

How to control size of list-style-type disc in CSS?

My HTML first: <ul class="moreLinks" > <div>More from Travelandleisure.com</div> <li><a rel="nofollow" href="">xyz1</a></li> <li><a rel="nofollow" href="">xyz1</a></li&g...

Change priorityQueue to max priorityqueue

I have priority queue in Java of Integers: PriorityQueue<Integer> pq= new PriorityQueue<Integer>(); When I call pq.poll() I get the minimum element. Question: how to change the code to get the maximum element?...

Exit a while loop in VBS/VBA

Is there a method of exiting/breaking a while in VBS/VBA? Following code won't work as intended: num = 0 while (num < 10) if (status = "Fail") then exit while end if num = num+1 wend ...

How to move mouse cursor using C#?

I want to simulate mouse movement every x seconds. For that, I'll use a timer (x seconds) and when the timer ticks I'll make the mouse movement. But, how can I make the mouse cursor move using C#?...

How to detect chrome and safari browser (webkit)

I am trying to detect the chrome and safari browser using jquery or javascript. I thought we are not supposed to use jQuery.browser. Are there any suggestions here? Thanks a lot!...

Convert java.util.date default format to Timestamp in Java

The default format of java.util.date is something like this "Mon May 27 11:46:15 IST 2013". How can I convert this into timestamp and calculate in seconds the difference between the same and current time? java.util.Date date= new java.util.Date(); T...

Adding IN clause List to a JPA Query

I have built a NamedQuery that looks like this: @NamedQuery(name = "EventLog.viewDatesInclude", query = "SELECT el FROM EventLog el WHERE el.timeMark >= :dateFrom AND " + "el.timeMark <= :dateTo AND " + "el.name IN (:in...

How do I write the 'cd' command in a makefile?

For example, I have something like this in my makefile: all: cd some_directory But when I typed make I saw only 'cd some_directory', like in the echo command....

How to resolve "Waiting for Debugger" message?

I have HTC Comet connected to Eclipse with SDK 2.2. I do a debug build - the application does not run; though it does get installed on the device. On the device I get this message box on the Comet screen Waiting for Debugger Application HunyDew (pro...

PHP to write Tab Characters inside a file?

How do i simply write out a file including real tabs inside? tab means real tab which is not the spaces. How to write the tab or what is the character for real tab? For example here: $chunk = "a,b,c"; file_put_contents("chunk.csv",$chunk); What c...

Difference between numeric, float and decimal in SQL Server

What are the differences between numeric, float and decimal datatypes and which should be used in which situations? For any kind of financial transaction (e.g. for salary field), which one is preferred and why?...

Identify if a string is a number

If I have these strings: "abc" = false "123" = true "ab2" = false Is there a command, like IsNumeric() or something else, that can identify if a string is a valid number?...

Finding longest string in array

Is there a short way to find the longest string in a string array? Something like arr.Max(x => x.Length);?...

Check if an array is empty or exists

When the page is loading for the first time, I need to check if there is an image in image_array and load the last image. Otherwise, I disable the preview buttons, alert the user to push new image button and create an empty array to put the images; ...

Strip all non-numeric characters from string in JavaScript

Consider a non-DOM scenario where you'd want to remove all non-numeric characters from a string using JavaScript/ECMAScript. Any characters that are in range 0 - 9 should be kept. var myString = 'abc123.8<blah>'; //desired output is 1238 Ho...

Converting string to Date and DateTime

If I have a PHP string in the format of mm-dd-YYYY (for example, 10-16-2003), how do I properly convert that to a Date and then a DateTime in the format of YYYY-mm-dd? The only reason I ask for both Date and DateTime is because I need one in one spot...

Please initialize the log4j system properly. While running web service

Maybe it looks silly to ask this but I am confused. I referred to Configuring Log4j property but it doesn't seem to help. I have written a simple web service HelloWorld. And while running it I am getting the error something like this : log4j:WA...

Open new popup window without address bars in firefox & IE

hope someone can help. just cannot get a new window to open in Firefox without address bars. IE works fine with below code window.open('/pageaddress.html', 'winname', directories=0,titlebar=0,toolbar=0,location=0,status=0, menubar=0,s...

How to display Woocommerce Category image?

I use this code in PHP: $idcat = 147; $thumbnail_id = get_woocommerce_term_meta( $idcat, 'thumbnail_id', true ); $image = wp_get_attachment_url( $thumbnail_id ); echo '<img src="'.$image.'" alt="" width="762" height="365" />'; Where 147 is t...

Pandas group-by and sum

I am using this data frame: Fruit Date Name Number Apples 10/6/2016 Bob 7 Apples 10/6/2016 Bob 8 Apples 10/6/2016 Mike 9 Apples 10/7/2016 Steve 10 Apples 10/7/2016 Bob 1 Oranges 10/7/2016 Bob 2 Oranges 10/6/2016 Tom 15 O...

Hibernate: How to fix "identifier of an instance altered from X to Y"?

org.hibernate.HibernateException: identifier of an instance of org.cometd.hibernate.User altered from 12 to 3 in fact, my user table is really must dynamically change its value, my Java app is multithreaded. Any ideas how to fix it? ...

How to get the top position of an element?

Is it possible to get the top position of an element using javascript/jquery ? The element is a table, if that matters....

How do check if a parameter is empty or null in Sql Server stored procedure in IF statement?

I read this: How do I check if a Sql server string is null or empty but it not helped me in this situation. The piece of code from my stored procedure: IF (@item1 IS NOT NULL) OR (LEN(@item1) > 0) SELECT @sql = 'SELECT * FROM TEST1' ...

Change marker size in Google maps V3

I am using this explanation of how to color a google maps marker by setting the icon using a MarkerImage, and the coloring works well. But I can't make the scaledSize argument change the size of the marker. var pinColor = 'FFFF00'; var pinI...

Functional, Declarative, and Imperative Programming

What do the terms functional, declarative, and imperative programming mean?...

Set new id with jQuery

"this" is a text field, "new_id" is an integer. When I apply the following snippet: $(this).attr('id', this.id + '_' + new_id); $(this).attr('name', this.name + '_' + new_id); $(this).attr('value', 'test'); the id changes, the name changes too,...

Replacing Pandas or Numpy Nan with a None to use with MysqlDB

I am trying to write a Pandas dataframe (or can use a numpy array) to a mysql database using MysqlDB . MysqlDB doesn't seem understand 'nan' and my database throws out an error saying nan is not in the field list. I need to find a way to convert the ...

jquery fill dropdown with json data

I have the following jQuery code. I am able to get the following data from server [{"value":"1","label":"xyz"}, {"value":"2","label":"abc"}]. How do I iterate over this and fill a select box with id=combobox $.ajax({ type: 'POST', url: "<...

Echo equivalent in PowerShell for script testing

I would like to output variables and values out in a PowerShell script by setting up flags and seeing the data matriculate throughout the script. How would I do this? For example, what would be the PowerShell equivalent to the following PHP code...

Update label from another thread

I use a thread writing in another class for update a label. The label is contents in Winform Main class. Scanner scanner = new Scanner(ref lblCont); scanner.ListaFile = this.listFiles; Thread trd = new Thread(new ThreadStart(scanner.automaticScan...

Android - How To Override the "Back" button so it doesn't Finish() my Activity?

I currently have an Activity that when it gets displayed a Notification will also get displayed in the Notification bar. This is so that when the User presses home and the Activity gets pushed to the background they can get back to the Activity via ...

How to clear form after submit in Angular 2?

I have some simple angular 2 component with template. How to clear form and all fields after submit?. I can't reload page. After set data with date.setValue('') field is stil touched. import {Component} from 'angular2/core'; import {FORM_DIRECTIVES...

How to navigate through textfields (Next / Done Buttons)

How can I navigate through all my text fields with the "Next" Button on the iPhone Keyboard? The last text field should close the Keyboard. I've setup the IB the Buttons (Next / Done) but now I'm stuck. I implemented the textFieldShouldReturn acti...

How to handle query parameters in angular 2

In my routable component I have @RouteConfig { {path: '/login', name: 'Login', component: LoginComponent} } But how do I get the query params if I go to app_url/login?token=1234?...

Excel Validation Drop Down list using VBA

I have an array of values. I want to show those values in Excel Cell as drop down list using VBA. Here is my code. It shows "Type Mismatch Error!" Dim xlValidateList(6) As Integer xlValidateList(1) = 1 xlValidateList(2) = 2 xlValidateList(3) = 3 xl...

jQuery pass more parameters into callback

Is there a way to pass more data into a callback function in jQuery? I have two functions and I want the callback to the $.post, for example, to pass in both the resulting data of the AJAX call, as well as a few custom arguments function clicked() ...

What is a elegant way in Ruby to tell if a variable is a Hash or an Array?

To check what @some_var is, I am doing a if @some_var.class.to_s == 'Hash' I am sure there is a more elegant way to check if @some_var is a Hash or an Array....

What is the difference between Python's list methods append and extend?

What's the difference between the list methods append() and extend()?...

How to set a session variable when clicking a <a> link

I have the following problem... I want to set a session variable when clicking on a normal link like: <a href="home" name="home">home</a> My research seems to point out that it is not possible for PHP to catch up with the click event i...

How to get UTC time in Python?

I've search a bunch on StackExchange for a solution but nothing does quite what I need. In JavaScript, I'm using the following to calculate UTC time since Jan 1st 1970: function UtcNow() { var now = new Date(); var utc = Date.UTC(now.getUTC...

How to retrieve Request Payload

I'm using PHP, ExtJS and ajax store. It sends data (on create, update, destroy) not in POST or GET. In the Chrome Console I see my outgoing params as JSON in the "Request Payload" field. $_POST and $_GET are empty. How to retrieve it in PHP?...

python socket.error: [Errno 98] Address already in use

when i setup application.py, it shows that socket.error: [Errno 98] Address already in use. Traceback (most recent call last): File "application.py", line 121, in <module> main() File "application.py", line 117, in main http_server.listen(opti...

Getting the class of the element that fired an event using JQuery

is there anyway to get the class when click event is fired. My code as below, it only work for id but not class. _x000D_ _x000D_ $(document).ready(function() {_x000D_ $("a").click(function(event) {_x000D_ alert(event.target.id + " and " + even...

Truncate a SQLite table if it exists?

To truncate a table in SQLite I need to use this syntax: DELETE FROM someTable But how do I truncate the table only if it exists? Unfortunately this throws an error: DELETE FROM someTable IF EXISTS This doesn't work either: DELETE IF EXISTS F...

How to declare std::unique_ptr and what is the use of it?

I try to understand how std::unique_ptr works and for that I found this document. The author starts from the following example: #include <utility> //declarations of unique_ptr using std::unique_ptr; // default construction unique_ptr<int>...

How to compare two colors for similarity/difference

I want to design a program that can help me assess between 5 pre-defined colors which one is more similar to a variable color, and with what percentage. The thing is that I don't know how to do that manually step by step. So it is even more difficul...

How to show hidden divs on mouseover?

How to show a set of hidden div's onmouseover? For example : <div id="div1">Div 1 Content</div> <div id="div2">Div 2 Content</div> <div id="div3">Div 3 Content</div> All div's need to be shown onmouseover event...

String "true" and "false" to boolean

I have a Rails application and I'm using jQuery to query my search view in the background. There are fields q (search term), start_date, end_date and internal. The internal field is a checkbox and I'm using the is(:checked) method to build the url th...

Algorithm to compare two images

Given two different image files (in whatever format I choose), I need to write a program to predict the chance if one being the illegal copy of another. The author of the copy may do stuff like rotating, making negative, or adding trivial details (as...

How to get full path of selected file on change of <input type=‘file’> using javascript, jquery-ajax?

How to get full path of file while selecting file using <input type=‘file’> <input type="file" id="fileUpload"> <script type="text/javascript"> function getFilePath(){ $('input[type=file]').change(function () { va...

Efficient way to Handle ResultSet in Java

I'm using a ResultSet in Java, and am not sure how to properly close it. I'm considering using the ResultSet to construct a HashMap and then closing the ResultSet after that. Is this HashMap technique efficient, or are there more efficient ways of ha...

LINQ query on a DataTable

I'm trying to perform a LINQ query on a DataTable object and bizarrely I am finding that performing such queries on DataTables is not straightforward. For example: var results = from myRow in myDataTable where results.Field("RowNo") == 1 select resu...

Show constraints on tables command

I have tables that I've tried setting PK FK relationships on but I want to verify this. How can I show the PK/FK restraints? I saw this manual page, but it does not show examples and my google search was fruitless also. My database is credentialing1 ...

How to sum digits of an integer in java?

I am having a hard time figuring out the solution to this problem. I am trying to develop a program in Java that takes a number, such as 321, and finds the sum of digits, in this case 3 + 2 + 1 = 6. I need all the digits of any three digit number to ...

Should 'using' directives be inside or outside the namespace?

I have been running StyleCop over some C# code, and it keeps reporting that my using directives should be inside the namespace. Is there a technical reason for putting the using directives inside instead of outside the namespace?...

NPM global install "cannot find module"

I wrote a module which I published to npm a moment ago (https://npmjs.org/package/wisp) So it installs fine from the command line: $ npm i -g wisp However, when I run it from the command line, I keep getting an error that optimist isn't installed:...

Dynamic loading of images in WPF

I have a strange issue with WPF, I was loading images from the disk at runtime and adding them to a StackView container. However, the images were not displayed. After some debugging I found the trick, but it really doesn't make any sense. I've mad...

How do I show multiple recaptchas on a single page?

I have 2 forms on a single page. One of the forms has a recaptcha displaying all the time. The other should display a recaptcha only after a certain event such as maxing out login attempts. So there are times when I would need 2 recaptchas to appe...

Type Checking: typeof, GetType, or is?

I've seen many people use the following code: Type t = typeof(obj1); if (t == typeof(int)) // Some code here But I know you could also do this: if (obj1.GetType() == typeof(int)) // Some code here Or this: if (obj1 is int) // Some ...

Pass multiple arguments into std::thread

I'm asking the <thread> library in C++11 standard. Say you have a function like: void func1(int a, int b, ObjA c, ObjB d){ //blahblah implementation } int main(int argc, char* argv[]){ std::thread(func1, /*what do do here??*/); } ...

Center/Set Zoom of Map to cover all visible Markers?

I am setting multiple markers on my map and I can set statically the zoom levels and the center but what I want is, to cover all the markers and zoom as much as possible having all markets visible Available methods are following setZoom(zoom:numb...

How to sort an array in descending order in Ruby

I have an array of hashes: [ { :foo => 'foo', :bar => 2 }, { :foo => 'foo', :bar => 3 }, { :foo => 'foo', :bar => 5 }, ] I am trying to sort this array in descending order according to the value of :bar in each hash. I am ...

How to load all the images from one of my folder into my web page, using Jquery/Javascript

I have a folder named "images" in the same directory as my .js file. I want to load all the images from "images" folder into my html page using Jquery/Javascript. Since, names of images are not some successive integers, how am I supposed to load the...

Python, how to check if a result set is empty?

I have a sql statement that returns no hits. For example, 'select * from TAB where 1 = 2'. I want to check how many rows are returned, cursor.execute(query_sql) rs = cursor.fetchall() Here I get already exception: "(0, 'No result set')" How c...

postgres default timezone

I installed PostgreSQL 9 and the time it is showing is 1 hour behind the server time. Running Select NOW() shows: 2011-07-12 11:51:50.453842+00 The server date shows: Tue Jul 12 12:51:40 BST 2011 It is 1 hour behind but the timezone shown in phppg...

Sql Server trigger insert values from new row into another table

I have a site using the asp.net membership schema. I'd like to set up a trigger on the aspnet_users table that inserted the user_id and the user_name of the new row into another table. How do I go about getting the values from the last insert? ...

Nested ifelse statement

I'm still learning how to translate a SAS code into R and I get warnings. I need to understand where I'm making mistakes. What I want to do is create a variable which summarizes and differentiates 3 status of a population: mainland, overseas, foreign...

Add column with constant value to pandas dataframe

Given a DataFrame: np.random.seed(0) df = pd.DataFrame(np.random.randn(3, 3), columns=list('ABC'), index=[1, 2, 3]) df A B C 1 1.764052 0.400157 0.978738 2 2.240893 1.867558 -0.977278 3 0.950088 -0.151357 -0.103219 ...

Check whether a string matches a regex in JS

I want to use JavaScript (can be with jQuery) to do some client-side validation to check whether a string matches the regex: ^([a-z0-9]{5,})$ Ideally it would be an expression that returned true or false. I'm a JavaScript newbie, does match() do...

sort files by date in PHP

I currently have an index.php file which allows me to output the list of files inside the same directory, the output shows the names then I used filemtime() function to show the date when the file was modified. my problem now is, how will I sort the ...

Adding Lombok plugin to IntelliJ project

I'm trying to add Lombok to my Spring Boot project in IntelliJ IDEA. So far, I've added the plugin under Settings - Plugins (version 0.13.16) added compile('org.projectlombok:lombok') to my Gradle dependencies enabled annotation processing It sti...

Python, print all floats to 2 decimal places in output

I need to output 4 different floats to two decimal places. This is what I have: print '%.2f' % var1,'kg =','%.2f' % var2,'lb =','%.2f' % var3,'gal =','%.2f' % var4,'l' Which is very unclean, and looks bad. Is there a way to make any float in that...

How to install ADB driver for any android device?

I am an android developer. I have a new HTC Inspire 4g phone but I don't know how to install usb driver for it. This is my android_winusb.inf file: ; ; Android WinUsb driver installation. ; [Version] Signature = "$Windows NT$" Class ...

Disabling Warnings generated via _CRT_SECURE_NO_DEPRECATE

What is the best way to disable the warnings generated via _CRT_SECURE_NO_DEPRECATE that allows them to be reinstated with ease and will work across Visual Studio versions?...

Multiple left-hand assignment with JavaScript

var var1 = 1, var2 = 1, var3 = 1; This is equivalent to this: var var1 = var2 = var3 = 1; I'm fairly certain this is the order the variables are defined: var3, var2, var1, which would be equivalent to this: var var3 = 1, var2 = var3, va...

How to access a RowDataPacket object

I'm currently developing a desktop application with Node-webkit. During that process I need to get some data from a local MySQL-database. The querying works fine, but I can't figure out how to access the results. I store all of them in an array that...

Sql Server string to date conversion

I want to convert a string like this: '10/15/2008 10:06:32 PM' into the equivalent DATETIME value in Sql Server. In Oracle, I would say this: TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS AM') This question implies that I must parse th...

How to convert from Hex to ASCII in JavaScript?

How to convert from Hex string to ASCII string in JavaScript? Ex: 32343630 it will be 2460 ...

How to find the users list in oracle 11g db?

How to find out the users list, which is all created in the oracle 11g database. Is there any command to find out the users list which we can execute from the Command line interface! ...

How do I call a specific Java method on a click/submit event of a specific button in JSP?

My Java file is: public class MyClass { public void method1() { // some code } public void method2() { //some code } public void method3() { //some code } } In my JSP page I have three HTML bu...

Access to build environment variables from a groovy script in a Jenkins build step (Windows)

I'm using Scriptler plugin, so I can run a groovy script as a build step. My Jenkins slaves are running on windows in service mode. With scriptler, I don't need to use windows batch scripts. But I have trouble to get the environment variables in a b...

How to scroll HTML page to given anchor?

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

How do you remove duplicates from a list whilst preserving order?

Is there a built-in that removes duplicates from list in Python, whilst preserving order? I know that I can use a set to remove duplicates, but that destroys the original order. I also know that I can roll my own like this: def uniq(input): output...

PHP & MySQL: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

I'm trying to Integrate HTML Purifier http://htmlpurifier.org/ to filter my user submitted data but I get the following error below. And I was wondering how can I fix this problem? I get the following error. on line 22: mysqli_num_rows() expects pa...

Entry point for Java applications: main(), init(), or run()?

So far I've been using public void run() {} methods to execute my code in Java. When/why might one want to use main() or init() instead of run()?...

%i or %d to print integer in C using printf()?

I am just learning C and I have a little knowledge of Objective-C due to dabbling in iOS development, however, in Objective-C I was using NSLog(@"%i", x); to print the variable x to the console however I have been reading a few C tutorials and they a...

OS X: equivalent of Linux's wget

How can I do an HTTP GET from a Un*x shell script on a stock OS X system? (installing third-party software is not an option, for this has to run on a lot of different systems which I don't have control on). For example if I start the Mercurial serve...

py2exe - generate single executable file

I thought I heard that py2exe was able to do this, but I never figured it out. Has anyone successfully done this? Can I see your setup.py file, and what command line options you used? Basically I'm thinking of it giving me a single executable file...

Angular 2.0 and Modal Dialog

I am trying to find some examples on how to do a Confirmation modal dialog in Angular 2.0. I have been using Bootstrap dialog for Angular 1.0 and unable to find any examples in the web for Angular 2.0. I also checked angular 2.0 docs with no luck. ...

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

The following code: Class.forName("com.mysql.jdbc.Driver"); Connection m_connection = DriverManager.getConnection("jdbc:mysql://localhost","root","root"); Throws this exception on getConnection(): java.sql.SQLException: Access denied for user 'ro...

Joining two lists together

If I have two lists of type string (or any other type), what is a quick way of joining the two lists? The order should stay the same. Duplicates should be removed (though every item in both links are unique). I didn't find much on this when googling...

Unescape HTML entities in Javascript?

I have some Javascript code that communicates with an XML-RPC backend. The XML-RPC returns strings of the form: <img src='myimage.jpg'> However, when I use the Javascript to insert the strings into HTML, they render literally. I don't see an...

How to store a dataframe using Pandas

Right now I'm importing a fairly large CSV as a dataframe every time I run the script. Is there a good solution for keeping that dataframe constantly available in between runs so I don't have to spend all that time waiting for the script to run?...

Letsencrypt add domain to existing certificate

I am just simply trying to add the domain test.example.com to the certificate that already exists for example.com. How do I add a domain to my existing certificate and replace the old certificate? I have tried these few commands ./letsencrypt-auto ...

How to import Swagger APIs into Postman?

Recently I wrote restful APIs with SpringMvc and swagger-ui(v2). I noticed the Import function in Postman: So my question is how to create the file which Postman needed? I am not familiar with Swagger....

Using Python's list index() method on a list of tuples or objects?

Python's list type has an index() method that takes one parameter and returns the index of the first item in the list matching the parameter. For instance: >>> some_list = ["apple", "pear", "banana", "grape"] >>> some_list.index("...

Is it possible to specify condition in Count()?

Is it possible to specify a condition in Count()? I would like to count only the rows that have, for example, "Manager" in the Position column. I want to do it in the count statement, not using WHERE; I'm asking about it because I need to count both...

Java path..Error of jvm.cfg

Can anyone please tell me why I get the following error when I try to run my Java programs? The programs get compiled successfully but are not able to be run. I have already set the path of Java. C:\JavaServ>javac hello1.java C:\JavaServ>java...

jQuery bind to Paste Event, how to get the content of the paste

I have a jquery token tagit plugin and I want to bind to the paste event to add items correctly. I'm able to bind to the paste event like so: .bind("paste", paste_input) ... function paste_input(e) { console.log(e) return false; } ...

How to use Simple Ajax Beginform in Asp.net MVC 4?

I am new in Asp.net MVC and i researched about Ajax.BeginForm but when i apply codes it did not work. Can you share very simple example with Ajax.Beginform with View, Controller, Model? Thanks....

Check play state of AVPlayer

Is there a way to know whether an AVPlayer playback has stalled or reached the end?...

How is Pythons glob.glob ordered?

I have written the following Python code: #!/usr/bin/python # -*- coding: utf-8 -*- import os, glob path = '/home/my/path' for infile in glob.glob( os.path.join(path, '*.png') ): print infile Now I get this: /home/my/path/output0352.png /home/...

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 2014-03-17 200.000 2014-03-17 5.000 2014...

Regex Match all characters between two strings

Example: "This is just\na simple sentence". I want to match every character between "This is" and "sentence". Line breaks should be ignored. I can't figure out the correct syntax....

How do I convert from a string to an integer in Visual Basic?

How do I convert from a string to an integer? Here's what I tried: Price = CInt(Int(txtPrice.Text)) I took out the Int and I still got an exception....

How to extract week number in sql

I have a transdate column of varchar2 type which has the following entrees 01/02/2012 01/03/2012 etc. I converted it in to date format in another column using to_date function. This is the format i got. 01-JAN-2012 03-APR-2012 When I'm trying...

TypeError: document.getElementbyId is not a function

In the following snippet everything works as expected, but when I click "Show Source" Firefox produces this error: -- [11:07:30.630] TypeError: document.getElementbyId is not a function @ http://localhost:8888/html5/native-rich-text.html:10 And S...

How to change the window title of a MATLAB plotting figure?

I have created a MATLAB plotting with the plot() function. How do I change the window title of the generated figure of the plotting? My MATLAB m-file which I'm working on: hold on x = [0; 0.2; 0.4; 0.6; 0.8; 1; 1.2; 1.4; 1.6; 1.8; 2; 2.2; 2.4; 2.6...

npm install gives error "can't find a package.json file"

npm install / npm install -g command is not working in Windows 7 Node.js is installed properly, node.js version is v0.10.28 Couldn't read dependencies ENOENT, open '"filepath"\package.json' This is most likely not a problem with npm itself....

Read pdf files with php

I have a large PDF file that is a floor map for a building. It has layers for all the office furniture including text boxes of seat location. My goal is to read this file with PHP, search the document for text layers, get their contents and coordina...

Check if checkbox is checked with jQuery

How can I check if a checkbox in a checkbox array is checked using the id of the checkbox array? I am using the following code, but it always returns the count of checked checkboxes regardless of id. function isCheckedById(id) { alert(id); ...

SVN "Already Locked Error"

When trying to commit a change to a repository ( where I am the only user ) I get an error Path '/trunk/TemplatesLibrary/constraints/templates/TP145210GB01_PersonWithOrganizationUniversal.cs' is already locked by user 'admin' in filesystem '/guest/g...

Setting font on NSAttributedString on UITextView disregards line spacing

I'm trying to set an attributed string to a UITextView in iOS 6. The problem is, if I attempt to set the font property on the attributed string, the line spacing is ignored. However, if I don't set the font, and the default font is used, then line sp...

validate natural input number with ngpattern

I use ng-pattern="/0-9/" to set price_field do not accept decimal number. But when I input natural number (from 0 to 9999999),ng-show gets activated with Not valid number!. Where did I go wrong?. Please help. <form name="myform" data-ng-submit=...

How can I remove the "No file chosen" tooltip from a file input in Chrome?

I would like to remove the "No file chosen" tooltip from a file input in Google Chrome (I see that no tooltip is displayed in Firefox). Please notice that I'm talking not about the text inside the input field, but about the tooltip that appears when...

Difference between JSON.stringify and JSON.parse

I have been confused over when to use these two parsing methods. After I echo my json_encoded data and retrieve it back via ajax, I often run into confusion about when I should use JSON.stringify and JSON.parse. I get [object,object] in my console....

Simple division in Java - is this a bug or a feature?

I'm trying this simple calculation in a Java application: System.out.println("b=" + (1 - 7 / 10)); Obviously I expect the output to be b=0.3, but I actually get b=1 instead. What?! Why does this happen? If I write: System.out.println("b=" + (1 ...

How to make JavaScript execute after page load?

I'm executing an external script, using a <script> inside <head>. Now since the script executes before the page has loaded, I can't access the <body>, among other things. I'd like to execute some JavaScript after the document has b...

Show history of a file?

Possible Duplicate: View the change history of a file using Git versioning Sometimes I want to step through the history of a particular file. In the past I used P4V and this was very quick and intuitive. Right click on a file and select...

java.lang.OutOfMemoryError: Java heap space in Maven

When I run maven test, java.lang.OutOfMemoryError happens. I googled it for solutions and have tried to export MAVEN_OPTS=-Xmx1024m, but it did not work. Anyone know other solutions for this problem? I am using maven 3.0 Paste the error message here ...

How to install Python MySQLdb module using pip?

How can I install the MySQLdb module for Python using pip?...

How can I use pointers in Java?

I know Java doesn't have pointers, but I heard that Java programs can be created with pointers and that this can be done by the few who are experts in java. Is it true?...

Selenium Webdriver: Entering text into text field

When I enter text into the text field it gets removed. Here is the code: String barcode="0000000047166"; WebElement element_enter = _driver.findElement(By.xpath("//*[@id='div-barcode']")); element_enter.findElement(By.xpath("//html/body/div[1]/di...

php variable in html no other way than: <?php echo $var; ?>

I work a lot in mixed HTML and PHP and most time I just want solid HTML with a few PHP variables in it so my code look like this: <tr><td> <input type="hidden" name="type" value="<?php echo $var; ?>" ></td></tr> ...

A cycle was detected in the build path of project xxx - Build Path Problem

I'm in the process of converting my projects to OSGI bundles using maven and eclipse. Maven builds the stuff just fine, only I get the above error now within Eclipse. How can I find out which project causes this? Is there a special view or something?...

How to declare a global variable in C++

I know one should not use global variables but I have a need for them. I have read that any variable declared outside a function is a global variable. I have done so, but in another *.cpp File that variable could not be found. So it was not realy glo...

Pass multiple complex objects to a post/put Web API method

Can some please help me to know how to pass multiple objects from a C# console app to Web API controller as shown below? using (var httpClient = new System.Net.Http.HttpClient()) { httpClient.BaseAddress = new Uri(ConfigurationManager.AppSetting...

How can I know if a process is running?

When I get a reference to a System.Diagnostics.Process, how can I know if a process is currently running?...

Draggable div without jQuery UI

I'm trying to make a div draggable without using jQuery UI. However, I'm stuck with the code below. I understand that I should use the mouse position relative to the container div (in which the div will be dragged) and that I should set the div's off...

How to align a div to the top of its parent but keeping its inline-block behaviour?

See: http://jsfiddle.net/b2BpB/1/ Q: How can you make box1 and box3 align to the top of the parent div boxContainer? #boxContainerContainer { background: #fdd; text-align: center; } #boxContainer { display: inline-block; border: thick dott...

Create a button programmatically and set a background image

When I try creating a button and setting a background image in Swift: let button = UIButton.buttonWithType(UIButtonType.System) as UIButton button.frame = CGRectMake(100, 100, 100, 100) button.setImage(IMAGE, forState: UIControlState.Norma...

unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING error

i've been staringly blanky at this error and can't seem to know what the problem is.When i run the query i get this error: unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING at this line: $sqlupdate1 = "UPD...

Fastest way to convert string to integer in PHP

Using PHP, what's the fastest way to convert a string like this: "123" to an integer? Why is that particular method the fastest? What happens if it gets unexpected input, such as "hello" or an array?...

I want to load another HTML page after a specific amount of time

I have one html page "form1.html" which has an animated image. I want to load another page "form2.html" after 5 seconds. How do I do this?...

Inserting multiple rows in mysql

Is the database query faster if I insert multiple rows at once: like INSERT.... UNION INSERT.... UNION (I need to insert like 2-3000 rows)...

ssl.SSLError: tlsv1 alert protocol version

I'm using the REST API for a Cisco CMX device, and trying to write Python code which makes a GET request to the API for information. The code is as follows and is the same as that in the file except with the necessary information changed. from http....

Find package name for Android apps to use Intent to launch Market app from web

I'm creating a mobile website that will include a page from which people can download relevant apps that we recommend. I've found instructions for creating the links to launch the Market but this assumes that you are the developer of the app in quest...

Get the element triggering an onclick event in jquery?

I have a form where i've replaced the submit button with an input (with type=button) with an onclick which calls an existing function: <form accept-charset="UTF-8" action="/admin/message_campaigns" class="new_message_campaign" id="new_message_cam...

Android studio: emulator is running but not showing up in Run App "choose a running device"

I have launched my emulator via the AVD manager and once it's running I have clicked on run app. I have waited a couple of minutes for my running device to show up in choose a running device but the window always stays blank. ...

How to convert a string from uppercase to lowercase in Bash?

I have been searching to find a way to convert a string value from upper case to lower case. All the search results show approaches of using tr command. The problem with the tr command is that I am able to get the result only when I use the command ...

How to clear/delete the contents of a Tkinter Text widget?

I am writing a Python program in TKinter on Ubuntu to import and print the name of files from particular folder in Text widget. It is just adding filenames to the previous filnames in the Text widget, but I want to clear it first, then add a fresh li...

XmlSerializer: remove unnecessary xsi and xsd namespaces

Is there a way to configure the XmlSerializer so that it doesn't write default namespaces in the root element? What I get is this: <?xml ...> <rootelement xmlns:xsi="..." xmlns:xsd="..."> </rootelement> and I want to remove both...

Error: Cannot find module 'webpack'

I'm just getting started with webpack and am having difficulty getting the multiple-entry-points sample to build. The webpack.config.js file in the example includes the line var CommonsChunkPlugin = require("../../lib/optimize/CommonsChunkPlugin")...

Google Maps API Multiple Markers with Infowindows

I am trying to add multiple markers each with its own infowindow that comes up when clicked on. I am having trouble with getting the infowindows coming up, when I try it either shows up only one marker without an infowindow. Thanks, let me know if ...

How do I use Wget to download all images into a single folder, from a URL?

I am using wget to download all images from a website and it works fine but it stores the original hierarchy of the site with all the subfolders and so the images are dotted around. Is there a way so that it will just download all the images into a s...

Android: Clear Activity Stack

I'm having several activities in my application. and flow is very complicated. When I click the Logout application navigates to login Screen and from there user can exit by cancel button (calling system.exit(0) ) when I exit or back button, the syst...

How to create a data file for gnuplot?

I'm trying to make a graph with gnuplot. I specified my xrange, yrange, and labels, but when I typed in the following command: gnuplot> plot "data.txt" using 1:2 with lines gnuplot tells me: warning: Skipping unreadable file "data.txt" No d...

Angular, Http GET with parameter?

I dont know how to make an API call to such a method: [HttpGet] [ActionName("GetSupport")] public HttpResponseMessage GetSupport(int projectid) Because it is GET but still got a parameter to pass, how to do this? Would it be something like this? ...

Generating a random & unique 8 character string using MySQL

I'm working on a game which involves vehicles at some point. I have a MySQL table named "vehicles" containing the data about the vehicles, including the column "plate" which stores the License Plates for the vehicles. Now here comes the part I'm hav...

Running ASP.Net on a Linux based server

For a developer with a Java background, I am interested in exploring software development using the ASP.NET tools/platform as well. Java web applications (.jsp and servlets) can run on many server platforms. Question: Will a .NET web application b...

Cache an HTTP 'Get' service response in AngularJS?

I want to be able to create a custom AngularJS service that makes an HTTP 'Get' request when its data object is empty and populates the data object on success. The next time a call is made to this service, I would like to bypass the overhead of maki...

Add Insecure Registry to Docker

I have a docker 1.12 running on CentOS. I am trying to add insecure registry to it and things mentioned in documentation just don't work. The system uses systemd so I created a /etc/systemd/system/docker.service.d/50-insecure-registry.conf file. $ c...

open cv error: (-215) scn == 3 || scn == 4 in function cvtColor

I'm currently in Ubuntu 14.04, using python 2.7 and cv2. When I run this code: import numpy as np import cv2 img = cv2.imread('2015-05-27-191152.jpg',0) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) it returns: File "face_detection.py", line ...

How can I enable MySQL's slow query log without restarting MySQL?

I followed the instructions here: http://crazytoon.com/2007/07/23/mysql-changing-runtime-variables-with-out-restarting-mysql-server/ but that seems to only set the threshold. Do I need to do anything else like set the filepath? According to MySQL's...

Call a Class From another class

I want to call class2 from class1 but class2 doesn't have a main function to refer to like Class2.main(args); ...

Render Content Dynamically from an array map function in React Native

I'm trying to get data from an array and using map function to render content. Look at **{this.lapsList()}** and the associated **lapsList()** function to understand what I'm trying to do. The result is nothing is displaying (Views under vi...

How to merge rows in a column into one cell in excel?

E.g A1:I A2:am A3:a A4:boy I want to merge them all to a single cell "Iamaboy" This example shows 4 cells merge into 1 cell however I have many cells (more than 100), I can't type them one by one using A1 & A2 & A3 & A4 what can I do...

How to view DB2 Table structure

How to view the table structure in DB2 database...

How to replace a character from a String in SQL?

I have 100's of cells in our database which contain ? instead of '. It is possible that this might happen in all rows and columns and in more than one word per cell. Here is an example of just one cell. Parents? CUI assumed equal to the sum of the ...

How do you loop in a Windows batch file?

What is the syntax for a FOR loop in a Windows batch file?...

Lock, mutex, semaphore... what's the difference?

I've heard these words related to concurrent programming, but what's the difference between them?...

How to add font-awesome to Angular 2 + CLI project

I'm using Angular 2+ and Angular CLI. How do I add font-awesome to my project?...

fatal: could not create work tree dir 'kivy'

I'm trying to clone my fork of the kivy git, but it's not working. I've made the fork correctly, I believe, but when I type this into my Mac terminal: git clone https://github.com/mygitusername/kivy.git I get this error: fatal: could not cr...

How can I get current date in Android?

I wrote the following code Date d = new Date(); CharSequence s = DateFormat.format("MMMM d, yyyy ", d.getTime()); But is asking me parameter, I want current date in string format, like 28-Dec-2011 so that I can set over TextView, explain a...

Can I use a case/switch statement with two variables?

I am a newbie when it comes to JavaScript and it was my understanding that using one SWITCH/CASE statements is faster than a whole bunch of IF statements. However, I want to use a SWITCH/CASE statement with two variables. My web app has two slide...

Calling dynamic function with dynamic number of parameters

I’m looking for a trick about this. I know how to call a dynamic, arbitrary function in JavaScript, passing specific parameters, something like this: function mainfunc(func, par1, par2){ window[func](par1, par2); } function calledfunc(par1, p...

How can I remove a trailing newline?

What is the Python equivalent of Perl's chomp function, which removes the last character of a string if it is a newline?...

Twitter bootstrap 3 two columns full height

I'm trying to make two-column full-height layout with twitter bootstrap 3. It seems that twitter bootstrap 3 does not support full height layouts. What I want to do: +-------------------------------------------------+ | Heade...

How to stop line breaking in vim

I like that the long lines are displayed over more than one terminal line; I don’t like that vim inserts newlines into my actual text. Which part of .vimrc I should change?...

Why can't I use switch statement on a String?

Is this functionality going to be put into a later Java version? Can someone explain why I can't do this, as in, the technical way Java's switch statement works?...

Getting a link to go to a specific section on another page

I have a link on one page that needs to go to a different page, but load to a specific section on that other page. I have done this before with bootstrap but they take all the 'coding' out of it, so I need to know how to do from scratch. Here is the...

PHP list of specific files in a directory

The following code will list all the file in a directory <?php if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if (($file != ".") && ($file != "..")) { $thelist .=...

How to get table list in database, using MS SQL 2008?

I want to verify if a table exists in a database, and if it doesn't exist, to create it. How can I get a list of all the tables in the current database? I could get the database list with a SELECT like this: SELECT * FROM sys.databases What's lef...

Why use multiple columns as primary keys (composite primary key)

This example is taken from w3schools. CREATE TABLE Persons ( P_Id int NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255), Address varchar(255), City varchar(255), CONSTRAINT pk_PersonID PRIMARY KEY (P_Id,LastNa...

Android get Current UTC time

What is the function to get the current UTC time. I have tried with System.getCurrentTime but i get the current date and time of the device. Thanks...

What's the difference between integer class and numeric class in R

I want to preface this by saying I'm an absolute programming beginner, so please excuse how basic this question is. I'm trying to get a better understanding of "atomic" classes in R and maybe this goes for classes in programming in general. I under...

Get nodes where child node contains an attribute

Suppose I have the following XML: <book category="CLASSICS"> <title lang="it">Purgatorio</title> <author>Dante Alighieri</author> <year>1308</year> <price>30.00</price> </book> &...

Freeze the top row for an html table only (Fixed Table Header Scrolling)

I want to make an html table with the top row frozen (so when you scroll down vertically you can always see it). Is there a clever way to make this happen without javascript? Note that I do NOT need the left column frozen. ...

Remove shadow below actionbar

I use actionbarsherlock. The piece of code below is responsible for changing it's background to a custom one. <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.ActionBar"> <item name="background">@drawable/actionbar_bg<...

npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

I am trying all the ways of creating react application. I have tried with maven and now i am trying with crate-react-app build system from Facebook Incubators. When i tried to run the command create-react-app my-app in npm environment, it worked on ...

How to query GROUP BY Month in a Year

I am using Oracle SQL Developer. I essentially have a table of pictures that holds the columns: [DATE_CREATED(date), NUM_of_PICTURES(int)] and if I do a select *, I would get an output similar to: 01-May-12 12 02-May-12 15 03-May-12 09 .....

Using an image caption in Markdown Jekyll

I am hosting a Jekyll Blog on Github and write my posts with Markdown. When I am adding images, I do it the following way: ![name of the image](http://link.com/image.jpg) This then shows the image in the text. However, how can I tell Markdown to ...

Output (echo/print) everything from a PHP Array

Is it possible to echo or print the entire contents of an array without specifying which part of the array? The scenario: I am trying to echo everything from: while($row = mysql_fetch_array($result)){ echo $row['id']; } Without specifying "id" an...

Checkbox for nullable boolean

My model has a boolean that has to be nullable public bool? Foo { get; set; } so in my Razor cshtml I have @Html.CheckBoxFor(m => m.Foo) except that doesn't work. Neither does casting it with (bool). If I do @Html.CheckBoxFor(m => ...

-bash: export: `=': not a valid identifier

Every time I open my terminal I get the error below: Last login: Sun Aug 4 17:23:05 on ttys000 -bash: export: `=': not a valid identifier -bash: export: `/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/mysql/bin': not a valid identifier -ba...

onclick event pass <li> id or value

I want to pass <li> id or value in onclick event. here is my exiting code. <li onclick="getPaging(this.value)" id="1" value="1">1</li> <li onclick="getPaging(this.value)" id="2" value="2">2</li> here is the javascript...

What is the difference between PUT, POST and PATCH?

What is the difference between PUT, POST and PATCH methods in HTTP protocol?...

Error Code: 1406. Data too long for column - MySQL

Error Code: 1406. Data too long for column CREATE TABLE `TEST` ( `idTEST` INT NOT NULL , `TESTcol` VARCHAR(45) NULL , PRIMARY KEY (`idTEST`) ); Now Insert some values INSERT INTO TEST VALUES ( 1, 'Vikas' ) select SELECT * ...

Document directory path of Xcode Device Simulator

In iOS 7, the document directory of the iOS simulators can be found in: /Users/Sabo/Library/Application Support/iPhone Simulator/ However, in iOS 8 Beta Simulator, I can't find the corresponding directory for iOS 8 in the directory above. Where's...

Run a string as a command within a Bash script

I have a Bash script that builds a string to run as a command Script: #! /bin/bash matchdir="/home/joao/robocup/runner_workdir/matches/testmatch/" teamAComm="`pwd`/a.sh" teamBComm="`pwd`/b.sh" include="`pwd`/server_official.conf" serverbin='/usr/...

How do you create a read-only user in PostgreSQL?

I'd like to create a user in PostgreSQL that can only do SELECTs from a particular database. In MySQL the command would be: GRANT SELECT ON mydb.* TO 'xxx'@'%' IDENTIFIED BY 'yyy'; What is the equivalent command or series of commands in PostgreSQL...

How to include quotes in a string

I have a string "I want to learn "c#"". How can I include the quotes before and after c#?...

Way to run Excel macros from command line or batch file?

I have an Excel VBA macro which I need to run when accessing the file from a batch file, but not every time I open it (hence not using the open file event). Is there a way to run the macro from the command line or batch file? I'm not familiar with su...

System.Collections.Generic.IEnumerable' does not contain any definition for 'ToList'

Here is the problem. I am getting IEnumerable from ViewPage and when I tried it to convert List it is showing me error like: 'System.Collections.Generic.IEnumerable<Pax_Detail>' does not contain a definition for 'ToList' and no extension ...

How to determine whether an object has a given property in JavaScript

How can I determine whether an object x has a defined property y, regardless of the value of x.y? I'm currently using if (typeof(x.y) !== 'undefined') but that seems a bit clunky. Is there a better way?...

Python error "ImportError: No module named"

Python is installed in a local directory. My directory tree looks like this: (local directory)/site-packages/toolkit/interface.py My code is in here: (local directory)/site-packages/toolkit/examples/mountain.py To run the example, I write py...

Shell command to sum integers, one per line?

I am looking for a command that will accept (as input) multiple lines of text, each line containing a single integer, and output the sum of these integers. As a bit of background, I have a log file which includes timing measurements. Through greppin...

Scala best way of turning a Collection into a Map-by-key?

If I have a collection c of type T and there is a property p on T (of type P, say), what is the best way to do a map-by-extracting-key? val c: Collection[T] val m: Map[P, T] One way is the following: m = new HashMap[P, T] c foreach { t => m ad...

How to create jobs in SQL Server Express edition

Could anyone please explain to me how to create jobs in SQL Server Express edition?...

Executing JavaScript after X seconds

I am building a interstitial page, using <div> and JavaScript, really simple script but neat. Everything is working, but I also would like to close the div's after a few seconds (like 10 seconds, for example). Here what I have so far: I have tw...

How to display raw JSON data on a HTML page

Possible Duplicate: JSON pretty print using JavaScript I'd like to display my raw JSON data on a HTML page just as JSONview does. For example, my raw json data is: { "hey":"guy", "anumber":243, "anobject":{ "whoa":"nuts",...

navigator.geolocation.getCurrentPosition sometimes works sometimes doesn't

So I have a pretty simple bit of JS using the navigator.geolocation.getCurrentPosition jammy. $(document).ready(function(){ $("#business-locate, #people-locate").click(function() { navigator.geolocation.getCurrentPosition(foundLocation, noLoca...

Remove all child elements of a DOM node in JavaScript

How would I go about removing all of the child elements of a DOM node in JavaScript? Say I have the following (ugly) HTML: <p id="foo"> <span>hello</span> <div>world</div> </p> And I grab the node I wan...

Return True, False and None in Python

I have function a call function b (returns True or False to a), afterwards function a can return the result to be printed. class C: ... def a(self, data): p = self.head return self.b( p,data) def b(self, p, data): ...

Execution failed for task :':app:mergeDebugResources'. Android Studio

I've just installed android studio and there's an error I don't know how to fix ...

Is there a command to undo git init?

I just Git init'ed a repos with a wrong user, and want to undo it. Is there any command for this? Do I actually have to go in and edit the .git directory?...

How to filter an array/object by checking multiple values

I'm playing around with arrays trying to understand them more since I tend to work with them alot lately. I got this case where I want to search an array and compare it's element values to another array which contains values of some selected filters....

Magento: get a static block as html in a phtml file

I have a static block called newest_product (with content) and I would like to display it on a .phtml file as html. I've tried this code: echo $this->getLayout()->createBlock('cms/block')->setBlockId('newest_product')->toHtml(); But...

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

CSS3's border-radius property and border-collapse:collapse don't mix. How can I use border-radius to create a collapsed table with rounded corners?

Edit - Original Title: Is there an alternative way to achieve border-collapse:collapse in CSS (in order to have a collapsed, rounded corner table)? Since it turns out that simply getting the table's borders to collapse does not solve the root proble...

Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project

When creating a new Java project in IntelliJ IDEA, the following directories and files are created: ./projectname.iml ./projectname.ipr ./projectname.iws ./src/ I want to configure IntelliJ IDEA to include my dependency JARs in ./lib/*.jar to the ...

how to realize countifs function (excel) in R

I have a dataset containing 100000 rows of data. I tried to do some countif operations in Excel, but it was prohibitively slow. So I am wondering if this kind of operation can be done in R? Basically, I want to do a count based on multiple conditions...

Set cellpadding and cellspacing in CSS?

In an HTML table, the cellpadding and cellspacing can be set like this: <table cellspacing="1" cellpadding="1"> How can the same be accomplished using CSS?...

Java generating non-repeating random numbers

I want to create a set of random numbers without duplicates in Java. For example I have an array to store 10,000 random integers from 0 to 9999. Here is what I have so far: import java.util.Random; public class Sort{ public static void main(S...

Convert ASCII number to ASCII Character in C

In C is there a way to convert an ASCII value typed as an int into the the corresponding ASCII character as a char?...

Get human readable version of file size?

A function to return human readable size from bytes size: >>> human_readable(2048) '2 kilobytes' >>> How to do this?...

Javascript: How to pass a function with string parameters as a parameter to another function

I need to do something like this: <input type="button" value="click" id="mybtn" onclick="myfunction('/myController/myAction', 'myfuncionOnOK('/myController2/myAction2', 'myParameter2');', ...

What does string::npos mean in this code?

What does the phrase std::string::npos mean in the following snippet of code? found = str.find(str2); if (found != std::string::npos) std::cout << "first 'needle' found at: " << int(found) << std::endl; ...

How can I display a pdf document into a Webview?

I want to display pdf contents on webview. Here is my code: WebView webview = new WebView(this); setContentView(webview); webview.getSettings().setJavaScriptEnabled(true); webview.loadUrl("http://www.adobe.com/devnet/acrobat/pdfs/pdf_open_paramete...

Excel - programm cells to change colour based on another cell

I am trying to create a formula for Excel whereby a cell would change colour based on the text in the previous cell. So for example if cell B2 contains the letter X and then B3 is Y, I would like B3 to turn green. Equally, if B2 contains X and B3 co...

How to get a file or blob from an object URL?

I am allowing the user to load images into a page via drag&drop and other methods. When an image is dropped, I'm using URL.createObjectURL to convert to an object URL to display the image. I am not revoking the url, as I do reuse it. So, when ...

REST URI convention - Singular or plural name of resource while creating it

I'm new to REST and I've observed that in some RESTful services they use different resource URI for update/get/delete and Create. Such as Create - using /resources with POST method (observe plural) at some places using /resource (singular) Update -...

How to [recursively] Zip a directory in PHP?

Directory is something like: home/ file1.html file2.html Another_Dir/ file8.html Sub_Dir/ file19.html I am using the same PHP Zip class used in PHPMyAdmin http://trac.seagullproject.org/browser/branches/0.6-bugfix/lib/other...

appending list but error 'NoneType' object has no attribute 'append'

I have a script in which I am extracting value for every user and adding that in a list but I am getting "'NoneType' object has no attribute 'append'". My code is like last_list=[] if p.last_name==None or p.last_name=="": pass last_list=last_l...

How to add a jar in External Libraries in android studio

I am new to Android Studio. What I need to do is add a few jar files in the External Libraries below the < JDK > folder. If anyone has knowledge of how to do this, please help me....

Convert Java Object to JsonNode in Jackson

Is it possible to directly convert a Java Object to an JsonNode-Object? The only way I found to solve this is to convert the Java Object to String and then to JsonNode: ObjectMapper mapper = new ObjectMapper(); String json = mapper.writeValueAsStr...

How to remove leading zeros using C#

How to remove leading zeros in strings using C#? For example in the following numbers, I would like to remove all the leading zeros. 0001234 0000001234 00001234 ...

Parse DateTime string in JavaScript

Does anyone know how to parse date string in required format dd.mm.yyyy?...

"You may need an appropriate loader to handle this file type" with Webpack and Babel

I am trying to use Webpack with Babel to compile ES6 assets, but I am getting the following error message: You may need an appropriate loader to handle this file type. | import React from 'react'; | /* | import { render } from 'react-dom' Here is ...

Most efficient way to concatenate strings?

What's the most efficient way to concatenate strings?...

How to use ADB Shell when Multiple Devices are connected? Fails with "error: more than one device and emulator"

$ adb --help -s SERIAL use device with given serial (overrides $ANDROID_SERIAL) $ adb devices List of devices attached emulator-5554 device 7f1c864e device $ adb shell -s 7f1c864e error: more than one device and emulator ...

What's the difference between HEAD^ and HEAD~ in Git?

When I specify an ancestor commit object in Git, I'm confused between HEAD^ and HEAD~. Both have a "numbered" version like HEAD^3 and HEAD~2. They seem very similar or the same to me, but are there any differences between the tilde and the caret?...

missing private key in the distribution certificate on keychain

I have the following problem which I could not find a solution for anywhere. Basically, we have a company developer account (not enterprise) and so in order to submit our app, I requested from our team lead to send me the distribution certificate and...

How to display image from database using php

I am trying to display an image coming from the database and I was not able to display the image .but its showing like this user-1.jpg Please see my code can one guide me how to display the image. $sqlimage = "SELECT image FROM userdetail where `id`...

Renaming Column Names in Pandas Groupby function

Q1) I want to do a groupby, SQL-style aggregation and rename the output column: Example dataset: >>> df ID Region count 0 100 Asia 2 1 101 Europe 3 2 102 US 1 3 103 Africa 5 4 100 ...

How to loop over directories in Linux?

I am writing a script in bash on Linux and need to go through all subdirectory names in a given directory. How can I loop through these directories (and skip regular files)? For example: the given directory is /tmp/ it has the following subdirectori...

When to use Comparable and Comparator

I have a list of objects I need to sort on a field, say Score. Without giving much thought I wrote a new class that implements Comparator, that does the task and it works. Now looking back at this, I am wondering if I should have instead have the m...

Rotating a point about another point (2D)

I'm trying to make a card game where the cards fan out. Right now to display it Im using the Allegro API which has a function: al_draw_rotated_bitmap(OBJECT_TO_ROTATE,CENTER_X,CENTER_Y,X ,Y,DEGREES_TO_ROTATE_IN_RADIANS); so with this I can...

How to grep for contents after pattern?

Given a file, for example: potato: 1234 apple: 5678 potato: 5432 grape: 4567 banana: 5432 sushi: 56789 I'd like to grep for all lines that start with potato: but only pipe the numbers that follow potato:. So in the above example, the output would...

Add key value pair to all objects in array

I wanted to add a key:value parameter to all the objects in an array. eg: var arrOfObj = [{name: 'eve'},{name:'john'},{name:'jane'}]; Now I wanted to add a new parameter, isActive to all the objects so the resulting array will look like. eg: ...

Sending Arguments To Background Worker?

Let's say I want to sent an int parameter to a background worker, how can this be accomplished? private void worker_DoWork(object sender, DoWorkEventArgs e) { } I know when this is worker.RunWorkerAsync();, I don't understand how to define in wor...

"date(): It is not safe to rely on the system's timezone settings..."

I got this error when I requested to update the PHP version from 5.2.17 to PHP 5.3.21 on the server. <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;"> <h4>A PHP Error was encountered</h4> <p>Severi...

Bootstrap 4 - Inline List?

I migrated a site from Bootstrap 4 alpha 6 to Bootstrap 4 Beta 1. <ul class="nav navbar-nav list-inline"> <li class="list-inline-item"><a class="social-icon text-xs-center" target="_blank" href="#">FB</a></li> <...

Send XML data to webservice using php curl

I'm working on Flight API of arzoo. The server must receive the posted data in simple POST Request. To achieve this i'm using PHP cURL. In the API Document it is clearly mention that the data should be sent in the following format: <AvailRequest&...

'numpy.float64' object is not iterable

I'm trying to iterate an array of values generated with numpy.linspace: slX = numpy.linspace(obsvX, flightX, numSPts) slY = np.linspace(obsvY, flightY, numSPts) for index,point in slX: yPoint = slY[index] arcpy.AddMessage(yPoint) This cod...

SQL Delete Records within a specific Range

This is probably a very simple question for somebody with experience, but I just wanted to know the safest way to delete a couple of hundred records in an SQL table that fall between a specific range. For example I need to delete rows with an ID bet...

Delegation: EventEmitter or Observable in Angular

I am trying to implement something like a delegation pattern in Angular. When the user clicks on a nav-item, I would like to call a function which then emits an event which should in turn be handled by some other component listening for the event. ...

Error 5 : Access Denied when starting windows service

I'm getting this error when I try to start a windows service I've created in C#: My Code so far: private ServiceHost host = null; public RightAccessHost() { InitializeComponent(); } protected override void OnStart(string[] args) { host ...

Converting LastLogon to DateTime format

My objective is to get a list of users from my domain with the following info: -Display name -Country -Manager Name -Last login date I am running the following script, and everything looks good except for the LastLogon. It outputs the time into a ...

Get and set position with jQuery .offset()

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

When to use reinterpret_cast?

I am little confused with the applicability of reinterpret_cast vs static_cast. From what I have read the general rules are to use static cast when the types can be interpreted at compile time hence the word static. This is the cast the C++ compiler ...

CSS: How to change colour of active navigation page menu

I'm trying to change the colour of the active or current page navigation link which is selected by the user on my website. What am I doing wrong? Thanks. So far the CSS looks like this: div.menuBar { font-family: BirchStd; font-size: 40px; ...

'method' object is not subscriptable. Don't know what's wrong

I'm writing some code to create an unsorted list but whenever I try to insert a list using the insert method I get the 'method' object is not subscriptable error. Not sure how to fix it. Thanks. class UnsortedList: def __init__(self): se...

Service has zero application (non-infrastructure) endpoints

I recently created a WCF service (dll) and a service host (exe). I know my WCF service is working correctly since I am able to successfully add the service to WcfTestClient. However, I seem to be running into an issue when I comes to utlizing my WC...

Can I write a CSS selector selecting elements NOT having a certain class or attribute?

I would like to write a CSS selector rule that selects all elements that don't have a certain class. For example, given the following HTML: <html class="printable"> <body class="printable"> <h1 class="printable">Example...

How to remove last n characters from every element in the R vector

I am very new to R, and I could not find a simple example online of how to remove the last n characters from every element of a vector (array?) I come from a Java background, so what I would like to do is to iterate over every element of a$data and...

Storing data into list with class

I have the following class: public class EmailData { public string FirstName{ set; get; } public string LastName { set; get; } public string Location{ set; get; } } I then did the following but was not working properly: List<EmailD...

Git commit with no commit message

How can I commit changes without specifying commit message? Why is it required by default?...

Apply style to only first level of td tags

Is there a way to apply a Class' style to only ONE level of td tags? <style>.MyClass td {border: solid 1px red;}</style> <table class="MyClass"> <tr> <td> THIS SHOULD HAVE RED BORDERS </td> &l...

Fast check for NaN in NumPy

I'm looking for the fastest way to check for the occurrence of NaN (np.nan) in a NumPy array X. np.isnan(X) is out of the question, since it builds a boolean array of shape X.shape, which is potentially gigantic. I tried np.nan in X, but that seems ...

How can I export tables to Excel from a webpage

How can I export tables to Excel from a webpage. I want the export to contain all the formatting and colours....

Any way to return PHP `json_encode` with encode UTF-8 and not Unicode?

Any way to return PHP json_encode with encode UTF-8 and not Unicode? $arr=array('a'=>'á'); echo json_encode($arr); mb_internal_encoding('UTF-8');and $arr=array_map('utf8_encode',$arr); does not fix it. Result: {"a":"\u00e1"} Expected result:...

How to compare only date components from DateTime in EF?

I am having two date values, one already stored in the database and the other selected by the user using DatePicker. The use case is to search for a particular date from the database. The value previously entered in the database always has time comp...

How to add include path in Qt Creator?

I have a project I'm working on in Qt creator that requires a third-party library. I want to add the headers to the include path for the project. How do I do this?...

How can I check whether a option already exist in select by JQuery

How can I check whether a option already exist in select by JQuery? I want to dynamically add options into select and so I need to check whether the option is already exist to prevent duplication....

TypeError: 'undefined' is not an object

I have a currently fairly dysfunctional Javascript program that's been causing me problems. However, it throws one error that I just don't understand: TypeError: 'undefined' is not an object (evaluating 'sub.from.length') What I'm trying to do, as...

How do I UPDATE from a SELECT in SQL Server?

In SQL Server, it is possible to insert rows into a table with an INSERT.. SELECT statement: INSERT INTO Table (col1, col2, col3) SELECT col1, col2, col3 FROM other_table WHERE sql = 'cool' Is it also possible to update a table with SELECT? I have...

Position a CSS background image x pixels from the right?

I think the answer is no, but can you position a background image with CSS, so that it is a fixed amount of pixels away from the right? If I set background-position values of x and y, it seems those only give fixed pixel adjustments from the left an...

Combine Multiple child rows into one row MYSQL

Thanks in advance, I just can't seem to get it! I have two tables Ordered_Item ID | Item_Name 1 | Pizza 2 | Stromboli Ordered_Options Ordered_Item_ID | Option_Number | Value 1 43 Pepperoni 1 ...

Program to find prime numbers

I want to find the prime number between 0 and a long variable but I am not able to get any output. The program is using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication16 { class Pro...

pretty-print JSON using JavaScript

How can I display JSON in an easy-to-read (for human readers) format? I'm looking primarily for indentation and whitespace, with perhaps even colors / font-styles / etc....

Change variable name in for loop using R

I have a for loop: for (i in 1:10){ Ai=d+rnorm(3)} What I would like to do is have A1, A2,A3...A10 and I have the variable i in the variable name. It doesn't work this way, but I'm probably missing some small thing. How can I use the i in the for...

Batch file to delete folders older than 10 days in Windows 7

I want to create a batch file which should delete all subfolders of a folder which are older than 10 days, using Windows 7 Any help would be appreciated....

Remove all occurrences of a value from a list?

In Python remove() will remove the first occurrence of value in a list. How to remove all occurrences of a value from a list? This is what I have in mind: >>> remove_values_from_list([1, 2, 3, 4, 2, 2, 3], 2) [1, 3, 4, 3] ...

How to change a Git remote on Heroku

I do not want to upload my app to the wrong domain. How can I change the git master branch on git? ...

How can I use Html.Action?

I am trying to understand how to use: @Html.Action("GetOptions", ) What I would like to do is to pass a call to my controller and pass the parameters: pk = "00" and rk = "00" Can someone explain how I can do that with the Html.Action...

Count if two criteria match - EXCEL formula

I have this table and I would like to create a formula which would count values based on true conditions from column A and column C. Example: If in column A value is M (male), and in column C is YES, then it would count. could anyone help me with...

How to create temp table using Create statement in SQL Server?

How to create a temp table similarly to creating a normal table? Example: CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, .... ); ...

CSS: stretching background image to 100% width and height of screen?

I have an image called myImage.jpg. This is my CSS: body { background-image:url("../images/myImage.jpg"); background-repeat: no-repeat; background-size: 100% 100%; } For some reason, when I do this, the width of myImage stretches acros...

Razor View Without Layout

How come when I have Layout = null; in my view - it still pulls in the default layout?! Is there some trick to stop it doing that? Here is my view without layout: @{ Layout = ""; } <!DOCTYPE html> <html> <head> <titl...

ERROR: ld.so: object LD_PRELOAD cannot be preloaded: ignored

I am using ubuntu 12.04. Every time I start my bash terminal and every time when I finish typing a command(and press enter) , I get this message: ERROR: ld.so: object '/usr/lib/liblunar-calendar-preload.so' from LD_PRELOAD cannot be preloaded:...

How do I force "git pull" to overwrite local files?

How do I force an overwrite of local files on a git pull? The scenario is the following: A team member is modifying the templates for a website we are working on They are adding some images to the images directory (but forgets to add them under so...

How can I create a text box for a note in markdown?

I am writing a document in markdown. I am using the wonderful pandoc to create docx and tex files from the markdown source. I would like to have a textbox for tips and notes to readers the way programming books often do. I cannot figure out how to do...

How to customize the back button on ActionBar

I have been able to customize the action bar's background, logo image and text color using suggestions from these: Android: How to change the ActionBar "Home" Icon to be something other than the app icon? ActionBar text color ActionBar back...

What is the difference between DBMS and RDBMS?

After reading some answers on different websites I am confused now. So, it would be helpful to mention the key difference between DBMS and RDBMS and any relation between them....

Directing print output to a .txt file

Is there a way to save all of the print output to a txt file in python? Lets say I have the these two lines in my code and I want to save the print output to a file named output.txt. print ("Hello stackoverflow!") print ("I have a question.") I wa...

Deserialize JSON to Array or List with HTTPClient .ReadAsAsync using .NET 4.0 Task pattern

I'm trying to deserialize the JSON returned from http://api.usa.gov/jobs/search.json?query=nursing+jobs using the .NET 4.0 Task pattern. It returns this JSON ('Load JSON data' @ http://jsonviewer.stack.hu/). [ { "id": "usajobs:353400300", ...

Encode URL in JavaScript?

How do you safely encode a URL using JavaScript such that it can be put into a GET string? var myUrl = "http://example.com/index.html?param=1&anotherParam=2"; var myOtherUrl = "http://example.com/index.html?url=" + myUrl; I assume that you nee...

Read/Write String from/to a File in Android

I want to save a file to the internal storage by getting the text inputted from EditText. Then I want the same file to return the inputted text in String form and save it to another String which is to be used later. Here's the code: package com.omm...

C# List of objects, how do I get the sum of a property

I have a list of objects. One property of the individual object entry is amount. How do I get the sum of amount? If my list was of type double I may be able to do something like this: double total = myList.Sum(); However I want to something simil...

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

How to create a shortcut using PowerShell

I want to create a shortcut with PowerShell for this executable: C:\Program Files (x86)\ColorPix\ColorPix.exe How can this be done?...

How do I change selected value of select2 dropdown with JqGrid?

I'm using Oleg's select2 demo, but I am wondering whether it would be possible to change the currently selected value in the dropdown menu. For example, if the four values loaded were: "Any", "Fruit", "Vegetable", "Meat" and the dropdown list defaul...

Passing Objects By Reference or Value in C#

In C#, I have always thought that non-primitive variables were passed by reference and primitive values passed by value. So when passing to a method any non-primitive object, anything done to the object in the method would effect the object being pa...

Formatting text in a TextBlock

How do I achieve formatting of a text inside a TextBlock control in my WPF application? e.g.: I would like to have certain words in bold, others in italic, and some in different colors, like this example: The reason behind my question is this act...

How to use an image for the background in tkinter?

#import statements from Tkinter import * import tkMessageBox import tkFont from PIL import ImageTk,Image Code to import image: app = Tk() app.title("Welcome") image2 =Image.open('C:\\Users\\adminp\\Desktop\\titlepage\\front.gif') image1 = ImageTk....

Node.js global proxy setting

I was working in a corporate network behind a proxy server. In my code I can set the proxy by using the approach mentioned in this thread. But the problem is that most of the 3rd party modules do not have proxy setting and I cannot modify their code...

What is the largest TCP/IP network port number allowable for IPv4?

What is the highest port number one can use?...

Using different Web.config in development and production environment

I need to use different database connection string and SMTP server address in my ASP.NET application depending on it is run in development or production environment. The application reads settings from Web.config file via WebConfigurationManager.Ap...

Using jQuery Fancybox or Lightbox to display a contact form

I would like to use jQuery Fancybox or Lightbox to load a contact form from a standard link in a web page. I have reviewed the documents at http://fancybox.net/example but the closest option is the iFrame one and it doesn't work with a standard page ...

Why can't I duplicate a slice with `copy()`?

I need to make a copy of a slice in Go and reading the docs there is a copy function at my disposal. The copy built-in function copies elements from a source slice into a destination slice. (As a special case, it also will copy bytes from a ...

How to print from Flask @app.route to python console

I would like to simply print a "hello world" to the python console after /button is called by the user. This is my naive approach: @app.route('/button/') def button_clicked(): print 'Hello world!' return redirect('/') Background: I would ...

Javascript format date / time

I need to change a date/time from 2014-08-20 15:30:00 to look like 08/20/2014 3:30 pm Can this be done using javascript's Date object?...

IIS URL Rewrite and Web.config

I don't understand anything about IIS, but am trying to solve this problem of redirecting all visitors to domain.com/page to domain.com/page.html <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.webServer> <...

How to exit a 'git status' list in a terminal?

I'm new to Git and the terminal. How can I exit a listing mode generated by the git status command?...

Deprecation warning in Moment.js - Not in a recognized ISO format

I'm getting a warning that a value provided to moment is not in a recognized ISO format. I changed my variable today with the moment function and still it doesn't work. Here's the warning error: Deprecation warning: value provided is not in a recogn...

What is the size of a pointer?

Is the size of a pointer the same as the size as the type its pointing to, or do pointers always have a fixed size? For example... int x = 10; int * xPtr = &x; char y = 'a'; char * yPtr = &y; std::cout << sizeof(x) << "\n"; std...

How do I export a project in the Android studio?

How do I export project in the Android Studio? I mean, like I used to do in Eclipse by File|Export.....

How do you read from stdin?

I'm trying to do some of the code golf challenges, but they all require the input to be taken from stdin. How do I get that in Python?...

OSError: [Errno 8] Exec format error

I am having hard time parsing the arguments to subprocess.Popen. I am trying to execute a script on my Unix server. The script syntax when running on shell prompt is as follows: /usr/local/bin/script hostname = <hostname> -p LONGLIST. No matte...

"Uncaught Error: [$injector:unpr]" with angular after deployment

I have a fairly simple Angular application that runs just fine on my dev machine, but is failing with this error message (in the browser console) after I deploy it: Uncaught Error: [$injector:unpr] http://errors.angularjs.org/undefined/$injector/unp...

Multiple radio button groups in MVC 4 Razor

I need to have multiple radio button groups in my form like this: I know it's simply done by specifying the same "name" html attribute for each group. HOWEVER MVC doesn't let you specify your own name attribute when using html helper like this: ...

Execute JavaScript code stored as a string

How do I execute some JavaScript that is a string? function ExecuteJavascriptString() { var s = "alert('hello')"; // how do I get a browser to alert('hello')? } ...

Using AngularJS date filter with UTC date

I have an UTC date in milliseconds which I am passing to Angular's date filter for human formatting. {{someDate | date:'d MMMM yyyy'}} Awesome, except someDate is in UTC and the date filter considers it to be in local time. How can I tell Angular...

Multiple rows to one comma-separated value in Sql Server

I want to create a table valued function in SQL Server, which I want to return data in comma separated values. For example table: tbl ID | Value ---+------- 1 | 100 1 | 200 1 | 300 1 | 400 Now when I execute the query using the function...

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

VBA Excel Provide current Date in Text box

I have a dialog box that appears when the user clicks a macro button. This dialog box is mostly filled out (date, email, producer, website, etc are filled) and all the user needs to do is enter their name. The problem is that the date entered is st...

HQL "is null" And "!= null" on an Oracle column

Does hibernate convert column != null in HQL to a column is null in SQL?...

Make index.html default, but allow index.php to be visited if typed in

I have the following line in my .htaccess file: DirectoryIndex index.html index.php Everytime I go to index.php it takes me to index.html. Is it possible to allow for both, but leave index.html the default for users visiting www.domain.com?...

How to write to files using utl_file in oracle

How to use put function.my procedure is not compiling with put. but putline is working fine. i want to print in the same line...

how does multiplication differ for NumPy Matrix vs Array classes?

The numpy docs recommend using array instead of matrix for working with matrices. However, unlike octave (which I was using till recently), * doesn't perform matrix multiplication, you need to use the function matrixmultipy(). I feel this makes the c...

Convert integer to binary in C#

How to convert an integer number into its binary representation? I'm using this code: String input = "8"; String output = Convert.ToInt32(input, 2).ToString(); But it throws an exception: Could not find any parsable digits ...

How to tell if JRE or JDK is installed

I have one computer that I intentionally installed JDK on. I have another computer with JRE, for, among other things, testing. However, when I got a java application working on this computer, and then tried it on another, it complained that JDK was r...

How to avoid precompiled headers

I am trying to compile a simple VS program in C++ as an assignment for class. We only ever include <iostream> and I keep getting this error: 1>Assignment.cpp(15): fatal error C1010: unexpected end of file while looking for precompiled heade...

How can I get this ASP.NET MVC SelectList to work?

I create a selectList in my controller, to display in the view. I'm trying to create it on the fly, sorta thing .. like this... myViewData.PageOptionsDropDown = new SelectList(new [] {"10", "15", "25", "50", "100", "1000"}, "15"); It compiles...

doGet and doPost in Servlets

I've developed an HTML page that sends information to a Servlet. In the Servlet, I am using the methods doGet() and doPost(): public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String id ...

Like Operator in Entity Framework?

We're trying to implement the "LIKE" operator in Entity Framework for our entities with string fields, but it doesn't appear to be supported. Has anyone else tried to do something like this? This blog post summarizes the issue we're having. We cou...

Converting string to numeric

I've imported a test file and tried to make a histogram pichman <- read.csv(file="picman.txt", header=TRUE, sep="/t") hist <- as.numeric(pichman$WS) However, I get different numbers from values in my dataset. Originally I thought tha...

SystemError: Parent module '' not loaded, cannot perform relative import

I have the following directory: myProgram +-- app +-- __init__.py +-- main.py +-- mymodule.py mymodule.py: class myclass(object): def __init__(self): pass def myfunc(self): print("Hello!") main.py: from .mymodule import ...

Set background image in CSS using jquery

I am trying to set the background image for one of my html element using jquery <div class="rmz-srchbg"> <input type="text" id="globalsearchstr" name="search" value="" class="rmz-txtbox"> <input type="submit" value="&nbsp;...

Wipe data/Factory reset through ADB

Basically this is my problem/ I have 200+ phones running stock Android that need to be wiped (in the Wipe Data/Factory Reset way) and then a new ROM installed with some additional apks. Currently I've got everything automated except the Wipe Data p...

Using CMake to generate Visual Studio C++ project files

I am working on an open source C++ project, for code that compiles on Linux and Windows. I use CMake to build the code on Linux. For ease of development setup and political reasons, I must stick to Visual Studio project files/editor on Windows (I can...

How do I get my solution in Visual Studio back online in TFS?

I had my solution in Visual Studio 2012 (which is under TFS source control) open and the TFS server (2010) was down. When I then made a change to one of the files and attempted to save it I got a prompt to ask whether I wanted to Overwrite the file s...

How do Python's any and all functions work?

I'm trying to understand how the any() and all() Python built-in functions work. I'm trying to compare the tuples so that if any value is different then it will return True and if they are all the same it will return False. How are they working in ...

T-SQL to list all the user mappings with database roles/permissions for a Login

I am looking for a t-sql script which can list the databases and and the respective roles/privileges mapped for a particular user. Using SQL Server 2008 R2....

Submitting the value of a disabled input field

I want to disable an input field, but when I submit the form it should still pass the value. Use case: I am trying to get latitude and longitude from Google Maps and wanna display it, but I don't want the user to edit it. Is this possible?...

Checkbox Check Event Listener

Recently I have been working with the Chrome Plugin API and I am looking to develop a plugin which will make life easier for me for managing a website. Now what I wish to do is to fire an event when a certain checkbox is checked. As this website doe...

Path to Powershell.exe (v 2.0)

Where is the Powershell (version 2.0) located? What is the path to Powershell.exe? I have Windows Server 2008 and Powershell installed. When I look at this folder: PS C:\Windows\System32\WindowsPowerShell> dir Directory: C:\Windows\System32...

400 vs 422 response to POST of data

I'm trying to figure out what the correct status code to return on different scenarios with a "REST-like" API that I'm working on. Let's say I have an end point that allows POST'ing purchases in JSON format. It looks like this: { "...

Convert HTML string to image

I have a string variable which holds HTML markup. This HTML markup basically represents the email content. Now I want to create an image from this string content which actually holds the HTML markup. I don't want to create the HTML file by writing t...

java build path problems

From someone's project, I am getting this error: Java Build Path Problems (1 item) Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workplace that are strictly compatible with this environment. I have the ...

How do I convert this list of dictionaries to a csv file?

I have a list of dictionaries that looks something like this: toCSV = [{'name':'bob','age':25,'weight':200},{'name':'jim','age':31,'weight':180}] What should I do to convert this to a csv file that looks something like this: name,age,weight bob,2...

An object reference is required to access a non-static member

I'm having this error come up and I'm not sure why... I've tried to look it up, people are saying to create an object of the class or create the methods as static... but I'm unsure how. Here's my code below: public class SoundManager : MonoBehaviou...

How to terminate a thread when main program ends?

If I have a thread in an infinite loop, is there a way to terminate it when the main program ends (for example, when I press Ctrl+C)?...

How to display default text "--Select Team --" in combo box on pageload in WPF?

In a WPF app, in MVP app, I have a combo box,for which I display the data fetched from Database. Before the items added to the Combo box, I want to display the default text such as " -- Select Team --" so that on pageload it displays and on sel...

string sanitizer for filename

I'm looking for a php function that will sanitize a string and make it ready to use for a filename. Anyone know of a handy one? ( I could write one, but I'm worried that I'll overlook a character! ) Edit: for saving files on a Windows NTFS filesys...

How to send POST request?

I found this script online: import httplib, urllib params = urllib.urlencode({'number': 12524, 'type': 'issue', 'action': 'show'}) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"} conn = httplib.HTT...

minimum double value in C/C++

Is there a standard and/or portable way to represent the smallest negative value (e.g. to use negative infinity) in a C(++) program? DBL_MIN in float.h is the smallest positive number....

What's the difference between text/xml vs application/xml for webservice response

This is more of a general question about the difference between text/xml and application/xml. I am fairly new to writing webservices (REST - Jersey). I have been producing application/xml since it is what shows up in most tutorials / code examples th...

in angularjs how to access the element that triggered the event?

I use both Bootstrap and AngularJS in my web app. I'm having some difficulty getting the two to work together. I have an element, which has the attribute data-provide="typeahead" <input id="searchText" ng-model="searchText" type="text" cl...

How to install OpenSSL in windows 10?

I have a question about how and what is the version of OpenSSl that I must install in Windows to later create certificates. Install a one version (openssl-1.0.2d-fips-2.0.10) found in SourceForge but it does not generate the files correctly. There is...

Android and setting alpha for (image) view alpha

Is there really no XML attribute counterpart to setAlpha(int)? If not, what alternatives are there?...

Change the location of the ~ directory in a Windows install of Git Bash

I am not even sure I am asking the right question. Let me explain my situation: This is about Git on Windows 7. My company sets up the Windows user directory on a network drive, not on the local hard drive (for backup and other purposes beyond...

Floating divs in Bootstrap layout

I need to do something like this using Boostrap. "Fluid" content on the page with two widgets inside it - first at top-right and second at left-bottom. Widget1 is easy - I just needed class="pull-right". But what to do with the second one to get ...

Get Enum from Description attribute

Possible Duplicate: Finding an enum value by its Description Attribute I have a generic extension method which gets the Description attribute from an Enum: enum Animal { [Description("")] NotSet = 0, [Description("Giant Panda...

What is com.sun.proxy.$Proxy

I have seen that when errors occur deep in different frameworks (e.g frameworks implementing the EJB specification or some JPA providers) the stacktrace contain classes like com.sun.proxy.$Proxy. I know what a Proxy is, but I am looking for a more te...

c++ array - expression must have a constant value

I get an error when I try to create an array from the variables I declared. int row = 8; int col= 8; int [row][col]; Why do I get this error: expression must have a constant value. ...

Validating a Textbox field for only numeric input.

I have created a form-based program that needs some input validation. I need to make sure the user can only enter numeric values within the distance Textbox. So far, I've checked that the Textbox has something in it, but if it has a value then it s...

Mips how to store user input string

I used to think I knew how to do this. But then I actually tried to do it. Here's the program I wrote but the Berkeley S*** simulator for mac said there was a syntax error on the last line. What did I do wrong? .text .globl __start ...

Checking if jquery is loaded using Javascript

I am attempting to check if my Jquery Library is loaded onto my HTML page. I am checking to see if it works, but something is not right. Here is what I have: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script typ...

compare two list and return not matching items using linq

i have a two list List<Sent> SentList; List<Messages> MsgList; both have the same property called MsgID; MsgList SentList MsgID Content MsgID Content Stauts 1 aaa 1 aaa 0 2 bbb 3 ...

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

clientHeight/clientWidth returning different values on different browsers

Properties document.body.clientHeight and document.body.clientWidth return different values on IE7, IE8 and Firefox: IE 8: document.body.clientHeight : 704 document.body.clientWidth : 1148 IE 7: document.body.clientHeight : 704 document.b...

How do I create a transparent Activity on Android?

I want to create a transparent Activity on top of another activity. How can I achieve this?...

Add JavaScript object to JavaScript object

I'd like to have JavaScript objects within another JavaScript object as such: Issues: - {"ID" : "1", "Name" : "Missing Documentation", "Notes" : "Issue1 Notes"} - {"ID" : "2", "Name" : "Software Bug", "Notes" : "Issue2 Notes, blah, blah"} - {...

Why is document.write considered a "bad practice"?

I know document.write is considered bad practice; and I'm hoping to compile a list of reasons to submit to a 3rd party vendor as to why they shouldn't use document.write in implementations of their analytics code. Please include your reason for clai...

Moment.js - two dates difference in number of days

I get incorrect results when trying to find numeric difference between two dates: var startDate = moment( $('[name="date-start"]').val(), "DD.MM.YYYY"), // $('[name="date-start"]').val() === "13.04.2016" endDate = moment( $('[name="date-end"]'...

ASP.NET Core Identity - get current user

To get the currently logged in user in MVC5, all we had to do was: using Microsoft.AspNet.Identity; [Authorize] public IHttpActionResult DoSomething() { string currentUserId = User.Identity.GetUserId(); } Now, with ASP.NET Core I thought this ...

List of encodings that Node.js supports

I need to read a file which is encoded with ISO-8859-1 (also called latin1), something like this: var file_contents = fs.readFileSync("test_data.html", "latin1"); However, Node complains about "latin1" or "ISO-8859-1" not being a valid encoding ("...

Identifier not found error on function call

I have a program here where I invert the case of an entered string. This is the code in my .cpp file and I am using Visual Studio C++ IDE. I am not sure what I need in a header file or if I need one to make this work. Error with my function call swa...

Difference between ProcessBuilder and Runtime.exec()

I'm trying to execute an external command from java code, but there's a difference I've noticed between Runtime.getRuntime().exec(...) and new ProcessBuilder(...).start(). When using Runtime: Process p = Runtime.getRuntime().exec(installation_path ...

How to center a window on the screen in Tkinter?

I'm trying to center a tkinter window. I know I can programatically get the size of the window and the size of the screen and use that to set the geometry, but I'm wondering if there's a simpler way to center the window on the screen....

How can I use a custom font in Java?

I wrote a program in Java that uses a special font that by default doesn't exist on any operating system. Is it possible in Java to add this special font to the operation system? For example, in Windows, to copy this font to the special Fonts folder...

File name without extension name VBA

I need to get file name without extension name by VBA. I know ActiveWorkbook.Name property , but if user haves Windows property Hide extensions for known file types turn off, the result of my code will be [Name.Extension]. How can I return only name ...

Laravel Eloquent Sum of relation's column

I've been working on a shopping cart application and now I've come to the following issue.. There is a User, a Product and a Cart object. The Cart table only contains the following columns: id, user_id, product_id and timestamps. The UserModel hasMa...

AppFabric installation failed because installer MSI returned with error code : 1603

When I reinstall the AppFabric 1.1, Why I'm getting this error "AppFabric installation failed because installer MSI returned with error code : 1603".? I did run it with administrative rights. Below is the error log. 2012-06-26 18:20:07, Informat...

Bootstrap 3.0: How to have text and input on same line?

I'm currently switching my website over to Bootstrap 3.0. I'm having an issue with form input and text formatting. What worked in Bootstrap 2 does not work in Bootstrap 3. How can I get text on the same line before and after a form input? I hav...

How to disable gradle 'offline mode' in android studio?

I am new to android studio IDE development. Every time when I imported a sample project that developed in the android studio, I am getting this error.. No cached version of com.android.tools.build:gradle:1.1.0 available for offline mode. Disabl...

How is Java platform-independent when it needs a JVM to run?

I just started learning Java and I'm confused about the topic of platform independence. Doesn't "independent" imply that Java code should run on any machine and need no special software to be installed? Yet the JVM needs to be present in the machine...

CURRENT_TIMESTAMP in milliseconds

Is there any way to get milliseconds out of a timestamp in MySql or PostgreSql (or others just out of curiosity)? SELECT CURRENT_TIMESTAMP --> 2012-03-08 20:12:06.032572 Is there anything like this: SELECT CURRENT_MILLISEC --> 1331255526000...

Get nth character of a string in Swift programming language

How can I get the nth character of a string? I tried bracket([]) accessor with no luck. var string = "Hello, world!" var firstChar = string[0] // Throws error ERROR: 'subscript' is unavailable: cannot subscript String with an Int, see the doc...

How to identify all stored procedures referring a particular table

I created a table on development environment for testing purpose and there are few sp's which are refreing this table. Now I have have to drop this table as well as identify all sp's which are referring this table. I am facing difficulty to find list...

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 on both Windows and Linux, but at a push Linux only...

Is there a way to detach matplotlib plots so that the computation can continue?

After these instructions in the Python interpreter one gets a window with a plot: from matplotlib.pyplot import * plot([1,2,3]) show() # other code Unfortunately, I don't know how to continue to interactively explore the figure created by show() w...

How to auto import the necessary classes in Android Studio with shortcut?

I've just switch to Android Studio 0.5.1, and the things going so slow here, because nothing works in the regular way... How do I import the necessary classes with shortcut? I mean like this ones? import android.os.Bundle; import android.support.v...

Spring MVC Controller redirect using URL parameters instead of in response

I am trying to implement RESTful urls in my Spring MVC application. All is well except for handling form submissions. I need to redirect either back to the original form or to a "success" page. @Controller @RequestMapping("/form") public class MyCo...

Alter table to modify default value of column

I have a requirement where we need to modify a column's default value in database table. The table is already an existing table in database and currently the default value of the column is NULL. Now if add a new default value to this column, If I am ...

JTable How to refresh table model after insert delete or update the data.

This is my jTable private JTable getJTable() { String[] colName = { "Name", "Email", "Contact No. 1", "Contact No. 2", "Group", "" }; if (jTable == null) { jTable = new JTable() { public boolean isCellEditabl...

Error: Cannot find module '../lib/utils/unsupported.js' while using Ionic

I always get this error message when I run "Ionic start project name": Error message Running command - failed![ERROR] An error occurred while running npm install (exit code 1): module.js:471 throw err; ^ Error: Cannot find...

How to make link not change color after visited?

I have this css: a:visited { text-decoration: none; decoration: none; } After a link is visited it changes color. It is happening to the "Browse All Problems" link on the bottom of the right side of this page: http://www.problemio.com...

Excel telling me my blank cells aren't blank

So in excel I'm trying to get rid of the blank cells between my cells which have info in them by using F5 to find the blank cells, then Ctrl + - to delete them, and shift the cells up. But when I try to do that, it tells me that there are 'No cells f...

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( children: <Widget>[ new Con...

How to refresh Gridview after pressed a button in asp.net

I am trying to make a simple library database. I list the search results in a gridview, then i have a textbox and a button, user enters the isbn and clicks loan button. Then, if there is enough number of items (itemNumber>0) it is loaned by user. Her...

Two models in one view in ASP MVC 3

I have 2 models: public class Person { public int PersonID { get; set; } public string PersonName { get; set; } } public class Order { public int OrderID { get; set; } public int TotalSum { get; set; } } I want edit objects of BOTH...

How to get a pixel's x,y coordinate color from an image?

Is there any way to check if a selected(x,y) point of a PNG image is transparent?...

Logarithmic returns in pandas dataframe

Python pandas has a pct_change function which I use to calculate the returns for stock prices in a dataframe: ndf['Return']= ndf['TypicalPrice'].pct_change() I am using the following code to get logarithmic returns, but it gives the exact same val...

How can I add a background thread to flask?

I'm busy writing a small game server to try out flask. The game exposes an API via REST to users. It's easy for users to perform actions and query data, however I'd like to service the "game world" outside the app.run() loop to update game entities, ...

Laravel 5 error SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

I have installed Laravel 5 successfully and changed MySQL credentials in database.php file in config directory to ' mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localhost'), 'dat...

HTML text input allow only numeric input

Is there a quick way to set an HTML text input (<input type=text />) to only allow numeric keystrokes (plus '.')?...

Combining node.js and Python

Node.js is a perfect match for our web project, but there are few computational tasks for which we would prefer Python. We also already have a Python code for them. We are highly concerned about speed, what is the most elegant way how to call a Pytho...

How to create batch file in Windows using "start" with a path and command with spaces

I need to create a batch file which starts multiple console applications in a Windows .cmd file. This can be done using the start command. However, the command has a path in it. I also need to pass paramaters which have spaces as well. How to do ...

How to change a css class style through Javascript?

According to the book that I am reading, it is better to change a css, by class when you are using Javascript for changing css. But how? Can someone give a sample snippet for this?...

Getting value GET OR POST variable using JavaScript?

How to get value of the get or post variable on page load using JavaScript?...

SOAP-ERROR: Parsing WSDL: Couldn't load from - but works on WAMP

This works fine on my WAMP server, but doesn't work on the linux master server!? try{ $client = new SoapClient('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl', ['trace' => true]); $result = $client->checkVat([ ...

Could not load file or assembly 'EntityFramework' after downgrading EF 5.0.0.0 --> 4.3.1.0

After too hastily upgrading to EF 5.0.0.0 RC and being stuck with a .NET 4.5 project that wouldn't deploy to Windows Azure (.NET 4.0 and below), I decided to downgrade to EF 4.3.1.0. I'm unsure of the best way to perform this type of migration but m...

Using ZXing to create an Android barcode scanning app

I've been searching for how to add a barcode scanner to my app. Are there any examples or how can I do this easily?...

Removing Duplicate Values from ArrayList

I have one Arraylist of String and I have added Some Duplicate Value in that. and i just wanna remove that Duplicate value So how to remove it. Here Example I got one Idea. List<String> list = new ArrayList<String>(); list.add(...

Is there a "null coalescing" operator in JavaScript?

Is there a null coalescing operator in Javascript? For example, in C#, I can do this: String someString = null; var whatIWant = someString ?? "Cookies!"; The best approximation I can figure out for Javascript is using the conditional operator: v...

What is IPV6 for localhost and 0.0.0.0?

As we all know the IPv4 address for localhost is 127.0.0.1 (loopback address). What is the IPv6 address for localhost and for 0.0.0.0 as I need to block some ad hosts....

Start new Activity and finish current one in Android?

Currently I'm starting a new Activity and calling finish on a current one. Is there any flag that can be passed to Intent that enables finishing current Activity without a need to call finish manually from code?...

Deleting a folder from svn repository

I sometimes make mistakes with svn and have folders stuck in my repository. I want to remove these folders but I cannot figure out a way to do this. Keep in mind I am very new with SVN. I am running this command from apple terminal: sudo svn dele...

TSQL PIVOT MULTIPLE COLUMNS

I have the following table but unsure of whether it is possible to pivot this and retain all the labels. RATIO RESULT SCORE GRADE Current Ratio 1.294 60 Good Gearing Ratio 0.3384 70 Good Performance Ratio...

Trouble using ROW_NUMBER() OVER (PARTITION BY ...)

I'm using SQL Server 2008 R2. I have table called EmployeeHistory with the following structure and sample data: EmployeeID Date DepartmentID SupervisorID 10001 20130101 001 10009 10001 20130909 001 10019 10001 ...

Linq with group by having count

how do I write this query in linq (vb.net)? select B.Name from Company B group by B.Name having COUNT(1) > 1 ...

WRONGTYPE Operation against a key holding the wrong kind of value php

Hi I am using Laravel with Redis .When I am trying to access a key by get method then get following error "WRONGTYPE Operation against a key holding the wrong kind of value" I am using following code to access the key value - i use this code for ge...

How to view DLL functions?

I have a DLL file. How can I view the functions in that DLL?...

How to set column header text for specific column in Datagridview C#

How to set column header text for specific column in Datagridview C#...

Installing PIL with pip

I am trying to install PIL (the Python Imaging Library) using the command: sudo pip install pil but I get the following message: Downloading/unpacking PIL You are installing a potentially insecure and unverifiable file. Future versions of pip w...

Match at every second occurrence

Is there a way to specify a regular expression to match every 2nd occurrence of a pattern in a string? Examples searching for a against string abcdabcd should find one occurrence at position 5 searching for ab against string abcdabcd should find ...

Change div width live with jQuery

Is it possible to change a div's width live with jQuery? And if it is, how? What I want is to change its width depending on the browser's window width in real time, so if/when the user changes the browser window, the div's dimensions are changed as ...

Maven:Non-resolvable parent POM and 'parent.relativePath' points at wrong local POM

I am using maven 3 to run the application but I am getting the following error: [ERROR] The build could not read 1 project -> [Help 1] org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [F...

Use of True, False, and None as return values in Python functions

I think that I fully understand this, but I just want to make sure since I keep seeing people say to never ever test against True, False, or None. They suggest that routines should raise an error rather than return False or None. Anyway, I have many...

What characters can be used for up/down triangle (arrow without stem) for display in HTML?

I'm looking for a HTML or ASCII character which is a triangle pointing up or down so that I can use it as a toggle switch. I found ↑ (&uarr;), and ↓ (&darr;) - but those have a narrow stem. I'm looking just for the HTML arrow "head...

MATLAB, Filling in the area between two sets of data, lines in one figure

I have a question about using the area function; or perhaps another function is in order... I created this plot from a large text file: The green and the blue represent two different files. What I want to do is fill in the area between the red lin...

in_array multiple values

How do I check for multiple values, such as: $arg = array('foo','bar'); if(in_array('foo','bar',$arg)) That's an example so you understand a bit better, I know it won't work....

How do I split a string so I can access item x?

Using SQL Server, how do I split a string so I can access item x? Take a string "Hello John Smith". How can I split the string by space and access the item at index 1 which should return "John"?...

How to modify a global variable within a function in bash?

I'm working with this: GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu) I have a script like below: #!/bin/bash e=2 function test1() { e=4 echo "hello" } test1 echo "$e" Which returns: hello 4 But if I assign the result o...

How can I declare dynamic String array in Java

I am using String Array declare as zoom z[]=new String[422];. But this array stores value from 0 to 32, so I got null pointer exception after looping value 32. How to solve this problem in java? How can I declare a dynamic array in java ?...

How to install toolbox for MATLAB

I am just wondering, if I need a toolbox which not available in my MATLAB, how do I do that? For example: if I need image processing toolbox, how do I get it?...

MySQL with Node.js

I've just started getting into Node.js. I come from a PHP background, so I'm fairly used to using MySQL for all my database needs. How can I use MySQL with Node.js?...

Programmatically getting the MAC of an Android device

I need to obtain the MAC address of my android device using Java. I've searched online, but I haven't found anything useful....

Most efficient way to find mode in numpy array

I have a 2D array containing integers (both positive or negative). Each row represents the values over time for a particular spatial site, whereas each column represents values for various spatial sites for a given time. So if the array is like: 1 ...

How to redirect in a servlet filter?

I'm trying to find a method to redirect my request from a filter to the login page but I don't know how to redirect from servlet. I've searched but what I find is sendRedirect() method. I can't find this method on my response object in the filter. Wh...

CSS to prevent child element from inheriting parent styles

Possible Duplicate: How do I prevent CSS inheritance? Is there a way to declare the CSS property of an element such that it will not affect any of its children or is there a way to declare CSS of an element to implement just the style specified an...

Is there a command to list all Unix group names?

I know there is the /etc/group file that lists all users groups. I would like to know if there is a simple command to list all user group names in spite of parsing the world readable /etc/group file. I am willing to create an administrator web page ...

How to select last child element in jQuery?

How to select last child element in jQuery? Just the last child, not its descendants....

Position buttons next to each other in the center of page

I'm trying to position the two buttons next to each other in the center of the page and also make the buttons static as you resize the page. <!doctype html> <html lang="en"> <head> <style> #button1{ width: 300px; height: 40p...

Find and Replace text in the entire table using a MySQL query

Usually I use manual find to replace text in a MySQL database using phpmyadmin. I'm tired of it now, how can I run a query to find and replace a text with new text in the entire table in phpmyadmin? Example: find keyword domain.com, replace with ww...

What are the differences between "=" and "<-" assignment operators in R?

What are the differences between the assignment operators = and <- in R? I know that operators are slightly different, as this example shows x <- y <- 5 x = y = 5 x = y <- 5 x <- y = 5 # Error in (x <- y) = 5 : could not find fun...

xsl: how to split strings?

I want to split an address on semicolons (;) into rows separated by <br />: e.g. if address=123 Elm Street, I want to output 123 Elm Street, but if address=123 Elm Street;PO Box 222, I want to output 123 Elm Street<br />PO Box 222 a...

How to open some ports on Ubuntu?

I know little about Linux.Today I create a VPN server on My ubuntu according to https://github.com/philplckthun/setup-simple-ipsec-l2tp-vpn But when I finish the installation. I use my iphone to connect the ipsect vpn,bur it shows the VPN Server has...

Java Spring Boot: How to map my app root (“/”) to index.html?

I'm new to Java and to Spring. How can I map my app root http://localhost:8080/ to a static index.html? If I navigate to http://localhost:8080/index.html its works fine. My app structure is : My config\WebConfig.java looks like this: @Configurat...

adding child nodes in treeview

I'm new to C# and don't have any programming experience. But I've finish a C# basics. Now I would like to design a simple tree view by adding parent node and child node. I would like to add a second child for the Second node, I'm quite stuck here an...

Exists Angularjs code/naming conventions?

Does anyone know if exists any official or most accepted reference for Angular naming conventions to use when we build our applications? Angular has many different types of components such as filters, directives, services, and so on. Wouldn't you agr...

How do I find the current executable filename?

Possible Duplicate: How do I get the name of the current executable in C#? An executable file loads an external library. Is there a way for the library to know the calling executable file? (I would have sworn I saw the answer to this el...

Jenkins: Can comments be added to a Jenkinsfile?

Are comments possible in a Jenkinsfile? If so, what's the syntax? I am using the declarative pipeline syntax. I want to comment out the "post" section below until my SMTP server is working. pipeline { agent { label 'docker-build-slave' } env...

Android "hello world" pushnotification example

I am new to android application development and I am learning little bit. I am in a hard mission for sending push notification ( cloud messaging ) from my web server ( PHP ) to android application ( just a "helloworld" ). I did some "googling" and fe...

How to find lines containing a string in linux

I have a file in Linux, I would like to diplay lines which contain a specific string in that file, how to do this?...

Post form data using HttpWebRequest

I want to post some form data to a specified URL that isn't inside my own web application. It has the same domain, such like "domain.client.nl". The web application has a url "web.domain.client.nl" en the url where I want to post to is "idp.domain.cl...

Create a menu Bar in WPF?

I want to create a menu bar identical to the one in windows forms in my WPF application. How would I do this? The menu option in the WPF controls toolbox only gives a blank bar....

Why check both isset() and !empty()

Is there a difference between isset and !empty. If I do this double boolean check, is it correct this way or redundant? and is there a shorter way to do the same thing? isset($vars[1]) AND !empty($vars[1]) ...

What does android:layout_weight mean?

I don't understand how to use this attribute. Can anyone tell me more about it?...

How to edit default.aspx on SharePoint site without SharePoint Designer

On several occations, I have faced the situation that the default.aspx page on a Site doesn't work. More specifically, a reference to a WebPart and/or Control is throwing a error because the assembly is not found. Fine, you just fire up the dreaded ...

How to add Active Directory user group as login in SQL Server

I have a .net application which is connecting to the SQL Server using windows authentication. We cannot use SQL Server authentication in the application. We have lot of Active Directory users there for our project. So we have to create separate log...

Create iOS Home Screen Shortcuts on Chrome for iOS

I have a web app that allows the user to add the web page to his home screen on the iphone. That functionality exists with Safari. Now they released the chrome browser for the iphone too. My question is how can I instruct the user to add the web p...

http://localhost/phpMyAdmin/ unable to connect

I installed XAMPP (Apache, PHP, MYSQL) in my computer C:\xampp. When I tried to start phpMyAdmin from my web browser with http: followed by //localhost/phpMyAdmin/ as address, I got "Unable to connect" error. I searched stackoverflow and found that s...

Error System.Data.OracleClient requires Oracle client software version 8.1.7 or greater when installs setup

I have made a desktop app Setup that connects with remote Oracle 10g Database. When I install Setup on remote machine and run my application then I get following error: system.data.oracleclient requires oracle client software version 8.1.7 or greate...

Filter Excel pivot table using VBA

I have tried copying and pasting solutions from the internet forever now to try to filter a pivot table in Excel using VBA. The code below doesn't work. Sub FilterPivotTable() Application.ScreenUpdating = False ActiveSheet.PivotTables("Pivot...

How do I turn off the mysql password validation?

It seems that I may have inadvertently loaded the password validation plugin in MySQL 5.7. This plugin seems to force all passwords to comply to certain rules. I would like to turn this off. I've tried changing the validate_password_length variable...

CORS: credentials mode is 'include'

Yes, I know what you are thinking - yet another CORS question, but this time I'm stumped. So to start off, the actual error message: XMLHttpRequest cannot load http://localhost/Foo.API/token. The value of the 'Access-Control-Allow-Origin' head...

Usage of __slots__?

What is the purpose of __slots__ in Python — especially with respect to when I would want to use it, and when not?...

How can I right-align text in a DataGridView column?

How can I right-align text in a DataGridView column? I am writing a .NET WinForms application....

Count the number of items in my array list

I want to count the number of itemids in my array, can i get an example of how i would go about adding this to my code. code below; if (value != null && !value.isEmpty()) { Set set = value.keySet(); Object[] key = set.toArray(); ...

img tag displays wrong orientation

I have an image at this link: http://d38daqc8ucuvuv.cloudfront.net/avatars/216/2014-02-19%2017.13.48.jpg As you can see, this is a normal image with correct orientation. However, when I set this link to src attribute of my image tag, the image becom...

What is the difference between method overloading and overriding?

What is the difference between overloading a method and overriding a method? Can anyone explain it with an example?...

ERROR:'keytool' is not recognized as an internal or external command, operable program or batch file

When i use the command C:\>keytool -list -alias androiddebugkey -keystore .android\debug.keystore -storepass android -keypass android I get this error: 'keytool' is not recognized as an internal or external comman...

How to save a BufferedImage as a File

I am using the imgscalr Java library to resize an image . The result of a resize() method call is a BufferedImage object. I now want to save this as a file (usually .jpg). How can I do that? I want to go from BufferedImage -> File but perhaps this ...

How to downgrade php from 7.1.1 to 5.6 in xampp 7.1.1?

I want to downgrade php version from 7.1.1 to 5.6 in xampp 7.1.1. But I can't find any option. ...

How to get list of dates between two dates in mysql select query

I want list of dates lies between two dates by select query. For example: If i give '2012-02-10' and '2012-02-15' I need the result. date ---------- 2012-02-10 2012-02-11 2012-02-12 2012-02-13 2012-02-14 2012-02-15 How can i get?...

Plotting power spectrum in python

I have an array with 301 values, which were gathered from a movie clip with 301 frames. This means 1 value from 1 frame. The movie clip is running at 30 fps, so is in fact 10 sec long Now I would like to get the power spectrum of this "signal" ( wit...

WPF: Create a dialog / prompt

I need to create a Dialog / Prompt including TextBox for user input. My problem is, how to get the text after having confirmed the dialog? Usually I would make a class for this which would save the text in a property. However I want do design the Dia...

*ngIf else if in template

How would I have multiple cases in an *ngIf statement? I'm used to Vue or Angular 1 with having an if, else if, and else, but it seems like Angular 4 only has a true (if) and false (else) condition. According to the documentation, I can only do: ...

Kubernetes service external ip pending

I am trying to deploy nginx on kubernetes, kubernetes version is v1.5.2, I have deployed nginx with 3 replica, YAML file is below, apiVersion: extensions/v1beta1 kind: Deployment metadata: name: deployment-example spec: replicas: 3 revisionHist...

ReflectionException: Class ClassName does not exist - Laravel

As soon, I am typing php artisan db:seed command. I'm getting Error Like: [ReflectionException] Class UserTableSeeder does not exist root@dd-desktop:/opt/lampp/htdocs/dd/laravel# php artisan db:seed Here, Is my UserTableSeeder.php &am...

Remove IE10's "clear field" X button on certain inputs?

It's a useful feature, to be sure, but is there any way to disable it? For instance, if the form is a single text field and already has a "clear" button beside it, it's superfluous to also have the X. In this situation, it would be better to remove i...

Assert that a WebElement is not present using Selenium WebDriver with java

In tests that I write, if I want to assert a WebElement is present on the page, I can do a simple: driver.findElement(By.linkText("Test Search")); This will pass if it exists and it will bomb out if it does not exist. But now I want to assert tha...

What causes this error? "Runtime error 380: Invalid property value"

we had developed an application using vb6.0 and SQL server 2000 a few years ago. recently, some of our customers tell us that while running the application, on some of computers which use Winxp sp2 as their O/S, they get the following error when the...

All shards failed

I was working on elastic search and it was working perfectly. Today I just restarted my remote server (Ubuntu). Now I am searching in my indexes, it is giving me this error. {"error":"SearchPhaseExecutionException[Failed to execute phase [query_fetc...

Writing an input integer into a cell

I am writing a quick application myself - first project, however I am trying to find the VBA code for writing the result of an input string to a named cell in Excel. For example, a input box asks the question "Which job number would you like to add ...

Get Selected value from Multi-Value Select Boxes by jquery-select2?

I am using Select2 Jquery to bind my dropdown which is used for multiple selection . I am using select2 jquery. It's working fine, I can bind my dropdown but I need to get the selected value from my multi-value selector. I am l...

Bootstrap Alert Auto Close

My need is to call alert when I click on Add to Wishlist button and should disappear the alert in 2 secs. This is how I tried, but the alert is disappearing instantly as soon as it is appearing. Not sure, where the bug is.. Can anyone help me out? J...