Questions Tagged with #Xmlschemaset

HTTPS connection Python

I am trying to verify the that target exposes a https web service. I have code to connect via HTTP but I am not sure how to connect via HTTPS. I have read you use SSL but I have also read that it did ..

How do I handle a click anywhere in the page, even when a certain element stops the propagation?

We are working on a JavaScript tool that has older code in it, so we cannot re-write the whole tool. Now, a menu was added position fixed to the bottom and the client would very much like it to have ..

Including a css file in a blade template?

I want to include a css file in my Laravel blade template. I've tried: @include(public_path('css/styles.css')) But it says view does not exist. It does exist. How can I include a css file? Pleas..

Creating a blocking Queue<T> in .NET?

I have a scenario where I have multiple threads adding to a queue and multiple threads reading from the same queue. If the queue reaches a specific size all threads that are filling the queue will be ..

Is it possible to use jQuery .on and hover?

I have a <ul> that is populated with javascript after the initial page load. I'm currently using .bind with mouseover and mouseout. The project just updated to jQuery 1.7 so I have the option ..

How do I create a new column from the output of pandas groupby().sum()?

Trying to create a new column from the groupby calculation. In the code below, I get the correct calculated values for each date (see group below) but when I try to create a new column (df['Data4']) w..

Get Value of a Edit Text field

I am learning how to create UI elements. I have created a few EditText input fields. On the click of a Button I want to capture the content typed into that input field. <EditText android:id="@+id/..

How can I explicitly free memory in Python?

I wrote a Python program that acts on a large input file to create a few million objects representing triangles. The algorithm is: read an input file process the file and create a list of triangles..

Any way to make a WPF textblock selectable?

How to allow TextBlock's text to be selectable? I tried to get it to work by displaying the text using a read-only TextBox styled to look like a textblock but this will not work in my case because a T..

Why am I getting this redefinition of class error?

Apologies for the code dump: gameObject.cpp: #include "gameObject.h" class gameObject { private: int x; int y; public: gameObject() { x = 0; y = 0; } gameObj..

How to determine if a number is odd in JavaScript

Can anyone point me to some code to determine if a number in JavaScript is even or odd?..

CREATE TABLE IF NOT EXISTS equivalent in SQL Server

CREATE TABLE IF NOT EXISTS works on mysql but fails with SQL Server 2008 R2. What is the equivalent syntax?..

Remove non-ascii character in string

var str="INFO] :??????, ???????2????, ???????, ????? (Higashikurume)"; and i need to remove all non-ascii character from string, means str only contain "INFO] (Higashikurume)";..

Context.startForegroundService() did not then call Service.startForeground()

I am using Service Class on the Android O OS. I plan to use the Service in the background. The Android documentation states that If your app targets API level 26 or higher, the system imposes..

How to format an inline code in Confluence?

How can I format an inline code in Confluence like this? I mean, not a separate code block, but just inline classname, for example...

Java Multithreading concept and join() method

I'm confused in join() method used in Threads in Java. In the following code: // Using join() to wait for threads to finish. class NewThread implements Runnable { String name; // name of thread ..

For loop in Oracle SQL

I am new to Oracle and I am unaware about using for loop in Oracle SQL (not PL/SQL). I had a requirement to increase the number by +1 in the query and execute the statements; is it possible to use a ..

How to install libusb in Ubuntu

I have a C program that have #include part in the header. I have download libusb-1.0.0 to my computer. If I simply copy libusb-1.0.0 folder to the folder where my C program is, it will not work. The..

How to close an iframe within iframe itself

How do I use javascript or jQuery to close an iframe within iframe itself? I've tried <a href="javascript:self.close()"> but it didn't work...

Detect viewport orientation, if orientation is Portrait display alert message advising user of instructions

I am building a website specifically for mobile devices. There is one page in particular which is best viewed in landscape mode. Is there a way to detect if the user visiting that page is viewing it..

What is the &#xA; character?

What's the meaning of this char?..

Kubernetes how to make Deployment to update image

I do have deployment with single pod, with my custom docker image like: containers: - name: mycontainer image: myimage:latest During development I want to push new latest version and make Dep..

Count all duplicates of each value

I would like a SQL query for MS Jet 4.0 (MSSql?) to get a count of all the duplicates of each number in a database. The fields are: id (autonum), number (text) I have a database with a lot of numb..

How to model type-safe enum types?

Scala doesn't have type-safe enums like Java has. Given a set of related constants, what would be the best way in Scala to represent those constants?..

Shorthand for if-else statement

I have some code with a lot of if/else statements similar to this: var name = "true"; if (name == "true") { var hasName = 'Y'; } else if (name == "false") { var hasName = 'N'; }; But is th..

How can I get the full object in Node.js's console.log(), rather than '[Object]'?

