Questions Tagged with #Dirtyread

Split string into individual words Java

I would like to know how to split up a large string into a series of smaller strings or words. For example: I want to walk my dog. I want to have a string: "I", another string:"want", etc. How ..

Why does Google prepend while(1); to their JSON responses?

Why does Google prepend while(1); to their (private) JSON responses? For example, here's a response while turning a calendar on and off in Google Calendar: while (1); [ ['u', [ ['smsSentFlag',..

Fastest method of screen capturing on Windows

I want to write a screencasting program for the Windows platform, but am unsure of how to capture the screen. The only method I'm aware of is to use GDI, but I'm curious whether there are other ways t..

Get the distance between two geo points

I want to make an app which checks the nearest place where a user is. I can easily get the location of the user and I have already a list of places with latitude and longitude. What would be the best..

MySQL Query - Records between Today and Last 30 Days

I want to return all records that were added to the database within the last 30 days. I need to convert the date to mm/dd/yy because of display purposes. create_date between DATE_FORMAT(curdate(),..

PadLeft function in T-SQL

I have the following table A: id ---- 1 2 12 123 1234 I need to left-pad the id values with zero's: id ---- 0001 0002 0012 0123 1234 How can I achieve this?..

SQL Server - inner join when updating

I have the below query which does not work. What am I doing wrong? Is this even possible? UPDATE ProductReviews AS R INNER JOIN products AS P ON = SET R.status = '0' WHERE R...

How can I convert string to double in C++?

How can I convert string to double in C++? I want a function that returns 0 when the string is not numerical...

Right pad a string with variable number of spaces

I have a customer table that I want to use to populate a parameter box in SSRS 2008. The cust_num is the value and the concatenation of the cust_name and cust_addr will be the label. The required fiel..

Where to declare variable in react js

I am trying to declare a variable in a react-js class. The variable should be accessible in different functions. This is my code class MyContainer extends Component { constructor(props) { ..

How to redirect to a route in laravel 5 by using href tag if I'm not using blade or any template?

Route::get('/page','UserController@view page'); is my route. I have a list with href tag and I want to redirect to this route. <ul> <li><a href="">how it works</a><..

Best way to access web camera in Java

I need to access web camera using Java. This is what I want to do Access web cam Now the user can see web cam working because his face is visible on screen (have heard some libs are there which doe..

counting the number of lines in a text file

I'm reading lines off of text file and I'm wondering if this is a good way to go? I had to write the function numberoflines to decrease the number_of_lines variable by one because within the while loo..

Sorting std::map using value

I need to sort an std::map by value rather than by key. Is there an easy way to do it? I got one solution from the follwing thread: std::map sort by data? Is there a better solution? map<long, ..

MySQL Server has gone away when importing large sql file

I tried to import a large sql file through phpMyAdmin...But it kept showing error 'MySql server has gone away' What to do?..

Virtual/pure virtual explained

What exactly does it mean if a function is defined as virtual and is that the same as pure virtual?..

Incorrect integer value: '' for column 'id' at row 1

I am trying to insert into my mySQL database. The first column is the 'id' column, since its an auto_increment field, I left it blank. For some reason, I am unable to insert and I am getting the error..

How do I check to see if a value is an integer in MySQL?

I see that within MySQL there are Cast() and Convert() functions to create integers from values, but is there any way to check to see if a value is an integer? Something like is_int() in PHP is what ..

Design Android EditText to show error message as described by google

I need an EditText that looks like this onError: calling onError looks like this instead : Note: the app is running on SDK 19 (4.4.2) min SDK is 1 Is there a method similar to setError that..

How can I clear the content of a file?

I need to clear the contents of a particular file every time the applications starts. How do I do it?..

Load local javascript file in chrome for testing?

I am trying to test some JavaScript on my local computer using the Chrome browser but Chrome will not load local resources. Is there an easy work around for this?..

How to return a resultset / cursor from a Oracle PL/SQL anonymous block that executes Dynamic SQL?

I have this table: ALLITEMS --------------- ItemId | Areas --------------- 1 | EAST 2 | EAST 3 | SOUTH 4 | WEST The DDL: drop table allitems; Create Table Allitems(ItemId..

How to set JAVA_HOME environment variable on Mac OS X 10.9?

I just purchased a brand new MacBook Pro. This is my first MAC ever and I'm still trying to get the hang of navigating my way around. Anyway, I'm also new to Java and I've been practicing on my Wi..

Access Https Rest Service using Spring RestTemplate

Can anybody provide me with a code sample to access rest service url secured with https using spring rest template. I have the certificate, username and password. Basic Authentication is used on the ..

How do I include a newline character in a string in Delphi?

I want to create a string that spans multiple lines to assign to a Label Caption property. How is this done in Delphi?..

How to convert const char* to char* in C?

In my project there is a method which only returns a const char*, whereas I need a char* string, as the API doesn't accept const char*. Any idea how to convert between const char* to char*?..

Spring Boot without the web server

I have a simple Spring Boot application that gets messages from a JMS queue and saves some data to a log file, but does not need a web server. Is there any way of starting Spring Boot without the web ..

Get data type of field in select statement in ORACLE

Can I get data types of each column I selected instead of the values, using a select statement? FOR EXAMPLE: SELECT, a.surname, b.ordernum FROM customer a JOIN orders b ON = and ..

jQuery validate Uncaught TypeError: Cannot read property 'nodeName' of null

I have the following code: $(document).ready ( function () { $.validator.addMethod( "lessThan", function (value, element, param) { // bind to the b..

Atom menu is missing. How do I re-enable

The menu in Atom text editor is gone. I dont know how I disabled it. I tried F1-12 keys. How do I re enable it? Here's how it's looking now: ..

How do I convert a float to an int in Objective C?

Total newbie question but this is driving me mad! I'm trying this: myInt = [myFloat integerValue]; but I get an error saying essentially integerValue doesn't work on floats. How do I do it?..

How to import a SQL Server .bak file into MySQL?

The title is self explanatory. Is there a way of directly doing such kind of importing?..

How to add "on delete cascade" constraints?

In PostgreSQL 8 is it possible to add ON DELETE CASCADES to the both foreign keys in the following table without dropping the latter? # \d scores Table "public.scores" Column | Type..

How to get value by key from JObject?

I have a JObject like this: { "@STARTDATE": "'2016-02-17 00:00:00.000'", "@ENDDATE": "'2016-02-18 23:59:00.000'" } I want to get @STARTDATE and @ENDDATE value from JObject. This is a sample ..

Set IDENTITY_INSERT ON is not working

I want to copy a table Equipment from one database MyDBQA to our test database MyDB. There is an identity column in the table which is the primary key (int, not null). But I got an error: Msg 810..

Deserialize a JSON array in C#

I'm stuck with a tricky problem. I've a JSON string of this format: [{ "record": { "Name": "Komal", "Age": 24, "Location": "Siliguri" } ..

How to resize an image to a specific size in OpenCV?

IplImage* img = cvLoadImage("something.jpg"); IplImage* src = cvLoadImage("src.jpg"); cvSub(src, img, img); But the size of the source image is different from img. Is there any opencv function to r..

Filtering Pandas Dataframe using OR statement

I have a pandas dataframe and I want to filter the whole df based on the value of two columns in the data frame. I want to get back all rows and columns where IBRD or IMF != 0. alldata_balance = a..

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)

I'm having problems dealing with unicode characters from text fetched from different web pages (on different sites). I am using BeautifulSoup. The problem is that the error is not always reproducibl..

How to add an action to a UIAlertView button using Swift iOS

I want to add another button other than the "OK" button which should just dismiss the alert. I want the other button to call a certain function. var logInErrorAlert: UIAlertView = UIAlertView() logIn..

How to convert XML to java.util.Map and vice versa

I'm searching a lightweight API (preferable single class) to convert a Map<String,String> map = new HashMap<String,String(); to xml and, vice versa, convert the XML back to a Map. example..

Put quotes around a variable string in JavaScript

I have a JavaScript variable: var text = "" Text can be multiple links. How can I put '' around the variable string? I want the strings to, for example, look like this: "'http:/..

Convert tuple to list and back

I'm currently working on a map editor for a game in pygame, using tile maps. The level is built up out of blocks in the following structure (though much larger): level1 = ( (1,1,1,1,1,1) ..

Create a hexadecimal colour based on a string with JavaScript

I want to create a function that will accept any old string (will usually be a single word) and from that somehow generate a hexadecimal value between #000000 and #FFFFFF, so I can use it as a colour ..

How to replace comma with a dot in the number (or any replacement)

I could not found a solution yet, for replacing , with a dot. var tt="88,9827"; tt.replace(/,/g, '.') alert(tt) //88,9827 i'm trying to replace a comma a dot thanks in advance..

Android Studio: Gradle: error: cannot find symbol variable

I was working on my app and everything was normal until I tried to display image in java. I ran the app once and it ran normally, the picture was displayed. After that it asked me to import some libr..

Command line: search and replace in all filenames matched by grep

I'm trying to search and replace a string in all files matched by grep: grep -n 'foo' * will give me output in the form: [filename]:[line number]:[text] For each file returned by grep, I'd like to mo..

Why does Firebug say toFixed() is not a function?

I am using jQuery 1.7.2 and jQuery UI 1.9.1. I am using the code below within a slider. ( I have a function that should test two values and depending on the difference bet..

Reading data from XML

I'm planning to use XML for database purpose. Only thing I was able to do is read whole XML file. I want to be able to read only some data and I don't know how to do that. Here is a simple XML <B..

How to convert a time string to seconds?

I need to convert time value strings given in the following format to seconds, for example: 1.'00:00:00,000' -> 0 seconds 2.'00:00:10,000' -> 10 seconds 3.'00:01:04,000' -> 64 seconds 4.'..

SQL Server - find nth occurrence in a string

I have a table column that contains values such as abc_1_2_3_4.gif or zzz_12_3_3_45.gif etc. I want to find the index of each underscore _ in the above values. There will only ever be four underscore..

Detect current device with UI_USER_INTERFACE_IDIOM() in Swift

What is the equivalent of UI_USER_INTERFACE_IDIOM() in Swift to detect between iPhone and iPad? I get an Use of unresolved identifier error when compiling in Swift...

How to get the parent dir location

this code is get the templates/blog1/page.html in path = os.path.join(os.path.dirname(__file__), os.path.join('templates', 'blog1/page.html')) but i want to get the parent dir location: aPa..

Where do I call the BatchNormalization function in Keras?

If I want to use the BatchNormalization function in Keras, then do I need to call it once only at the beginning? I read this documentation for it: I don't see w..

Unable to copy ~/.ssh/

I’m following in Generating SSH Keys, it says sudo apt-get install xclip Downloads and installs xclip. If you don't have apt-get, you might need to use another installer (like yum) xclip -sel cli..

Regular expression for exact match of a string

I want to match two passwords with regular expression. For example I have two inputs "123456" and "1234567" then the result should be not match (false). And when I have entered "123456" and "123456" t..

How to make HTTP Post request with JSON body in Swift

I'm trying to make an HTTP post request with a JSON body : How to be able to add an NSdictionnary to the HTTP request body. Here is my code, it doesn't seem to work properly. var entry1 = Response(..

Detach (move) subdirectory into separate Git repository

I have a Git repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository. How can I..

How can strip whitespaces in PHP's variable?

I know this comment I would like to have a similar tool like tr for PHP such that I can run simply tr -d " " "" I run unsuccessfully the function php_strip_whitespace by $tags_trimmed = p..

How to create ls in windows command prompt?

I want to use ls in windows command prompt and make it run the dir command. How can I do that?..

"Could not run curl-config: [Errno 2] No such file or directory" when installing pycurl

I'm trying to install pycurl via: sudo pip install pycurl It downloaded fine, but when when it runs I get the following traceback: Downloading/unpacking pycurl Running egg_info..

How to use onResume()?

Can anyone give me an example that uses onResume() in Android? Also, if I want to restart the activity at the end of the execution of another, which method is executed—onCreate() or onResume()? An..

Reading from memory stream to string

I am trying to write an object to an Xml string and take that string and save it to a DB. But first I need to get the string... private static readonly Encoding LocalEncoding = Encoding.UTF8; ..

How can I read the contents of an URL with Python?

The following works when I paste it on the browser: But when I try reading the URL with Python nothing happens: link = '

android start activity from service

Android: public class LocationService extends Service { @Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); startActivity(new Intent(this,..

Generate random int value from 3 to 6

Is it possible in Microsoft SQL Server generate random int value from Min to Max (3-9 example, 15-99 e.t.c) I know, i can generate from 0 to Max, but how to increase Min border? This query generate ..

How to order citations by appearance using BibTeX?

By default (using the plain style) BibTeX orders citations alphabetically. How to order the citations by order of appearance in the document?..

Best way to iterate through a Perl array

Which is the best implementation(in terms of speed and memory usage) for iterating through a Perl array? Is there any better way? (@Array need not be retained). Implementation 1 foreach (@Array) { ..

Android Studio Run/Debug configuration error: Module not specified

I am getting a 'Module not specified' error in my run config. I have no module showing in the drop down yet I can see my module no probs. The issue came about when I refactored my module name, changed..

How to use Oracle's LISTAGG function with a unique filter?

I have a table like this: group_id name -------- ---- 1 David 1 John 1 Alan 1 David 2 Julie 2 Charles And I want the following result: group_id ..

jQuery Upload Progress and AJAX file upload

It seems like I have not clearly communicated my problem. I need to send a file (using AJAX) and I need to get the upload progress of the file using the Nginx HttpUploadProgressModule. I need a good s..

seek() function?

Please excuse my confusion here but I have read the documentation regarding the seek() function in python (after having to use it) and although it helped me I am still a bit confused on the actual mea..

How can I alias a default import in JavaScript?

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

lodash: mapping array to object

Is there a built-in lodash function to take this: var params = [ { name: 'foo', input: 'bar' }, { name: 'baz', input: 'zle' } ]; And output this: var output = { foo: 'bar', baz: 'z..

Android TextView padding between lines

I have a TextView which displays a long text. I want to give some space between lines like in CSS with line-height property. How can I do it?..

C++ convert hex string to signed integer

I want to convert a hex string to a 32 bit signed integer in C++. So, for example, I have the hex string "fffefffe". The binary representation of this is 11111111111111101111111111111110. The sig..

WSDL/SOAP Test With soapui

I have tested my web services (wsdl/soap) with soapui. and i have the errors : http/log : error 400 BAD REQUEST. What can be the error please with my wsdl ? error/log : un Jun 05 14:10:37 CEST 2011..

How to make the first option of <select> selected with jQuery

How do I make the first option of selected with jQuery? <select id="target"> <option value="1">...</option> <option value="2">...</option> </select> ..

Resource blocked due to MIME type mismatch (X-Content-Type-Options: nosniff)

I am developing a web page using JavaScript and HTML, everything was working good when I have received this list of errors from my HTML page: The resource from “

How to check if an alert exists using WebDriver?

I need to check the existence of Alert in WebDriver. Sometimes it pops up an alert but sometimes it will not pop up. I need to check if the alert exists first, then I can accept or dismiss it or it w..

How to query first 10 rows and next time query other 10 rows from table

I have more than 500 rows with in my Database Table with particular date. To query the rows with particular date. select * from msgtable where cdate='18/07/2012' This returns 500 rows. How to qu..

Pipe output and capture exit status in Bash

I want to execute a long running command in Bash, and both capture its exit status, and tee its output. So I do this: command | tee out.txt ST=$? The problem is that the variable ST captures the e..

Pandas Replace NaN with blank/empty string

I have a Pandas Dataframe as shown below: 1 2 3 0 a NaN read 1 b l unread 2 c NaN read I want to remove the NaN values with an empty string so that it looks like so: ..

How to parse data in JSON format?

My project is currently receiving a JSON message in python which I need to get bits of information out of. For the purposes of this, let's set it to some simple JSON in a string: jsonStr = '{"one" : ..

How to playback MKV video in web browser?

I am trying to make a MKV video with a MPEG4 video codec and AC3 audio codec available to be played online using Mozilla or Chrome. I have tried multiple methods including native HTML5, which plays ba..

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

Check if an element has event listener on it. No jQuery

How to check if an element has event listener on it, if I use an inline function on it like the code below? Because I have a function that recalls the function and add the event listener, but it cause..

What is the use of BindingResult interface in spring MVC?

Is BindingResult useful to bind just exceptions with view, or something else? what is the exact use of BindingResult? Or is it useful in binding model attribute with view...

Intercept page exit event

When editing a page within my system, a user might decide to navigate to another website and in doing so could lose all the edits they have not saved. I would like to intercept any attempt to go to a..

Parse JSON String to JSON Object in C#.NET

I have a JSON String returned by my SOAP web service in .NET. It is as follows: { "checkrecord": [ { "rollno":"abc2", "percentage":40, "attended":12, "missed":34 ..

Generate full SQL script from EF 5 Code First Migrations

How do I use Entity Framework 5 Code First Migrations to create a full database script from the initial (empty) state to the latest migration? The blog post at MSDN Blog suggests to do this, but it s..

Add inline style using Javascript

I'm attempting to add this code to a dynamically created div element style = "width:330px;float:left;" The code in which creates the dynamic div is var nFilter = document.createElement('div'); n..

How do I resolve a HTTP 414 "Request URI too long" error?

I have developed a PHP web app. I am giving an option to the user to update multiple issues on one go. In doing so, sometimes the user is encountering this error. Is there any way to increase the leng..

How to plot a very simple bar chart (Python, Matplotlib) using input *.txt file?

I use Python 2.7 and matplotlib. I have a *.txt data file : 0 14-11-2003 1 15-03-1999 12 04-12-2012 33 09-05-2007 44 16-08-1998 55 25-07-2001 76 31-12-2011 87 25-06-1993 118 16-02-1995 119 10-02-1981..

Exit a while loop in VBS/VBA

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

Reading a text file and splitting it into single words in python

I have this text file made up of numbers and words, for example like this - 09807754 18 n 03 aristocrat 0 blue_blood 0 patrician and I want to split it so that each word or number will come up as a ne..

How to find an object in an ArrayList by property

How can I find an object, Carnet, in a ArrayList<Carnet> knowing its property codeIsin. List<Carnet> listCarnet = carnetEJB.findAll(); public class Carnet { private String codeTitre..

Split string in C every white space

I want to write a program in C that displays each word of a whole sentence (taken as input) at a seperate line. This is what i have done so far: void manipulate(char *buffer); int get_words(char *b..

Where do I put my php files to have Xampp parse them?

I finished installing Ubuntu 10 for netbooks, and XAMPP. The XAMPP website tutorial made it very easy to install, then left me high and dry. Everything works, but I have no idea where to put my handwr..

Xcode 6 Storyboard the wrong size?

Built a new project from scratch in Swift in Xcode 6 (Beta 1) and have seen some strange behaviour with Storyboards and the output that I am viewing. I have built a simple interface (as shown below) ..

Is there a unique Android device ID?

Do Android devices have a unique ID, and if so, what is a simple way to access it using Java?..

How to merge remote master to local branch

I have a local branch of a project ("configUpdate") that I've forked from somebody else's project and I've done a load of changes on it and would like to merge the changes they've made in to my local ..

NSURLConnection Using iOS Swift

I am trying to follow this tutorial and connect to a JSON api using Swift and NSURLConnection. I can see that it is hitting the url but the connectionDidFinishLoading does not seem to fire. import U..

Python Socket Receive Large Amount of Data

When I try to receive larger amounts of data it gets cut off and I have to press enter to get the rest of the data. At first I was able to increase it a little bit but it still won't receive all of it..

How can I select checkboxes using the Selenium Java WebDriver?

How can I check the checkboxes using an id or XPath expression? Is there a method similar to select by visibletext for a dropdown? Going through the examples given for all other related questions, I c..

Line break in HTML with '\n'

Is there a way to make HTML properly treat \n line breaks? Or I have to replace them with <br/>?

Remove a parameter to the URL with JavaScript

Original URL: http://yourewebsite.php?id=10&color_id=1 Resulting URL: http://yourewebsite.php?id=10 I got the function adding Param function insertParam(key, value){ key = escape(key); ..

Type of expression is ambiguous without more context Swift

I am getting a 'Type of expression is ambiguous without more context ' on this part of code from a project I am trying to upgrade to latest Swift version. I can't seem to figure it out. I tried differ..

Why are only a few video games written in Java?

Why aren't many commercial, 3D video games (not random open source 2D ones) written in Java? In theory, it makes a lot of sense: you get a productivity boost and a cross-platform application almost fo..

How to find which version of Oracle is installed on a Linux server (In terminal)

I am in terminal in Redhat 5.5 and I need to find out which version of Oracle is installed. I am pretty new at Linux, but I have searched Google for a while and I can't find what I need. I have to loc..

Google Maps API warning: NoApiKeys

I've been using Google Maps API v3 for some time without an API key, and it worked well. It still works, but I get a warning in the console: Google Maps API warning: NoApiKeys https://developers..

Bootstrap Element 100% Width

I want to create alternating 100% colored blocks. An "ideal" situation is illustrated as an attachment, as well as the current situation. Desired setup: Currently: My first idea was to create..

XML Parsing - Read a Simple XML File and Retrieve Values

I've written a Task Scheduling program for learning purposes. Currently I'm saving the scheduled tasks just as plain text and then parsing it using Regex. This looks messy (code wise) and is not very ..

Executors.newCachedThreadPool() versus Executors.newFixedThreadPool()

newCachedThreadPool() versus newFixedThreadPool() When should I use one or the other? Which strategy is better in terms of resource utilization?..

How do I move an existing Git submodule within a Git repository?

I would like to change the directory name of a Git submodule in my Git superproject. Lets suppose I have the following entry in my .gitmodules file: [submodule ".emacs.d/vimpulse"] path = .emacs.d..

Find document with array that contains a specific value

If I have this schema... person = { name : String, favoriteFoods : Array } ... where the favoriteFoods array is populated with strings. How can I find all persons that have "sushi" as their..

Writing a dictionary to a csv file with one line for every 'key: value'

I've got a dictionary: mydict = {key1: value_a, key2: value_b, key3: value_c} I want to write the data to a file dict.csv, in this style: key1: value_a key2: value_b key3: value_c I wrote: impo..

Removing duplicate elements from an array in Swift

I might have an array that looks like the following: [1, 4, 2, 2, 6, 24, 15, 2, 60, 15, 6] Or, really, any sequence of like-typed portions of data. What I want to do is ensure that there is only one o..

What are good examples of genetic algorithms/genetic programming solutions?

Genetic algorithms (GA) and genetic programming (GP) are interesting areas of research. I'd like to know about specific problems you have solved using GA/GP and what libraries/frameworks you used if..

How to enable mbstring from php.ini?

I have real difficulties with enabling mbstring extension on my localhost. I'm using XAMPP 1.7.4, for Windows, which has PHP 5.3.5, and tried to edit my php.ini file according to the documentation a.. MVC ModelState.Clear

Can anyone give me a succinct definition of the role of ModelState in MVC (or a link to one). In particular I need to know in what situations it is necessary or desirable to call ModelState.C..

<select> HTML element with height

Does anyone know of a way to style an HTML select element so that it has a certain height and looks good across browsers? I've tried simply setting height in CSS but the text inside the box is vertic..

Could not resolve all dependencies for configuration ':classpath'

I cant seem to get build tools for the latest gradle at all. I suspect its something to do with proxy setting for gradle. I have had a good look online but still cant seem to find a solution. I use gr..

Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?

I'd like to have iOS to open URLs from my domain (e.g. with my app whenever the app is installed on the phone, and with Mobile Safari in case it is not. I read it is possible to..

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '...' is therefore not allowed access

I'm using .htaccess to rewrite urls and I used html base tag in order to make it work. Now, when I try to make an ajax request I get the following error: XMLHttpRequest cannot load http://www.exa..

Dart SDK is not configured

I installed Flutter and set up Android Studio. Then I cloned an example of flutter on GitHub ( and launched it in Android Studio, but it warns me "Dart SDK is n..

Adding a line break in MySQL INSERT INTO text

Could someone tell me how to add a new line in a text that I enter in a MySql table? I tried using the '\n' in the line I entered with INSERT INTO statement but '\n' is shown as it is. Actually I ha..

How to bind Events on Ajax loaded Content?

I have a link, myLink, that should insert AJAX-loaded content into a div (appendedContainer) of my HTML page. The problem is that the click event I have bound with jQuery is not being executed on the ..

javascript setTimeout() not working

Hi I'm trying to use the function setTimeout() in javascript except it's not working. Thanks in advance to anyone who can help. <!DOCTPYE html> <html> <head> <script> ..

What does Docker add to lxc-tools (the userspace LXC tools)?

If you take a look at Docker's features, most of them are already provided by LXC. So what does Docker add? Why would I use Docker over plain LXC?..

How do I clone a single branch in Git?

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

Find out free space on tablespace

Our application has failed a few times because an 'ORA-01536: space quota exceeded for tablespace', and we would like to be able to prevent this by checking regularly the free space on the tablespace ..

How to find out if a Python object is a string?

How can I check if a Python object is a string (either regular or Unicode)?..

What is console.log in jQuery?

What is console.log? What is it used for in jQuery?..

Maven: repository element was not specified in the POM inside distributionManagement?

I am trying to run the command, mvn release:perform, but I get this error: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project git-demo: Deploy..

How to merge a specific commit in Git

I have forked a branch from a repository in GitHub and committed something specific to me. Now I found the original repository had a good feature which was at HEAD. I want to merge it only without pr..

Python Pandas Error tokenizing data

I'm trying to use pandas to manipulate a .csv file but I get this error: pandas.parser.CParserError: Error tokenizing data. C error: Expected 2 fields in line 3, saw 12 I have tried to read the..

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

How do I set the version information for an existing .exe, .dll?

As part of our build process I need to set the version information for all of our compiled binaries. Some of the binaries already have version information (added at compile time) and some do not. I ..

Is it possible to insert multiple rows at a time in an SQLite database?

In MySQL you can insert multiple rows like this: INSERT INTO 'tablename' ('column1', 'column2') VALUES ('data1', 'data2'), ('data1', 'data2'), ('data1', 'data2'), ('data1', 'data2'); ..

How to check if a file exists in a shell script

I'd like to write a shell script which checks if a certain file, archived_sensor_data.json, exists, and if so, deletes it. Following

How to add/update an attribute to an HTML element using JavaScript?

I'm trying to find a way that will add / update attribute using JavaScript. I know I can do it with setAttribute() function but that doesn't work in IE...

The Network Adapter could not establish the connection when connecting with Oracle DB

When trying to connect with a remote Oracle database via JDBC I receive the following exception: java.sql.SQLRecoverableException: IO-fout: The Network Adapter could not establish the connection at o..

How to Get enum item name from its value

I declared a enum type as this, enum WeekEnum { Mon = 0; Tue = 1; Wed = 2; Thu = 3; Fri = 4; Sat = 5; Sun = 6; }; How can I get the item name "Mon, Tue, etc" when I already have the item value "0, ..

Connecting to a network folder with username/password in Powershell

I often access shared network folders in Powershell to grab files etc. But if the share requires a username/password, Powershell does not prompt me for these, unlike Windows Explorer. If I connect to ..

IOException: The process cannot access the file 'file path' because it is being used by another process

I have some code and when it executes, it throws a IOException, saying that The process cannot access the file 'filename' because it is being used by another process What does this mean, and..

HTML 5 Favicon - Support?

I was reading the Favicon page on Wikipedia. They mention the HTML 5 spec for Favicon: The current HTML5 specification recommends specifying size icons in multiple sizes using the attributes rel=..

How do I programmatically get the GUID of an application in .NET 2.0

I need to access the assembly of my project in C# .NET 2.0. I can see the GUID in the 'Assembly Information' dialog in under project properties, and at the moment I have just copied it to a const in t..

How to update values using pymongo?

I've a mongodb collection in this form: {id=ObjectId(....),key={dictionary of values}} where dictionary of values is {'a':'1','b':'2'.....} Let dictionary of values be 'd'. I need to update the val..

How do you say not equal to in Ruby?

This is a much simpler example to what I'm trying to do in my program but is the similar idea. In an if statement how do I say say not equal to? Is != correct? def test vara = 1 varb = 2 if va..

Using a batch to copy from network drive to C: or D: drive

I am having issues executing a batch file that will copy files from a mapped network drive to a local drive. Here is the batch code I'm using (it's just in a low level folder at the moment as I don't..

"Unable to get the VLookup property of the WorksheetFunction Class" error

I am trying to develop a form to track invoices as they come in. The form will have a combobox where I can click on and select a vendor number. I want the textbox to automatically fill in based on the..

What is the default Precision and Scale for a Number in Oracle?

When creating a column of type NUMBER in Oracle, you have the option of not specifying a precision or scale. What do these default do if you don't specify them?..

Change string color with NSAttributedString?

I have a slider for a survey that display the following strings based on the value of the slider: "Very Bad, Bad, Okay, Good, Very Good". Here is the code for the slider: - (IBAction) sliderValueC..

Using SQL LIKE and IN together

Is there a way to use LIKE and IN together? I want to achieve something like this. SELECT * FROM tablename WHERE column IN ('M510%', 'M615%', 'M515%', 'M612%'); So basically I want to be able to m..

Print a list of all installed node.js modules

In a node.js script that I'm working on, I want to print all node.js modules (installed using npm) to the command line. How can I do this? console.log(__filename); //now I want to print all installe..

Communication between tabs or windows

I was searching for a way how to communicate between multiple tabs or windows in a browser (on the same domain, not CORS) without leaving traces. There were several solutions: using window object po..

Eclipse Workspaces: What for and why?

I have seen, read and thought of different ways of using workspaces (per project, per application (multi-asseted or not), per program language, per target (web-development, plugins,..), and so on) and..

long long int vs. long int vs. int64_t in C++

I experienced some odd behavior while using C++ type traits and have narrowed my problem down to this quirky little problem for which I will give a ton of explanation since I do not want to leave anyt..

Is there any publicly accessible JSON data source to test with real world data?

I'm working on a JavaScript dynamically loaded tree view user control. I'd like to test it with real world data. Does anybody know any public service with an API that provides access to hierarchical ..

How do I remove accents from characters in a PHP string?

I'm attempting to remove accents from characters in PHP string as the first step to making the string usable in a URL. I'm using the following code: $input = "Fóø Bår"; setlocale(LC_ALL, "en_US...

WCF error - There was no endpoint listening at

I am developing a WCF service, running IIS6 on Window server 2003. I have built a test client to talk to the WCF service and I am getting the error below. I have been looking at this error for days an..

Difference between window.location.href and top.location.href

Can Anyone tell me the difference between window.location.href and top.location.href ? And also where to use which one. And which one will be better when redirecting after an ajax call in mvc?..

How to sort with lambda in Python

In Python, I am trying to sort by date with lambda. I can't understand my error message. The message is: <lambda>() takes exactly 1 argument (2 given) The line I have is a = sorted(a, lambd..

Resolve Git merge conflicts in favor of their changes during a pull

How do I resolve a git merge conflict in favor of pulled changes? Basically I need to remove all conflicting changes from a working tree without having to go through all of the conflicts with a git ..

Likelihood of collision using most significant bits of a UUID in Java

If I'm using Long uuid = UUID.randomUUID().getMostSignificantBits() how likely is it to get a collision. It cuts off the least significant bits, so there is a possibility that you run into a collision..

ImportError: numpy.core.multiarray failed to import

I'm trying to run this program import cv2 import time cv.NamedWindow("camera", 1) capture = cv.CaptureFromCAM(0) while True: img = cv.QueryFrame(capture) cv.ShowImage("camera..

Keyboard shortcut to comment lines in Sublime Text 2

In Sublime Text 2, how do I enclose a selection in a comment? Is there a keyboard shortcut for this action?..

Why do I get a warning icon when I add a reference to an MEF plugin project?

I wish to test the core class of a plugin by directly referencing the plugin project and instantiating the plugin class. When I create a test Console App project and add a project reference to the plu..

How to force Sequential Javascript Execution?

I've only found rather complicated answers involving classes, event handlers and callbacks (which seem to me to be a somewhat sledgehammer approach). I think callbacks may be useful but I cant seem to..

GitHub: How to make a fork of public repository private?

How can I fork a public repository, but make my fork private? I do have the subscription to support private repositories...

Getting activity from context in android

This one has me stumped. I need to call an activity method from within a custom layout class. The problem with this is that I don't know how to access the activity from within the layout. ProfileVie..

Add some word to all or some rows in Excel?

If I want to add some word before each number of a column, how can I do that. 10 s 123 24 c 235 33 s 345 46 s 346 59 s 546 62 c 277 I mean : for example I put the word "k" before each number ..

Prevent Android activity dialog from closing on outside touch

I have an activity that is using the Theme.Dialog style such that it is a floating window over another activity. However, when I click outside the dialog window (on the background activity), the dialo..

Copy a git repo without history

I have a private repository on GitHub that I want to make public. However, some of the initial commits contain information that I don't want to publicize (hard-coded credentials, etc). What is the eas..

The application was unable to start correctly (0xc000007b)

I have a client/server app which I have been developing on a single PC. Now it needs two serial ports, so I borrowed a PC from a friend. When I build my app and try to run or debug it (whether in the..

Retrieving the last record in each group - MySQL

There is a table messages that contains data as shown below: Id Name Other_Columns ------------------------- 1 A A_data_1 2 A A_data_2 3 A A_data_3 4 B B_data_..

Convert Pandas DataFrame to JSON format

I have a Pandas DataFrame with two columns – one with the filename and one with the hour in which it was generated: File Hour F1 1 F1 2 F2 1 F3 1 I..

how to call a onclick function in <a> tag?

i want to open a new window on click of 1 $leadID = "<a href=', myWin, scrollbars=yes, width=400, height=650);'>1</a>"; it is not sh..

Open page in new window without popup blocking

Hope you can help a bit here... I have a form that translate a word in a field, populate the field with the translated term and then do submit action all in one submit button. the submit is being mad..

Android ADB devices unauthorized

Configuration: Windows 8.1 ADB version: 1.0.32 Smartphone: Oneplus One Problem I installed the Samsung drivers as it is said to do. When I run the ADB devices command, it said unauthorized. Alre..

Timestamp conversion in Oracle for YYYY-MM-DD HH:MM:SS format

I'm trying to insert records with YYYY-MM-DD HH:MM:SS format into Oracle from Netezza, but I'm getting invalid date type. How can I accomplish this one? CREATE TABLE AM_PROGRAM_TUNING_EVENT_TMP1 ( ..

Using Javascript: How to create a 'Go Back' link that takes the user to a link if there's no history for the tab or window?

EDIT-2: None of the answers seem to work. Not even the one I previously marked as the answer of this question. Any help is appreciated. Thanks. First, I have googled for a how-to on creating a 'Go Ba..

Sending email with PHP from an SMTP server

$from = "[email protected]"; $headers = "From:" . $from; echo mail ("[email protected]" ,"testmailfunction" , "Oj",$headers); I have trouble sending email in PHP. I get an error: SMTP server..

TypeError: only length-1 arrays can be converted to Python scalars while trying to exponentially fit data

f=np.loadtxt('Single Small Angle 1.txt',unpack=True,skiprows=2) g=np.loadtxt('Single Small Angle 5.txt',unpack=True,skiprows=2) x = f-g[:,:11944] t=range(len(x)) m=math.log10(abs(x)) np.polyfit(t,m)..

How to check if a variable is not null?

I know that below are the two ways in JavaScript to check whether a variable is not null, but I’m confused which is the best practice to use. Should I do: if (myVar) {...} or if (myVar !== null..

Changing the interval of SetInterval while it's running

I have written a javascript function that uses setInterval to manipulate a string every tenth of a second for a certain number of iterations. function timer() { var section = document.getElementB..

react router v^4.0.0 Uncaught TypeError: Cannot read property 'location' of undefined

I've been having some trouble with react router (i'm using version^4.0.0). this is my index.js import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import './index.c..

Python: How do I make a subclass from a superclass?

In Python, how do you make a subclass from a superclass?..

ASP.NET MVC 404 Error Handling

Possible Duplicate: How can I properly handle 404 in ASP.NET MVC? I've made the changes outlined at 404 Http error handler in Asp.Net MVC (RC 5) and I'm still getting the standard 404 error..

How to get JSON from webpage into Python script

Got the following code in one of my scripts: # # url is defined above. # jsonurl = urlopen(url) # # While trying to debug, I put this in: # print jsonurl # # Was hoping text would contain the actua..

Visual Studio 2015 is very slow

I just finished the installation and the whole IDE is super slow. It seems like it's making some kind of heavy CPU calls in the background where the whole IDE literally freezes and becomes unresponsiv..

JSLint is suddenly reporting: Use the function form of "use strict"

I include the statement: "use strict"; at the beginning of most of my Javascript files. JSLint has never before warned about this. But now it is, saying: Use the function form of "use strict"...

Difference Between Select and SelectMany

I've been searching the difference between Select and SelectMany but I haven't been able to find a suitable answer. I need to learn the difference when using LINQ To SQL but all I've found are standar..

Difference between Subquery and Correlated Subquery

Is the following piece of SQL Query a normal query or a Correlated Subquery ?? SELECT UserID, FirstName, LastName, DOB, GFName, GLName, LoginName, Log..

Can't open config file: /usr/local/ssl/openssl.cnf on Windows

I have installed OpenSSL 64. I want to use a certificate for my nodejs https server. I ran the following command: openssl genrsa -out 1024 But I have got the error: WARNIN..

How to display an unordered list in two columns?

With the following HTML, what is the easiest method to display the list as two columns? <ul> <li>A</li> <li>B</li> <li>C</li> <li>D</..

Excel Validation Drop Down list using VBA

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

CSS pseudo elements in React

I'm building React components. I have added CSS inline in the components as suggested in this brilliant presentation by one of the guys behind React. I've been trying all night to find a way to add CS..

Incrementing in C++ - When to use x++ or ++x?

I'm currently learning C++ and I've learned about the incrementation a while ago. I know that you can use "++x" to make the incrementation before and "x++" to do it after. Still, I really don't know ..