Questions Tagged with #Pyscripter

PyScripter is a free and open-source software Python integrated development environment (IDE) editor for Windows. It is built in Object Pascal and released under the MIT license.

Running powershell script within python script, how to make python print the powershell output while it is running

I am writing a python script which checks various conditions and runs a powershell script accordingly to help me automate migration from windows XP to windows 7. The powershell script gives its own ou..

What does the 'u' symbol mean in front of string values?

Yes in short i would like to know why am I seeing a u in front of my keys and values. I am rendering a form. The form has check-box for the particular label and one text field for the ip address. I ..

Easiest way to change font and font size

which is the easiest way to change Font size with C#. with java it can all be done easily by calling Font constructor with necessary arguments. JLabel lab = new JLabel("Font Bold at 24"); lab.setF..

Get Application Directory

Does someone know how do I get the path of my application directory? (e.g. /data/data/my.app.lication/) Currently I'm using this method: myActivity.getFilesDir().getParent(); but it seems to me like ..

get the titles of all open windows

How can I retrieve the titles of all open windows (including windows such as tabs in Internet Explorer)?..

Loading an image to a <img> from <input file>

I'm trying to load an image selected by the user through an element. I added a onchange event handler to the input element like this: <input type="file" name="picField" id="picField" size="24" o..

What is the difference between static func and class func in Swift?

I can see these definitions in the Swift library: extension Bool : BooleanLiteralConvertible { static func convertFromBooleanLiteral(value: Bool) -> Bool } protocol BooleanLiteralConvertible ..

How to do a scatter plot with empty circles in Python?

In Python, with Matplotlib, how can a scatter plot with empty circles be plotted? The goal is to draw empty circles around some of the colored disks already plotted by scatter(), so as to highlight t..

stringstream, string, and char* conversion confusion

My question can be boiled down to, where does the string returned from stringstream.str().c_str() live in memory, and why can't it be assigned to a const char*? This code example will explain it bett..

matplotlib get ylim values

I'm using matplotlib to plot data (using plot and errorbar functions) from Python. I have to plot a set of totally separate and independent plots, and then adjust their ylim values so they can be eas..

Use jQuery to get the file input's selected filename without the path

I used this: $('input[type=file]').val() to get the file name selected, but it returned the full path, as in "C:\fakepath\filename.doc". The "fakepath" part was actually there - not sure if it's su..

Remove spaces from std::string in C++

What is the preferred way to remove spaces from a string in C++? I could loop through all the characters and build a new string, but is there a better way?..

Saving utf-8 texts with json.dumps as UTF8, not as \u escape sequence

Sample code: >>> import json >>> json_string = json.dumps("??? ????") >>> print(json_string) "\u05d1\u05e8\u05d9 \u05e6\u05e7\u05dc\u05d4" The problem: ..

How to show the text on a ImageButton?

I have an ImageButton and I want to show a text and an image on it. But when I try on emulator: <ImageButton android:text="OK" android:id="@+id/buttonok" android:src="@drawable/butt..

How to align matching values in two columns in Excel, and bring along associated values in other columns

I want to know how to align values in one column with matching values in another column, as shown in How to align duplicates on the same rows in Excel, but also carry over associated values in other c..

How do I find an array item with TypeScript? (a modern, easier way)