When debugging using console.log(), how can I get the full object? const myObject = { "a":"a", "b":{ "c":"c", "d":{ "e":"e", "f":{ "g":"g", ..

Efficient method to generate UUID String in JAVA (UUID.randomUUID().toString() without the dashes)

I would like an efficient utility to generate unique sequences of bytes. UUID is a good candidate but UUID.randomUUID().toString() generates stuff like 44e128a5-ac7a-4c9a-be4c-224b6bf81b20 which is go..

T-SQL: Selecting rows to delete via joins

Scenario: Let's say I have two tables, TableA and TableB. TableB's primary key is a single column (BId), and is a foreign key column in TableA. In my situation, I want to remove all rows in TableA ..

How to set python variables to true or false?

I want to set a variable in Python to true or false. But the words true and false are interpreted as undefined variables: #!/usr/bin/python a = true; b = true; if a == b: print("same");..

Getting a list item by index

I've recently started using c# moving over from Java. I can't seem to find how to get a list item by index. In java to get the first item of the list it would be: list1.get(0); What is the equivale..

WCFTestClient The HTTP request is unauthorized with client authentication scheme 'Anonymous'

I've created one WCF service and deployed it on Server. When I browse this service it gives me positive response with ?wsdl URL. Now I'm trying to test the service through WCF Test client. It shows pr..

npm global path prefix

I am being more cautious than usual because I have been confused by the behavior of npm in the past. I am on a Mac and have installed node.js through brew install node. Now that I want to run jsli..

Python 2.7.10 error "from urllib.request import urlopen" no module named request

I opened python code from github. I assumed it was python2.x and got the above error when I tried to run it. From the reading I've seen Python 3 has depreciated urllib itself and replaced it with a ..

How to create many labels and textboxes dynamically depending on the value of an integer variable?

Is there any way to dynamically create and display 'n' Labels with 'n' corresponding Textboxs when we know value of 'n' after for example, clicking "Display" button. Let me know if anything make you ..

Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one?

The different LogCat methods are: Log.v(); // Verbose Log.d(); // Debug Log.i(); // Info Log.w(); // Warning Log.e(); // Error What are the appropriate situations to use each type of Logging? I kno..

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

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

overlay a smaller image on a larger image python OpenCv

Hi I am creating a program that replaces a face in a image with someone else's face. However, I am stuck on trying to insert the new face into the original, larger image. I have researched ROI and add..

Text to speech(TTS)-Android

I am new to the android platform. Now I am working on TTS(Text to Speech).If I enter the text in a TextArea and I would like it to be converted to speech when i click the speak button. Can anyone he..

symfony 2 twig limit the length of the text and put three dots

How can I limit the length of the text, e.g., 50, and put three dots in the display? {% if myentity.text|length > 50 %} {% block td_text %} {{ myentity.text}}{% endblock %} {%endif%} ..

Check whether an array is empty

I have the following code <?php $error = array(); $error['something'] = false; $error['somethingelse'] = false; if (!empty($error)) { echo 'Error'; } else { echo 'No errors'; } ?> ..

How do you reindex an array in PHP but with indexes starting from 1?

I have the following array, which I would like to reindex so the keys are reversed (ideally starting at 1): Current array (edit: the array actually looks like this): Array ( [2] => Object ( ..

How can I get the client's IP address in ASP.NET MVC?

I'm totally new to the ASP.NET MVC stack, and I was wondering what happened to the simple Page object and the Request ServerVariables object? Basically, I want to to pull out the client PC's IP addre..

Delete a database in phpMyAdmin

By mistake, I have created a duplicate database in the phpMyAdmin page of cPanel. I want to delete this database, but I am not able to find any delete button in the UI. How to delete a database in ph..

How does one check if a table exists in an Android SQLite database?

I have an android app that needs to check if there's already a record in the database, and if not, process some things and eventually insert it, and simply read the data from the database if the data ..

Mailbox unavailable. The server response was: 5.7.1 Unable to relay Error

I have Hosted one of my website on netsol server. From there a contact.aspx has to send email using exchange server. When I attempt to send an email: Error: Mailbox unavailable. The server respons..

Retrieve all values from HashMap keys in an ArrayList Java

Good day, this is kind of confusing me now(brain freeze!) and seem to be missing something. Have an ArrayList which i populate with a HashMap. now i put in my HashMap and arraylist. Map.put(DATE, va..

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

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

Eclipse Indigo - Cannot install Android ADT Plugin

When I try to install the Android Developer Tool, I get the following error. Software being installed: Android Development Tools 11.0.0.v201105251008-128486 (com.android.ide.eclipse.adt.featur..

Creating and throwing new exception

How I can create and throw a new exception in PowerShell? I want to do different things for a specific error...

how to use math.pi in java

I am having problems converting this formula V = 4/3 p r^3. I used Math.PI and Math.pow, but I get this error: ';' expected Also, the diameter variable doesn't work. Is there an error there? im..

Ignore duplicates when producing map using streams

Map<String, String> phoneBook = people.stream() .collect(toMap(Person::getName, Person::getAddress)); ..

How to update and order by using ms sql

Ideally I want to do this: UPDATE TOP (10) messages SET status=10 WHERE status=0 ORDER BY priority DESC; In English: I want to get the top 10 available (status=0) messages from the DB and lock them..

How to change checkbox's border style in CSS?

How can I change checkbox (input) border's style? I've put border:1px solid #1e5180 upon it, but in FireFox 3.5, nothing happens!..

How to have a transparent ImageButton: Android

<ImageButton android:id="@+id/previous" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/media_skip_backward" android:background="@drawable/transparen..

Linux Script to check if process is running and act on the result

I have a process that fails regularly & sometimes starts duplicate instances.. When I run: ps x |grep -v grep |grep -c "processname" I will get: 2 This is normal as the process runs with a recove..

How to keep a git branch in sync with master

At the moment git is doing my head in, I cannot come up with the best solution for the following. There are two branches, one called master and one called mobiledevicesupport. I want to keep mobilede..

How to change background and text colors in Sublime Text 3

My questions are: How do I change the overall colors (background and font)? How do I change the colors based on the file type that is open? Do I need to learn how to create a whole theme? I read ..

Rollback to last git commit

I just did a git commit -m "blah" then I added some files, how do I rollback and remove what is in my current files that have not yet been added/committed?..

Bootstrap's JavaScript requires jQuery version 1.9.1 or higher

I have all necessary files in my code and I am still getting this error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher This is my code: <script src="http://ajax.googleapis.c..

Run text file as commands in Bash

If I have a text file with a separate command on each line how would I make terminal run each line as a command? I just don't want to have to copy and paste 1 line at a time. It doesn't HAVE to be a t..

Kubernetes Pod fails with CrashLoopBackOff

I 'm Following this guide in order to set up a pod using minikube and pull an image from a private repository hosted at: hub.docker.com When trying to set up a pod to pull the image i see CrashLoopBa..

How do I use LINQ Contains(string[]) instead of Contains(string)

I got one big question. I got a linq query to put it simply looks like this: from xx in table where xx.uid.ToString().Contains(string[]) select xx The values of the string[] array would be numbers..

Difference between $(window).load() and $(document).ready() functions

What is the difference between $(window).load(function() {}) and $(document).ready(function() {}) in jQuery?..

How to write to a JSON file in the correct format

I am creating a hash in Ruby and want to write it to a JSON file, in the correct format. Here is my code: tempHash = { "key_a" => "val_a", "key_b" => "val_b" } fJson = File.open("pub..

Find a commit on GitHub given the commit hash

I am fairly new to Github and have come across an amateur-ish problem. I have been asked to do a code review and have been provided with a commit hash, however I have tried looking in Git if I can se..

Vim: insert the same characters across multiple lines

Sometimes I want to edit a certain visual block of text across multiple lines. For example, I would take a text that looks like this: name comment phone email And make it look like this vendor_na..

How do you give iframe 100% height

I'm trying <iframe height="100%" ...> but it still doesn't resize it. When i try the height in pixles it works. edit: 100% seems to be working on IE but not firefox..

Regex pattern inside SQL Replace function?

SELECT REPLACE('<strong>100</strong><b>.00 GB', '%^(^-?\d*\.{0,1}\d+$)%', ''); I want to replace any markup between two parts of the number with above regex, but it does not seem t..

Html.Textbox VS Html.TextboxFor

What is the difference between Html.Textbox and Html.TextboxFor?..

Passing headers with axios POST request

I have written an axios POST request as recommended from the npm package documentation like: var data = { 'key1': 'val1', 'key2': 'val2' } axios.post(Helper.getUserAPI(), data) .then((..

"Thinking in AngularJS" if I have a jQuery background?

Suppose I'm familiar with developing client-side applications in jQuery, but now I'd like to start using AngularJS. Can you describe the paradigm shift that is necessary? Here are a few questions that..

How to programmatically round corners and set random background colors

I'd like to round the corners of a view and also change the color of the view based on the contents at runtime. TextView v = new TextView(context); v.setText(tagsList.get(i)); if(i%2 == 0){ v.set..

How do you install Boost on MacOS?

How do you install Boost on MacOS? Right now I can't find bjam for the Mac...

How can I restore the MySQL root user’s full privileges?

I accidentally removed some of the privileges from my MySQL root user, including the ability to alter tables. Is there some way I can restore this user to its original state (with all privileges)? UP..

How can I tell if an algorithm is efficient?

Relatively new to C++ but I am very interested in the algorithmic aspect of programming. Is there a general framework for deciding if an algorithm is efficient? i.e. the quickest possible? I am tryi..

How to stop/terminate a python script from running?

I wrote a program in IDLE to tokenize text files and it starts to tokeniza 349 text files! How can I stop it? How can I stop a running Python program?..

Where can I get a virtual machine online?

I am looking for some VPS/ Virtual machine which should be available all the time and I must be able to access it from any computer having internet. I know a few paid services but just wondering If I..

How to create a box when mouse over text in pure CSS?

I have tried many times to do this, but it has not worked out yet. When I mouse over this text Then it must show me this box I want to achieve this effect purely with CSS if anybody can do this..

How do I express "if value is not empty" in the VBA language?

How do I express the condition "if value is not empty" in the VBA language? Is it something like this? "if value is not empty then..." Edit/Delete Message ..

How to show Error & Warning Message Box in .NET/ How to Customize MessageBox

Using C# .NET (Winforms). I want to know how can I show the message boxes with a Ding!! sound & a red colored cross mark in it. This is what I'm talking about: How to do such things for my s..

HTML Script tag: type or language (or omit both)?

<script type="text/javascript"> /* ... */ </script> vs. <script language="Javascript"> /* ... */ </script> Which should be used and why? Or, the third alternative..

Angular cookies

I've been looking all around for Angular cookies but I haven't been able to find how to implement cookies management in Angular. Is there any way to manage cookies (like $cookie in AngularJS)?..

TCPDF ERROR: Some data has already been output, can't send PDF file

I keep receiving this error when trying to add my own array into the code. Here is my array; $array = array(); while (odbc_fetch_row($rs)) { $array[] = odbc_result($rs,'Product Name'); } $test = pr..

Using only CSS, show div on hover over <a>

I would like to show a div when someone hovers over an <a> element, but I would like to do this in CSS and not JavaScript. Do you know how this can be achieved?..

How to make CSS3 rounded corners hide overflow in Chrome/Opera

I need round corners on a parent div to mask content from its childen. overflow: hidden works in simple situations, but breaks in webkit based browsers and Opera when the parent is positioned relative..

python save image from url

I got a problem when I am using python to save an image from url either by urllib2 request or urllib.urlretrieve. That is the url of the image is valid. I could download it manually using the explorer..

How to change TextBox's Background color?

I got C# code that is like: if(smth == "Open") { TextBox.Background = ??? } How to change TextBox's background color?..

Android Fragment onAttach() deprecated

I have updated my app to use the latest support library (version 23.0.0), I've found out that they deprecated the onAttach() function of the Fragment class. Instead of: onAttach (Activity activity) ..

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

How to force a line break in a long word in a DIV?

Okay, this is really confusing me. I have some content inside of a div like so: <div style="background-color: green; width: 200px; height: 300px;"> Thisisatest.Thisisatest.Thisisatest.Thisisat..

How to debug Google Apps Script (aka where does Logger.log log to?)

In Google Sheets, you can add some scripting functionality. I'm adding something for the onEdit event, but I can't tell if it's working. As far as I can tell, you can't debug a live event from Google ..

Including an anchor tag in an ASP.NET MVC Html.ActionLink

In ASP.NET MVC, I'm trying to create a link that includes an anchor tag (that is, directing the user to a page, and a specific section of the page). The URL I am trying to create should look like the..

How to make a ssh connection with python?

Can anyone recommend something for making a ssh connection in python? I need it to be compatible with any OS. I've already tried pyssh only to get an error with SIGCHLD, which I've read is because W..

Passing html values into javascript functions

I was making a javascript function in which I need to confirm the input. I wrote the following code but its giving negative value i.e. "else" part even if i enter a valid value. Can some one please su..

How to add "active" class to Html.ActionLink in ASP.NET MVC

I'm trying to add an"active" class to my bootstrap navbar in MVC, but the following doesn't show the active class when written like this: <ul class="nav navbar-nav"> <li>@Html.ActionLin..

generate random double numbers in c++

How to generate random numbers between two doubles in c++ , these numbers should look like xxxxx,yyyyy ...

set date in input type date

<input id="datePicker" type="date" />? i will set today date in datepicker input type date in chrome. $(document).ready( function() { var now = new Date(); var today = now.getDate() ..

Remove multiple elements from array in Javascript/jQuery

I have two arrays. The first array contains some values while the second array contains indices of the values which should be removed from the first array. For example: var valuesArr = new Array("v..

How to add a constant column in a Spark DataFrame?

I want to add a column in a DataFrame with some arbitrary value (that is the same for each row). I get an error when I use withColumn as follows: dt.withColumn('new_column', 10).head(5) -----------..

How to cache data in a MVC application

I have read lots of information about page caching and partial page caching in a MVC application. However, I would like to know how you would cache data. In my scenario I will be using LINQ to Entiti..

Can I animate absolute positioned element with CSS transition?

I want to animate an element's position change with CSS transition, but it is not working even when I use the transition on all properties, as in the example here: http://jsfiddle.net/yFy5n/3/ Howeve..

Can I change the headers of the HTTP request sent by the browser?

I'm looking into a restful design and would like to use the HTTP methods (POST, GET, ...) and HTTP headers as much as possible. I already found out that the HTTP methods PUT and DELETE are not support..

Convert Java string to Time, NOT Date

I would like to convert a variable string to a Time type variable, not Date using Java. the string look like this 17:40 I tried using the code below but this instance is a date type variable not time..

How to plot time series in python

I have been trying to plot a time series graph from a CSV file. I have managed to read the file and converted the data from string to date using strptime and stored in a list. When I tried plotting a ..

Base64 String throwing invalid character error

I keep getting a Base64 invalid character error even though I shouldn't. The program takes an XML file and exports it to a document. If the user wants, it will compress the file as well. The compress..

INSERT IF NOT EXISTS ELSE UPDATE?

I've found a few "would be" solutions for the classic "How do I insert a new record or update one if it already exists" but I cannot get any of them to work in SQLite. I have a table defined as follo..

The character encoding of the HTML document was not declared

When I click on my form's submit button the following error message appears: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser ..

Is it possible to use if...else... statement in React render function?

Basically, I have a react component, its render() function body is as below: (It is my ideal one, which means it currently does not work) render(){ return ( <div> <El..

Create autoincrement key in Java DB using NetBeans IDE

I'm coming from MySQL world, please help. Is it possible to create autoincrement key from NetBeans IDE in JavaDB? Do you use some more advanced db clients, which? Thanks...

Get RETURN value from stored procedure in SQL

I have a stored procedure where it ends with a RETURN value of 0 or 1. I want to use this value in an IF statement in another stored procedure. How can I get the return value of the former stored pr..

How to concatenate two strings in C++?

I have a private class variable char name[10] to which I would like to add the .txt extension so that I can open the file present in the directory. How do I go about this? It would be preferable to..

Finding absolute value of a number without using Math.abs()

Is there any way to find the absolute value of a number without using the Math.abs() method in java...

ip address validation in python using regex

In the following ip address validation i want to see if it a valid ip address or not how can i do this using the below re >>> ip="241.1.1.112343434" >>> aa=re.match(r"\d{1,3}\.\d{1..

Format certain floating dataframe columns into percentage in pandas

I am trying to write a paper in IPython notebook, but encountered some issues with display format. Say I have following dataframe df, is there any way to format var1 and var2 into 2 digit decimals and..

Serializing an object as UTF-8 XML in .NET

Proper object disposal removed for brevity but I'm shocked if this is the simplest way to encode an object as UTF-8 in memory. There has to be an easier way doesn't there? var serializer = new XmlSer..

#if DEBUG vs. Conditional("DEBUG")

Which is better to use, and why, on a large project: #if DEBUG public void SetPrivateValue(int value) { ... } #endif or [System.Diagnostics.Conditional("DEBUG")] public void SetPrivateValu..

Update my gradle dependencies in eclipse

I have a simple gradle project in my eclipse. I update the build.gradle to include a few apache http jars... dependencies { compile group: 'commons-collections', name: 'commons-collections', vers..

Adding a caption to an equation in LaTeX

Well, it seems simple enough, but I can't find a way to add a caption to an equation. The caption is needed to explain the variables used in the equation, so some kind of table-like structure to keep ..

Javascript onclick hide div

I want to hide this warning div using javascript inside it. I'm i getting the javascript right? I want to hide/close the div when i click on the close icon (images/close_icon.gif) <div> <..

Can scripts be inserted with innerHTML?

I tried to load some scripts into a page using innerHTML on a <div>. It appears that the script loads into the DOM, but it is never executed (at least in Firefox and Chrome). Is there a way to h..

Triangle Draw Method

I have trouble drawing a triangle with the draw(Graphics g) method in Java. I can draw a rectangle like so: public void draw(Graphics g) { g.setColor(colorFill); g.fillRect(p.x, p.y, width, h..

How to use OpenFileDialog to select a folder?

How to use OpenFileDialog to select folders? I was going to use the following project: https://github.com/scottwis/OpenFileOrFolderDialog However, I faced one problem. It uses the GetOpenFileName fu..

jQuery Validate - Enable validation for hidden fields

In the new version of jQuery validation plugin 1.9 by default validation of hidden fields ignored. I'm using CKEditor for textarea input field and it hides the field and replace it with iframe. The fi..

What is an idempotent operation?

What is an idempotent operation?..

How to clear File Input

Below is part of the jquery code I have which displays the file input and a "Clear File" button. var $imagefile = $('<input />').attr({ type: 'file', name: 'imageFile', class: 'imag..

Java Scanner String input

I'm writing a program that uses an Event class, which has in it an instance of a calendar, and a description of type String. The method to create an event uses a Scanner to take in a month, day, year..

Convert Java Array to Iterable

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

How to delete shared preferences data from App in Android

How do I delete SharedPreferences data for my application? I'm creating an application that uses a lot of web services to sync data. For testing purposes, I need to wipe out some SharedPreferences va..

Auto-fit TextView for Android

Background Many times we need to auto-fit the font of the TextView to the boundaries given to it. The problem Sadly, even though there are many threads and posts (and suggested solutions) talking a..

How do I get the last word in each line with bash

For example i have a file: $ cat file i am the first example. i am the second line. i do a question about a file. and i need: example, line, file i intent with "awk" but the problem is that t..

How to round up a number to nearest 10?

How can we round off a number to the nearest 10 in php? Say I have 23, what code would I use to round it off to 30?..

How can I add comments in MySQL?

I want to add comment in SQL code. How can I do this? I'm using MySQL...

Setting an image for a UIButton in code

How do you set the image for a UIButton in code? I have this: UIButton *btnTwo = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btnTwo.frame = CGRectMake(40, 140, 240, 30); [btnTwo setTitle:@"v..

database vs. flat files

The company I work for is trying to switch a product that uses flat file format to a database format. We're handling pretty big files of data (ie: 25GB/file) and they get updated really quick. We need..

How can I see if a Perl hash already has a certain key?

I have a Perl script that is counting the number of occurrences of various strings in a text file. I want to be able to check if a certain string is not yet a key in the hash. Is there a better way of..

Get the client's IP address in socket.io

When using socket.IO in a Node.js server, is there an easy way to get the IP address of an incoming connection? I know you can get it from a standard HTTP connection, but socket.io is a bit of a diffe..

Search an Oracle database for tables with specific column names?

We have a large Oracle database with many tables. Is there a way I can query or search to find if there are any tables with certain column names? IE show me all tables that have the columns: id, fna..

Accessing localhost (xampp) from another computer over LAN network - how to?

I have just set up a wi-fi network at home. I have all my files on my desktop computer (192.168.1.56) and want to access localhost over there from another computer (192.168.1.2). On my desktop I can ..

SQL use CASE statement in WHERE IN clause

Is it posible to use case in where in clause? Something like this: DECLARE @Status VARCHAR(50); SET @Status='published'; SELECT * FROM Product P WHERE P.Status IN (CASE WHEN @Status='publish..

ORA-12170: TNS:Connect timeout occurred

I was trying to connect to the database here in my laptop using Oracle Toad but I kept on having this error: ORA-12170: TNS:Connect timeout occurred What are the possible reasons why I kept on h..

python catch exception and continue try block

Can I return to executing try-block after exception occurs? (The goal is to write less) For Example: try: do_smth1() except: pass try: do_smth2() except: pass vs try: do_smth1..

Android image caching

How can I cache images after they are downloaded from web?..

How to set environment variables in PyCharm?

I have started to work on a Django project, and I would like to set some environment variables without setting them manually or having a bash file to source. I want to set the following variables: exp..

Why can't Python import Image from PIL?

The single line that I am trying to run is the following: from PIL import Image However simple this may seem, it gives an error: Traceback (most recent call last): File "C:\...\2014-10-22_12-49...

Is it possible to overwrite a function in PHP

Can you declare a function like this... function ihatefooexamples(){ return "boo-foo!"; }; And then redeclare it somewhat like this... if ($_GET['foolevel'] == 10){ function ihatefooexamples()..

How can I change the text color with jQuery?

When I hover a text with animation definitely I will use jQuery. Is there a code that will change the color, or size?..

Javascript Click on Element by Class

So I am writing a script that can be run on a page but I want to click on this element, unfortunately, it does not have an id to get and I am trying to use the .click() function on it, but it doesn't ..

How-to turn off all SSL checks for postman for a specific site

Please read this carefully. Please do not send me a link on how to import a certificate. I I am using Postman for QA and testing work. I have a test system I frequently rebuild myself and so it is co..

jQuery Event : Detect changes to the html/text of a div

I have a div which has its content changing all the time , be it ajax requests, jquery functions, blur etc etc. Is there a way I can detect any changes on my div at any point in time ? I dont want t..

Call break in nested if statements

I have the following situation: IF condition THEN IF condition THEN sequence 1 ELSE break //? ENDIF ELSE sequence 3 ENDIF What is the result of the ..

Vertically and horizontally centering text in circle in CSS (like iphone notification badge)

I'm looking for a way of to do a cross-browser iphone-like badge in CSS3. I'd obviously like to use one div for this, but alternative solutions would be fine. The important factor is that it needs to ..

How can a LEFT OUTER JOIN return more records than exist in the left table?

I have a very basic LEFT OUTER JOIN to return all results from the left table and some additional information from a much bigger table. The left table contains 4935 records yet when I LEFT OUTER JOIN ..

how to call scalar function in sql server 2008

I have created a Scalar Functions, it was created successfully, but when I call the function using select statement, it says Invalid object name 'dbo.fun_functional_score'. my function: ALTER func..

How to add 10 minutes to my (String) time?

I have this time: String myTime = "14:10"; Now I want to add 10 minutes to this time, so that it would be 14:20 How can I achieve this?..

fatal: could not read Username for 'https://github.com': No such file or directory

I have the following problem when I try to pull code using git Bash on Windows: fatal: could not read Username for 'https://github.com': No such file or directory I already tried to implement the acc..

How to debug in Django, the good way?

So, I started learning to code in Python and later Django. The first times it was hard looking at tracebacks and actually figure out what I did wrong and where the syntax error was. Some time has pass..

Listening for variable changes in JavaScript

Is it possible to have an event in JS that fires when the value of a certain variable changes? JQuery is accepted...

How to define Gradle's home in IDEA?

I am trying to import a Gradle project into IntelliJ, and when I get to the Gradle Home textbox, it is not automatically populated, nor will typing in the path of Gradle Home result in a valid locatio..

What is the shortcut to Auto import all in Android Studio?

Is there any way of auto importing (like in Eclipse Shift+Ctrl+O) in Android Studio? I have found only Ctrl+Alt+O which ask for each thing, and I have to press Alt+Enter to accept it. No way to do ..

Android ACTION_IMAGE_CAPTURE Intent

We are trying to use the native camera app to let the user take a new picture. It works just fine if we leave out the EXTRA_OUTPUT extra and returns the small Bitmap image. However, if we putExtra(EXT..

How to find a parent with a known class in jQuery?

I have a <div> that has many other <div>s within it, each at a different nesting level. Rather than give every child <div> an identifier, I rather just give the root <div> the ..

How do I compile C++ with Clang?

I have installed Clang by using apt-get in Ubuntu, and I can successfully compile C files using it. However, I have no idea how to compile C++ through it. What do I need to do to compile C++?..

FFmpeg: How to split video efficiently?

I wish to split a large avi video into two smaller consecutive videos. I am using ffmpeg. One way is to run ffmpeg two times: ffmpeg -i input.avi -vcodec copy -acodec copy -ss 00:00:00 -t 00:30:00 o..

How to convert Nonetype to int or string?

I've got an Nonetype value x, it's generally a number, but could be None. I want to divide it by a number, but Python raises: TypeError: int() argument must be a string or a number, not 'NoneType' ..

how can select from drop down menu and call javascript function

I have a drop down which has many options. I want that when I select any option then it calls a function through JavaScript. the code which I used is here <select name="aa" onchange="report(this...

Space between two divs

My issue is that I have two (or more) divs of the same class, that need to be spaced from each other. I cannot directly use margins however, as the last or first element would also have the margin app..

Random state (Pseudo-random number) in Scikit learn

I want to implement a machine learning algorithm in scikit learn, but I don't understand what this parameter random_state does? Why should I use it? I also could not understand what is a Pseudo-rand..

How to set background color of an Activity to white programmatically?

How can I set the background color of an Activity to white programatically?..

Server configuration by allow_url_fopen=0 in

I'm getting the following error when running a script. The error message is as follows... Warning: file_get_contents() [function.file-get-contents]: https:// wrapper is disabled in the server conf..

Show red border for all invalid fields after submitting form angularjs

I have a form in which I have some input fields. Some of them are required fields and some are email fields. I am using HTML5 required attribute for required fields and type="email" attribute for em..

How to get integer values from a string in Python?

Suppose I had a string string1 = "498results should get" Now I need to get only integer values from the string like 498. Here I don't want to use list slicing because the integer values may incre..

How to run a function when the page is loaded?

I want to run a function when the page is loaded, but I don’t want to use it in the <body> tag. I have a script that runs if I initialise it in the <body>, like this: function codeAddr..

How to update an "array of objects" with Firestore?

I'm currently trying Firestore, and I'm stuck at something very simple: "updating an array (aka a subdocument)". My DB structure is super simple. For example: proprietary: "John Doe", sharedWith: ..

Java - Access is denied java.io.FileNotFoundException

I have the following code: List<FileItem> items = uploadHandler.parseRequest(request); for (FileItem item : items) { if (!item.isFormField()) { File file = new File("D:/Data"); ..

R * not meaningful for factors ERROR

I have the following data.frame and I want to perform some calculations on the 2nd column. > test code age 1 101 15 2 102 25 3 103 16 4 104 u1 5 105 u1 6 106 u2 7 107 27 8 10..

Server cannot set status after HTTP headers have been sent IIS7.5

Sometimes I get exception in my production environment: Process information Process ID: 3832 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE Exception i..

Centering a canvas

How do I markup a page with an HTML5 canvas such that the canvas Takes up 80% of the width Has a corresponding pixel height and width which effectively define the ratio (and are proportionally maint..

How to copy a file to a remote server in Python using SCP or SSH?

I have a text file on my local machine that is generated by a daily Python script run in cron. I would like to add a bit of code to have that file sent securely to my server over SSH...

SQL Query for Selecting Multiple Records

I have 9 fields and I need to see all the data from these fields which have a particular set of IDs. Could any one tell me the SQL query for it? Ex: Database contains 100 records. I need to select a ..

How to create a new column in a select query

In MS Access, I want to insert a new column into the returned result of a select query. The new column has the same value for every row. For example, my select returns columns A, B and I want C to be ..

How to get a dependency tree for an artifact?

dependency:tree can be used to see the dependency tree for a given project. But what I need is to see the dependency tree for a 3rd party artifact. I guess I can create an empty project, but I'm look..

write a shell script to ssh to a remote machine and execute commands

I have two questions: There are multiple remote linux machines, and I need to write a shell script which will execute the same set of commands in each machine. (Including some sudo operations). How ..

Remove a cookie

When I want to remove a Cookie I try unset($_COOKIE['hello']); I see in my cookie browser from firefox that the cookie still exists. How can I really remove the cookie?..

Plotting multiple curves same graph and same scale

This is a follow-up of this question. I wanted to plot multiple curves on the same graph but so that my new curves respect the same y-axis scale generated by the first curve. Notice the following ex..

Use css gradient over background image

I've been trying to use a linear gradient on top of my background image in order to get a fading effect on the bottom of my background from black to transparent but can't seem to be able to make it sh..

What is the difference between '@' and '=' in directive scope in AngularJS?

I've read the AngularJS documentation on the topic carefully, and then fiddled around with a directive. Here's the fiddle. And here are some relevant snippets: From the HTML: <pane bi-title="ti..

Download File Using Javascript/jQuery

I have a very similar requirement specified here. I need to have the user's browser start a download manually when $('a#someID').click(); But I cannot use the window.href method, since it replaces t..

How do I get this javascript to run every second?

How do I get this javascript to run every second? source code: <script type="text/javascript"> $(function() { //More Button $('.more').live("click",function() { ..

How to select specific form element in jQuery?

I have two form like this: <form id='form1' name='form1'> <input name='name' id='name'> <input name='name2' id='name2'> </form> <form id='form2' name='form2'> <..

mailto link multiple body lines

having trouble getting multiple lines to work correctly in a mailto link In my case I'm testing it with an Outlook default mail reader. The following is put in an anchor href: mailto:email@address..

PHP unable to load php_curl.dll extension

Follow-up from my post yesterday (Enabling cURL with PHP) The problem is that PHP isn't able to load php_curl.dll. I've tried several steps including uncommenting extension=php_curl.dll, making sure..

Java getHours(), getMinutes() and getSeconds()

As I know getHours(), getMinutes() and getSeconds() are all deprecated in Java and they are replaced with Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND. These will in fact return the hour, m..

Converting any object to a byte array in java

I have an object of type X which I want to convert into byte array before sending it to store in S3. Can anybody tell me how to do this? I appreciate your help...

LPCSTR, LPCTSTR and LPTSTR

What the difference between LPCSTR, LPCTSTR and LPTSTR? Why do we need to do this to convert a string into a LV / _ITEM structure variable pszText: LV_DISPINFO dispinfo; dispinfo.item.pszText = ..

How to get and set the current web page scroll position?

How can I get and set the current web page scroll position? I have a long form which needs to be refreshed based on user actions/input. When this happens, the page resets to the very top, which is a..

What is the purpose and uniqueness SHTML?

Recently I came to know about SHTML when I saw a site with .shtml extensions. What is the purpose of SHTML, and in what ways does it differ from HTML and DHTML?..

Laravel Request::all() Should Not Be Called Statically

In Laravel, I'm trying to call $input = Request::all(); on a store() method in my controller, but I'm getting the following error: Non-static method Illuminate\Http\Request::all() should not be ca..

Renaming a branch in GitHub

I just renamed my local branch using git branch -m oldname newname but this only renames the local version of the branch. How can I rename the one on GitHub?..

How to set background color of a button in Java GUI?

Below is the code which creates 9 buttons in gridlayout form on a specific pannel3. What i want is to make the background of each button black with grey text over it. Can anyone help please? for(in..

Remove a modified file from pull request

I have 3 modified files (no new files) in a pull request at the moment. I would like to remove one of those files from the pull request, so that the pull request only contains changes to two files a..