Questions Tagged with #Writeonly

Qt - reading from a text file

I have a table view with three columns; I have just passed to write into text file using this code QFile file("/home/hamad/lesson11.txt"); if(! { QMessageBox::info..

Strip HTML from Text JavaScript

Is there an easy way to take a string of html in JavaScript and strip out the html? ..

Android Studio Stuck at Gradle Download on create new project

I have installed the new Android Studio. Everything was working fine but when I try to create a new project it gets stuck at downloading Gradle. Is there any way to install the Gradle required by And..

Can I specify maxlength in css?

Can I replace the maxlength attribute with something in CSS? <input type='text' id="phone_extension" maxlength="4" /> ..

Send auto email programmatically

i want to send email programmatically. i tried out the following code. final Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND); emailIntent.setType("plain/te..

RegisterStartupScript from code behind not working when Update Panel is used

I have created a radiobutton list followed by one button. I can select one of the item from the radiobutton list and then click the button to execute something. And I want the page to pop up a window ..

Login failed for user 'DOMAIN\MACHINENAME$'

I know this is almost a duplicate of : The error "Login failed for user 'NT AUTHORITY\IUSR'" in ASP.NET and SQL Server 2008 and Login failed for user 'username' - System.Data..

How to do fade-in and fade-out with JavaScript and CSS

I want to make an HTML div tag fade in and fade out. I have some code that fades out, but when I fade in, the opacity of the div stays at 0.1 and doesn't increase. <!DOCTYPE html PUBLIC "-//W3C/..

Convert iterator to pointer?

I have a std::vector with n elements. Now I need to pass a pointer to a vector that has the last n-1 elements to a function. For example, my vector<int> foo contains (5,2,6,87,251). A function ..

Multiple "style" attributes in a "span" tag: what's supposed to happen?

Consider the following HTML fragment with two style attributes: <span style="color:blue" style="font-style:italic">Test</span> In Opera 12.16 and Chrome 40, it shows up as blue non-ital..

Paste in insert mode?

Is it possible to paste in insert mode in Vim?..

How to specify jdk path in eclipse.ini on windows 8 when path contains space

This doesn't work -vm %JAVA_HOME%/bin/javaw.exe How can I replace %JAVA_HOME% with full path on Windows 8 when path contains space ("Program Files" directory)..

How can I get onclick event on webview in android?

I want to know when the user clicks on webview but not on a hyperlink. On that click I want to show/hide a view of my activity that holds a webview. Any suggestion?..

Sending an Intent to browser to open specific URL

I'm just wondering how to fire up an Intent to the phone's browser to open an specific URL and display it. Can someone please give me a hint?..

Search for all occurrences of a string in a mysql database

I'm trying to figure out how to locate all occurrences of a url in a database. I want to search all tables and all fields. But I have no idea where to start or if it's even possible...

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

Calculate RSA key fingerprint

I need to do the SSH key audit for GitHub, but I am not sure how do find my RSA key fingerprint. I originally followed a guide to generate an SSH key on Linux. What is the command I need to enter to ..

how to get list of port which are in use on the server

How to get list of ports which are in use on the server?..

Counting unique / distinct values by group in a data frame

Let's say I have the following data frame: > myvec name order_no 1 Amy 12 2 Jack 14 3 Jack 16 4 Dave 11 5 Amy 12 6 Jack 16 7 Tom 19 8..

IF function with 3 conditions

I'm looking to create a formula with 3 conditions. It is currently only working with 2 conditions. Here's what I'm looking for: E9 has a number If the number is 21+ then I want it to show Text 1 I..

How to horizontally center an unordered list of unknown width?

It is common to have a set of links in a footer represented in a list, such as: <div id="footer"> <ul> <li><a href="#">Home</a></li> <li>..

Persistent invalid graphics state error when using ggplot2

I believe my dataframe is okay and my code is okay. In fact, I have eliminated parts of the dataframe and most of the graphing code to make things as basic as possible. But still, I get: Error in ...

How to create image slideshow in html?

I wanna make image slideshow on my web, here's my code <head> <script type="text/javascript"> var image1 = new Image() image1.src = "images/pentagg.jpg" var image2 = new Image..

Display tooltip on Label's hover?

I have below HTML code ? <label for="male">Hello This Will Have Some Value</label> But actually i dont have enough space to show this much long label. So i thought of creating label as ..

Check if a string is a valid date using DateTime.TryParse

I am using DateTime.TryParse() function to check if a particular string is a valid datetime not depending on any cultures. To my surprise , the function returns true for even strings like "1-1", "1/1..

google chrome extension :: console.log() from background page?

If I call console.log('something'); from the popup page, or any script included off that it works fine. However as the background page is not directly run off the popup page it is not included in the..

How to send an HTTPS GET Request in C#

Related: how-do-i-use-webrequest-to-access-an-ssl-encrypted-site-using-https How to send an HTTPS GET Request in C#?..

List all files in one directory PHP

What would be the best way to list all the files in one directory with PHP? Is there a $_SERVER function to do this? I would like to list all the files in the usernames/ directory and loop over that r.. has key method?

If my response has key "error" I need to process error and show warning box. Is there "haskey" method exists in Like: var x= JObject.Parse(string_my); if(x.HasKey["error_msg"]) Messag..

handling DATETIME values 0000-00-00 00:00:00 in JDBC

I get an exception (see below) if I try to do resultset.getString("add_date"); for a JDBC connection to a MySQL database containing a DATETIME value of 0000-00-00 00:00:00 (the quasi-null value fo..

laravel 5.5 The page has expired due to inactivity. Please refresh and try again

I'm new with Laravel and I have a problem which I don't understand. I have ? log form in my project and my method is POST. When I try a request the result is: 'The page has expired due to inactiv..

Inline CSS styles in React: how to implement a:hover?

I quite like the inline CSS pattern in React and decided to use it. However, you can't use the :hover and similar selectors. So what's the best way to implement highlight-on-hover while using inline ..

Regular expression for extracting tag attributes

I'm trying to extract the attributes of a anchor tag (<a>). So far I have this expression: (?<name>\b\w+\b)\s*=\s*("(?<value>[^"]*)"|'(?<value>[^']*)'|(?<value>[^"'<&..

Finding the mode of a list

Given a list of items, recall that the mode of the list is the item that occurs most often. I would like to know how to create a function that can find the mode of a list but that displays a message ..

Current Subversion revision command

Is there a Subversion command to show the current revision number? After svn checkout I want to start a script and need the revision number in a variable. It would be great if there is a command lik..

Html5 Full screen video

Is there any way to do this? I wan to play video in full screen. Without browser. setting width:100%; height:100%; keep browser visible yet..

docker: executable file not found in $PATH

I have a docker image which installs grunt, but when I try to run it, I get an error: Error response from daemon: Cannot start container foo_1: \ exec: "grunt serve": executable file not found ..

What is the difference between docker-compose ports vs expose

What is the difference between ports and expose options in docker-compose.yml..

Valid to use <a> (anchor tag) without href attribute?

I've been using Twitter Bootstrap to build a site, and a lot of its functionality depends on wrapping things in <a>, even if they're just going to execute Javascript. I've had problems with the ..

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

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

How to select id with max date group by category in PostgreSQL?

For an example, I would like to select id with max date group by category, the result is: 7, 2, 6 id category date 1 a 2013-01-01 2 b 2013-01-03 3 c 2013-01-02 4 a ..

How can I get a side-by-side diff when I do "git diff"?

When I type "git diff", I'd like to see a side-by-side diff, like with "diff -y", or like to display the diff in an interactive diff tool like "kdiff3". How can this be done?..

What is wrong with this code that uses the mysql extension to fetch data from a database in PHP?

I want to fetch data from a mysql table using php. Please, can anyone tell me what is wrong with this code? What is the correct code to fetch data from a mysql database: <?php $dbhost = 'loca..

Best way to format integer as string with leading zeros?

I need to add leading zeros to integer to make a string with defined quantity of digits ($cnt). What the best way to translate this simple function from PHP to Python: function add_nulls($int, $cnt=2..

Vertically centering Bootstrap modal window

I would like to center my modal on the viewport (middle) I tried to add some css properties .modal { position: fixed; top:50%; left:50%; } I'm using this example

select count(*) from select

I am trying to get row count from the following query. I get only row count as 1 but there are 35 records. Could you please let me know how to get the count from inner query? Thank you SELECT COUNT(..

How to do relative imports in Python?

Imagine this directory structure: app/ sub1/ sub2/ I'm coding mod1, and I need to import something from mod2. Ho..

How to set up subdomains on IIS 7

I have a website sitting on an IIS 7 server: WWW.example.COM I would like to create several sub domains that looks like SUBDOMAIN1.example.COM I created an IIS website and I set the bindings to be h..

Image inside div has extra space below the image

Why in the following code the height of the div is bigger than the height of the img ? There is a gap below the image, but it doesn't seems to be a padding/margin. What is the gap or extra space bel..

Location of ini/config files in linux/unix?

Two questions, really: Is there a standard/convention regarding the placement on configuration files? For system or quasi-system programs they seem to usually be somewhere in /etc. It seems less..

Calculate the center point of multiple latitude/longitude coordinate pairs

Given a set of latitude and longitude points, how can I calculate the latitude and longitude of the center point of that set (aka a point that would center a view on all points)? EDIT: Python soluti..

Generic htaccess redirect www to non-www

I would like to redirect to The following htaccess code makes this happen: RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] RewriteRule ^(.*)$$1 [L,R=..

Printing Exception Message in java

Is there a way to print an exception message in Java without the exception? When I try the following piece of code: try { // statements } catch (javax.script.ScriptException ex) { System.ou..

Abstract Class vs Interface in C++

Possible Duplicate: How do you declare an interface in C++? This is a general question about C++. As you know, there is no clear distinction between interface and abstract class in C++ unli..

Escape quote in web.config connection string

I have a connection string in my web config: <add name="MyConString" connectionString="Server=dbsrv;User ID=myDbUser;Password=somepass"word" providerName="System.Data.SqlClient" /> As you see..

Apache: The requested URL / was not found on this server. Apache

I've installed Apache 2.2 server and PHP 5.3 on Windows XP SP3. After the initial install, Apache loaded the test page, i.e., http:/localhost (C:/Program Files/Apache2.2/htdocs/index.html) showed "It..

Send password when using scp to copy files from one server to another

using scp to copy files from 1 unix server to another regularly and performing certain actions. to do this quickly I wish to use a unix script which does the scp and inputs the password required to co..

How Can I Bypass the X-Frame-Options: SAMEORIGIN HTTP Header?

I am developing a web page that needs to display, in an iframe, a report served by another company's SharePoint server. They are fine with this. The page we're trying to render in the iframe is givi..

How can I share Jupyter notebooks with non-programmers?

I am trying to wrap my head around what I can/cannot do with Jupyter. I have a Jupyter server running on our internal server, accessible via VPN and password protected. I am the only one actually c..

Check if a string contains a string in C++

I have a variable of type std::string. I want to check if it contains a certain std::string. How would I do that? Is there a function that returns true if the string is found, and false if it isn't..

How to check if a file exists in a folder?

I need to check if an xml file exists in the folder. DirectoryInfo di = new DirectoryInfo(ProcessingDirectory); FileInfo[] TXTFiles = di.GetFiles("*.xml"); if (TXTFiles.Length == 0) { log.Info("n..

How to solve error message: "Failed to map the path '/'."

I've searched and searched on Google, and I can't find anything that even seems applicable to my situation, let alone solves the problem. It doesn't matter which address in my website I try to navigat..

MySQL "between" clause not inclusive?

If I run a query with a between clause, it seems to exclude the ending value. For example: select * from person where dob between '2011-01-01' and '2011-01-31' This gets all results with dob from '..

How to capture no file for fs.readFileSync()?

Within node.js readFile() shows how to capture an error, however there is no comment for the readFileSync() function regarding error handling. As such, if I try to use readFileSync() when there is no ..

How to redraw DataTable with new data

I have checked several questions already about this topic here in stackoverflow, but they are all using the old dataTable. I am using DataTable. I populated my DataTable by NOT USING server side, so d..

CALL command vs. START with /WAIT option

How is the START command with a WAIT option START /wait notepad.exe START /wait notepad.exe ...any different from using a CALL command? CALL notepad.exe CALL notepad.exe Is there a situati..

How do I sort a two-dimensional (rectangular) array in C#?

I have a two-dimensional array (of Strings) which make up my data table (of rows and columns). I want to sort this array by any column. I tried to find an algorithm for doing this in C#, but have no..

What does it mean to write to stdout in C?

Does a program that writes to "stdout" write to a file? the screen? I don't understand what it means to write to stdout...

how to merge 200 csv files in Python

Guys, I here have 200 separate csv files named from SH (1) to SH (200). I want to merge them into a single csv file. How can I do it?..

PHP: Possible to automatically get all POSTed data?

Simple question: Is it possible to get all the data POSTed to a page, even if you don't know all the fields? For example, I want to write a simple script that collects any POSTed data and emails it. ..

How do I find the version of Apache running without access to the command line?

I need to either find a file in which the version is encoded or a way of polling it across the web so it reveals its version. The server is running at a host who will not provide me command line acces..

A network-related or instance-specific error occurred while establishing a connection to SQL Server

I deployed my web application on, whenever I login into this site ( it gives me a network related error like: A network-related or instance-specific error occurred whi..

How to develop or migrate apps for iPhone 5 screen resolution?

The new iPhone 5 display has a new aspect ratio and a new resolution (640 x 1136 pixels). What is required to develop new or transition already existing applications to the new screen size? What sho..

Typescript: difference between String and string

Does anyone know the difference between String and string in TypeScript? Am I correct in assuming that they ought to be the same? var a: String = "test"; var b: string = "another test"; a = b; b = a;..

How to find and turn on USB debugging mode on Nexus 4

In settings on my Nexus 4 device there isn't any "USB debugging options" item. How do I find and turn on USB debugging mode on Nexus 4?..

How to Serialize a list in java?

I would like to deep clone a List. for that we are having a method // apache commons method. This object should be serializable SerializationUtils.clone ( object ) so now to clone my List i should..

Hibernate - A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance

I'm having the following issue when trying to update my entity: "A collection with cascade=”all-delete-orphan” was no longer referenced by the owning entity instance". I have a parent entity an..

Start ssh-agent on login

I have a site as a remote Git repo pulling from using an SSH alias. I can manually start the ssh-agent on my server but I have to do this every time I login via SSH. I manually start th..

How do I read a large csv file with pandas?

I am trying to read a large csv file (aprox. 6 GB) in pandas and i am getting a memory error: MemoryError Traceback (most recent call last) <ipython-input-58-67a72687..

Delete empty lines using sed

I am trying to delete empty lines using sed: sed '/^$/d' but I have no luck with it. For example, I have these lines: xxxxxx yyyyyy zzzzzz and I want it to be like: xxxxxx yyyyyy zzzzzz ..

Getting the index of the returned max or min item using max()/min() on a list

I'm using Python's max and min functions on lists for a minimax algorithm, and I need the index of the value returned by max() or min(). In other words, I need to know which move produced the max (at ..

How to get single value of List<object>

I'm a new to ASPX, hope you dont mind if my problem is so simple with somebody. I use a List<object> selectedValues; selectedValues=...list of object(item1, item2,..) Each object has 3 field..

How to take the nth digit of a number in python

I want to take the nth digit from an N digit number in python. For example: number = 9876543210 i = 4 number[i] # should return 6 How can I do something like that in python? Should I change it to ..

How can I see all the "special" characters permissible in a varchar or char field in SQL Server?

Where can I see all the non-visible characters stored on a varchar or char field in SQL Server? e.g. \n (new-line), \r (carriage return) and other "non-printable" characters? How to print th..

Float a div in top right corner without overlapping sibling header

Having a div and a h1 inside a section, how do i float the div in the top right corner without overlapping the text of the header ? The HTML code is the following: <section> <h1>some l..

Forward declaration of a typedef in C++

Why won't the compiler let me forward declare a typedef? Assuming it's impossible, what's the best practice for keeping my inclusion tree small?..

How to test code dependent on environment variables using JUnit?

I have a piece of Java code which uses an environment variable and the behaviour of the code depends on the value of this variable. I would like to test this code with different values of the environm..

Cannot set property 'innerHTML' of null

Why do I get an error or Uncaught TypeError: Cannot set property 'innerHTML' of null? I thought I understood innerHTML and had it working before. <!DOCTYPE HTML> <html> <head> <m..

What are the different NameID format used for?

In SAML metadata file there are several NameID format defined, for example: <NameIDFormat>urn:mace:shibboleth:1.0:nameIdentifier</NameIDFormat> <NameIDFormat>urn:oasis:names:tc:SAM..

Make an Installation program for C# applications and include .NET Framework installer into the setup

I've finished my C# application, but I have a little problem: When I try to run my application in another PC, I need always to Install .NET Framework 4.0. Is there something to do to make it work wi..

How to empty a Heroku database

I'm working on a Ruby on Rails 3 webapp on Heroku. How do I empty the database?..

Hexadecimal to Integer in Java

I am trying to convert a String hexadecimal to an integer. The string hexadecimal was calculated from a hash function (sha-1). I get this error : java.lang.NumberFormatException. I guess it doesn't li..

How to set an HTTP proxy in Python 2.7?

I am trying to run a script that installs pip: and am getting a connection timeout due to my network being behind an HTTP proxy. Is there some way I could configure an HTTP proxy in my Pyth..

Undoing a 'git push'

Here's what I did on my supposed-to-be-stable branch... % git rebase master First, rewinding head to replay your work on top of it... Fast-forwarded alpha-0.3.0 to master. % git status # On branch al..

Check if argparse optional argument is set or not

I would like to check whether an optional argparse argument has been set by the user or not. Can I safely check using isset? Something like this: if(isset(args.myArg)): #do something else: ..

Playing .mp3 and .wav in Java?

How can I play an .mp3 and a .wav file in my Java application? I am using Swing. I tried looking on the internet, for something like this example: public void playSound() { try { AudioInp..

using nth-child in tables tr td

<table> <tr> <th>&nbsp;</th> <td>$</td> <td>&nbsp;</td> </tr> <tr> <th>&nbsp;</th> <td&..

how to remove untracked files in Git?

I'm working on a branch, say "experimental" branch which I branch out from my master branch.Then, I generate a user model in experimental branch, but does not add them to index yet. What do I have to..

POST request with JSON body

I would like to add a post to a Blogger blog via PHP. Google provided the example below. How to use that with PHP? You can add a post for a blog by sending a POST request to the post collection ..

Windows Forms - Enter keypress activates submit button?

How can I capture enter keypresses anywhere on my form and force it to fire the submit button event?..

Disable scrolling on `<input type=number>`

Is it possible to disable the scroll wheel changing the number in an input number field? I've messed with webkit-specific CSS to remove the spinner but I'd like to get rid of this behavior altogether...

Retrieving Android API version programmatically

Is there any way to get the API version that the phone is currently running?..

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

The problem Im facing while trying to connect to database for mysql. I have also given the database settings that i have used. Traceback (most recent call last): File "", line 10, in <m..

Getting rid of \n when using .readlines()

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

How to install multiple python packages at once using pip

I know it's an easy way of doing it but i didn't find it neither here nor on google. So i was curious if there is a way to install multiple packages using pip. Something like: pip install progra1..

Remove Select arrow on IE

I have select element, i want to remove the arrow, then i can add other icon.. i can do that for Firefox Safari and Chrome, but this didn't work on IE9. .styled-select select { border: 0 !import..

How to align linearlayout to vertical center?

I'm trying to align LinearLayout's vertical center which shows following pic (skycolor border) to delete button's vertical center. so I set the gravity of id:groupNumbers to center_vertical. but no ..

jQuery trigger event when click outside the element

$(document).click(function(evt) { var target = evt.currentTarget; var inside = $(".menuWraper"); if (target != inside) { alert("bleep"); } }); I am trying to figure out how ..

Apache is downloading php files instead of displaying them

OS and server information: CentOS 6.4 (Final) Apache 2.2.15 PHP 5.5.1 I previously had php 5.3.x installed but decided to upgrade. I first uninstalled the php 5.3.x and then installed php 5.5.1 bu..

SQLite with encryption/password protection

I'm just learning to use SQLite and I was curious if such is possible: Encryption of the database file? Password protect opening of the database? PS. I know that there is this "SQLite Encryption E..

Delete data with foreign key in SQL Server table

I'm going to delete data in an SQL Server table (parent) which has a relationship with another table (child). I tried the basic Delete query. But it isn't working (and I know it won't). DELETE FROM t..

HttpRequest maximum allowable size in tomcat?

What is the maximum data size I can send in a single HttpURLConnection to Tomcat? Is there any limitation for the request size?..

How to use "like" and "not like" in SQL MSAccess for the same field?

I would like to filter all the rows that are: field like "*AA*" and field not like "*BB*" But this is returning everything instead of showing all the rows that contains AA and doesn't contain BB. ..

Style jQuery autocomplete in a Bootstrap input field

I have implemented a jQuery autocomplete function to a Bootstrap input. The jQuery autocomplete is working fine but I want to see the results as a combo and I guess it's now happening because I'm usin..

C# catch a stack overflow exception

I have a recursive call to a method that throws a stack overflow exception. The first call is surrounded by a try catch block but the exception is not caught. Does the stack overflow exception behav..

T-SQL: Deleting all duplicate rows but keeping one

I have a table with a very large amount of rows. Duplicates are not allowed but due to a problem with how the rows were created I know there are some duplicates in this table. I need to eliminate the ..

DateTime.ToString() format that can be used in a filename or extension?

I want to add a timestamp to filenames as files are created but most of the DateTime methods I've tried output something with spaces and slashes. For instance: Debug.WriteLine(DateTime.Now.ToString()..

switch() statement usage

I am a little confused about the switch statement in R. Simply googling the function I get an example as follows: A common use of switch is to branch according to the character value of one of the a..

Find non-ASCII characters in varchar columns using SQL Server

How can rows with non-ASCII characters be returned using SQL Server? If you can show how to do it for one column would be great. I am doing something like this now, but it is not working select * ..

How to extract the first two characters of a string in shell scripting?

For example, given: USCAGoleta9311734.5021-120.1287855805 I want to extract just: US ..

How can I list all foreign keys referencing a given table in SQL Server?

I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign key constraints I will need to remove in order to drop the table? (SQL answers preferable..

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

Assigning default values to shell variables with a single command in bash

I have a whole bunch of tests on variables in a bash (3.00) shell script where if the variable is not set, then it assigns a default, e.g.: if [ -z "${VARIABLE}" ]; then FOO='default' else ..

Write to Windows Application Event Log

Is there a way to write to this event log: Or at least, some other Windows default log, where I don't have to register an event source?..

What to do with "Unexpected indent" in python?

How do I rectify the error "unexpected indent" in python?..

Recursively look for files with a specific extension

I'm trying to find all files with a specific extension in a directory and its subdirectories with my bash (Latest Ubuntu LTS Release). This is what's written in a script file: #!/bin/bash directory..

How to use Google Translate API in my Java application?

If I pass a string (either in English or Arabic) as an input to the Google Translate API, it should translate it into the corresponding other language and give the translated string to me. I read th..

Using sed to mass rename files

Objective Change these filenames: F00001-0708-RG-biasliuyda F00001-0708-CS-akgdlaul F00001-0708-VF-hioulgigl to these filenames: F0001-0708-RG-biasliuyda F0001-0708-CS-akgdlaul F0001-0708-VF-hi..

Log4j2 configuration - No log4j2 configuration file found

Lately I decided to learn how to use the log4j2 logger. I downloaded required jar files, created library, xml comfiguration file and tried to use it. Unfortunately i get this statement in console (Ecl..

Run a .bat file using python code

I try to run a .bat file in Windows using Python script. ask.bat file: Application.exe work.xml I write Python code : import os os.system("D:\xxx1\xxx2XMLnew\otr.bat ") Output: when try to run ..

How do I find the index of a character in a string in Ruby?

For example, str = 'abcdefg'. How do I find the index if c in this string using Ruby?..

How to check if std::map contains a key without doing insert?

The only way I have found to check for duplicates is by inserting and checking the std::pair.second for false, but the problem is that this still inserts something if the key is unused, whereas what I..

jQuery find file extension (from string)

I was wondering if it was possible for jQuery to find a file extension based on a returned string? A filename (string) will be passed to a function (openFile) and I wanted that function to do differe..

How to split a string in Java

I have a string, "004-034556", that I want to split into two strings: string1="004"; string2="034556"; That means the first string will contain the characters before '-', and the second string will..

How to create .pfx file from certificate and private key?

I need .pfx file to install https on website on IIS. I have two separate files: certificate (.cer or pem) and private key (.crt) but IIS accepts only .pfx files. I obviously installed certificate a..

What is a faster alternative to Python's http.server (or SimpleHTTPServer)?

Python's http.server (or SimpleHTTPServer for Python 2) is a great way of serve the contents of the current directory from the command line: python -m http.server However, as far as web servers go, i..

How to prevent a click on a '#' link from jumping to top of page?

I'm currently using <a> tags with jQuery to initiate things like click events, etc. Example is <a href="#" class="someclass">Text</a> But I hate how the '#' makes the page jump to..

How can I convert a cv::Mat to a gray scale in OpenCv?

How can I convert a cv::Mat to a gray scale? I am trying to run drawKeyPoints func from opencv, however I have been getting an Assertion Filed error. My guess is that it needs to receive a gray scale..

Uncaught SyntaxError: Unexpected token < On Chrome

I know this question has been asked many times but I can't find similarity with my issue. I'm getting this error only in Chrome, in every other browser everything is ok. I return data with JSON in sev..

Days between two dates?

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

How to make a window always stay on top in .Net?

I have a C# winforms app that runs a macro in another program. The other program will continually pop up windows and generally make things look, for lack of a better word, crazy. I want to implement..

Is there a standard function to check for null, undefined, or blank variables in JavaScript?

Is there a universal JavaScript function that checks that a variable has a value and ensures that it's not undefined or null? I've got this code, but I'm not sure if it covers all cases: function isE..

How can I roll back my last delete command in MySQL?

I accidentally deleted some huge number of rows from a table... How can I roll it back? I executed the query using PuTTY. I'll be grateful if any of you can guide me safely out of this.....

Is there a query language for JSON?

Is there a (roughly) SQL or XQuery-like language for querying JSON? I'm thinking of very small datasets that map nicely to JSON where it would be nice to easily answer queries such as "what are all t..

How can I mock requests and the response?

I am trying to use Pythons mock package to mock Pythons requests module. What are the basic calls to get me working in below scenario? In my, I have a function that makes variety of requests..

Detect IE version (prior to v9) in JavaScript

I want to bounce users of our web site to an error page if they're using a version of Internet Explorer prior to v9. It's just not worth our time and money to support IE pre-v9. Users of all other non..

OSX -bash: composer: command not found

If i type "composer" i get the above error message. I did on my macbook: curl -sS | php sudo mv composer.phar /usr/local/bin/composer to install Composer globally..

how to convert long date value to mm/dd/yyyy format

Possible Duplicate: converting long string to date I need to convert long date value to mm/dd/yyyy long value is strDate1="1346524199000" please help me..

Cannot read property length of undefined

I am trying to simply check if I have an empty input text box but I get this error when I run this in Chrome: Uncaught TypeError: Cannot read property 'length' of undefined. Here is how I go abo..

Gradle project refresh failed after Android Studio update

Here's the output: 11:57:04 AM Gradle 'KeddreaderProject' project refresh failed: Cause: org.gradle.internal.service.ServiceLocator.([Ljava/lang/ClassLoader;)V: I've tried to remove .gradle fo..

How do you kill a Thread in Java?

How do you kill a java.lang.Thread in Java?..

Plot 3D data in R

I have a 3D dataset: data = data.frame( x = rep( c(0.1, 0.2, 0.3, 0.4, 0.5), each=5), y = rep( c(1, 2, 3, 4, 5), 5) ) data$z = runif( 25, min = (data$x*data$y - 0.1 * (data$x*data$y)..

Referring to a Column Alias in a WHERE Clause

SELECT logcount, logUserID, maxlogtm , DATEDIFF(day, maxlogtm, GETDATE()) AS daysdiff FROM statslogsummary WHERE daysdiff > 120 I get "invalid column name daysdiff". Maxlogtm is a date..

Git list of staged files

I staged a lot of files using git add, now I want to see all the files I have staged, without untracked files or changed but unstaged files. How do I do that? When using git diff --cached I can see t..

Best algorithm for detecting cycles in a directed graph

What is the most efficient algorithm for detecting all cycles within a directed graph? I have a directed graph representing a schedule of jobs that need to be executed, a job being a node and a depen..

set gvim font in .vimrc file

I am using gVim 7.2 on Windows 7. I can set the gui font as Consolas 10 (font size) from the menu. I am trying to set this in .vimrc file like below: set guifont=Consolas\ 10 But it doesn't work. D..

How to send control+c from a bash script?

I'm starting a number of screens in a bash script, then running django's runserver command in each of them. I'd like to be able to programmatically stop them all as well, which requires me to send Con..

Time complexity of accessing a Python dict

I am writing a simple Python program. My program seems to suffer from linear access to dictionaries, its run-time grows exponentially even though the algorithm is quadratic. I use a dictionary to ..

Expanding tuples into arguments

Is there a way to expand a Python tuple into a function - as actual parameters? For example, here expand() does the magic: some_tuple = (1, "foo", "bar") def myfun(number, str1, str2): return (..

Stretch Image to Fit 100% of Div Height and Width

I have a div with the following CSS #mydiv{ top: 50px; left: 50px; width: 200px; height: 200px; } and my HTML looks like this <div id = "mydiv"> <img src = "folder/fil..

Hiding a form and showing another when a button is clicked in a Windows Forms application

I am doing an application a Windows Form application. At first, a certain form appears, and after the user hits the next button, this form should be hidden and another form is shown. I tried to do it..

How can I generate Javadoc comments in Eclipse?

Is there a way to generate Javadoc comments in Eclipse? If so, what is it?..

How to create localhost database using mysql?

I download mysql installer here: And then I downloaded MySql WorkBench. At workbench's connection configuration I put hostname as "", port "3306",..

True and False for && logic and || Logic table

Table true/false for C Language I have heard of a table true false for C Language for and && or || is kind of the mathematics one for which they say if true+true=true and false+true=false I'm ..

c++ parse int from string

Possible Duplicate: How to parse a string to an int in C++? I have done some research and some people say to use atio and others say it's bad, and I can't get it to work anyways. So I just..

if-else statement inside jsx: ReactJS

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

Google Maps v2 - set both my location and zoom in

My question is, does anyone know how to set google maps up, to open up both my location and in a zoomed-in view? Currently, the main view opens up to Africa, all the way zoomed out. And so I have be..

unknown type name 'uint8_t', MinGW

I get "unknown type name 'uint8_t'" and others like it using C in MinGW. Any ideas how to solve this?..

Set value to NULL in MySQL

I want a value to be set to NULL if nothing is put into the text box in the form I'm submitting. How can I make this happen? I've tried inserting 'NULL' but this just adds the word NULL into the field..

Access Control Request Headers, is added to header in AJAX request with jQuery

I would like to add a custom header to an AJAX POST request from jQuery. I have tried this: $.ajax({ type: 'POST', url: url, headers: { "My-First-Header":"first value", ..

Truncating Text in PHP?

I'm trying to truncate some text in PHP and have stumbled across this method (, which judging by the comments seems like a ..

How can I perform a reverse string search in Excel without using VBA?

I have an Excel spreadsheet containing a list of strings. Each string is made up of several words, but the number of words in each string is different. Using built in Excel functions (no VBA), is the..

Why is volatile needed in C?

Why is volatile needed in C? What is it used for? What will it do?..

What is the easiest way to get current GMT time in Unix timestamp format?

Python provides different packages (datetime, time, calendar) as can be seen here in order to deal with time. I made a big mistake by using the following to get current GMT time time.mktime(datetime.d..

How to pass a JSON array as a parameter in URL

I have an requirement to pass a some values from mobile to server in a web service call and so I am planning to pass all the values in JSON format like the below { "nameservice": [ { ..

Angular 2 Routing run in new tab

I am working with a core application with angular2 and my routing is working fine. <a target="target" routerLink="/page1" routerLinkActive="active">Associates</a> <a routerLin..

Unable to install packages in latest version of RStudio and R Version.3.1.1

I am unable to install packages through latest version of RStudio and R Version.3.1.1. Kindly help. I got the error as mentioned below: Example: Warning in install.packages : InternetOpenUrl faile..

CSS transition when class removed

I have a form that functions as a settings page. When form elements are modified, they are marked as unsaved and have a different border color. When the form is saved, they are marked as saved by havi..

How to use environment variables in docker compose

I would like to be able to use env variables inside docker-compose.yml, with values passed in at the time of docker-compose up. This is the example. I am doing this today with basic docker run command..

How can I make my match non greedy in vim?

I have a big HTML file that has lots of markup that looks like this: <p class="MsoNormal" style="margin: 0in 0in 0pt;"> <span style="font-size: small; font-family: Times New Roman;">stu..

What is cardinality in Databases?

I have been searching all over the internet but I couldn't seem to find an answer that I can understand. So kindly, if somebody could explain to me with the help of examples what is cardinality in da..

Change window location Jquery

I am using ajax to load my website content and want to update the window location when ajax is successful. How can I update the window location to "/newpage"?? I need users to be able to go back and ..

Adding dictionaries together, Python

I have two dictionaries and I'd like to be able to make them one: Something like this pseudo-Python would be nice: dic0 = {'dic0': 0} dic1 = {'dic1': 1} ndic = dic0 + dic1 # ndic would equal {'dic0..

Check string for nil & empty

Is there a way to check strings for nil and "" in Swift? In Rails, I can use blank() to check. I currently have this, but it seems overkill: if stringA? != nil { if !stringA!.isEmpty { ..

ORA-01652: unable to extend temp segment by 128 in tablespace SYSTEM: How to extend?

I have a large Oracle table, which contains 542512 rows. It has three columns and when I try to create an index for it with the following command: CREATE INDEX FTS_INDEX ON FILTERED_TEKLI_IIS_TABLO..

Calling constructors in c++ without new

I've often seen that people create objects in C++ using Thing myThing("asdf"); Instead of this: Thing myThing = Thing("asdf"); This seems to work (using gcc), at least as long as there are no te..

How can I make the cursor turn to the wait cursor?

How can I display the Wait/Busy Cursor (usually the hourglass) to the user to let them know the program is doing something?..

How to initialize an array in one step using Ruby?

I initialize an array this way: array = array << '1' << '2' << '3' Is it possible to do that in one step? If so, how?..

Export specific rows from a PostgreSQL table as INSERT SQL script

I have a database schema named: nyummy and a table named cimory: create table nyummy.cimory ( id numeric(10,0) not null, name character varying(60) not null, city character varying(50) not null..

How do I ignore a directory with SVN?

I just started using SVN, and I have a cache directory that I don't need under source control. How can I ignore the whole directory/folder with SVN? I am using Versions and TextMate on OS X and ..

What does it mean if a Python object is "subscriptable" or not?

Which types of objects fall into the domain of "subscriptable"?..

HTML Table cellspacing or padding just top / bottom

Can you have cellpadding or spacing just on the top/ bottom as opposed to all (T, B, L, R) ?..

AndroidStudio SDK directory does not exists

I am using Android Studio for a project on SVN (usually on Windows PCs). Lately I want to run this on a Mac, it keep giving the below error: Error:The SDK directory '/Users/AhmadMusa/Desktop/[PRO..

String Pattern Matching In Java

I want to search for a given string pattern in an input sting. For Eg. String URL = "https://localhost:8080/sbs/01.00/sip/dreamworks/v/01.00/cui/print/$fwVer/{$fwVer}/$lang/en/$model/{$model}/$regio..

Executing JavaScript without a browser?

I am looking into Javascript programming without a browser. I want to run scripts from the Linux or Mac OS X command line, much like we run any other scripting language (ruby, php, perl, python...) $..

How to set HTTP headers (for cache-control)?

How to enable browser caching for my site? Do I just put cache-control:public somewhere up in my header like this? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3...

How do I capture the output of a script if it is being ran by the task scheduler?

Using Windows Server 2008, how do I go about capturing the output of a script that is being ran with the windows task scheduler? I'm testing a rather long custom printing batch-script, and for debugg..

Escape double quote character in XML

Is there an escape character for a double quote in xml? I want to write a tag like: <parameter name="Quote = " "> but if I put ", then that means string has ended. I need something like thi..

"A referral was returned from the server" exception when accessing AD from C#

DirectoryEntry oDE = new DirectoryEntry("LDAP://DC=Test1,DC=Test2,DC=gov,DC=lk"); using (DirectorySearcher ds = new DirectorySearcher(oDE)) { ds.PropertiesToLoad.Add("name"); ds.PropertiesToL..

Understanding esModuleInterop in tsconfig file

I was checking out someone .tsconfig file and there I spotted --esModuleInterop This is his .tsconfig file { "compilerOptions": { "moduleResolution": "node", &q..

java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

I wrote a Java Servlet program but when I run it, it was showing the Exception java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver My code is package skypark; import*; imp..