Is there a canonical way to find an item in an array with TypeScript? ES6+ allows this simple/clean approach [{"id":1}, {"id":-2}, {"id":3}].find(myObj => myObj.id <..

fork() child and parent processes

I am trying to create a program that uses fork() to create a new process. The sample output should look like so: This is the child process. My pid is 733 and my parent's id is 772. This is the parent..

Find stored procedure by name

Is there any way I can find in SQL Server Management Studio stored procedure by name or by part of the name? (on active database context) Thanks for help..

Access index of last element in data frame

I've looking around for this but I can't seem to find it (though it must be extremely trivial). The problem that I have is that I would like to retrieve the value of a column for the first and last e..

How to return only the Date from a SQL Server DateTime datatype

SELECT GETDATE() Returns: 2008-09-22 15:24:13.790 I want that date part without the time part: 2008-09-22 00:00:00.000 How can I get that?..

Use of *args and **kwargs

So I have difficulty with the concept of *args and **kwargs. So far I have learned that: *args = list of arguments - as positional arguments **kwargs = dictionary - whose keys become separate keywo..

Read and Write CSV files including unicode with Python 2.7

I am new to Python, and I have a question about how to use Python to read and write CSV files. My file contains like Germany, French, etc. According to my code, the files can be read correctly in Pyth..

Wait for a process to finish

Is there any builtin feature in Bash to wait for a process to finish? The wait command only allows one to wait for child processes to finish. I would like to know if there is any way to wait for any ..

Creating threads - Task.Factory.StartNew vs new Thread()

I am just learning about the new Threading and Parallel libraries in .Net 4 In the past I would create a new Thread like so (as an example): DataInThread = new Thread(new ThreadStart(ThreadProcedure..

What are the differences between the urllib, urllib2, urllib3 and requests module?

In Python, what are the differences between the urllib, urllib2, urllib3 and requests modules? Why are there three? They seem to do the same thing.....

Batch Files - Error Handling

I'm currently writing my first batch file for deploying an asp.net solution. I've been Googling a bit for a general error handling approach and can't find anything really useful. Basically if any thi..

Struct memory layout in C

I have a C# background. I am very much a newbie to a low-level language like C. In C#, struct's memory is laid out by the compiler by default. The compiler can re-order data fields or pad additional ..

Using an authorization header with Fetch in React Native

I'm trying to use fetch in React Native to grab information from the Product Hunt API. I've obtained the proper Access Token and have saved it to State, but don't seem to be able to pass it along with..

Check if XML Element exists

How can someone validate that a specific element exists in an XML file? Say I have an ever changing XML file and I need to verify every element exists before reading/parsing it. ..

How SQL query result insert in temp table?

I have a SQL query (SQL Server) and it generate reports, I want to store that exact report in temp table so I can play with it later. Now question is do I need to create temp table first and then stor..

What does the NS prefix mean?

Many classes in Cocoa/Cocoa Touch have the NS prefix. What does it mean?..

NodeJS - Error installing with NPM

Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\Windows\system32>npm install caress-server npm http GET https://registry.npmjs.org/caress-server npm ht..

jQuery position DIV fixed at top on scroll

I have a page that's fairly long and within the layout's menu, there's a flyout menu. I'd like this flyout portion of the menu to show at the top of the page even when the user has scrolled the menu b..

How to check if object property exists with a variable holding the property name?

I am checking for the existence of an object property with a variable holding the property name in question. var myObj; myObj.prop = "exists"; var myProp = "p"+"r"+"o"+"p"; if(myObj.myProp){ al..

How to run a JAR file

I created a JAR file like this: jar cf Predit.jar *.* I ran this JAR file by double clicking on it (it didn't work). So I ran it from the DOS prompt like this: java -jar Predit.jar It raised "Fa..

Best practices for SQL varchar column length

Every time is set up a new SQL table or add a new varchar column to an existing table, I am wondering one thing: what is the best value for the length. So, lets say, you have a column called name of..

MS-DOS Batch file pause with enter key

Is it possible in MS-DOS batch file to pause the script and wait for user to hit enter key? I wish to do this inside a for loop. After each iteration, I want the script to pause and wait for user to..

MongoDb shuts down with Code 100

I followed the MongoDb Docs to setup my first MongoDb, When I start MongoDB using the command C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe I get the following error ..

Can anyone explain me StandardScaler?

I am unable to understand the page of the StandardScaler in the documentation of sklearn. Can anyone explain this to me in simple terms?..

How to backup MySQL database in PHP?

I got this tutorial from the Internet. But I don't even have a basic understanding on how backup of a MySQL database through PHP would work. Using PHP to Backup MySQL Databases Can you recommend so..

Microsoft SQL Server 2005 service fails to start

I’ve been trying to install Ms SQL Server 2005 for over two weeks now, and I’ve finally gotten to the point where the prerequisites all seem to be in place. Unfortunately, every time I try to inst..

Button that refreshes the page on click

I need a button that will refresh the page on the user's click. I tried this: <input type="button" value="Reload Page" onClick="reload"> or <input type="button" value="Refresh Page" onCl..

Radio Buttons ng-checked with ng-model

In my HTML page, I have two sets of Boolean based radio buttons: Labeled: "Yes" and "No" / Values: True and False respectively. I'm populating a full form from a PostgreSQL database table to allow the..

Spring Boot: How can I set the logging level with application.properties?

This is very simple question, but I cannot find information. (Maybe my knowledge about Java frameworks is severely lacking) How can I set the logging level with application.properties? And logging fi..

How to create an HTML button that acts like a link?

I would like to create an HTML button that acts like a link. So, when you click the button, it redirects to a page. I would like it to be as accessible as possible. I would also like it so there aren..

How to disable XDebug

I think that my server became slow since I installed XDebug. So, in order to test my hypothesis I want to disable XDebug completely. I've been searching for tutorials on how to do this but I can't fin..

How do I add a new class to an element dynamically?

Is there any way to add a new CSS class to an element on :hover? Like for jQuery, but translated into CSS: $(element).addClass('someclass'); ..

How do I list all the files in a directory and subdirectories in reverse chronological order?

I want to do something like ls -t but also have the files in subdirectories included. But the problem is that I don't want the output formated like ls -R does, which is like this: [test]$ ls -Rt b ..

"Strict Standards: Only variables should be passed by reference" error

I am trying to get an HTML-based recursive directory listing based on code here: http://webdevel.blogspot.in/2008/06/recursive-directory-listing-php.html Code runs fine but it throws some errors: ..

Powershell: Get FQDN Hostname

I want to retrieve the FQDN name of windows server via powershell script. I have found 2 solution so far: $server = Invoke-Command -ScriptBlock {hostname} Above line will print just the short name..

CSS smooth bounce animation

I needed to implement infinite bounce effect using pure CSS, so I referred this site and ended up doing this. _x000D_ _x000D_ .animated {_x000D_ -webkit-animation-duration: 2.5s;_x000D_ animation..

How can I kill a process by name instead of PID?

Sometimes when I try to start Firefox it says "a Firefox process is already running". So I have to do this: jeremy@jeremy-desktop:~$ ps aux | grep firefox jeremy 7451 25.0 27.4 170536 65680 ? ..

Downloading Java JDK on Linux via wget is shown license page instead

When I try to download Java from Oracle I instead end up downloading a page telling me that I need agree to the OTN license terms. Sorry! In order to download products from Oracle Technology ..

How to display an activity indicator with text on iOS 8 with Swift?

I wanna show, programmatically, an activity indicator with text, like the one in the Photos app (after editing and saving a picture). How can I do this? ..

Properly escape a double quote in CSV

I have a line like this in my CSV: "Samsung U600 24"","10000003409","1","10000003427" Quote next to 24 is used to express inches, while the quote just next to that quote closes the field. I'm readin..

How to update /etc/hosts file in Docker image during "docker build"

I want to update my /etc/hosts file during "docker build". I added below line in Dockerfile but it's neither updating /etc/hosts file nor giving any error. RUN echo "192.168.33.11 mynginx" >&g..

View's getWidth() and getHeight() returns 0

I am creating all of the elements in my android project dynamically. I am trying to get the width and height of a button so that I can rotate that button around. I am just trying to learn how to work ..

Get key from a HashMap using the value

I want to get the key of a HashMap using the value. hashmap = new HashMap<String, Object>(); haspmap.put("one", 100); haspmap.put("two", 200); Which means i want a function that will take th..

MySQL does not start when upgrading OSX to Yosemite or El Capitan

I know similar questions exist, such as MySQL with MAMP does not work with OSX Yosemite 10.10. However, I do have MAMP, nor XAMPP installed on my computer. When I try to start mySQL from the PrefPane..

MySQL Job failed to start

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

User Get-ADUser to list all properties and export to .csv

I'm trying to go through a list of users I have and would like to get a few properties (DisplayName, Office) to show in a table then convert the table to a .csv. I've been working with: $Users = gc ..

How can I convert bigint (UNIX timestamp) to datetime in SQL Server?

How can I convert UNIX timestamp (bigint) to DateTime in SQL Server?..

Problems using Maven and SSL behind proxy

I just downloaded Maven and was trying to run the simple command found on the "Maven in Five Minutes" page (http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html). This is the comm..

How to put individual tags for a scatter plot

I am trying to do a scatter plot in matplotlib and I couldn't find a way to add tags to the points. For example: scatter1=plt.scatter(data1["x"], data1["y"], marker="o", c="blue"..

Excel VBA Code: Compile Error in x64 Version ('PtrSafe' attribute required)

I am using Win8 x64 + Office 2013 x64. MY PROBLEM: I have an excel file, which has some modules in it, and works flawlessly in Office (Excel) x86. It uses the Swiss Ephemeris file (swedll32.dll) t..

how to check for datatype in node js- specifically for integer

I tried the following to check for the datatype (specifically for integer), but not working. var i = "5"; if(Number(i) = 'NaN') { console.log('This is not number')); } ..

Calling a phone number in swift

I'm trying to call a number not using specific numbers but a number that is being called in a variable or at least tell it to pull up the number in your phone. This number that is being called in a va..

Get error message if ModelState.IsValid fails?

I have this function in my controller. [HttpPost] public ActionResult Edit(EmployeesViewModel viewModel) { Employee employee = GetEmployee(viewModel.EmployeeId); TryUpdateModel(employee); ..

Adding Table rows Dynamically in Android

I am trying to create a layout where I need to add table rows dynamically. Below is the table layout xml <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_..

Field 'browser' doesn't contain a valid alias configuration

I've started using webpack2 (to be precise, v2.3.2) and after re-creating my config I keep running into an issue I can't seem to solve I get (sorry in advance for ugly dump): ERROR in ./src/main.js M..

Python Regex - How to Get Positions and Values of Matches

How can I get the start and end positions of all matches using the re module? For example given the pattern r'[a-z]' and the string 'a1b2c3d4' I'd want to get the positions where it finds each letter...

How can I check if a string contains ANY letters from the alphabet?

What is best pure Python implementation to check if a string contains ANY letters from the alphabet? string_1 = "(555).555-5555" string_2 = "(555) 555 - 5555 ext. 5555 Where string_1 would return F..

How do I define and use an ENUM in Objective-C?

I declared an enum in my implementation file as shown below, and declared a variable of that type in my interface as PlayerState thePlayerState; and used the variable in my methods. But I am getting e..

Regex select all text between tags

What is the best way to select all the text between 2 tags - ex: the text between all the 'pre' tags on the page...

PHP: get the value of TEXTBOX then pass it to a VARIABLE

My Problem is: I want to get the value of textbox1 then transfer it to another page where the value of textbox1 will be appeared in the textbox2. Below is my codes for PHP: <html> <body>..

InputStream from a URL

How do I get an InputStream from a URL? for example, I want to take the file at the url wwww.somewebsite.com/a.txt and read it as an InputStream in Java, through a servlet. I've tried InputStream i..

Android global variable

How can I create global variable keep remain values around the life cycle of the application regardless which activity running...

What's the best way to join on the same table twice?

This is a little complicated, but I have 2 tables. Let's say the structure is something like this: *Table1* ID PhoneNumber1 PhoneNumber2 *Table2* PhoneNumber SomeOtherField The tables can be joine..

Vim and Ctags tips and tricks

I have just installed Ctags (to help with C++ development) with my Vim (or rather gVim), and would like to find out your favorite commands, macros, shortcuts, tips that go along with it... Share your..

How to put a List<class> into a JSONObject and then read that object?

I have a List<class> that I would like to convert into a json object and then traverse the data out of the json object. If this were just a list<String> I could just do something like: ..

Access Google's Traffic Data through a Web Service

Is there a way I can access traffic data that Google provides through a web service? There seems to be a GTrafficOverlay that puts traffic on top of a route on an embedded google map, but no direct w..

Clear variable in python

Is there a way to clear the value of a variable in python? For example if I was implementing a binary tree: class Node: self.left = somenode1 self.right = somenode2 If I wanted to remove some..

How to post object and List using postman

I am using postman packaged app to send a post request. I want to request the following controller. How to send a post requestbody using postman object(with values) and a list using the raw format? ..

What is the behavior difference between return-path, reply-to and from?

On our mailing application we are sending emails with the following header: FROM: [email protected] TO: [email protected] Return-PATH: bounc[email protected] The problem that we are f..

How to solve "Unresolved inclusion: <iostream>" in a C++ file in Eclipse CDT?

I download eclipse for c++ (cdt-master-8.0.2.zip). When I write: #include <iostream> It marks: Unresolved inclusion: <iostream> How can I fix it?..

Get model's fields in Django

Given a Django model, I'm trying to list all of its fields. I've seen some examples of doing this using the _meta model attribute, but doesn't the underscore in front of meta indicate that the _meta ..

omp parallel vs. omp parallel for

What is the difference between these two? [A] #pragma omp parallel { #pragma omp for for(int i = 1; i < 100; ++i) { ... } } [B] #pragma omp parallel for for(int i = 1;..

Add zero-padding to a string

How do I add "0" padding to a string so that my string length is always 4? Example If input "1", 3 padding is added = 0001 If input "25", 2 padding is added = 0025 If input "301", 1 padding is added..

Twitter Bootstrap vs jQuery UI?

I've been using jQuery UI for some basic page enhancements. Button and input styling and modal dialog boxes. Now I've come across Bootstrap and it looks pretty good. Has anyone any experience of goi..

Loading a .json file into c# program

I am trying to move my website from XML based config files to JSON based ones. Is there a way to load in a .json file in so that it turns into the object? I have been searching the web and I cannot fi..

How to change context root of a dynamic web project in Eclipse?

I developed a dynamic web project in Eclipse. I can access the app through my browser using the following URL: http://localhost:8080/MyDynamicWebApp I want to change the access URL to: http://lo..

How to set a header in an HTTP response?

I've a servlet A where I'm setting a header in the HTTP response: public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Stri..

Laravel-5 how to populate select box from database with id value and name value

I want to create a select box like the one below using illuminate\html : <select> <option value="$item->id">$item->name</option> <option value="$item->id">$it..

Connect to Active Directory via LDAP

I want to connect to our local Active Directory with C#. I've found this good documentation. But I really don't get how to connect via LDAP. Can somebody of you explain how to use the asked paramet..

When is JavaScript synchronous?

I have been under the impression for that JavaScript was always asynchronous. However, I have learned that there are situations where it is not (ie DOM manipulations). Is there a good reference anyw..

JSON forEach get Key and Value

I have the following forEach loop over a JSON object called obj: Object.keys(obj).forEach(function(){}); How can I make it console.log both key and value of each item inside the object? Something lik..

Stop on first error

Possible Duplicate: Automatic exit from bash shell script on error How can I have bash stop on the first command failure, without putting stuff like this all through my code? some_prog || ..

How to change the Spyder editor background to dark?

I've just updated Spyder to version 3.1 and I'm having trouble changing the colour scheme to dark. I've been able to change the Python and iPython console's to dark but the option to change the editor..

Is there a Python Library that contains a list of all the ascii characters?

Something like below: import ascii print ascii.charlist() Which would return something like [A, B, C, D...]..

Spring 3.0 - Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]

Any ideas what could be the cause of this? Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security] org.springframework.web.contex..

Get latitude and longitude automatically using php, API

In one of my php applications I have to find out the latitude and longitude of the place from address. I tried this code: $json = file_get_contents("http://maps.google.com/maps/api/geocode/json?ad..

How to force reloading a page when using browser back button?

I need to somehow detect that the user has pressed a browsers back button and reload the page with refresh (reloading the content and CSS) using jquery. How to detect such action via jquery? Because..

Filename timestamp in Windows CMD batch script getting truncated

I have a batch script that outputs a file, and I'm trying to ensure that each time the script is executed, no existing files are overwritten, so I'm trying to put a timestamp on it. Currently I have ..

Export data from R to Excel

I am writing codes to export database from R into Excel, I have been trying others codes including: write.table(ALBERTA1, "D:/ALBERTA1.txt", sep="\t") write.csv(ALBERTA1,":\ALBERTA1.csv") your_filena..

In Ruby, how do I skip a loop in a .each loop, similar to 'continue'

In Ruby, how do I skip a loop in a .each loop, similar to continue in other languages?..

How to convert String to Date value in SAS?

I want to convert a String to Date in SAS, I tried: data _null_; monyy = '05May2013'; date = input(substr(strip(monyy),1,9),yymmdd.);; put date=date9.; run; But it did not work. Can..

How can I join elements of an array in Bash?

If I have an array like this in Bash: FOO=( a b c ) How do I join the elements with commas? For example, producing a,b,c...

How to get commit history for just one branch?

Let's say I created a new branch my_experiment from master and made several commits to my_experiment. If I do a git log when on my_experiment, I see the commits made to this branch, but also the comm..

Mockito How to mock and assert a thrown exception?

I'm using mockito in a junit test. How do you make an exception happen and then assert that it has (generic pseudo-code)..

Best way to store date/time in mongodb

I've seen using strings, integer timestamps and mongo datetime objects. ..

How do I POST XML data to a webservice with Postman?

I want POST an XML request to a webservice using Postman. However, when I check the available request formats, I only see options for form-data, x-www-form-urlencoded, raw, and binary. How do I POST ..

Appending a line to a file only if it does not already exist

I need to add the following line to the end of a config file: include "/configs/projectname.conf" to a file called lighttpd.conf I am looking into using sed to do this, but I can't work out how. ..

Need to remove href values when printing in Chrome

I'm attempting to customize the print CSS, and finding that it prints links out with the href value as well as the link. This is in Chrome. For this HTML: <a href="http://www.google.com">Goog..

CSS fill remaining width

I have this header bar. <div id="header"> <div class="container"> <img src="img/logo.png"/> <div id="searchBar"> <input type..

Change values of select box of "show 10 entries" of jquery datatable

By default, jquery datatable shows 10 by default and has options : 10,25,50,100 How can I change these options?..

An error occurred while executing the command definition. See the inner exception for details

In my mvc asp.net application, I am getting an error in edit function : in given code public ActionResult Edit(int id) { var res = (from r in objeEntities.DocumentationsSet.Include("DocStatus"..

How to use external ".js" files

I have the following two javascript functions: 1 showCountry() 2 showUser() I would like to put them in external ".js" files 1 <a href="javascript:showCountry('countryCode')">country..

How to redirect Valgrind's output to a file?

While working with Valgrind tool, i need to log the details produced by valgrind tool. How can I accomplish that? I tried something like, valgrind a.out | test and valgrind a.out > test It ..

Display all items in array using jquery

I have an array that I want to have displayed in html.. I don't want to write multiple lines for posting each item in the array but all should be exactly the same. ie var array = []; //code that fill..

Python: converting a list of dictionaries to json

I have a list of dictionaries, looking some thing like this: list = [{'id': 123, 'data': 'qwerty', 'indices': [1,10]}, {'id': 345, 'data': 'mnbvc', 'indices': [2,11]}] and so on. There may be more ..

How to normalize a signal to zero mean and unit variance?

I am new to MATLAB and I am trying to built a voice morphing system using MATLAB. So I would like to know how to normalize a signal to zero mean and unit variance using MATLAB?..

Writing numerical values on the plot with Matplotlib

Is it possible, with Matplotlib, to print the values of each point on the graph? For example, if I have: x = numpy.range(0,10) y = numpy.array([5,3,4,2,7,5,4,6,3,2]) pyplot.plot(x,y) How can I dis..

Arrays.asList() of an array

What is wrong with this conversion? public int getTheNumber(int[] factors) { ArrayList<Integer> f = new ArrayList(Arrays.asList(factors)); Collections.sort(f); return f.get(0)*f.g..

Do you recommend using semicolons after every statement in JavaScript?

In many situations, JavaScript parsers will insert semicolons for you if you leave them out. My question is, do you leave them out? If you're unfamiliar with the rules, there's a description of semic..

Setting "checked" for a checkbox with jQuery

I'd like to do something like this to tick a checkbox using jQuery: $(".myCheckBox").checked(true); or $(".myCheckBox").selected(true); Does such a thing exist?..

JUnit Eclipse Plugin?

I feel stupid for not being able to find this, but where is the JUnit plugin for Eclipse? I've included the latest .jar in my buildpath, but I still don't have the option to create a new test case, ru..

How can I properly handle 404 in ASP.NET MVC?

I am using RC2 Using URL Routing: routes.MapRoute( "Error", "{*url}", new { controller = "Errors", action = "NotFound" } // 404s ); The above seems to take care of requests like th..

Autocomplete syntax for HTML or PHP in Notepad++. Not auto-close, autocompelete

How can I get autocompletion of syntax for HTML or PHP in Notepad++? Not auto-close, I am looking for autocompelete...

IOException: Too many open files

I'm trying to debug a file descriptor leak in a Java webapp running in Jetty 7.0.1 on Linux. The app had been happily running for a month or so when requests started to fail due to too many open file..

Add IIS 7 AppPool Identities as SQL Server Logons

I'm running an IIS 7 Website with an AppPool of Integrated Pipeline Mode. The AppPools does NOT run under NetworkService, etc.. identity (by purpose), but uses its own AppPool Identitiy (IIS AppPool\M..

Oracle 'Partition By' and 'Row_Number' keyword

I have a SQL query written by someone else and I'm trying to figure out what it does. Can someone please explain what the Partition By and Row_Number keywords does here and give a simple example of it..

Preview an image before it is uploaded

I want to be able to preview a file (image) before it is uploaded. The preview action should be executed all in the browser without using Ajax to upload the image. How can I do this?..

What is the difference between `git merge` and `git merge --no-ff`?

Using gitk log, I could not spot a difference between the two. How can I observe the difference (with a git command or some tool)?..

Convert date to UTC using moment.js

Probably and easy answer to this but I can't seem to find a way to get moment.js to return a UTC date time in milliseconds. Here is what I am doing: var date = $("#txt-date").val(), expires = mom..

Difference between HashMap, LinkedHashMap and TreeMap

What is the difference between HashMap, LinkedHashMap and TreeMap in Java? I don't see any difference in the output as all the three has keySet and values. What are Hashtables? Map m1 = new HashMap(..

What is the difference between "long", "long long", "long int", and "long long int" in C++?

I am transitioning from Java to C++ and have some questions about the long data type. In Java, to hold an integer greater than 232, you would simply write long x;. However, in C++, it seems that long ..

How to elegantly check if a number is within a range?

How can I do this elegantly with C# and .NET 3.5/4? For example, a number can be between 1 and 100. I know a simple if would suffice; but the keyword to this question is elegance. It's for my toy pr..

How to generate keyboard events?

short summary: I am trying to create a program that will send keyboard events to the computer that for all purposes the simulated events should be treated as actual keystrokes on the keyboard. origi..

How do I undo a checkout in git?

I just checked out an earlier commit from my local git repo. I haven't made any changes to it, I was just looking at it. Now I want to go back to my latest commit - how do I do that? The exact comman..

JavaScript: Parsing a string Boolean value?

JavaScript has parseInt() and parseFloat(), but there's no parseBool or parseBoolean method in the global scope, as far as I'm aware. I need a method that takes strings with values like "true" or "fa..

SQL Server Insert Example

I switch between Oracle and SQL Server occasionally, and often forget how to do some of the most trivial tasks in SQL Server. I want to manually insert a row of data into a SQL Server database table u..

SQL Server table creation date query

How can I get the table creation date of a MS SQL table using a SQL query? I could not see any table physically but I can query that particular table...

Add a tooltip to a div

I have a div tag like this: <div> <label>Name</label> <input type="text"/> </div> How can I displaying a tooltip on :hover of the div, preferably with a fade in/ou..

mappedBy reference an unknown target entity property

I am having an issue in setting up a one to many relationship in my annotated object. I have the following: @MappedSuperclass public abstract class MappedModel { @Id @GeneratedValue(strategy..

Encrypt and Decrypt in Java

I would like to store an encrypted password in a Java file. I saw at a solution using javax.crypto, but the problem with that was that the key was being generated on the fly and it was random. This..

SecurityException during executing jnlp file (Missing required Permissions manifest attribute in main jar)

OS: Windows 7 64 bit Java: jdk1.7.0_51 I have a jnlp file. When I double click on this, exception is occurred as below: Application Error: Unable to launch the application Exception: java.lang.Secu..

Is there a regular expression to detect a valid regular expression?

Is it possible to detect a valid regular expression with another regular expression? If so please give example code below...

Creating a config file in PHP

I want to create a config file for my PHP project, but I'm not sure what the best way to do this is. I have 3 ideas so far. 1-Use Variable $config['hostname'] = "localhost"; $config['dbuser'] = "db..

PHP Call to undefined function

I am trying to call a function from another function. I get an error: Fatal error: Call to undefined function getInitialInformation() in controller.php on line 24 controller.php file: require_onc..

Java double.MAX_VALUE?

For my assignment I have to create a Gas Meter System for a Gas company to allow employees to create new costumer accounts and amend data such as name and unit costs along with taking(depositing) mone..

bash: npm: command not found?

I'm learning laravel and follwing this tutorial, But when I went try and install npm, is says bash: npm: command not found ..

Difference between Dictionary and Hashtable

Possible Duplicate: Why Dictionary is preferred over hashtable in C#? What is the difference between Dictionary and Hashtable. How to decide which one to use?..

Create SQLite database in android

I want to create a SQLite database in my app, which contains three tables, I will add data into tables and will use them later on. but I like to keep database ,as if when app is first time installed ..

Calling functions in a DLL from C++

I have a solution in VS 2008 with 2 projects in it. One is a DLL written in C++ and the other is a simple C++ console application created from a blank project. I would like know how to call the functi..

Android: Reverse geocoding - getFromLocation

I am trying to get an address based on the long/lat. it appears that something like this should work? Geocoder myLocation = Geocoder(Locale.getDefault()); List myList = myLocation.getFromLocatio..

JSON for List of int

I have a class public class ItemList { public long Id { get; set; } public string Name { get; set; } public string Description { get; set; } public List<int> ItemModList { get; ..

Getting "The remote certificate is invalid according to the validation procedure" when SMTP server has a valid certificate

This seems a common error but while I've found a work-around (see below) I can't pin down the reason I'm getting it in the first place. I am writing SMTP functionality into our application and I'm at..

Insert multiple rows with one query MySQL

I want to write script, with function to multiple insert query. let me explain this better. I have one quantity input in html form. and I have MySQL query to insertregistered user into the table. so..

JSON - Iterate through JSONArray

I have a JSON file with some arrays in it. I want to iterate through the file arrays and get their elements and their values. This is how my file looks like: { "JObjects": { "JArray1": [ ..

H2 database error: Database may be already in use: "Locked by another process"

I am trying to use the H2 database from a Java application. I created the database and its tables through the H2 Console and then I try to connect from Java using Connection con = DriverManager.ge..

Chrome / Safari not filling 100% height of flex parent

I want to have a vertical menu with a specific height. Each child must fill the height of the parent and have middle-aligned text. The number of children is random, so I have to work with dynamic va..

Echo newline in Bash prints literal \n

In Bash, tried this: echo -e "hello\nworld" But it doesn't print a newline, only \n. How can I make it print the newline? I'm using Ubuntu 11.04...

How to get the device's IMEI/ESN programmatically in android?

To identify each devices uniquely I would like to use the IMEI (or ESN number for CDMA devices). How to access this programmatically?..

How to delete duplicates on a MySQL table?

I need to DELETE duplicated rows for specified sid on a MySQL table. How can I do this with an SQL query? DELETE (DUPLICATED TITLES) FROM table WHERE SID = "1" Something like this, but I don't kno..

C/C++ line number

In the sake of debugging purposes, can I get the line number in C/C++ compilers? (standard way or specific ways for certain compilers) e.g if(!Logical) printf("Not logical value at line number %..

Switch/toggle div (jQuery)

I wish to accomplish a fairly simple task (I hope!) I got two div tags and one anchor tags, like this: <a href="javascript:void(0);">forgot password?</a> <div id="login-form"></..

How to make clang compile to llvm IR

I want clang to compile my C/C++ code to LLVM bytecode rather than binary executable. How can I achieve that? And if I get the LLVM bytecode, how can I take it to further compile it to binary executab..

XAMPP PORT 80 is Busy / EasyPHP error in Apache configuration file:

This problem has completely shot my entire day. I reformatted my old windows XP comp and tried installing XAMPP only to find that when i try to start Apache xampp claims port 80 is busy....WHAT DOES T..

jQuery posting JSON

update: I would like to pass the var value to the server hello, same old, same old ... :) I have a form called <form id="testForm" action="javascript:test()"> and a code area called <code i..

PHP prepend leading zero before single digit number, on-the-fly

PHP - Is there a quick, on-the-fly method to test for a single character string, then prepend a leading zero? Example: $year = 11; $month = 4; $stamp = $year.add_single_zero_if_needed($month); // ..

How do I modify fields inside the new PostgreSQL JSON datatype?

With postgresql 9.3 I can SELECT specific fields of a JSON data type, but how do you modify them using UPDATE? I can't find any examples of this in the postgresql documentation, or anywhere online. I ..

Check if a file exists locally using JavaScript only

I want to check if a file exists locally, where the HTML file is located. It has to be JavaScript. JavaScript will never be disabled. jQuery is not good but can do. By the way, I am making a titanium..

DELETE_FAILED_INTERNAL_ERROR Error while Installing APK

I am using Android Studio 2.2 Preview. I am facing the issue Failure: Install failed invalid apk Error: While installing apk, I have made changes in build.gradle but could not retrack it, please sug..

Android - Share on Facebook, Twitter, Mail, ecc

I need to develop an app that has the share function. I have to share on Facebook, twitter, email and maybe other services. How can I do this? There a library on the net? For the iOS development the..

SQL Server: how to add new identity column and populate column with ids?

I have a table with huge amount of data. I'd like to add extra column id and use it as a primary key. What is the better way to fill this column with values from one 1 to row count Currently I'm usi..

How do I change the font-size of an <option> element within <select>?

I have built this fiddle as an example of what I am doing. What I am trying to do works fine in Firefox. With the font-size being 14px when you open up the select options. However looking at it in Goo..

ETag vs Header Expires

I've looked around but haven't been able to figure out if I should use both an ETag and an Expires Header or one or the other. What I'm trying to do is make sure that my flash files (and other images..

How to generate a git patch for a specific commit?

I need to write a script that creates patches for a list of SHA1 commit numbers. I tried using git format-patch <the SHA1>, but that generated a patch for each commit since that SHA1. After a f..

Using Sockets to send and receive data

I am using sockets to connect my Android application (client) and a Java backend Server. From the client I would like to send two variables of data each time I communicate with the server. 1) Some ki..

How to increase image size of pandas.DataFrame.plot in jupyter notebook?

How can I modify the size of the output image of the function pandas.DataFrame.plot? I tried: plt.figure (figsize=(10,5)) and %matplotlib notebook but none of them work...

How to add empty spaces into MD markdown readme on GitHub?

I'm struggling to add empty spaces before the string starts to make my GitHub README.md looks something like this: Right now it looks like this: I tried adding <br /> tag to fix the new st..

How is the java memory pool divided?

I’m currently monitoring a Java application with jconsole. The memory tab lets you choose between: Heap Memory Usage Non-Heap Memory Usage Memory Pool “Eden Space” Memory Pool “Survivor Space..

SQL How to Select the most recent date item

Hello I have a table with columns: *using oracle ID NUMBER USER_ID NUMBER DATE_ADDED DATE DATE_VIEWED DATE DOCUMENT_ID VARCHAR2 URL ..

Freemarker iterating over hashmap keys

Freemarker has two collection datatypes, lists and hashmaps Is there a way to iterate over hashmap keys just as we do with lists? So if I have a var with data lets say: user : { name : "user" em..

How to hide "Showing 1 of N Entries" with the dataTables.js library

How do you remove the "Showing 1 of N entries" line of text on a dataTable (that is when using the javascript library dataTables? I think I was looking for something along these lines... $('#example..

Sending and receiving data over a network using TcpClient

I need to develop a service that will connect to a TCP server. Main tasks are reading incoming messages and also sending commands to the server in ten minutes, like a synchronize command. For example,..

Convert python datetime to timestamp in milliseconds

How to convert a human readable time with the format 20.12.2016 09:38:42,76 to Unix timestamps in milliseconds? I found a lot of similar questions, but didn't found this specific question/answer...

Inserting code in this LaTeX document with indentation

How do I insert code into a LaTeX document? Is there something like: \begin{code}## Heading ## ... \end{code} The only thing that I really need is indentation and a fixed width font. Syntax highlig..

How does the ARM architecture differ from x86?

Is the x86 Architecture specially designed to work with a keyboard while ARM expects to be mobile? What are the key differences between the two?..

How to find third or n?? maximum salary from salary table?

How to find third or nth maximum salary from salary table(EmpID, EmpName, EmpSalary) in optimized way?..

python: changing row index of pandas data frame

I have a data frame called followers_df as below: followers_df 0 0 oasikhia 0 LEANEnergyUS 0 _johannesngwako 0 jamesbreenre 0 CaitlinFecteau 0 mantequillaFACE 0 ..

Embed Youtube video inside an Android app

I'm using a WebView for displaying embedded Youtube video and that works on Galaxcy S2 (OS 2.3.5) and doesn't on Nexus S (OS 2.3.4), all I get is white screen without any video display. Here is the c..

Count number of days between two dates

How do I count the number of days between these two dates? start_date = Date.parse "2012-03-02 14:46:21 +0100" end_date = Date.parse "2012-04-02 14:46:21 +0200" ..

How to make a smooth image rotation in Android?

I'm using a RotateAnimation to rotate an image that I'm using as a custom cyclical spinner in Android. Here's my rotate_indefinitely.xml file, which I placed in res/anim/: <?xml version="1.0" enc..

How do I catch an Ajax query post error?

I would like to catch the error and show the appropriate message if the Ajax request fails. My code is like the following, but I could not manage to catch the failing Ajax request. function getAjaxD..

C# code to validate email address

What is the most elegant code to validate that a string is a valid email address?..

Converting a char to ASCII?

I have tried lots of solutions to convert a char to Ascii. And all of them have got a problem. One solution was: char A; int ValeurASCII = static_cast<int>(A); But VS mentions that static_ca..

How do I set a checkbox in razor view?

I need to check a checkbox by default: I tried all of these, nothing is checking my checkbox - @Html.CheckBoxFor(m => m.AllowRating, new { @value = "true" }) @Html.CheckBoxFor(m => m.AllowRat..

Javascript callback when IFRAME is finished loading?

I need to execute a callback when an IFRAME has finished loading. I have no control over the content in the IFRAME, so I can't fire the callback from there. This IFRAME is programmaticly created, and..

php error: Class 'Imagick' not found

I am getting the error "Class 'Imagick' not found". Somehow I need to make this library accessible to php. I am using Php 5.2.6 on Fedora 8. my php_info has no mention of ImageMagick. I have tried: ..

How to initailize byte array of 100 bytes in java with all 0's

How to initialize byte array of 100 bytes in java with all 0's. I want to create 100 byte array and initialize it with all 0's..

SyntaxError: Non-ASCII character '\xa3' in file when function returns '£'

Say I have a function: def NewFunction(): return '£' I want to print some stuff with a pound sign in front of it and it prints an error when I try to run this program, this error message is di..