I Just installed Mountain Lion and had the same problem I use FLashBuilder (which is 32bit) and MountainLion is 64bit, which means by default MacPorts installs everything as 64bit. The version of subclipse I use is 1.8 As i had already installed Subversion and JavaHLBindings I just ran this command:
sudo port upgrade --enforce-variants active +universal
This made mac ports go through everything already installed and also install the 32bit version.
I then restarted FlashBuilder and it no longer showed any JavaHL errors.
To resolve this follow following steps:
If it still does not work. Try these. Its just a workaround though:
This will get latest version of file from repository and all conflicts will be resolved.
./eclipse -clean -refresh
as mentioned in comment by sulai Dec 20 '12 at 12:46, that worked for me.
However, on the Mac OS X, I had to figure out how to get to ./eclipse
Here's the solution:
cd Eclipse.app/Contents/MacOS/
Thank you Andrew's comment for this post: https://stackoverflow.com/a/1783448/2162226
from eclipse, you can select on the project, right click->team->upgrade
You might want to check if the websecurity of vpn client is the issue. I uninstalled it and it worked fine..Found the solution here https://superuser.com/questions/471089/svn-connection-not-successful
Exposing the Entity instead of the details of the entity.
"Details are there, but we do not consider them. They are not required."
Various calculations: Addition, Multiplication, Subtraction, Division, Square, Sin, Cos, Tan.
We do not show the details of how do we calculate the Sin, Cos or Tan. We just Show Calculator and it's various Methods which will be, and which needs to be used by the user.
Employee has: First Name, Last Name, Middle Name. He can Login(), Logout(), DoWork().
Many processes might be happening for Logging employee In, such as connecting to database, sending Employee ID and Password, receiving reply from Database. Although above details are present, we will hide the details and expose only "Employee".
Enclosing. Treating multiple characteristics/ functions as one unit instead of individuals. So that outside world will refer to that unit instead of it's details directly.
"Details are there, we consider them, but do not show them, instead we show what you need to see."
Instead of calling it as Addition, Subtraction, Multiplication, Division, Now we will call it as a Calculator.
All characteristics and operations are now referred by the employee, such as "John". John Has name. John Can DoWork(). John can Login().
Hiding the implemention from outside world. So that outside world will not see what should not be seen.
"Details are there, we consider them, but we do not show them. You do not need to see them."
Your requirement: Addition, Substraction, Multiplication, Division. You will be able to see it and get the result.
You do not need to know where operands are getting stored. Its not your requirement.
Also, every instruction that I am executing, is also not your requirement.
John Would like to know his percentage of attendance. So GetAttendancePercentage() Will be called.
However, this method needs data saved in database. Hence it will call FetchDataFromDB(). FetchDataFromDB() is NOT required to be visible to outside world.
Hence we will hide it. However, John.GetAttendancePercentage() will be visible to outside world.
Abstraction, encapsulation and hiding complement each others.
Because we create level of abstraction over details, the details are encapsulated. And because they are enclosed, they are hidden.
You can upload files via AJAX by using the FormData method. Although IE7,8 and 9 do not support FormData functionality.
$.ajax({
url: "ajax.php",
type: "POST",
data: new FormData('form'),
contentType: false,
cache: false,
processData:false,
success: function(data) {
$("#response").html(data);
}
});
This is a perfect use-case for DISTINCT ON
- a Postgres specific extension of the standard DISTINCT
:
SELECT DISTINCT ON (category)
id -- , category, date -- any other column (expression) from the same row
FROM tbl
ORDER BY category, date DESC;
Careful with descending sort order. If the column can be NULL, you may want to add NULLS LAST
:
DISTINCT ON
is simple and fast. Detailed explanation in this related answer:
For big tables with many rows per category
consider an alternative approach:
I need to do something like this I ended up going with the following solution.
I have a specific website URL that will open a page with two buttons
1) Button One go to website
2) Button Two go to application (iphone / android phone / tablet) you can fall back to a default location from here if the app is not installed (like another url or an app store)
3) cookie to remember users choice
<head>
<title>Mobile Router Example </title>
<script type="text/javascript">
function set_cookie(name,value)
{
// js code to write cookie
}
function read_cookie(name) {
// jsCode to read cookie
}
function goToApp(appLocation) {
setTimeout(function() {
window.location = appLocation;
//this is a fallback if the app is not installed. Could direct to an app store or a website telling user how to get app
}, 25);
window.location = "custom-uri://AppShouldListenForThis";
}
function goToWeb(webLocation) {
window.location = webLocation;
}
if (readCookie('appLinkIgnoreWeb') == 'true' ) {
goToWeb('http://somewebsite');
}
else if (readCookie('appLinkIgnoreApp') == 'true') {
goToApp('http://fallbackLocation');
}
</script>
</head>
<body>
<div class="iphone_table_padding">
<table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
<tr>
<td class="iphone_table_leftRight"> </td>
<td>
<!-- INTRO -->
<span class="iphone_copy_intro">Check out our new app or go to website</span>
</td>
<td class="iphone_table_leftRight"> </td>
</tr>
<tr>
<td class="iphone_table_leftRight"> </td>
<td>
<div class="iphone_btn_padding">
<!-- GET IPHONE APP BTN -->
<table border="0" cellspacing="0" cellpadding="0" class="iphone_btn" onclick="set_cookie('appLinkIgnoreApp',document.getElementById('chkDontShow').checked);goToApp('http://getappfallback')">
<tr>
<td class="iphone_btn_on_left"> </td>
<td class="iphone_btn_on_mid">
<span class="iphone_copy_btn">
Get The Mobile Applications
</span>
</td>
<td class="iphone_btn_on_right"> </td>
</tr>
</table>
</div>
</td>
<td class="iphone_table_leftRight"> </td>
</tr>
<tr>
<td class="iphone_table_leftRight"> </td>
<td>
<div class="iphone_btn_padding">
<table border="0" cellspacing="0" cellpadding="0" class="iphone_btn" onclick="set_cookie('appLinkIgnoreWeb',document.getElementById('chkDontShow').checked);goToWeb('http://www.website.com')">
<tr>
<td class="iphone_btn_left"> </td>
<td class="iphone_btn_mid">
<span class="iphone_copy_btn">
Visit Website.com
</span>
</td>
<td class="iphone_btn_right"> </td>
</tr>
</table>
</div>
</td>
<td class="iphone_table_leftRight"> </td>
</tr>
<tr>
<td class="iphone_table_leftRight"> </td>
<td>
<div class="iphone_chk_padding">
<!-- CHECK BOX -->
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="checkbox" id="chkDontShow" /></td>
<td>
<span class="iphone_copy_chk">
<label for="chkDontShow"> Don’t show this screen again.</label>
</span>
</td>
</tr>
</table>
</div>
</td>
<td class="iphone_table_leftRight"> </td>
</tr>
</table>
</div>
</body>
</html>
You can use the VisualTreeHelper to find controls. Below is a method that uses the VisualTreeHelper to find a parent control of a specified type. You can use the VisualTreeHelper to find controls in other ways as well.
public static class UIHelper
{
/// <summary>
/// Finds a parent of a given item on the visual tree.
/// </summary>
/// <typeparam name="T">The type of the queried item.</typeparam>
/// <param name="child">A direct or indirect child of the queried item.</param>
/// <returns>The first parent item that matches the submitted type parameter.
/// If not matching item can be found, a null reference is being returned.</returns>
public static T FindVisualParent<T>(DependencyObject child)
where T : DependencyObject
{
// get parent item
DependencyObject parentObject = VisualTreeHelper.GetParent(child);
// we’ve reached the end of the tree
if (parentObject == null) return null;
// check if the parent matches the type we’re looking for
T parent = parentObject as T;
if (parent != null)
{
return parent;
}
else
{
// use recursion to proceed with next level
return FindVisualParent<T>(parentObject);
}
}
}
Call it like this:
Window owner = UIHelper.FindVisualParent<Window>(myControl);
As Karthik mentioned, dct.keys()
will work but it will return all the keys in dict_keys
type not in list
type. So if you want all the keys in a list, then list(dct.keys())
will work.
Because MomentJS is quite heavy and sub-optimized, people not afraid to use a module should probably look at date-fns
instead, which provides an intervalToDuration method which does what you want:
const result = intervalToDuration({
start: new Date(dateNow),
end: new Date(dateFuture),
})
And which would return an object looking like so:
{
years: 39,
months: 2,
days: 20,
hours: 7,
minutes: 5,
seconds: 0,
}
Then you can even use formatDuration to display this object as a string using the parameters you prefer
I am going to assume this is a WinForms questions (which it feels like, based on it being a "program" rather than a website/app). In which case you can simple do the following to change the text colour of a label:
myLabel.ForeColor = System.Drawing.Color.Red;
Or any other colour of your choice. If you want to be more specific you can use an RGB value like so:
myLabel.ForeColor = Color.FromArgb(0, 0, 0);//(R, G, B) (0, 0, 0 = black)
Having different colours for different users can be done a number of ways. For example, you could allow each user to specify their own RGB value colours, store these somewhere and then load them when the user "connects".
An alternative method could be to just use 2 colours - 1 for the current user (running the app) and another colour for everyone else. This would help the user quickly identify their own messages above others.
A third approach could be to generate the colour randomly - however you will likely get conflicting values that do not show well against your background, so I would suggest not taking this approach. You could have a pre-defined list of "acceptable" colours and just pop one from that list for each user that joins.
Some great help found here. However, I still could not make it to work despite loading JAR properly. I found out later that I accidentally created module in the file structure instead of regular folder and this very module was pre-selected in the project setting.
Here is the footprint:
File -> Project Structure -> Modules -> (select proper module if you have more) -> Dependencies -> + -> JAR or Libraries
map
no longer returns a list
but a mapObject
, thus the answer will look something like
>>> map(lambda x:x.strip(),l)
<map object at 0x7f00b1839fd0>
You can read more about it on What’s New In Python 3.0.
map()
andfilter()
return iterators. If you really need alist
, a quick fix is e.g.list(map(...))
So now what are the ways of getting trough this?
list
call over map
with a lambda
map
returns an iterator. list
is a function that can convert an iterator to a list. Hence you will need to wrap a list
call around map
. So the answer now becomes,
>>> l = ['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3\n']
>>> list(map(lambda x:x.strip(),l))
['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3']
Very good, we get the output. Now we check the amount of time it takes for this piece of code to execute.
$ python3 -m timeit "l = ['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3\n'];list(map(lambda x:x.strip(),l))"
100000 loops, best of 3: 2.22 usec per loop
2.22 microseconds. That is not so bad. But are there more efficient ways?
list
call over map
withOUT a lambda
lambda
is frowned upon by many in the Python community (including Guido). Apart from that it will greatly reduce the speed of the program. Hence we need to avoid that as much as possible. The toplevel function str.strip
. Comes to our aid here.
The map
can be re-written without using lambda
using str.strip
as
>>> list(map(str.strip,l))
['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3']
And now for the times.
$ python3 -m timeit "l = ['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3\n'];list(map(str.strip,l))"
1000000 loops, best of 3: 1.38 usec per loop
Fantastic. You can see the efficiency differences between the two ways. It is nearly 60% faster. Thus the approach without using a lambda
is a better choice here.
Another important point from What’s New In Python 3.0 is that it advices us to avoid map
where possible.
Particularly tricky is
map()
invoked for the side effects of the function; the correct transformation is to use a regularfor
loop (since creating a list would just be wasteful).
So we can solve this problem without a map
by using a regular for
loop.
The trivial way of solving (the brute-force) would be:-
>>> l = ['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3\n']
>>> final_list = []
>>> for i in l:
... final_list.append(i.strip())
...
>>> final_list
['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3']
The timing setup
def f():
l = ['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3\n']
final_list = []
for i in l:
final_list.append(i.strip())
import timeit
print(min(timeit.repeat("f()","from __main__ import f")))
And the result.
1.5322505849981098
As you can see the brute-force is a bit slower here. But it is definitely more readable to a common programmer than a map
clause.
A list comprehension here is also possible and is the same as in Python2.
>>> [i.strip() for i in l]
['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3']
Now for the timings:
$ python3 -m timeit "l = ['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3\n'];[i.strip() for i in l]"
1000000 loops, best of 3: 1.28 usec per loop
As you can see the list-comprehension is more effective than map
(even that without a lambda
). Hence the thumb rule in Python3 is to use a list comprehension instead of map
A final way is to make the changes in-place within the list itself. This will save a lot of memory space. This can be done using enumerate
.
>>> l = ['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3\n']
>>> for i,s in enumerate(l):
... l[i] = s.strip()
...
>>> l
['Name1', '7.3', '6.9', '6.6', '6.6', '6.1', '6.4', '7.3']
The timing result would be 1.4806894720022683
. But however this way is space effective.
A comparitive list of timings (Both Python 3.4.3 and Python 3.5.0)
----------------------------------------------------
|Case| method | Py3.4 |Place| Py3.5 |Place|
|----|-----------------|-------|-----|-------|-----|
| 1 | map with lambda | 2.22u | 5 | 2.85u | 5 |
| 2 | map w/o lambda | 1.38u | 2 | 2.00u | 2 |
| 3 | brute-force | 1.53u | 4 | 2.22u | 4 |
| 4 | list comp | 1.28u | 1 | 1.25u | 1 |
| 5 | in-place | 1.48u | 3 | 2.14u | 3 |
----------------------------------------------------
Finally note that the list-comprehension is the best way and the map
using lambda
is the worst. But again --- ONLY IN PYTHON3
Like you, I have been looking into several comments and post to replace special escape characters in my JSON which contains html object inside that.
My object is to remove the special characters in JSON object and also render the html which is inside the json object.
Here is what I did and hope its very simple to use.
First I did JSON.stringify my json object and JSON.parse the result.
For eg:
JSON.parse(JSON.stringify(jsonObject));
And it solves my problem and done using Pure Javascript.
Do you want to return a full row? Does the default row need to have default values or can it be an empty row? Do you want the default row to have the same column structure as the table in question?
Depending on your requirements, you might do something like this:
1) run the query and put results in a temp table (or table variable) 2) check to see if the temp table has results 3) if not, return an empty row by performing a select statement similar to this (in SQL Server):
select '' as columnA, '' as columnB, '' as columnC from #tempTable
Where columnA, columnB and columnC are your actual column names.
I think these three links sum it up:
stringstream and lexical_cast solutions are about the same as lexical cast is using stringstream.
Some specializations of lexical cast use different approach see http://www.boost.org/doc/libs/release/boost/lexical_cast.hpp for details. Integers and floats are now specialized for integer to string conversion.
One can specialize lexical_cast for his/her own needs and make it fast. This would be the ultimate solution satisfying all parties, clean and simple.
Articles already mentioned show comparison between different methods of converting integers <-> strings. Following approaches make sense: old c-way, spirit.karma, fastformat, simple naive loop.
Lexical_cast is ok in some cases e.g. for int to string conversion.
Converting string to int using lexical cast is not a good idea as it is 10-40 times slower than atoi depending on the platform/compiler used.
Boost.Spirit.Karma seems to be the fastest library for converting integer to string.
ex.: generate(ptr_char, int_, integer_number);
and basic simple loop from the article mentioned above is a fastest way to convert string to int, obviously not the safest one, strtol() seems like a safer solution
int naive_char_2_int(const char *p) {
int x = 0;
bool neg = false;
if (*p == '-') {
neg = true;
++p;
}
while (*p >= '0' && *p <= '9') {
x = (x*10) + (*p - '0');
++p;
}
if (neg) {
x = -x;
}
return x;
}
Try making Internet Explorer your default browser temporarily.
LocalDate.parse(
"01-23-2017" ,
DateTimeFormatter.ofPattern( "MM-dd-uuuu" )
)
I have a java.util.Date in the format yyyy-mm-dd
As other mentioned, the Date
class has no format. It has a count of milliseconds since the start of 1970 in UTC. No strings attached.
The other Answers use troublesome old legacy date-time classes, now supplanted by the java.time classes.
If you have a java.util.Date
, convert to a Instant
object. The Instant
class represents a moment on the timeline in UTC with a resolution of nanoseconds (up to nine (9) digits of a decimal fraction).
Instant instant = myUtilDate.toInstant();
The other Answers ignore the crucial issue of time zone. Determining a date requires a time zone. For any given moment, the date varies around the globe by zone. A few minutes after midnight in Paris France is a new day, while still “yesterday” in Montréal Québec.
Define the time zone by which you want context for your Instant
.
ZoneId z = ZoneId.of( "America/Montreal" );
Apply the ZoneId
to get a ZonedDateTime
.
ZonedDateTime zdt = instant.atZone( z );
LocalDate
If you only care about the date without a time-of-day, extract a LocalDate
.
LocalDate localDate = zdt.toLocalDate();
To generate a string in standard ISO 8601 format, YYYY-MM-DD, simply call toString
. The java.time classes use the standard formats by default when generating/parsing strings.
String output = localDate.toString();
2017-01-23
If you want a MM-DD-YYYY format, define a formatting pattern.
DateTimeFormatter f = DateTimeFormatter.ofPattern( "MM-dd-uuuu" );
String output = localDate.format( f );
Note that the formatting pattern codes are case-sensitive. The code in the Question incorrectly used mm
(minute of hour) rather than MM
(month of year).
Use the same DateTimeFormatter
object for parsing. The java.time classes are thread-safe, so you can keep this object around and reuse it repeatedly even across threads.
LocalDate localDate = LocalDate.parse( "01-23-2017" , f );
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date
, Calendar
, & SimpleDateFormat
.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
Where to obtain the java.time classes?
The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval
, YearWeek
, YearQuarter
, and more.
vim
!)"my, tags are, in here".split(/[ ,]+/)
the result is :
["my", "tags", "are", "in", "here"]
In base R, we can select the columns which we want to test using grep
, compare the data with 0, use rowSums
to select rows which has all non-zero values.
cols <- grep("^Mac", names(df))
df[rowSums(df[cols] != 0) == length(cols), ]
# DateTime Mac1 Mac2 Mac3 Mac4
#1 2011-04-02 06:05 21 21 21 21
#2 2011-04-02 06:10 22 22 22 22
#3 2011-04-02 06:20 24 24 24 24
Doing this with inverted logic but giving the same output
df[rowSums(df[cols] == 0) == 0, ]
In dplyr
, we can use filter_at
to test for specific columns and use all_vars
to select rows where all the values are not equal to 0.
library(dplyr)
df %>% filter_at(vars(starts_with("Mac")), all_vars(. != 0))
data
df <- structure(list(DateTime = structure(1:6, .Label = c("2011-04-02 06:00",
"2011-04-02 06:05", "2011-04-02 06:10", "2011-04-02 06:15", "2011-04-02 06:20",
"2011-04-02 06:25"), class = "factor"), Mac1 = c(20L, 21L, 22L,
23L, 24L, 0L), Mac2 = c(0L, 21L, 22L, 23L, 24L, 25L), Mac3 = c(20L,
21L, 22L, 0L, 24L, 25L), Mac4 = c(20L, 21L, 22L, 23L, 24L, 0L
)), class = "data.frame", row.names = c(NA, -6L))
Small correction for the Set-Content command. If the searched string is not found the Set-Content
command will blank (empty) the target file.
You can first verify if the string you are looking for exist or not. If not it will not replace anything.
If (select-string -path "c:\Windows\System32\drivers\etc\hosts" -pattern "String to look for") `
{(Get-Content c:\Windows\System32\drivers\etc\hosts).replace('String to look for', 'String to replace with') | Set-Content c:\Windows\System32\drivers\etc\hosts}
Else{"Nothing happened"}
First off it's important to understand that there are two kinds of "event listeners":
Scope event listeners registered via $on
:
$scope.$on('anEvent', function (event, data) {
...
});
Event handlers attached to elements via for example on
or bind
:
element.on('click', function (event) {
...
});
When $scope.$destroy()
is executed it will remove all listeners registered via $on
on that $scope.
It will not remove DOM elements or any attached event handlers of the second kind.
This means that calling $scope.$destroy()
manually from example within a directive's link function will not remove a handler attached via for example element.on
, nor the DOM element itself.
Note that remove
is a jqLite method (or a jQuery method if jQuery is loaded before AngularjS) and is not available on a standard DOM Element Object.
When element.remove()
is executed that element and all of its children will be removed from the DOM together will all event handlers attached via for example element.on
.
It will not destroy the $scope associated with the element.
To make it more confusing there is also a jQuery event called $destroy
. Sometimes when working with third-party jQuery libraries that remove elements, or if you remove them manually, you might need to perform clean up when that happens:
element.on('$destroy', function () {
scope.$destroy();
});
This depends on how the directive is "destroyed".
A normal case is that a directive is destroyed because ng-view
changes the current view. When this happens the ng-view
directive will destroy the associated $scope, sever all the references to its parent scope and call remove()
on the element.
This means that if that view contains a directive with this in its link function when it's destroyed by ng-view
:
scope.$on('anEvent', function () {
...
});
element.on('click', function () {
...
});
Both event listeners will be removed automatically.
However, it's important to note that the code inside these listeners can still cause memory leaks, for example if you have achieved the common JS memory leak pattern circular references
.
Even in this normal case of a directive getting destroyed due to a view changing there are things you might need to manually clean up.
For example if you have registered a listener on $rootScope
:
var unregisterFn = $rootScope.$on('anEvent', function () {});
scope.$on('$destroy', unregisterFn);
This is needed since $rootScope
is never destroyed during the lifetime of the application.
The same goes if you are using another pub/sub implementation that doesn't automatically perform the necessary cleanup when the $scope is destroyed, or if your directive passes callbacks to services.
Another situation would be to cancel $interval
/$timeout
:
var promise = $interval(function () {}, 1000);
scope.$on('$destroy', function () {
$interval.cancel(promise);
});
If your directive attaches event handlers to elements for example outside the current view, you need to manually clean those up as well:
var windowClick = function () {
...
};
angular.element(window).on('click', windowClick);
scope.$on('$destroy', function () {
angular.element(window).off('click', windowClick);
});
These were some examples of what to do when directives are "destroyed" by Angular, for example by ng-view
or ng-if
.
If you have custom directives that manage the lifecycle of DOM elements etc. it will of course get more complex.
Firstly, run the command below:
apt-get update && apt-get install procps
and then run:
ps -ef
Adding the following to /etc/environment
fixed the problem for me on Debian and Ubuntu (of course, modify to match the locale you want to use):
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
Same thing, Just start the table name with #
or ##
:
CREATE TABLE #TemporaryTable -- Local temporary table - starts with single #
(
Col1 int,
Col2 varchar(10)
....
);
CREATE TABLE ##GlobalTemporaryTable -- Global temporary table - note it starts with ##.
(
Col1 int,
Col2 varchar(10)
....
);
Temporary table names start with #
or ##
- The first is a local temporary table and the last is a global temporary table.
Here is one of many articles describing the differences between them.
It's easy to define one yourself. That's the power of JavaScript.
if(!Array.prototype.last) {
Array.prototype.last = function() {
return this[this.length - 1];
}
}
var arr = [1, 2, 5];
arr.last(); // 5
However, this may cause problems with 3rd-party code which (incorrectly) uses for..in
loops to iterate over arrays.
However, if you are not bound with browser support problems, then using the new ES5 syntax to define properties can solve that issue, by making the function non-enumerable, like so:
Object.defineProperty(Array.prototype, 'last', {
enumerable: false,
configurable: true,
get: function() {
return this[this.length - 1];
},
set: undefined
});
var arr = [1, 2, 5];
arr.last; // 5
Minimal example
And just to make what Mizux said as a minimal example:
main_c.c
#include <stdio.h>
int main(void) {
puts("hello");
}
main_cpp.cpp
#include <iostream>
int main(void) {
std::cout << "hello" << std::endl;
}
Then, without any Makefile
:
make CFLAGS='-g -O3' \
CXXFLAGS='-ggdb3 -O0' \
CPPFLAGS='-DX=1 -DY=2' \
CCFLAGS='--asdf' \
main_c \
main_cpp
runs:
cc -g -O3 -DX=1 -DY=2 main_c.c -o main_c
g++ -ggdb3 -O0 -DX=1 -DY=2 main_cpp.cpp -o main_cpp
So we understand that:
make
had implicit rules to make main_c
and main_cpp
from main_c.c
and main_cpp.cpp
.c
compilation.cpp
compilationThose variables are only used in make's implicit rules automatically: if compilation had used our own explicit rules, then we would have to explicitly use those variables as in:
main_c: main_c.c
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $<
main_cpp: main_c.c
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
to achieve a similar affect to the implicit rules.
We could also name those variables however we want: but since Make already treats them magically in the implicit rules, those make good name choices.
Tested in Ubuntu 16.04, GNU Make 4.1.
The Uri class is generally your best bet for manipulating Urls.
Sometimes you don't have a local REF for pushing that branch back to the origin.
Try
git push origin master:master
This explicitly indicates which branch to push to (and from)
You should use django methods, like exists. Its there for you to use it.
if qs.exists():
return qs[0]
return None
The below code prints the value as 1200.00.
var convertDecimal = Convert.ToDecimal("1200.00");
Console.WriteLine(convertDecimal);
Not sure what you are expecting?
We can also use postgresql-easy. It is built on node-postgres and sqlutil. Note: pg_connection.js & your_handler.js are in the same folder. db.js is in the config folder placed.
pg_connection.js
const PgConnection = require('postgresql-easy');
const dbConfig = require('./config/db');
const pg = new PgConnection(dbConfig);
module.exports = pg;
./config/db.js
module.exports = {
database: 'your db',
host: 'your host',
port: 'your port',
user: 'your user',
password: 'your pwd',
}
your_handler.js
const pg_conctn = require('./pg_connection');
pg_conctn.getAll('your table')
.then(res => {
doResponseHandlingstuff();
})
.catch(e => {
doErrorHandlingStuff()
})
1.Create a new folder named 'public' if none exists.
2.Create a new folder named 'css' under the newly created 'public' folder
3.create your css file under the public/css path
4.On your html link css i.e
<link rel="stylesheet" type="text/css" href="/css/style.css">
// note the href uses a slash(/) before and you do not need to include the 'public'
5.On your app.js include :
app.use(express.static('public'));
Boom.It works!!
You can also use sequence unpacking with zip
:
L = [(1,2),(2,3),(4,5),(3,4),(6,7),(6,7),(3,8)]
_, res = zip(*L)
print(res)
# (2, 3, 5, 4, 7, 7, 8)
This also creates a tuple _
from the discarded first elements. Extracting only the second is possible, but more verbose:
from itertools import islice
res = next(islice(zip(*L), 1, None))
I Checked page load complete, work in Selenium 3.14.0
public static void UntilPageLoadComplete(IWebDriver driver, long timeoutInSeconds)
{
Until(driver, (d) =>
{
Boolean isPageLoaded = (Boolean)((IJavaScriptExecutor)driver).ExecuteScript("return document.readyState").Equals("complete");
if (!isPageLoaded) Console.WriteLine("Document is loading");
return isPageLoaded;
}, timeoutInSeconds);
}
public static void Until(IWebDriver driver, Func<IWebDriver, Boolean> waitCondition, long timeoutInSeconds)
{
WebDriverWait webDriverWait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds));
webDriverWait.Timeout = TimeSpan.FromSeconds(timeoutInSeconds);
try
{
webDriverWait.Until(waitCondition);
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
The following worked for me (Windows 7):
oradim -shutdown -sid enter_sid_here
oradim -startup -sid enter_sid_here
(with enter_sid_here
replaced by the SID)
yes It is possible.. returns type can be different only if parent class method return type is
a super type of child class method return type..
means
class ParentClass {
public Circle() method1() {
return new Cirlce();
}
}
class ChildClass extends ParentClass {
public Square method1() {
return new Square();
}
}
Class Circle {
}
class Square extends Circle {
}
With Kotlin, we can now make a generic function for this!
object RepeatHelper {
fun repeatDelayed(delay: Long, todo: () -> Unit) {
val handler = Handler()
handler.postDelayed(object : Runnable {
override fun run() {
todo()
handler.postDelayed(this, delay)
}
}, delay)
}
}
And to use, just do:
val delay = 1000L
RepeatHelper.repeatDelayed(delay) {
myRepeatedFunction()
}
It looks funny but it works.
<?php
$file = 'newpage.html';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= "<!doctype html><html>
<head><meta charset='utf-8'>
<title>new file</title>
</head><body><h3>New HTML file</h3>
</body></html>
";
// Write the contents back to the file
file_put_contents($file, $current);
?>
You probably have found this out already, but for someone stuck with this problem:
$("#tableId > tbody").html("");
If your objective is to import a theme into your Wordpress then you can manually copy paste your theme into your wp-content->themes folder and extract it of course. I just encountered this and couldn't locate the php.ini file for WAMP.
You can't do that, because GetFiles
only accepts a single search pattern. Instead, you can call GetFiles
with no pattern, and filter the results in code:
string[] extensions = new[] { ".jpg", ".tiff", ".bmp" };
FileInfo[] files =
dinfo.GetFiles()
.Where(f => extensions.Contains(f.Extension.ToLower()))
.ToArray();
If you're working with .NET 4, you can use the EnumerateFiles
method to avoid loading all FileInfo objects in memory at once:
string[] extensions = new[] { ".jpg", ".tiff", ".bmp" };
FileInfo[] files =
dinfo.EnumerateFiles()
.Where(f => extensions.Contains(f.Extension.ToLower()))
.ToArray();
You can install vim/vi for windows and set windows PATH variable and open it in command line.
I'm not sure how efficient this is but you can use range() to slice in both axis
x=np.arange(16).reshape((4,4))
x[range(1,3), :][:,range(1,3)]
Date.prototype.toISOString
throws RangeError
(at least in Chromium and Firefox) on invalid dates. You can use it as a means of validation and may not need isValidDate
as such (EAFP). Otherwise it's:
function isValidDate(d)
{
try
{
d.toISOString();
return true;
}
catch(ex)
{
return false;
}
}
This works perfectly for me:
import subprocess
try:
#prints results and merges stdout and std
result = subprocess.check_output("echo %USERNAME%", stderr=subprocess.STDOUT, shell=True)
print result
#causes error and merges stdout and stderr
result = subprocess.check_output("copy testfds", stderr=subprocess.STDOUT, shell=True)
except subprocess.CalledProcessError, ex: # error code <> 0
print "--------error------"
print ex.cmd
print ex.message
print ex.returncode
print ex.output # contains stdout and stderr together
Thank you all for your help. This is my final version, and it works thanks to your combined help ! I am only showing the changes i made, all the rest is taken from Joe Chung's work
public class GoogleSearchResults
{
[DataMember]
public ResponseData responseData { get; set; }
[DataMember]
public string responseDetails { get; set; }
[DataMember]
public int responseStatus { get; set; }
}
and
[DataContract]
public class ResponseData
{
[DataMember]
public List<Results> results { get; set; }
}
I have encountered the exception java.lang.IllegalArgumentException: Unknown URI: content://downloads/public_downloads/7505 in getting the doucument from the downloads. This solution worked for me.
else if (isDownloadsDocument(uri)) {
String fileName = getFilePath(context, uri);
if (fileName != null) {
return Environment.getExternalStorageDirectory().toString() + "/Download/" + fileName;
}
String id = DocumentsContract.getDocumentId(uri);
if (id.startsWith("raw:")) {
id = id.replaceFirst("raw:", "");
File file = new File(id);
if (file.exists())
return id;
}
final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null);
}
This the method used to get the filepath
public static String getFilePath(Context context, Uri uri) {
Cursor cursor = null;
final String[] projection = {
MediaStore.MediaColumns.DISPLAY_NAME
};
try {
cursor = context.getContentResolver().query(uri, projection, null, null,
null);
if (cursor != null && cursor.moveToFirst()) {
final int index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DISPLAY_NAME);
return cursor.getString(index);
}
} finally {
if (cursor != null)
cursor.close();
}
return null;
}
You can also use the ES6 Reflect
object:
x = {'key': 1};
Reflect.has( x, 'key'); // returns true
Documentation on MDN for Reflect.has
can be found here.
The static
Reflect.has()
method works like the in operator as a function.
The problem was solved by reinstalling Visual Studio 2015.
Use trasform: scale(1.1) property to make bg image bigger, move it up with position: relative; top: -10px;
<div class="home-hero">
<div class="home-hero__img"></div>
</div>
.home-hero__img{
position:relative;
top:-10px;
transform: scale(1.1);
background: {
size: contain;
image: url('image.svg');
}
}
You cannot use WHILE
like that; see: mysql DECLARE WHILE outside stored procedure how?
You have to put your code in a stored procedure. Example:
CREATE PROCEDURE myproc()
BEGIN
DECLARE i int DEFAULT 237692001;
WHILE i <= 237692004 DO
INSERT INTO mytable (code, active, total) VALUES (i, 1, 1);
SET i = i + 1;
END WHILE;
END
Fiddle: http://sqlfiddle.com/#!2/a4f92/1
Alternatively, generate a list of INSERT
statements using any programming language you like; for a one-time creation, it should be fine. As an example, here's a Bash one-liner:
for i in {2376921001..2376921099}; do echo "INSERT INTO mytable (code, active, total) VALUES ($i, 1, 1);"; done
By the way, you made a typo in your numbers; 2376921001 has 10 digits, 237692200 only 9.
In VS2017, right-click on the solution => Open CommandLine => Developer Command Line.
Once thats open, type in (and press enter after)
dotnet restore
That will restore any/all packages, and you get a nice console output of whats been done...
In your route configuration you typically define a route like,
.when('somewhere/:param1/:param2')
You can then either get the route in the resolve object by using $route.current.params
or in a controller, $routeParams
. In either case the parameters is extracted using the mapping of the route, so param1
can be accessed by $routeParams.param1
in the controller.
Edit: Also note that the mapping has to be exact
/some/folder/:param1
Will only match a single parameter.
/some/folder/:param1/:param2
Will only match two parameters.
This is a bit different then most dynamic server side routes. For example NodeJS (Express) route mapping where you can supply only a single route with X number of parameters.
use RelativeLayout which has 2 imageViews in . and set transparency code on the top imageView.
transparency code :
<solid android:color="@color/white"/>
<gradient android:startColor="#40000000" android:endColor="#FFFFFFFF" android:angle="270"/>
Select count(created_date) total
, created_dt
from table
group by created_date
order by created_date desc
Just put the below code in your .htaccess
file:
AddType application/octet-stream .csv
AddType application/octet-stream .xls
AddType application/octet-stream .doc
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .pdf
Or you can also do trick by JavaScript
element.setAttribute( 'download', whatever_string_you_want);
You can use dict.pop
:
mydict.pop("key", None)
Note that if the second argument, i.e. None
is not given, KeyError
is raised if the key is not in the dictionary. Providing the second argument prevents the conditional exception.
I saw a lot of examples here where no real work was being performed, and they were mostly CPU-bound. Here is an example of a CPU-bound task that computes all prime numbers between 10 million and 10.05 million. I have used all four methods here:
import math
import timeit
import threading
import multiprocessing
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
def time_stuff(fn):
"""
Measure time of execution of a function
"""
def wrapper(*args, **kwargs):
t0 = timeit.default_timer()
fn(*args, **kwargs)
t1 = timeit.default_timer()
print("{} seconds".format(t1 - t0))
return wrapper
def find_primes_in(nmin, nmax):
"""
Compute a list of prime numbers between the given minimum and maximum arguments
"""
primes = []
# Loop from minimum to maximum
for current in range(nmin, nmax + 1):
# Take the square root of the current number
sqrt_n = int(math.sqrt(current))
found = False
# Check if the any number from 2 to the square root + 1 divides the current numnber under consideration
for number in range(2, sqrt_n + 1):
# If divisible we have found a factor, hence this is not a prime number, lets move to the next one
if current % number == 0:
found = True
break
# If not divisible, add this number to the list of primes that we have found so far
if not found:
primes.append(current)
# I am merely printing the length of the array containing all the primes, but feel free to do what you want
print(len(primes))
@time_stuff
def sequential_prime_finder(nmin, nmax):
"""
Use the main process and main thread to compute everything in this case
"""
find_primes_in(nmin, nmax)
@time_stuff
def threading_prime_finder(nmin, nmax):
"""
If the minimum is 1000 and the maximum is 2000 and we have four workers,
1000 - 1250 to worker 1
1250 - 1500 to worker 2
1500 - 1750 to worker 3
1750 - 2000 to worker 4
so let’s split the minimum and maximum values according to the number of workers
"""
nrange = nmax - nmin
threads = []
for i in range(8):
start = int(nmin + i * nrange/8)
end = int(nmin + (i + 1) * nrange/8)
# Start the thread with the minimum and maximum split up to compute
# Parallel computation will not work here due to the GIL since this is a CPU-bound task
t = threading.Thread(target = find_primes_in, args = (start, end))
threads.append(t)
t.start()
# Don’t forget to wait for the threads to finish
for t in threads:
t.join()
@time_stuff
def processing_prime_finder(nmin, nmax):
"""
Split the minimum, maximum interval similar to the threading method above, but use processes this time
"""
nrange = nmax - nmin
processes = []
for i in range(8):
start = int(nmin + i * nrange/8)
end = int(nmin + (i + 1) * nrange/8)
p = multiprocessing.Process(target = find_primes_in, args = (start, end))
processes.append(p)
p.start()
for p in processes:
p.join()
@time_stuff
def thread_executor_prime_finder(nmin, nmax):
"""
Split the min max interval similar to the threading method, but use a thread pool executor this time.
This method is slightly faster than using pure threading as the pools manage threads more efficiently.
This method is still slow due to the GIL limitations since we are doing a CPU-bound task.
"""
nrange = nmax - nmin
with ThreadPoolExecutor(max_workers = 8) as e:
for i in range(8):
start = int(nmin + i * nrange/8)
end = int(nmin + (i + 1) * nrange/8)
e.submit(find_primes_in, start, end)
@time_stuff
def process_executor_prime_finder(nmin, nmax):
"""
Split the min max interval similar to the threading method, but use the process pool executor.
This is the fastest method recorded so far as it manages process efficiently + overcomes GIL limitations.
RECOMMENDED METHOD FOR CPU-BOUND TASKS
"""
nrange = nmax - nmin
with ProcessPoolExecutor(max_workers = 8) as e:
for i in range(8):
start = int(nmin + i * nrange/8)
end = int(nmin + (i + 1) * nrange/8)
e.submit(find_primes_in, start, end)
def main():
nmin = int(1e7)
nmax = int(1.05e7)
print("Sequential Prime Finder Starting")
sequential_prime_finder(nmin, nmax)
print("Threading Prime Finder Starting")
threading_prime_finder(nmin, nmax)
print("Processing Prime Finder Starting")
processing_prime_finder(nmin, nmax)
print("Thread Executor Prime Finder Starting")
thread_executor_prime_finder(nmin, nmax)
print("Process Executor Finder Starting")
process_executor_prime_finder(nmin, nmax)
main()
Here are the results on my Mac OS X four-core machine
Sequential Prime Finder Starting
9.708213827005238 seconds
Threading Prime Finder Starting
9.81836523200036 seconds
Processing Prime Finder Starting
3.2467174359990167 seconds
Thread Executor Prime Finder Starting
10.228896902000997 seconds
Process Executor Finder Starting
2.656402041000547 seconds
I'm not sure what the query syntax is. But here is the expanded LINQ expression example.
var query = someList.Select(x => { x.SomeProp = "foo"; return x; })
What this does is use an anonymous method vs and expression. This allows you to use several statements in one lambda. So you can combine the two operations of setting the property and returning the object into this somewhat succinct method.
scanf
uses any whitespace as a delimiter, so if you just say scanf("%d", &var)
it will skip any whitespace and then read an integer (digits up to the next non-digit) and nothing more.
Note that whitespace is any whitespace -- spaces, tabs, newlines, or carriage returns. Any of those are whitespace and any one or more of them will serve to delimit successive integers.
Not possible. How is the Map supposed to know which subclass of Animal it's going to get, given only a String key?
The only way this would be possible is if each Animal accepted only one type of friend (then it could be a parameter of the Animal class), or of the callFriend() method got a type parameter. But it really looks like you're missing the point of inheritance: it's that you can only treat subclasses uniformly when using exclusively the superclass methods.
Swift 3 / Swift 4
You must first import
import SystemConfiguration
You can check internet connection with the following method
func isConnectedToNetwork() -> Bool {
var zeroAddress = sockaddr_in()
zeroAddress.sin_len = UInt8(MemoryLayout.size(ofValue: zeroAddress))
zeroAddress.sin_family = sa_family_t(AF_INET)
let defaultRouteReachability = withUnsafePointer(to: &zeroAddress) {
$0.withMemoryRebound(to: sockaddr.self, capacity: 1) {zeroSockAddress in
SCNetworkReachabilityCreateWithAddress(nil, zeroSockAddress)
}
}
var flags = SCNetworkReachabilityFlags()
if !SCNetworkReachabilityGetFlags(defaultRouteReachability!, &flags) {
return false
}
let isReachable = (flags.rawValue & UInt32(kSCNetworkFlagsReachable)) != 0
let needsConnection = (flags.rawValue & UInt32(kSCNetworkFlagsConnectionRequired)) != 0
return (isReachable && !needsConnection)
}
I may be late but still...
This answer is based on removing and adding views dynamically
To disable scrolling:
View child = scoll.getChildAt(0);// since scrollView can only have one direct child
ViewGroup parent = (ViewGroup) scroll.getParent();
scroll.removeView(child); // remove child from scrollview
parent.addView(child,parent.indexOfChild(scroll));// add scroll child at the position of scrollview
parent.removeView(scroll);// remove scrollView from parent
To enable ScrollView just reverse the process
a MySQL-only solution would be something like this:
SELECT IF (UNIX_TIMESTAMP(`field`) > UNIX_TIMESTAMP(), `field`,'GO AHEAD') as `yourdate`
FROM `table`
A very typical approach to this type of problem is to use row_number()
:
select t.*
from (select t.*,
row_number() over (partition by number order by id) as seqnum
from t
) t
where seqnum = 1;
This is more generalizable than using a comparison to the minimum id. For instance, you can get a random row by using order by newid()
. You can select 2 rows by using where seqnum <= 2
.
<-
does assignment in the current environment.
When you're inside a function R creates a new environment for you. By default it includes everything from the environment in which it was created so you can use those variables as well but anything new you create will not get written to the global environment.
In most cases <<-
will assign to variables already in the global environment or create a variable in the global environment even if you're inside a function. However, it isn't quite as straightforward as that. What it does is checks the parent environment for a variable with the name of interest. If it doesn't find it in your parent environment it goes to the parent of the parent environment (at the time the function was created) and looks there. It continues upward to the global environment and if it isn't found in the global environment it will assign the variable in the global environment.
This might illustrate what is going on.
bar <- "global"
foo <- function(){
bar <- "in foo"
baz <- function(){
bar <- "in baz - before <<-"
bar <<- "in baz - after <<-"
print(bar)
}
print(bar)
baz()
print(bar)
}
> bar
[1] "global"
> foo()
[1] "in foo"
[1] "in baz - before <<-"
[1] "in baz - after <<-"
> bar
[1] "global"
The first time we print bar we haven't called foo
yet so it should still be global - this makes sense. The second time we print it's inside of foo
before calling baz
so the value "in foo" makes sense. The following is where we see what <<-
is actually doing. The next value printed is "in baz - before <<-" even though the print statement comes after the <<-
. This is because <<-
doesn't look in the current environment (unless you're in the global environment in which case <<-
acts like <-
). So inside of baz
the value of bar stays as "in baz - before <<-". Once we call baz
the copy of bar inside of foo
gets changed to "in baz" but as we can see the global bar
is unchanged. This is because the copy of bar
that is defined inside of foo
is in the parent environment when we created baz
so this is the first copy of bar
that <<-
sees and thus the copy it assigns to. So <<-
isn't just directly assigning to the global environment.
<<-
is tricky and I wouldn't recommend using it if you can avoid it. If you really want to assign to the global environment you can use the assign function and tell it explicitly that you want to assign globally.
Now I change the <<-
to an assign statement and we can see what effect that has:
bar <- "global"
foo <- function(){
bar <- "in foo"
baz <- function(){
assign("bar", "in baz", envir = .GlobalEnv)
}
print(bar)
baz()
print(bar)
}
bar
#[1] "global"
foo()
#[1] "in foo"
#[1] "in foo"
bar
#[1] "in baz"
So both times we print bar inside of foo
the value is "in foo" even after calling baz
. This is because assign
never even considered the copy of bar
inside of foo because we told it exactly where to look. However, this time the value of bar in the global environment was changed because we explicitly assigned there.
Now you also asked about creating local variables and you can do that fairly easily as well without creating a function... We just need to use the local
function.
bar <- "global"
# local will create a new environment for us to play in
local({
bar <- "local"
print(bar)
})
#[1] "local"
bar
#[1] "global"
An even quicker/shorter solution is:
escaped = new Option(html).innerHTML
This is related to some weird vestige of JavaScript whereby the Option element retains a constructor that does this sort of escaping automatically.
you can use the below css styles for all browsers except Firefox 30
select {
background: url(dropdown_arw.png) no-repeat right center;
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
width: 90px;
text-indent: 0.01px;
text-overflow: "";
}
demo page - http://kvijayanand.in/jquery-plugin/test.html
Updated
here is solution for Firefox 30. little trick for custom select elements in firefox :-moz-any() css pseudo class.
That code doesn't work very well i fixed it a little bit
var el = $('.caja-pago');
var elpos_original = el.offset().top;
$(window).scroll(function(){
var elpos = el.offset().top;
var windowpos = $(window).scrollTop();
var finaldestination = windowpos;
if(windowpos<elpos_original) {
finaldestination = elpos_original;
el.stop().animate({'top':400},500);
} else {
el.stop().animate({'top':windowpos+10},500);
}
});
In Swift:
override func viewDidLoad() {
super.viewDidLoad()
// We set the table view header.
let cellTableViewHeader = tableView.dequeueReusableCellWithIdentifier(TableViewController.tableViewHeaderCustomCellIdentifier) as! UITableViewCell
cellTableViewHeader.frame = CGRectMake(0, 0, self.tableView.bounds.width, self.heightCache[TableViewController.tableViewHeaderCustomCellIdentifier]!)
self.tableView.tableHeaderView = cellTableViewHeader
// We set the table view footer, just know that it will also remove extra cells from tableview.
let cellTableViewFooter = tableView.dequeueReusableCellWithIdentifier(TableViewController.tableViewFooterCustomCellIdentifier) as! UITableViewCell
cellTableViewFooter.frame = CGRectMake(0, 0, self.tableView.bounds.width, self.heightCache[TableViewController.tableViewFooterCustomCellIdentifier]!)
self.tableView.tableFooterView = cellTableViewFooter
}
Here is the (almost) complete file extensions's MIME in a JSON format. Just do example: MIME["ppt"], MIME["docx"], etc
{"x3d": "application/vnd.hzn-3d-crossword", "3gp": "video/3gpp", "3g2": "video/3gpp2", "mseq": "application/vnd.mseq", "pwn": "application/vnd.3m.post-it-notes", "plb": "application/vnd.3gpp.pic-bw-large", "psb": "application/vnd.3gpp.pic-bw-small", "pvb": "application/vnd.3gpp.pic-bw-var", "tcap": "application/vnd.3gpp2.tcap", "7z": "application/x-7z-compressed", "abw": "application/x-abiword", "ace": "application/x-ace-compressed", "acc": "application/vnd.americandynamics.acc", "acu": "application/vnd.acucobol", "atc": "application/vnd.acucorp", "adp": "audio/adpcm", "aab": "application/x-authorware-bin", "aam": "application/x-authorware-map", "aas": "application/x-authorware-seg", "air": "application/vnd.adobe.air-application-installer-package+zip", "swf": "application/x-shockwave-flash", "fxp": "application/vnd.adobe.fxp", "pdf": "application/pdf", "ppd": "application/vnd.cups-ppd", "dir": "application/x-director", "xdp": "application/vnd.adobe.xdp+xml", "xfdf": "application/vnd.adobe.xfdf", "aac": "audio/x-aac", "ahead": "application/vnd.ahead.space", "azf": "application/vnd.airzip.filesecure.azf", "azs": "application/vnd.airzip.filesecure.azs", "azw": "application/vnd.amazon.ebook", "ami": "application/vnd.amiga.ami", "N/A": "application/andrew-inset", "apk": "application/vnd.android.package-archive", "cii": "application/vnd.anser-web-certificate-issue-initiation", "fti": "application/vnd.anser-web-funds-transfer-initiation", "atx": "application/vnd.antix.game-component", "dmg": "application/x-apple-diskimage", "mpkg": "application/vnd.apple.installer+xml", "aw": "application/applixware", "mp3": "audio/mpeg", "les": "application/vnd.hhe.lesson-player", "swi": "application/vnd.aristanetworks.swi", "s": "text/x-asm", "atomcat": "application/atomcat+xml", "atomsvc": "application/atomsvc+xml", "atom, .xml": "application/atom+xml", "ac": "application/pkix-attr-cert", "aif": "audio/x-aiff", "avi": "video/x-msvideo", "aep": "application/vnd.audiograph", "dxf": "image/vnd.dxf", "dwf": "model/vnd.dwf", "par": "text/plain-bas", "bcpio": "application/x-bcpio", "bin": "application/octet-stream", "bmp": "image/bmp", "torrent": "application/x-bittorrent", "cod": "application/vnd.rim.cod", "mpm": "application/vnd.blueice.multipass", "bmi": "application/vnd.bmi", "sh": "application/x-sh", "btif": "image/prs.btif", "rep": "application/vnd.businessobjects", "bz": "application/x-bzip", "bz2": "application/x-bzip2", "csh": "application/x-csh", "c": "text/x-c", "cdxml": "application/vnd.chemdraw+xml", "css": "text/css", "cdx": "chemical/x-cdx", "cml": "chemical/x-cml", "csml": "chemical/x-csml", "cdbcmsg": "application/vnd.contact.cmsg", "cla": "application/vnd.claymore", "c4g": "application/vnd.clonk.c4group", "sub": "image/vnd.dvb.subtitle", "cdmia": "application/cdmi-capability", "cdmic": "application/cdmi-container", "cdmid": "application/cdmi-domain", "cdmio": "application/cdmi-object", "cdmiq": "application/cdmi-queue", "c11amc": "application/vnd.cluetrust.cartomobile-config", "c11amz": "application/vnd.cluetrust.cartomobile-config-pkg", "ras": "image/x-cmu-raster", "dae": "model/vnd.collada+xml", "csv": "text/csv", "cpt": "application/mac-compactpro", "wmlc": "application/vnd.wap.wmlc", "cgm": "image/cgm", "ice": "x-conference/x-cooltalk", "cmx": "image/x-cmx", "xar": "application/vnd.xara", "cmc": "application/vnd.cosmocaller", "cpio": "application/x-cpio", "clkx": "application/vnd.crick.clicker", "clkk": "application/vnd.crick.clicker.keyboard", "clkp": "application/vnd.crick.clicker.palette", "clkt": "application/vnd.crick.clicker.template", "clkw": "application/vnd.crick.clicker.wordbank", "wbs": "application/vnd.criticaltools.wbs+xml", "cryptonote": "application/vnd.rig.cryptonote", "cif": "chemical/x-cif", "cmdf": "chemical/x-cmdf", "cu": "application/cu-seeme", "cww": "application/prs.cww", "curl": "text/vnd.curl", "dcurl": "text/vnd.curl.dcurl", "mcurl": "text/vnd.curl.mcurl", "scurl": "text/vnd.curl.scurl", "car": "application/vnd.curl.car", "pcurl": "application/vnd.curl.pcurl", "cmp": "application/vnd.yellowriver-custom-menu", "dssc": "application/dssc+der", "xdssc": "application/dssc+xml", "deb": "application/x-debian-package", "uva": "audio/vnd.dece.audio", "uvi": "image/vnd.dece.graphic", "uvh": "video/vnd.dece.hd", "uvm": "video/vnd.dece.mobile", "uvu": "video/vnd.uvvu.mp4", "uvp": "video/vnd.dece.pd", "uvs": "video/vnd.dece.sd", "uvv": "video/vnd.dece.video", "dvi": "application/x-dvi", "seed": "application/vnd.fdsn.seed", "dtb": "application/x-dtbook+xml", "res": "application/x-dtbresource+xml", "ait": "application/vnd.dvb.ait", "svc": "application/vnd.dvb.service", "eol": "audio/vnd.digital-winds", "djvu": "image/vnd.djvu", "dtd": "application/xml-dtd", "mlp": "application/vnd.dolby.mlp", "wad": "application/x-doom", "dpg": "application/vnd.dpgraph", "dra": "audio/vnd.dra", "dfac": "application/vnd.dreamfactory", "dts": "audio/vnd.dts", "dtshd": "audio/vnd.dts.hd", "dwg": "image/vnd.dwg", "geo": "application/vnd.dynageo", "es": "application/ecmascript", "mag": "application/vnd.ecowin.chart", "mmr": "image/vnd.fujixerox.edmics-mmr", "rlc": "image/vnd.fujixerox.edmics-rlc", "exi": "application/exi", "mgz": "application/vnd.proteus.magazine", "epub": "application/epub+zip", "eml": "message/rfc822", "nml": "application/vnd.enliven", "xpr": "application/vnd.is-xpr", "xif": "image/vnd.xiff", "xfdl": "application/vnd.xfdl", "emma": "application/emma+xml", "ez2": "application/vnd.ezpix-album", "ez3": "application/vnd.ezpix-package", "fst": "image/vnd.fst", "fvt": "video/vnd.fvt", "fbs": "image/vnd.fastbidsheet", "fe_launch": "application/vnd.denovo.fcselayout-link", "f4v": "video/x-f4v", "flv": "video/x-flv", "fpx": "image/vnd.fpx", "npx": "image/vnd.net-fpx", "flx": "text/vnd.fmi.flexstor", "fli": "video/x-fli", "ftc": "application/vnd.fluxtime.clip", "fdf": "application/vnd.fdf", "f": "text/x-fortran", "mif": "application/vnd.mif", "fm": "application/vnd.framemaker", "fh": "image/x-freehand", "fsc": "application/vnd.fsc.weblaunch", "fnc": "application/vnd.frogans.fnc", "ltf": "application/vnd.frogans.ltf", "ddd": "application/vnd.fujixerox.ddd", "xdw": "application/vnd.fujixerox.docuworks", "xbd": "application/vnd.fujixerox.docuworks.binder", "oas": "application/vnd.fujitsu.oasys", "oa2": "application/vnd.fujitsu.oasys2", "oa3": "application/vnd.fujitsu.oasys3", "fg5": "application/vnd.fujitsu.oasysgp", "bh2": "application/vnd.fujitsu.oasysprs", "spl": "application/x-futuresplash", "fzs": "application/vnd.fuzzysheet", "g3": "image/g3fax", "gmx": "application/vnd.gmx", "gtw": "model/vnd.gtw", "txd": "application/vnd.genomatix.tuxedo", "ggb": "application/vnd.geogebra.file", "ggt": "application/vnd.geogebra.tool", "gdl": "model/vnd.gdl", "gex": "application/vnd.geometry-explorer", "gxt": "application/vnd.geonext", "g2w": "application/vnd.geoplan", "g3w": "application/vnd.geospace", "gsf": "application/x-font-ghostscript", "bdf": "application/x-font-bdf", "gtar": "application/x-gtar", "texinfo": "application/x-texinfo", "gnumeric": "application/x-gnumeric", "kml": "application/vnd.google-earth.kml+xml", "kmz": "application/vnd.google-earth.kmz", "gqf": "application/vnd.grafeq", "gif": "image/gif", "gv": "text/vnd.graphviz", "gac": "application/vnd.groove-account", "ghf": "application/vnd.groove-help", "gim": "application/vnd.groove-identity-message", "grv": "application/vnd.groove-injector", "gtm": "application/vnd.groove-tool-message", "tpl": "application/vnd.groove-tool-template", "vcg": "application/vnd.groove-vcard", "h261": "video/h261", "h263": "video/h263", "h264": "video/h264", "hpid": "application/vnd.hp-hpid", "hps": "application/vnd.hp-hps", "hdf": "application/x-hdf", "rip": "audio/vnd.rip", "hbci": "application/vnd.hbci", "jlt": "application/vnd.hp-jlyt", "pcl": "application/vnd.hp-pcl", "hpgl": "application/vnd.hp-hpgl", "hvs": "application/vnd.yamaha.hv-script", "hvd": "application/vnd.yamaha.hv-dic", "hvp": "application/vnd.yamaha.hv-voice", "sfd-hdstx": "application/vnd.hydrostatix.sof-data", "stk": "application/hyperstudio", "hal": "application/vnd.hal+xml", "html": "text/html", "irm": "application/vnd.ibm.rights-management", "sc": "application/vnd.ibm.secure-container", "ics": "text/calendar", "icc": "application/vnd.iccprofile", "ico": "image/x-icon", "igl": "application/vnd.igloader", "ief": "image/ief", "ivp": "application/vnd.immervision-ivp", "ivu": "application/vnd.immervision-ivu", "rif": "application/reginfo+xml", "3dml": "text/vnd.in3d.3dml", "spot": "text/vnd.in3d.spot", "igs": "model/iges", "i2g": "application/vnd.intergeo", "cdy": "application/vnd.cinderella", "xpw": "application/vnd.intercon.formnet", "fcs": "application/vnd.isac.fcs", "ipfix": "application/ipfix", "cer": "application/pkix-cert", "pki": "application/pkixcmp", "crl": "application/pkix-crl", "pkipath": "application/pkix-pkipath", "igm": "application/vnd.insors.igm", "rcprofile": "application/vnd.ipunplugged.rcprofile", "irp": "application/vnd.irepository.package+xml", "jad": "text/vnd.sun.j2me.app-descriptor", "jar": "application/java-archive", "class": "application/java-vm", "jnlp": "application/x-java-jnlp-file", "ser": "application/java-serialized-object", "java": "text/x-java-source,java", "js": "application/javascript", "json": "application/json", "joda": "application/vnd.joost.joda-archive", "jpm": "video/jpm", "jpeg, .jpg": "image/x-citrix-jpeg", "pjpeg": "image/pjpeg", "jpgv": "video/jpeg", "ktz": "application/vnd.kahootz", "mmd": "application/vnd.chipnuts.karaoke-mmd", "karbon": "application/vnd.kde.karbon", "chrt": "application/vnd.kde.kchart", "kfo": "application/vnd.kde.kformula", "flw": "application/vnd.kde.kivio", "kon": "application/vnd.kde.kontour", "kpr": "application/vnd.kde.kpresenter", "ksp": "application/vnd.kde.kspread", "kwd": "application/vnd.kde.kword", "htke": "application/vnd.kenameaapp", "kia": "application/vnd.kidspiration", "kne": "application/vnd.kinar", "sse": "application/vnd.kodak-descriptor", "lasxml": "application/vnd.las.las+xml", "latex": "application/x-latex", "lbd": "application/vnd.llamagraphics.life-balance.desktop", "lbe": "application/vnd.llamagraphics.life-balance.exchange+xml", "jam": "application/vnd.jam", "123": "application/vnd.lotus-1-2-3", "apr": "application/vnd.lotus-approach", "pre": "application/vnd.lotus-freelance", "nsf": "application/vnd.lotus-notes", "org": "application/vnd.lotus-organizer", "scm": "application/vnd.lotus-screencam", "lwp": "application/vnd.lotus-wordpro", "lvp": "audio/vnd.lucent.voice", "m3u": "audio/x-mpegurl", "m4v": "video/x-m4v", "hqx": "application/mac-binhex40", "portpkg": "application/vnd.macports.portpkg", "mgp": "application/vnd.osgeo.mapguide.package", "mrc": "application/marc", "mrcx": "application/marcxml+xml", "mxf": "application/mxf", "nbp": "application/vnd.wolfram.player", "ma": "application/mathematica", "mathml": "application/mathml+xml", "mbox": "application/mbox", "mc1": "application/vnd.medcalcdata", "mscml": "application/mediaservercontrol+xml", "cdkey": "application/vnd.mediastation.cdkey", "mwf": "application/vnd.mfer", "mfm": "application/vnd.mfmp", "msh": "model/mesh", "mads": "application/mads+xml", "mets": "application/mets+xml", "mods": "application/mods+xml", "meta4": "application/metalink4+xml", "mcd": "application/vnd.mcd", "flo": "application/vnd.micrografx.flo", "igx": "application/vnd.micrografx.igx", "es3": "application/vnd.eszigno3+xml", "mdb": "application/x-msaccess", "asf": "video/x-ms-asf", "exe": "application/x-msdownload", "cil": "application/vnd.ms-artgalry", "cab": "application/vnd.ms-cab-compressed", "ims": "application/vnd.ms-ims", "application": "application/x-ms-application", "clp": "application/x-msclip", "mdi": "image/vnd.ms-modi", "eot": "application/vnd.ms-fontobject", "xls": "application/vnd.ms-excel", "xlam": "application/vnd.ms-excel.addin.macroenabled.12", "xlsb": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "xltm": "application/vnd.ms-excel.template.macroenabled.12", "xlsm": "application/vnd.ms-excel.sheet.macroenabled.12", "chm": "application/vnd.ms-htmlhelp", "crd": "application/x-mscardfile", "lrm": "application/vnd.ms-lrm", "mvb": "application/x-msmediaview", "mny": "application/x-msmoney", "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "sldx": "application/vnd.openxmlformats-officedocument.presentationml.slide", "ppsx": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "potx": "application/vnd.openxmlformats-officedocument.presentationml.template", "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xltx": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "dotx": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "obd": "application/x-msbinder", "thmx": "application/vnd.ms-officetheme", "onetoc": "application/onenote", "pya": "audio/vnd.ms-playready.media.pya", "pyv": "video/vnd.ms-playready.media.pyv", "ppt": "application/vnd.ms-powerpoint", "ppam": "application/vnd.ms-powerpoint.addin.macroenabled.12", "sldm": "application/vnd.ms-powerpoint.slide.macroenabled.12", "pptm": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "ppsm": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "potm": "application/vnd.ms-powerpoint.template.macroenabled.12", "mpp": "application/vnd.ms-project", "pub": "application/x-mspublisher", "scd": "application/x-msschedule", "xap": "application/x-silverlight-app", "stl": "application/vnd.ms-pki.stl", "cat": "application/vnd.ms-pki.seccat", "vsd": "application/vnd.visio", "vsdx": "application/vnd.visio2013", "wm": "video/x-ms-wm", "wma": "audio/x-ms-wma", "wax": "audio/x-ms-wax", "wmx": "video/x-ms-wmx", "wmd": "application/x-ms-wmd", "wpl": "application/vnd.ms-wpl", "wmz": "application/x-ms-wmz", "wmv": "video/x-ms-wmv", "wvx": "video/x-ms-wvx", "wmf": "application/x-msmetafile", "trm": "application/x-msterminal", "doc": "application/msword", "docm": "application/vnd.ms-word.document.macroenabled.12", "dotm": "application/vnd.ms-word.template.macroenabled.12", "wri": "application/x-mswrite", "wps": "application/vnd.ms-works", "xbap": "application/x-ms-xbap", "xps": "application/vnd.ms-xpsdocument", "mid": "audio/midi", "mpy": "application/vnd.ibm.minipay", "afp": "application/vnd.ibm.modcap", "rms": "application/vnd.jcp.javame.midlet-rms", "tmo": "application/vnd.tmobile-livetv", "prc": "application/x-mobipocket-ebook", "mbk": "application/vnd.mobius.mbk", "dis": "application/vnd.mobius.dis", "plc": "application/vnd.mobius.plc", "mqy": "application/vnd.mobius.mqy", "msl": "application/vnd.mobius.msl", "txf": "application/vnd.mobius.txf", "daf": "application/vnd.mobius.daf", "fly": "text/vnd.fly", "mpc": "application/vnd.mophun.certificate", "mpn": "application/vnd.mophun.application", "mj2": "video/mj2", "mpga": "audio/mpeg", "mxu": "video/vnd.mpegurl", "mpeg": "video/mpeg", "m21": "application/mp21", "mp4a": "audio/mp4", "mp4": "application/mp4", "m3u8": "application/vnd.apple.mpegurl", "mus": "application/vnd.musician", "msty": "application/vnd.muvee.style", "mxml": "application/xv+xml", "ngdat": "application/vnd.nokia.n-gage.data", "n-gage": "application/vnd.nokia.n-gage.symbian.install", "ncx": "application/x-dtbncx+xml", "nc": "application/x-netcdf", "nlu": "application/vnd.neurolanguage.nlu", "dna": "application/vnd.dna", "nnd": "application/vnd.noblenet-directory", "nns": "application/vnd.noblenet-sealer", "nnw": "application/vnd.noblenet-web", "rpst": "application/vnd.nokia.radio-preset", "rpss": "application/vnd.nokia.radio-presets", "n3": "text/n3", "edm": "application/vnd.novadigm.edm", "edx": "application/vnd.novadigm.edx", "ext": "application/vnd.novadigm.ext", "gph": "application/vnd.flographit", "ecelp4800": "audio/vnd.nuera.ecelp4800", "ecelp7470": "audio/vnd.nuera.ecelp7470", "ecelp9600": "audio/vnd.nuera.ecelp9600", "oda": "application/oda", "ogx": "application/ogg", "oga": "audio/ogg", "ogv": "video/ogg", "dd2": "application/vnd.oma.dd2+xml", "oth": "application/vnd.oasis.opendocument.text-web", "opf": "application/oebps-package+xml", "qbo": "application/vnd.intu.qbo", "oxt": "application/vnd.openofficeorg.extension", "osf": "application/vnd.yamaha.openscoreformat", "weba": "audio/webm", "webm": "video/webm", "odc": "application/vnd.oasis.opendocument.chart", "otc": "application/vnd.oasis.opendocument.chart-template", "odb": "application/vnd.oasis.opendocument.database", "odf": "application/vnd.oasis.opendocument.formula", "odft": "application/vnd.oasis.opendocument.formula-template", "odg": "application/vnd.oasis.opendocument.graphics", "otg": "application/vnd.oasis.opendocument.graphics-template", "odi": "application/vnd.oasis.opendocument.image", "oti": "application/vnd.oasis.opendocument.image-template", "odp": "application/vnd.oasis.opendocument.presentation", "otp": "application/vnd.oasis.opendocument.presentation-template", "ods": "application/vnd.oasis.opendocument.spreadsheet", "ots": "application/vnd.oasis.opendocument.spreadsheet-template", "odt": "application/vnd.oasis.opendocument.text", "odm": "application/vnd.oasis.opendocument.text-master", "ott": "application/vnd.oasis.opendocument.text-template", "ktx": "image/ktx", "sxc": "application/vnd.sun.xml.calc", "stc": "application/vnd.sun.xml.calc.template", "sxd": "application/vnd.sun.xml.draw", "std": "application/vnd.sun.xml.draw.template", "sxi": "application/vnd.sun.xml.impress", "sti": "application/vnd.sun.xml.impress.template", "sxm": "application/vnd.sun.xml.math", "sxw": "application/vnd.sun.xml.writer", "sxg": "application/vnd.sun.xml.writer.global", "stw": "application/vnd.sun.xml.writer.template", "otf": "application/x-font-otf", "osfpvg": "application/vnd.yamaha.openscoreformat.osfpvg+xml", "dp": "application/vnd.osgi.dp", "pdb": "application/vnd.palm", "p": "text/x-pascal", "paw": "application/vnd.pawaafile", "pclxl": "application/vnd.hp-pclxl", "efif": "application/vnd.picsel", "pcx": "image/x-pcx", "psd": "image/vnd.adobe.photoshop", "prf": "application/pics-rules", "pic": "image/x-pict", "chat": "application/x-chat", "p10": "application/pkcs10", "p12": "application/x-pkcs12", "p7m": "application/pkcs7-mime", "p7s": "application/pkcs7-signature", "p7r": "application/x-pkcs7-certreqresp", "p7b": "application/x-pkcs7-certificates", "p8": "application/pkcs8", "plf": "application/vnd.pocketlearn", "pnm": "image/x-portable-anymap", "pbm": "image/x-portable-bitmap", "pcf": "application/x-font-pcf", "pfr": "application/font-tdpfr", "pgn": "application/x-chess-pgn", "pgm": "image/x-portable-graymap", "png": "image/x-png", "ppm": "image/x-portable-pixmap", "pskcxml": "application/pskc+xml", "pml": "application/vnd.ctc-posml", "ai": "application/postscript", "pfa": "application/x-font-type1", "pbd": "application/vnd.powerbuilder6", "pgp": "application/pgp-signature", "box": "application/vnd.previewsystems.box", "ptid": "application/vnd.pvi.ptid1", "pls": "application/pls+xml", "str": "application/vnd.pg.format", "ei6": "application/vnd.pg.osasli", "dsc": "text/prs.lines.tag", "psf": "application/x-font-linux-psf", "qps": "application/vnd.publishare-delta-tree", "wg": "application/vnd.pmi.widget", "qxd": "application/vnd.quark.quarkxpress", "esf": "application/vnd.epson.esf", "msf": "application/vnd.epson.msf", "ssf": "application/vnd.epson.ssf", "qam": "application/vnd.epson.quickanime", "qfx": "application/vnd.intu.qfx", "qt": "video/quicktime", "rar": "application/x-rar-compressed", "ram": "audio/x-pn-realaudio", "rmp": "audio/x-pn-realaudio-plugin", "rsd": "application/rsd+xml", "rm": "application/vnd.rn-realmedia", "bed": "application/vnd.realvnc.bed", "mxl": "application/vnd.recordare.musicxml", "musicxml": "application/vnd.recordare.musicxml+xml", "rnc": "application/relax-ng-compact-syntax", "rdz": "application/vnd.data-vision.rdz", "rdf": "application/rdf+xml", "rp9": "application/vnd.cloanto.rp9", "jisp": "application/vnd.jisp", "rtf": "application/rtf", "rtx": "text/richtext", "link66": "application/vnd.route66.link66+xml", "rss, .xml": "application/rss+xml", "shf": "application/shf+xml", "st": "application/vnd.sailingtracker.track", "svg": "image/svg+xml", "sus": "application/vnd.sus-calendar", "sru": "application/sru+xml", "setpay": "application/set-payment-initiation", "setreg": "application/set-registration-initiation", "sema": "application/vnd.sema", "semd": "application/vnd.semd", "semf": "application/vnd.semf", "see": "application/vnd.seemail", "snf": "application/x-font-snf", "spq": "application/scvp-vp-request", "spp": "application/scvp-vp-response", "scq": "application/scvp-cv-request", "scs": "application/scvp-cv-response", "sdp": "application/sdp", "etx": "text/x-setext", "movie": "video/x-sgi-movie", "ifm": "application/vnd.shana.informed.formdata", "itp": "application/vnd.shana.informed.formtemplate", "iif": "application/vnd.shana.informed.interchange", "ipk": "application/vnd.shana.informed.package", "tfi": "application/thraud+xml", "shar": "application/x-shar", "rgb": "image/x-rgb", "slt": "application/vnd.epson.salt", "aso": "application/vnd.accpac.simply.aso", "imp": "application/vnd.accpac.simply.imp", "twd": "application/vnd.simtech-mindmapper", "csp": "application/vnd.commonspace", "saf": "application/vnd.yamaha.smaf-audio", "mmf": "application/vnd.smaf", "spf": "application/vnd.yamaha.smaf-phrase", "teacher": "application/vnd.smart.teacher", "svd": "application/vnd.svd", "rq": "application/sparql-query", "srx": "application/sparql-results+xml", "gram": "application/srgs", "grxml": "application/srgs+xml", "ssml": "application/ssml+xml", "skp": "application/vnd.koan", "sgml": "text/sgml", "sdc": "application/vnd.stardivision.calc", "sda": "application/vnd.stardivision.draw", "sdd": "application/vnd.stardivision.impress", "smf": "application/vnd.stardivision.math", "sdw": "application/vnd.stardivision.writer", "sgl": "application/vnd.stardivision.writer-global", "sm": "application/vnd.stepmania.stepchart", "sit": "application/x-stuffit", "sitx": "application/x-stuffitx", "sdkm": "application/vnd.solent.sdkm+xml", "xo": "application/vnd.olpc-sugar", "au": "audio/basic", "wqd": "application/vnd.wqd", "sis": "application/vnd.symbian.install", "smi": "application/smil+xml", "xsm": "application/vnd.syncml+xml", "bdm": "application/vnd.syncml.dm+wbxml", "xdm": "application/vnd.syncml.dm+xml", "sv4cpio": "application/x-sv4cpio", "sv4crc": "application/x-sv4crc", "sbml": "application/sbml+xml", "tsv": "text/tab-separated-values", "tiff": "image/tiff", "tao": "application/vnd.tao.intent-module-archive", "tar": "application/x-tar", "tcl": "application/x-tcl", "tex": "application/x-tex", "tfm": "application/x-tex-tfm", "tei": "application/tei+xml", "txt": "text/plain", "dxp": "application/vnd.spotfire.dxp", "sfs": "application/vnd.spotfire.sfs", "tsd": "application/timestamped-data", "tpt": "application/vnd.trid.tpt", "mxs": "application/vnd.triscape.mxs", "t": "text/troff", "tra": "application/vnd.trueapp", "ttf": "application/x-font-ttf", "ttl": "text/turtle", "umj": "application/vnd.umajin", "uoml": "application/vnd.uoml+xml", "unityweb": "application/vnd.unity", "ufd": "application/vnd.ufdl", "uri": "text/uri-list", "utz": "application/vnd.uiq.theme", "ustar": "application/x-ustar", "uu": "text/x-uuencode", "vcs": "text/x-vcalendar", "vcf": "text/x-vcard", "vcd": "application/x-cdlink", "vsf": "application/vnd.vsf", "wrl": "model/vrml", "vcx": "application/vnd.vcx", "mts": "model/vnd.mts", "vtu": "model/vnd.vtu", "vis": "application/vnd.visionary", "viv": "video/vnd.vivo", "ccxml": "application/ccxml+xml,", "vxml": "application/voicexml+xml", "src": "application/x-wais-source", "wbxml": "application/vnd.wap.wbxml", "wbmp": "image/vnd.wap.wbmp", "wav": "audio/x-wav", "davmount": "application/davmount+xml", "woff": "application/x-font-woff", "wspolicy": "application/wspolicy+xml", "webp": "image/webp", "wtb": "application/vnd.webturbo", "wgt": "application/widget", "hlp": "application/winhlp", "wml": "text/vnd.wap.wml", "wmls": "text/vnd.wap.wmlscript", "wmlsc": "application/vnd.wap.wmlscriptc", "wpd": "application/vnd.wordperfect", "stf": "application/vnd.wt.stf", "wsdl": "application/wsdl+xml", "xbm": "image/x-xbitmap", "xpm": "image/x-xpixmap", "xwd": "image/x-xwindowdump", "der": "application/x-x509-ca-cert", "fig": "application/x-xfig", "xhtml": "application/xhtml+xml", "xml": "application/xml", "xdf": "application/xcap-diff+xml", "xenc": "application/xenc+xml", "xer": "application/patch-ops-error+xml", "rl": "application/resource-lists+xml", "rs": "application/rls-services+xml", "rld": "application/resource-lists-diff+xml", "xslt": "application/xslt+xml", "xop": "application/xop+xml", "xpi": "application/x-xpinstall", "xspf": "application/xspf+xml", "xul": "application/vnd.mozilla.xul+xml", "xyz": "chemical/x-xyz", "yaml": "text/yaml", "yang": "application/yang", "yin": "application/yin+xml", "zir": "application/vnd.zul", "zip": "application/zip", "zmm": "application/vnd.handheld-entertainment+xml", "zaz": "application/vnd.zzazz.deck+xml"}
If you want a "editable grid" i.e. a table like structure that allows you to make any of the rows a form, use CSS that mimics the TABLE tag's layout: display:table
, display:table-row
, and display:table-cell
.
There is no need to wrap your whole table in a form and no need to create a separate form and table for each apparent row of your table.
Try this instead:
<style>
DIV.table
{
display:table;
}
FORM.tr, DIV.tr
{
display:table-row;
}
SPAN.td
{
display:table-cell;
}
</style>
...
<div class="table">
<form class="tr" method="post" action="blah.html">
<span class="td"><input type="text"/></span>
<span class="td"><input type="text"/></span>
</form>
<div class="tr">
<span class="td">(cell data)</span>
<span class="td">(cell data)</span>
</div>
...
</div>
The problem with wrapping the whole TABLE in a FORM is that any and all form elements will be sent on submit (maybe that is desired but probably not). This method allows you to define a form for each "row" and send only that row of data on submit.
The problem with wrapping a FORM tag around a TR tag (or TR around a FORM) is that it's invalid HTML. The FORM will still allow submit as usual but at this point the DOM is broken. Note: Try getting the child elements of your FORM or TR with JavaScript, it can lead to unexpected results.
Note that IE7 doesn't support these CSS table styles and IE8 will need a doctype declaration to get it into "standards" mode: (try this one or something equivalent)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Any other browser that supports display:table, display:table-row and display:table-cell should display your css data table the same as it would if you were using the TABLE, TR and TD tags. Most of them do.
Note that you can also mimic THEAD, TBODY, TFOOT by wrapping your row groups in another DIV with display: table-header-group
, table-row-group
and table-footer-group
respectively.
NOTE: The only thing you cannot do with this method is colspan.
Check out this illustration: http://jsfiddle.net/ZRQPP/
Sample code:
public static '<'T'>' boolean isListDifferent(List'<'T'>' previousList,
List'<'T'>' newList) {
int sizePrevoisList = -1;
int sizeNewList = -1;
if (previousList != null && !previousList.isEmpty()) {
sizePrevoisList = previousList.size();
}
if (newList != null && !newList.isEmpty()) {
sizeNewList = newList.size();
}
if ((sizePrevoisList == -1) && (sizeNewList == -1)) {
return false;
}
if (sizeNewList != sizePrevoisList) {
return true;
}
List n_prevois = new ArrayList(previousList);
List n_new = new ArrayList(newList);
try {
Collections.sort(n_prevois);
Collections.sort(n_new);
} catch (ClassCastException exp) {
return true;
}
for (int i = 0; i < sizeNewList; i++) {
Object obj_prevois = n_prevois.get(i);
Object obj_new = n_new.get(i);
if (obj_new.equals(obj_prevois)) {
// Object are same
} else {
return true;
}
}
return false;
}
. argument of 0
is interpreted as infinite
. in order to drag the highGUI windows, you need to continually call the cv::waitKey()
function. eg for static images:
cv::imshow("winname", img);
while(cv::waitKey(1) != 27); // 27 = ascii value of ESC
You can use NSTask
. Here's an example that would run '/usr/bin/grep foo bar.txt
'.
int pid = [[NSProcessInfo processInfo] processIdentifier];
NSPipe *pipe = [NSPipe pipe];
NSFileHandle *file = pipe.fileHandleForReading;
NSTask *task = [[NSTask alloc] init];
task.launchPath = @"/usr/bin/grep";
task.arguments = @[@"foo", @"bar.txt"];
task.standardOutput = pipe;
[task launch];
NSData *data = [file readDataToEndOfFile];
[file closeFile];
NSString *grepOutput = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
NSLog (@"grep returned:\n%@", grepOutput);
NSPipe
and NSFileHandle
are used to redirect the standard output of the task.
For more detailed information on interacting with the operating system from within your Objective-C application, you can see this document on Apple's Development Center: Interacting with the Operating System.
Edit: Included fix for NSLog problem
If you are using NSTask to run a command-line utility via bash, then you need to include this magic line to keep NSLog working:
//The magic line that keeps your log where it belongs
task.standardOutput = pipe;
An explanation is here: https://web.archive.org/web/20141121094204/https://cocoadev.com/HowToPipeCommandsWithNSTask
You can also use html to override the css locally. I was having a similar issue and this worked for me:
<html>
<body>
<h4>A nested List:</h4>
<ul style="PADDING-LEFT: 12px">
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
</body>
</html>
$("selector").css("border-bottom-color", "#fff");
#mydiv
, then $("#mydiv")
.css()
method provided by jQuery to modify specified object's css property values. You can use jquery for this:
$('body').bind('copy paste',function(e) {
e.preventDefault(); return false;
});
Using jQuery bind()
and specififying your desired eventTypes
.
Add commons-collections4-x.x.jar file in your build path and try it again. It will work.
You can download it from https://mvnrepository.com/artifact/org.apache.commons/commons-collections4/4.0
You have to use the viewWithTag
function to find the view with the given tag
.
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
let touch = touches.anyObject() as UITouch
let point = touch.locationInView(self.view)
if let viewWithTag = self.view.viewWithTag(100) {
print("Tag 100")
viewWithTag.removeFromSuperview()
} else {
print("tag not found")
}
}
The solution pointed out by jou doesn't support value types, this works fine with them as well
Wrappers
import ObjectiveC
final class Lifted<T> {
let value: T
init(_ x: T) {
value = x
}
}
private func lift<T>(x: T) -> Lifted<T> {
return Lifted(x)
}
func setAssociatedObject<T>(object: AnyObject, value: T, associativeKey: UnsafePointer<Void>, policy: objc_AssociationPolicy) {
if let v: AnyObject = value as? AnyObject {
objc_setAssociatedObject(object, associativeKey, v, policy)
}
else {
objc_setAssociatedObject(object, associativeKey, lift(value), policy)
}
}
func getAssociatedObject<T>(object: AnyObject, associativeKey: UnsafePointer<Void>) -> T? {
if let v = objc_getAssociatedObject(object, associativeKey) as? T {
return v
}
else if let v = objc_getAssociatedObject(object, associativeKey) as? Lifted<T> {
return v.value
}
else {
return nil
}
}
A possible Class extension (Example of usage):
extension UIView {
private struct AssociatedKey {
static var viewExtension = "viewExtension"
}
var referenceTransform: CGAffineTransform? {
get {
return getAssociatedObject(self, associativeKey: &AssociatedKey.viewExtension)
}
set {
if let value = newValue {
setAssociatedObject(self, value: value, associativeKey: &AssociatedKey.viewExtension, policy: objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}
}
This is really such a great solution, I wanted to add another usage example that included structs and values that are not optionals. Also, the AssociatedKey values can be simplified.
struct Crate {
var name: String
}
class Box {
var name: String
init(name: String) {
self.name = name
}
}
extension UIViewController {
private struct AssociatedKey {
static var displayed: UInt8 = 0
static var box: UInt8 = 0
static var crate: UInt8 = 0
}
var displayed: Bool? {
get {
return getAssociatedObject(self, associativeKey: &AssociatedKey.displayed)
}
set {
if let value = newValue {
setAssociatedObject(self, value: value, associativeKey: &AssociatedKey.displayed, policy: objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}
var box: Box {
get {
if let result:Box = getAssociatedObject(self, associativeKey: &AssociatedKey.box) {
return result
} else {
let result = Box(name: "")
self.box = result
return result
}
}
set {
setAssociatedObject(self, value: newValue, associativeKey: &AssociatedKey.box, policy: objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
var crate: Crate {
get {
if let result:Crate = getAssociatedObject(self, associativeKey: &AssociatedKey.crate) {
return result
} else {
let result = Crate(name: "")
self.crate = result
return result
}
}
set {
setAssociatedObject(self, value: newValue, associativeKey: &AssociatedKey.crate, policy: objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}
}
You can find more information about the date pipe here, such as formats.
If you want to use it in your component, you can simply do
pipe = new DatePipe('en-US'); // Use your own locale
Now, you can simply use its transform method, which will be
const now = Date.now();
const myFormattedDate = this.pipe.transform(now, 'short');
The answer is here: How to use C/Cpp extension and add includepath to configurations.
Click the light bulb and then edit the JSON file which is opened. Choose the right block corresponding to your platform (there are Mac
, Linux
, Win32
– ms-vscode.cpptools version: 3). Update paths in includePath
(matters if you compile with VS Code) or browse.paths
(matters if you navigate with VS Code) or both.
Thanks to @Francesco Borzì, I will append his answer here:
You have to Left click on the bulb next to the squiggled code line.
If a
#include
file or one of its dependencies cannot be found, you can also click on the red squiggles under the include statements to view suggestions for how to update your configuration.
you can also use $sce.trustAsHtml('"<h1>" + str + "</h1>"')
,if you want to know more detail, please refer to $sce
please try this flower:
/^[a-z0-9\_\.\-]{2,20}\@[a-z0-9\_\-]{2,20}\.[a-z]{2,9}$/.test('[email protected]');
true
extern "C"
doesn't change the presence or absence of the __cplusplus
macro. It just changes the linkage and name-mangling of the wrapped declarations.
You can nest extern "C"
blocks quite happily.
If you compile your .c
files as C++ then anything not in an extern "C"
block, and without an extern "C"
prototype will be treated as a C++ function. If you compile them as C then of course everything will be a C function.
Yes
You can safely mix C and C++ in this way.
From arrays
An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed. You've seen an example of arrays already, in the main method of the "Hello World!" application. This section discusses arrays in greater detail.
So in the case of a String array, once you create it with some length, you can't modify it, but you can add elements until you fill it.
String[] arr = new String[10]; // 10 is the length of the array.
arr[0] = "kk";
arr[1] = "pp";
...
So if your requirement is to add many objects, it's recommended that you use Lists like:
List<String> a = new ArrayList<String>();
a.add("kk");
a.add("pp");
In oficial documentation https://github.com/mde/ejs#includes show that includes works like that:
<%- include('../partials/head') %>
Your code should be something like
require_once('class.twitter.php');
$t = new twitter;
$t->username = 'user';
$t->password = 'password';
$data = $t->publicTimeline();
To quote from man rand :
The srand() function sets its argument as the seed for a new sequence of pseudo-random integers to be returned by rand(). These sequences are repeatable by calling srand() with the same seed value.
If no seed value is provided, the rand() function is automatically seeded with a value of 1.
So, with no seed value, rand()
assumes the seed as 1 (every time in your case) and with the same seed value, rand()
will produce the same sequence of numbers.
For just counting the lines use:
$handle = fopen("file","r");
static $b = 0;
while($a = fgets($handle)) {
$b++;
}
echo $b;
list($width, $height) = getimagesize($filename)
Or,
$data = getimagesize($filename);
$width = $data[0];
$height = $data[1];
Yes you can - see ConfigurationManager
The ConfigurationManager class includes members that enable you to perform the following tasks:
- Read and write configuration files as a whole.
Learn to use the docs, they should be your first port-of call for a question like this.
For other readers, the error can come from the fact that there is no brackets wrapping the async function:
Considering the async function initData
async function initData() {
}
This code will lead to your error:
useEffect(() => initData(), []);
But this one, won't:
useEffect(() => { initData(); }, []);
(Notice the brackets around initData()
One possible solution is to pad the numeric values with a character in front so that all are of the same string length.
Here is an example using that approach:
select MyColumn
from MyTable
order by
case IsNumeric(MyColumn)
when 1 then Replicate('0', 100 - Len(MyColumn)) + MyColumn
else MyColumn
end
The 100
should be replaced with the actual length of that column.
Another thing to keep in mind is there are two different CASEs with MySQL: one like what @cdhowie and others describe here (and documented here: http://dev.mysql.com/doc/refman/5.7/en/control-flow-functions.html#operator_case) and something which is called a CASE, but has completely different syntax and completely different function, documented here: https://dev.mysql.com/doc/refman/5.0/en/case.html
Invariably, I first use one when I want the other.
You might need to collect the stats as you go, but @@ROWCOUNT
captures this:
declare @Fish table (
Name varchar(32)
)
insert into @Fish values ('Cod')
insert into @Fish values ('Salmon')
insert into @Fish values ('Butterfish')
update @Fish set Name = 'LurpackFish' where Name = 'Butterfish'
select @@ROWCOUNT --gives 1
update @Fish set Name = 'Dinner'
select @@ROWCOUNT -- gives 3
If anyone want to use only number from 0 to 9 with imeOptions
enable then use below line in your EditText
android:inputType="number|none"
This will only allow number and if you click on done/next button of keyboard your focus will move to next field.
If I understood your question, you want to merge branchB
into branchA
. To do so, first checkout branchA
like below,
git checkout branchA
Then execute the below command to merge branchB
into branchA
:
git merge branchB
I have (Open)JDK 8 and 11 installed on Windows 10 and I had the same problem. For me the following worked:
With the new feature WindowInsetsCompat
in androidx core release 1.5.0-alpha02 you could check the visibility of the soft keyboard easily as below
Quoting from reddit comment
val View.keyboardIsVisible: Boolean get() = WindowInsetsCompat .toWindowInsetsCompat(rootWindowInsets) .isVisible(WindowInsetsCompat.Type.ime())
Some note about backward compatibility, quoting from release notes
New Features
The
WindowInsetsCompat
APIs have been updated to those in the platform in Android 11. This includes the newime()
inset type, which allows checking the visibility and size of the on-screen keyboard.Some caveats about the
ime()
type, it works very reliably on API 23+ when your Activity is using theadjustResize
window soft input mode. If you’re instead using theadjustPan
mode, it should work reliably back to API 14.
References
BalusC's list is solid. One additional way this field frequently appears empty is when the user is behind a proxy server. This is similar to being behind a firewall but is slightly different so I wanted to mention it for the sake of completeness.
Related to your question, you may want to consider limiting the amount of RAM SQL Server has access to if you are using it in a shared environment, i.e., on a server that hosts more than just SQL Server:
This will help alleviate SQL Server from consuming all the server's RAM.
This problem happens because you are calling fun.cpp
instead of fun.hpp
. So c++ compiler finds func.cpp definition twice and throws this error.
Change line 3 of your main.cpp
file, from #include "fun.cpp"
to #include "fun.hpp"
.
The simple way to use XMLHttpRequest
with pure JavaScript
. You can set custom header
but it's optional used based on requirement.
window.onload = function(){
var request = new XMLHttpRequest();
var params = "UID=CORS&name=CORS";
request.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log(this.responseText);
}
};
request.open('POST', 'https://www.example.com/api/createUser', true);
request.setRequestHeader('api-key', 'your-api-key');
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
request.send(params);
}
You can send params using POST method.
Please run below example and will get an JSON response.
window.onload = function(){_x000D_
var request = new XMLHttpRequest();_x000D_
_x000D_
request.onreadystatechange = function() {_x000D_
if (this.readyState == 4 && this.status == 200) {_x000D_
console.log(this.responseText);_x000D_
}_x000D_
};_x000D_
_x000D_
request.open('GET', 'https://jsonplaceholder.typicode.com/users/1');_x000D_
request.send();_x000D_
}
_x000D_
I just added float:left
to div and it worked
function getElementsByClassName(classname, node) {
if(!node) node = document.getElementsByTagName("body")[0];
var a = [];
var re = new RegExp('\\b' + classname + '\\b');
var els = node.getElementsByTagName("*");
for(var i=0,j=els.length; i<j; i++)
if(re.test(els[i].className))a.push(els[i]);
return a;
}
var elements = new Array();
elements = getElementsByClassName('yourClassName');
for(i in elements ){
elements[i].style.display = "none";
}
Its always a hard one to say because they were using assembly up until 1993, NBA Jam if anyone remembers that bad boy. Technology is constantly trending so its very difficult to say where it will go, I would recommend learning C and getting a very firm grasp on that then move onto C++. I will say this as a caution if you enjoy playing games you will not enjoy coding games.
HTML5 does not support .mkv / Matroska files but you can use this code...
<video>
<source src="video.mkv" type="video/mp4">
</video>
But it depends on the browser as to whether it will play or not. This method is known to work with Chrome.
List is just an interface. The question is: is your actual List implementation serializable? Speaking about the standard List implementations (ArrayList, LinkedList) from the Java run-time, most of them actually are already.
Here is how to get the Guid's programmatically! You can then use these guids/filepaths with an above answer to add the reference!
Reference: http://www.vbaexpress.com/kb/getarticle.php?kb_id=278
Sub ListReferencePaths()
'Lists path and GUID (Globally Unique Identifier) for each referenced library.
'Select a reference in Tools > References, then run this code to get GUID etc.
Dim rw As Long, ref
With ThisWorkbook.Sheets(1)
.Cells.Clear
rw = 1
.Range("A" & rw & ":D" & rw) = Array("Reference","Version","GUID","Path")
For Each ref In ThisWorkbook.VBProject.References
rw = rw + 1
.Range("A" & rw & ":D" & rw) = Array(ref.Description, _
"v." & ref.Major & "." & ref.Minor, ref.GUID, ref.FullPath)
Next ref
.Range("A:D").Columns.AutoFit
End With
End Sub
Here is the same code but printing to the terminal if you don't want to dedicate a worksheet to the output.
Sub ListReferencePaths()
'Macro purpose: To determine full path and Globally Unique Identifier (GUID)
'to each referenced library. Select the reference in the Tools\References
'window, then run this code to get the information on the reference's library
On Error Resume Next
Dim i As Long
Debug.Print "Reference name" & " | " & "Full path to reference" & " | " & "Reference GUID"
For i = 1 To ThisWorkbook.VBProject.References.Count
With ThisWorkbook.VBProject.References(i)
Debug.Print .Name & " | " & .FullPath & " | " & .GUID
End With
Next i
On Error GoTo 0
End Sub
if (myReader.HasRows) //The key Word is **.HasRows**
{
ltlAdditional.Text = "Contains data";
}
else
{
ltlAdditional.Text = "Is null Or Empty";
}
If you really just want to subset each data frame by an index that exists in both data frames, you can do this with the 'match' function, like so:
data_A[match(data_B$index, data_A$index, nomatch=0),]
data_B[match(data_A$index, data_B$index, nomatch=0),]
This is, though, the same as:
data_A[data_A$index %in% data_B$index,]
data_B[data_B$index %in% data_A$index,]
Here is a demo:
# Set seed for reproducibility.
set.seed(1)
# Create two sample data sets.
data_A <- data.frame(index=sample(1:200, 90, rep=FALSE), value=runif(90))
data_B <- data.frame(index=sample(1:200, 120, rep=FALSE), value=runif(120))
# Subset data of each data frame by the index in the other.
t_A <- data_A[match(data_B$index, data_A$index, nomatch=0),]
t_B <- data_B[match(data_A$index, data_B$index, nomatch=0),]
# Make sure they match.
data.frame(t_A[order(t_A$index),], t_B[order(t_B$index),])[1:20,]
# index value index.1 value.1
# 27 3 0.7155661 3 0.65887761
# 10 12 0.6049333 12 0.14362694
# 88 14 0.7410786 14 0.42021589
# 56 15 0.4525708 15 0.78101754
# 38 18 0.2075451 18 0.70277874
# 24 23 0.4314737 23 0.78218212
# 34 32 0.1734423 32 0.85508236
# 22 38 0.7317925 38 0.56426384
# 84 39 0.3913593 39 0.09485786
# 5 40 0.7789147 40 0.31248966
# 74 43 0.7799849 43 0.10910096
# 71 45 0.2847905 45 0.26787813
# 57 46 0.1751268 46 0.17719454
# 25 48 0.1482116 48 0.99607737
# 81 53 0.6304141 53 0.26721208
# 60 58 0.8645449 58 0.96920881
# 30 59 0.6401010 59 0.67371223
# 75 61 0.8806190 61 0.69882454
# 63 64 0.3287773 64 0.36918946
# 19 70 0.9240745 70 0.11350771
I am having a similar problem and discovered this post. However, none of the currently provided answers solve the problem in the way you want. They don't make the spacing equally, but rather distribute the center of the labels equally. It is important to understand that this is not the same. I've constructed a little diagram to illustrate this.
There are 3 views, all 20pt tall. Using any of the suggested methods equally distributes the centers of the views and give you the illustrated layout. Notice that the y-center of the views are spaced equally. However, the spacing between superview and top view is 15pt, while the spacing between the subviews is just 5pt. To have the views spaced equally these should both be 10pt, i.e. all blue arrows should be 10pt.
Nevertheless, I haven't come up with a good generic solution, yet. Currently my best idea is to insert "spacing views" between the subviews and setting the heights of the spacing views to be equal.
Quote (read [here][1])-
When you use CAST to convert a CLOB value into a character datatype or a BLOB value into the RAW datatype, the database implicitly converts the LOB value to character or raw data and then explicitly casts the resulting value into the target datatype.
So, something like this should work-
report := CAST(report_clob AS VARCHAR2(100));
Or better yet use it as CAST(report_clob AS VARCHAR2(100))
where ever you are trying to use the BLOB
as VARCHAR
[1]: http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions016.htm
For me, this was an issue with how Android Studio environment was configured.
When I updated the File
-> Project Structure
-> JDK Location
to a later Java version (jdk1.8.0_192.jdk
- for me), everything started working.
This worked for me, as documented on this page:
TransformerFactory tf = TransformerFactory.newInstance();
Transformer trans = tf.newTransformer();
StringWriter sw = new StringWriter();
trans.transform(new DOMSource(document), new StreamResult(sw));
return sw.toString();
Here is what you are looking for:
Service hangs up at WaitForExit after calling batch file
It's about a question as to why a service can't execute a file, but it shows all the code necessary to do so.
As a complement to the answers given above; do not forget about Form MinimumSize Property, in case you require to create smaller Forms.
Example Bellow:
private void SetDefaultWindowSize()
{
int sizeW, sizeH;
sizeW = 180;
sizeH = 100;
var size = new Size(sizeW, sizeH);
Size = size;
MinimumSize = size;
}
private void SetNewSize()
{
Size = new Size(Width, 10);
}
best way:
<xmp>
// your codes ..
</xmp>
old samples:
sample 1:
<pre>
This text has
been formatted using
the HTML pre tag. The brower should
display all white space
as it was entered.
</pre>
sample 2:
<pre>
<code>
My pre-formatted code
here.
</code>
</pre>
sample 3: (If you are actually "quoting" a block of code, then the markup would be)
<blockquote>
<pre>
<code>
My pre-formatted "quoted" code here.
</code>
</pre>
</blockquote>
nice CSS sample:
pre{
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
margin-bottom: 10px;
overflow: auto;
width: auto;
padding: 5px;
background-color: #eee;
width: 650px!ie7;
padding-bottom: 20px!ie7;
max-height: 600px;
}
Syntax highlighting code (For pro work):
rainbows (very Perfect)
best links for you:
https://github.com/balupton/jquery-syntaxhighlighter
http://bavotasan.com/2009/how-to-wrap-text-within-the-pre-tag-using-css/
http://alexgorbatchev.com/SyntaxHighlighter/
Use ARel
t = Post.arel_table
results = Post.where(
t[:author].eq("Someone").
or(t[:title].matches("%something%"))
)
The resulting SQL:
ree-1.8.7-2010.02 > puts Post.where(t[:author].eq("Someone").or(t[:title].matches("%something%"))).to_sql
SELECT "posts".* FROM "posts" WHERE (("posts"."author" = 'Someone' OR "posts"."title" LIKE '%something%'))
Truth be told there are many, many resources explaining how to do this already out on the web:
Git: how to reverse-merge a commit?
Git: how to reverse-merge a commit?
Undoing Merges, from Git's blog (retrieved from archive.org's Wayback Machine)
So I guess I'll just summarize some of these:
git revert <merge commit hash>
This creates an extra "revert" commit saying you undid a merge
git reset --hard <commit hash *before* the merge>
This reset history to before you did the merge. If you have commits after the merge you will need to cherry-pick
them on to afterwards.
But honestly this guide here is better than anything I can explain, with diagrams! :)
I had the same issue and for me, I tried changing the options in
Server Locations
and it worked.
I do not understand why that issue came up. I did search but did not find a relevant answer(Maybe I didn't use the right keywords). If someone knows why that worked, kindly share.
Thanks.
Use this I think it's better
*isAngularSite(false);*
browser.get(crmUrl);
login.username.sendKeys(username);
login.password.sendKeys(password);
login.submit.click();
*isAngularSite(true);*
For you to use this setting of isAngularSite should put this in your protractor.conf.js here:
global.isAngularSite = function(flag) {
browser.ignoreSynchronization = !flag;
};
HashMap don't allow duplicate keys,but since it's not thread safe,it might occur duplicate keys. eg:
while (true) {
final HashMap<Object, Object> map = new HashMap<Object, Object>(2);
map.put("runTimeType", 1);
map.put("title", 2);
map.put("params", 3);
final AtomicInteger invokeCounter = new AtomicInteger();
for (int i = 0; i < 100; i++) {
new Thread(new Runnable() {
@Override
public void run() {
map.put("formType", invokeCounter.incrementAndGet());
}
}).start();
}
while (invokeCounter.intValue() != 100) {
Thread.sleep(10);
}
if (map.size() > 4) {
// this means you insert two or more formType key to the map
System.out.println( JSONObject.fromObject(map));
}
}
To improve upon @EndUzr's response:
To find a foreign port (IPv4 or IPv6) you can use:
netstat -an | findstr /r /c:":N [^:]*$"
To find a local port (IPv4 or IPv6) you can use:
netstat -an | findstr /r /c:":N *[^ ]*:[^ ]* "
Where N is the port number you are interested in. The "/r" switch tells it to process it as regexp. The "/c" switch allows findstr to include spaces within search strings instead of treating a space as a search string delimiter. This added space prevents longer ports being mistreated - for example, ":80" vs ":8080" and other port munging issues.
To list remote connections to the local RDP server, for example:
netstat -an | findstr /r /c:":3389 *[^ ]*:[^ ]*"
Or to see who is touching your DNS:
netstat -an | findstr /r /c:":53 *[^ ]*:[^ ]*"
If you want to exclude local-only ports you can use a series of exceptions with "/v" and escape characters with a backslash:
netstat -an | findstr /v "0.0.0.0 127.0.0.1 \[::\] \[::1\] \*\:\*" | findstr /r /c:":80 *[^ ]*:[^ ]*"
The problem is that skew
isn't being subsetted in colour=factor(skew)
, so it's the wrong length. Since subset(skew, product == 'p1')
is the same as subset(skew, product == 'p3')
, in this case it doesn't matter which subset is used. So you can solve your problem with:
p1 <- ggplot(df, aes(x=subset(price, product=='p1'),
y=subset(price, product=='p3'),
colour=factor(subset(skew, product == 'p1')))) +
geom_point(size=2, shape=19)
Note that most R users would write this as the more concise:
p1 <- ggplot(df, aes(x=price[product=='p1'],
y=price[product=='p3'],
colour=factor(skew[product == 'p1']))) +
geom_point(size=2, shape=19)
.NET has two CLRs 2.0 and 4.0. CLR 2.0 works till .NET framework 3.5. CLR 4.0 works from .NET 4.0 onwards. Its possible that your solution is using a different CLR than your reference assemblies. In your local development environment, you might have both the CLRs and hence you did not faced any problem. However when you moved to deployment environments, they might have a single CLR only and you got this error.
If you need your SVGs to be fully styleable with CSS they have to be inline in the DOM. This can be achieved through SVG injection, which uses Javascript to replace a HTML element (usually an <img>
element) with the contents of an SVG file after the page has loaded.
Here is a minimal example using SVGInject:
<html>
<head>
<script src="svg-inject.min.js"></script>
</head>
<body>
<img src="image.svg" onload="SVGInject(this)" />
</body>
</html>
After the image is loaded the onload="SVGInject(this)
will trigger the injection and the <img>
element will be replaced by the contents of the file provided in the src
attribute. This works with all browsers that support SVG.
Disclaimer: I am the co-author of SVGInject
I saw that someone was wondering how to do it for another controller.
In my case I had all of my email templates in the Views/Email folder, but you could modify this to pass in the controller in which you have views associated for.
public static string RenderViewToString(Controller controller, string viewName, object model)
{
var oldController = controller.RouteData.Values["controller"].ToString();
if (controller.GetType() != typeof(EmailController))
controller.RouteData.Values["controller"] = "Email";
var oldModel = controller.ViewData.Model;
controller.ViewData.Model = model;
try
{
using (var sw = new StringWriter())
{
var viewResult = ViewEngines.Engines.FindView(controller.ControllerContext, viewName,
null);
var viewContext = new ViewContext(controller.ControllerContext, viewResult.View, controller.ViewData, controller.TempData, sw);
viewResult.View.Render(viewContext, sw);
//Cleanup
controller.ViewData.Model = oldModel;
controller.RouteData.Values["controller"] = oldController;
return sw.GetStringBuilder().ToString();
}
}
catch (Exception ex)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
throw ex;
}
}
Essentially what this does is take a controller, such as AccountController and modify it to think it's an EmailController so that the code will look in the Views/Email
folder. It's necessary to do this because the FindView
method doesn't take a straight up path as a parameter, it wants a ControllerContext
.
Once done rendering the string, it returns the AccountController back to its initial state to be used by the Response object.
android:editable
If set, specifies that this TextView
has an input method. It will be a textual one unless it has otherwise been specified. For TextView
, this is false by default. For EditText
, it is true by default.
Must be a boolean
value, either true
or false
.
This may also be a reference to a resource (in the form @[package:]type:name
) or theme attribute (in the form ?[package:][type:]name
) containing a value of this type.
This corresponds to the global attribute resource symbol editable.
Related Methods
http://docs.jquery.com/Events/jQuery.Event
Try with event.target
Contains the DOM element that issued the event. This can be the element that registered for the event or a child of it.
I forgot to push the image tagged 1.0.8 to the ECR (AWS images hub)... If you are using Helm and upgrade by:
helm upgrade minta-user ./src/services/user/helm-chart
make sure that image tag inside values.yaml is pushed (to ECR or Docker Hub, etc) for example: (this is my helm-chart/values.yaml)
replicaCount: 1
image:
repository:dkr.ecr.us-east-1.amazonaws.com/minta-user
tag: 1.0.8
you need to make sure that the image:1.0.8 is pushed!
Also note that Scala extends String with a number of methods (via implicit conversion to a WrappedString brought in by Predef) so you could also do the following:
val formattedString = "Hello %s, isn't %s cool?".format("Ivan", "Scala")
Combining CodeIgniter and JavaScript:
//for using the base_url() function
$this->load->helper('url');
echo "<script type='javascript/text'>";
echo "alert('There are no fields to generate a report');"
echo "window.location.href = '" . base_url() . "admin/ahm/panel';"
echo "</script>";
Note: The redirect()
function automatically includes the base_url
path that is why it wasn't required there.
Python calls expressions "expression statements", so the question is perhaps not fully formed.
A statement consists of pretty much anything you can do in Python: calculating a value, assigning a value, deleting a variable, printing a value, returning from a function, raising an exception, etc. The full list is here: http://docs.python.org/reference/simple_stmts.html#
An expression statement is limited to calling functions (e.g., math.cos(theta)"), operators ( e.g., "2+3"), etc. to produce a value.
create view sal as
select yr,count(*) as ct from
(select title,yr from movie m, actor a, casting c
where a.name='JOHN'
and a.id=c.actorid
and c.movieid=m.id)group by yr
-----VIEW CREATED-----
select yr from sal
where ct =(select max(ct) from sal)
YR 2013
Comment to your edit:
Better solution is std::reference_wrapper
.
Details: http://www.cplusplus.com/reference/functional/reference_wrapper/
Example:
#include <iostream>
#include <functional>
using namespace std;
int main() {
int a=1,b=2,c=3,d=4;
using intlink = std::reference_wrapper<int>;
intlink arr[] = {a,b,c,d};
return 0;
}
On top of dhobbs answer above (https://stackoverflow.com/a/9728478/624597), here is an extra functionality of storing results to a file (I personally use it to copy and paste to FreeMind to have a nice overview of the structure, therefore I used tabs instead of spaces for indentation):
import os
def list_files(startpath):
with open("folder_structure.txt", "w") as f_output:
for root, dirs, files in os.walk(startpath):
level = root.replace(startpath, '').count(os.sep)
indent = '\t' * 1 * (level)
output_string = '{}{}/'.format(indent, os.path.basename(root))
print(output_string)
f_output.write(output_string + '\n')
subindent = '\t' * 1 * (level + 1)
for f in files:
output_string = '{}{}'.format(subindent, f)
print(output_string)
f_output.write(output_string + '\n')
list_files(".")
I want to go back to page 1 when I refresh the grid. Just calling the read() function will keep you on the current page, even if the new results don't have that many pages. Calling .page(1) on the datasource will refresh the datasource AND return to page 1 but fails on grids that aren't pageable. This function handles both:
function refreshGrid(selector) {
var grid = $(selector);
if (grid.length === 0)
return;
grid = grid.data('kendoGrid');
if (grid.getOptions().pageable) {
grid.dataSource.page(1);
}
else {
grid.dataSource.read();
}
}
According to doc: https://github.com/request/request
The example is:
multipart: {
chunked: false,
data: [
{
'content-type': 'application/json',
body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}})
},
]
}
I think you send an object where a string is expected, replace
body: requestData
by
body: JSON.stringify(requestData)
After hours of searching i fixed it in this way:
old_timestamp == null;
$('#productivity_table').on('click', function(event) {
// code executed at first load
// not working if you press too many clicks, it waits 1 second
if(old_timestamp == null || old_timestamp + 1000 < event.timeStamp)
{
// write the code / slide / fade / whatever
old_timestamp = event.timeStamp;
}
});
In case anybody has an issue with setting datetimepicker control to blank during the form load event, and then show the current date as needed, here is an example:
MAKE SURE THAT CustomFormat = " "
has same number of spaces (at least one space) in both methods
Private Sub setDateTimePickerBlank(ByVal dateTimePicker As DateTimePicker)
dateTimePicker.Visible = True
dateTimePicker.Format = DateTimePickerFormat.Custom
dateTimePicker.CustomFormat = " "
End Sub
Private Sub dateTimePicker_MouseHover(ByVal sender As Object, ByVal e As
System.EventArgs) Handles dateTimePicker.MouseHover
Dim dateTimePicker As DateTimePicker = CType(sender, DateTimePicker)
If dateTimePicker.Text = " " Then
dateTimePicker.Text = Format(DateTime.Now, "MM/dd/yyyy")
End If
End Sub
You can also use Tab Layout with custom tab view to achieve this.
custom_tab.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="8dp">
<ImageView
android:id="@+id/icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:scaleType="centerInside"
android:src="@drawable/ic_recents_selector" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textAllCaps="false"
android:textColor="@color/tab_color"
android:textSize="12sp"/>
</LinearLayout>
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
style="@style/AppTabLayout"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="?attr/colorPrimary" />
</LinearLayout>
MainActivity.java
public class MainActivity extends AppCompatActivity {
private TabLayout mTabLayout;
private int[] mTabsIcons = {
R.drawable.ic_recents_selector,
R.drawable.ic_favorite_selector,
R.drawable.ic_place_selector};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Setup the viewPager
ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager);
MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(pagerAdapter);
mTabLayout = (TabLayout) findViewById(R.id.tab_layout);
mTabLayout.setupWithViewPager(viewPager);
for (int i = 0; i < mTabLayout.getTabCount(); i++) {
TabLayout.Tab tab = mTabLayout.getTabAt(i);
tab.setCustomView(pagerAdapter.getTabView(i));
}
mTabLayout.getTabAt(0).getCustomView().setSelected(true);
}
private class MyPagerAdapter extends FragmentPagerAdapter {
public final int PAGE_COUNT = 3;
private final String[] mTabsTitle = {"Recents", "Favorites", "Nearby"};
public MyPagerAdapter(FragmentManager fm) {
super(fm);
}
public View getTabView(int position) {
// Given you have a custom layout in `res/layout/custom_tab.xml` with a TextView and ImageView
View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.custom_tab, null);
TextView title = (TextView) view.findViewById(R.id.title);
title.setText(mTabsTitle[position]);
ImageView icon = (ImageView) view.findViewById(R.id.icon);
icon.setImageResource(mTabsIcons[position]);
return view;
}
@Override
public Fragment getItem(int pos) {
switch (pos) {
case 0:
return PageFragment.newInstance(1);
case 1:
return PageFragment.newInstance(2);
case 2:
return PageFragment.newInstance(3);
}
return null;
}
@Override
public int getCount() {
return PAGE_COUNT;
}
@Override
public CharSequence getPageTitle(int position) {
return mTabsTitle[position];
}
}
}
Here is a sample helper class which converts an Object and returns an Expando with all public properties of the given object.
public static class dynamicHelper
{
public static ExpandoObject convertToExpando(object obj)
{
//Get Properties Using Reflections
BindingFlags flags = BindingFlags.Public | BindingFlags.Instance;
PropertyInfo[] properties = obj.GetType().GetProperties(flags);
//Add Them to a new Expando
ExpandoObject expando = new ExpandoObject();
foreach (PropertyInfo property in properties)
{
AddProperty(expando, property.Name, property.GetValue(obj));
}
return expando;
}
public static void AddProperty(ExpandoObject expando, string propertyName, object propertyValue)
{
//Take use of the IDictionary implementation
var expandoDict = expando as IDictionary;
if (expandoDict.ContainsKey(propertyName))
expandoDict[propertyName] = propertyValue;
else
expandoDict.Add(propertyName, propertyValue);
}
}
Usage:
//Create Dynamic Object
dynamic expandoObj= dynamicHelper.convertToExpando(myObject);
//Add Custom Properties
dynamicHelper.AddProperty(expandoObj, "dynamicKey", "Some Value");
Here's a nice function template using C++11 magic, working for both std::map, std::unordered_map:
template<template <typename...> class MAP, class KEY, class VALUE>
std::vector<KEY>
keys(const MAP<KEY, VALUE>& map)
{
std::vector<KEY> result;
result.reserve(map.size());
for(const auto& it : map){
result.emplace_back(it.first);
}
return result;
}
Check it out here: http://ideone.com/lYBzpL
In case you know a defined sized for your div
you could use calc
.
Live example: https://jsfiddle.net/o8416eq3/
Notes: This works only if you hard coded the width and height of your ``div` in the CSS.
#target {_x000D_
position:fixed;_x000D_
top: calc(50vh - 100px/2);_x000D_
left: calc(50vw - 200px/2);_x000D_
width:200px;_x000D_
height:100px;_x000D_
background-color:red;_x000D_
}
_x000D_
<div id='target'></div>
_x000D_
That entire block is misplaced.
class Example(object):
def main(self):
print "Hello World!"
if __name__ == '__main__':
Example().main()
But you really shouldn't be using a class just to run your main code.
<input type="number" id="n" value="0" step=".5" />
<input type="hidden" id="v" value = "0"/>
<script>
$("#n").bind('keyup mouseup', function () {
var current = $("#n").val();
var prevData = $("#v").val();
if(current > prevData || current < prevData){
$("#v").val(current);
var newv = $("#v").val();
alert(newv);
}
});
</script>
http://jsfiddle.net/patrickrobles53/s10wLjL3/
I've used a hidden input type to be the container of the previous value that will be needed for the comparison on the next change.
Dictionary:
It returns/throws Exception if we try to find a key which does not exist.
It is faster than a Hashtable because there is no boxing and unboxing.
Only public static members are thread safe.
Dictionary is a generic type which means we can use it with any data type (When creating, must specify the data types for both keys and values).
Example: Dictionary<string, string> <NameOfDictionaryVar> =
new Dictionary<string, string>();
Dictionay is a type-safe implementation of Hashtable, Keys
and Values
are strongly typed.
Hashtable:
It returns null if we try to find a key which does not exist.
It is slower than dictionary because it requires boxing and unboxing.
All the members in a Hashtable are thread safe,
Hashtable is not a generic type,
Hashtable is loosely-typed data structure, we can add keys and values of any type.
For IBM Db2 its LENGTH, not LEN:
SELECT MAX(LENGTH(Desc)) FROM table_name;
Seems based on benchmarks at JSPerf that using +=
is the fastest method, though not necessarily in every browser.
For building strings in the DOM, it seems to be better to concatenate the string first and then add to the DOM, rather then iteratively add it to the dom. You should benchmark your own case though.
(Thanks @zAlbee for correction)
No one here posted an answer with all of the correct CSS variations, so here it is:
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
$date = '2014-02-25';
date('D', strtotime($date));
I would re-write the original target test, taking care the needed variable is defined IN THE SAME SUB-PROCESS as the application to launch:
test:
( NODE_ENV=test mocha --harmony --reporter spec test )
if you still stuck or you get this
C:\\\Users\\\name of your\\\AppData\\\Local\\\Programs\\\Python\\\Python36
simply do this replace 2 \ with one
C:\Users\akshay\AppData\Local\Programs\Python\Python36
You can use any of the below code to get the controller name
@HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString();
If you are using MVC 3 you can use
@ViewContext.Controller.ValueProvider.GetValue("controller").RawValue
I solved this by adding autocomplete="one-time-code"
to the password input.
As per an HTML reference autocomplete="one-time-code"
- a one-time code used for verifying user identity. It looks like the best fit for this.
Are you referring to the server side or the client side?
For a client, you would want to adjust the sendTimeout attribute of a binding element. For a service, you would want to adjust the receiveTimeout attribute of a binding elemnent.
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="longTimeoutBinding"
receiveTimeout="00:10:00" sendTimeout="00:10:00">
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="longTimeoutService"
behaviorConfiguration="longTimeoutBehavior">
<endpoint address="net.tcp://localhost/longtimeout/"
binding="netTcpBinding" bindingConfiguration="longTimeoutBinding" />
</service>
....
Of course, you have to map your desired endpoint to that particular binding.
Horizontal centering is easy: text-align: center;
. Vertical centering of text inside an element can be done by setting line-height
equal to the container height, but this has subtle differences between browsers. On small elements, like a notification badge, these are more pronounced.
Better is to set line-height
equal to font-size
(or slightly smaller) and use padding. You'll have to adjust your height to accomodate.
Here's a CSS-only, single <div>
solution that looks pretty iPhone-like. They expand with content.
Demo: http://jsfiddle.net/ThinkingStiff/mLW47/
Output:
CSS:
.badge {
background: radial-gradient( 5px -9px, circle, white 8%, red 26px );
background-color: red;
border: 2px solid white;
border-radius: 12px; /* one half of ( (border * 2) + height + padding ) */
box-shadow: 1px 1px 1px black;
color: white;
font: bold 15px/13px Helvetica, Verdana, Tahoma;
height: 16px;
min-width: 14px;
padding: 4px 3px 0 3px;
text-align: center;
}
HTML:
<div class="badge">1</div>
<div class="badge">2</div>
<div class="badge">3</div>
<div class="badge">44</div>
<div class="badge">55</div>
<div class="badge">666</div>
<div class="badge">777</div>
<div class="badge">8888</div>
<div class="badge">9999</div>
I would try formatting your table correctly first off like so:
I cannot help but thinking that formatting the table could at the very least not do any harm.
<table>
<thead>
<th>Header1</th>
......
</thead>
<tbody>
<tr><td>Content1</td>....</tr>
......
</tbody>
</table>
Another way is to simply remove collapse navbar-collapse
from the markup. Example with Bootstrap 3.3.7
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">_x000D_
_x000D_
<nav class="navbar navbar-atp">_x000D_
<div class="container-fluid">_x000D_
<div class="">_x000D_
<ul class="nav navbar-nav nav-custom">_x000D_
<li>_x000D_
<a href="#" id="sidebar-btn"><span class="fa fa-bars">Toggle btn</span></a>_x000D_
</li>_x000D_
</ul>_x000D_
<ul class="nav navbar-nav navbar-right">_x000D_
<li>Nav item</li>_x000D_
</ul>_x000D_
</div>_x000D_
</div>_x000D_
</nav>
_x000D_
Well, I faced the same issue. For new users who may land at this page. Just follow their official documentation.
Install flask-cors
pip install -U flask-cors
then after app initialization, initialize flask-cors
with default arguments:
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route("/")
def helloWorld():
return "Hello, cross-origin-world!"
You can use the :before
pseudo-selector to insert content in front of the list item. You can find an example on Quirksmode, at http://www.quirksmode.org/css/beforeafter.html. I use this to insert giant quotes around blockquotes...
HTH.
If you are on Eclipse,
Right click on your project folder under "Package Explorer".
Goto Source -> Clean up and choose your project.
This will cleanup any mess and your break-point should work now.
You can go for identifying a list of elements with xPath:
//td[text() = ' Color Digest ']/following-sibling::td[1]
This will give you a list of two elements, than you can use the 2nd element as your intended one. For example:
List<WebElement> elements = driver.findElements(By.xpath("//td[text() = ' Color Digest ']/following-sibling::td[1]"))
Now, you can use the 2nd element as your intended element, which is elements.get(1)
Dim distinctValues As List(Of Double) = (From r In _
DirectCast(DataTable.AsEnumerable(),IEnumerable(Of DataRow)) Where (Not r.IsNull("ColName")) _
Select r.Field(Of Double)("ColName")).Distinct().ToList()
A quick search using...
apt search Xlib.h
Turns up the package libx11-dev but you shouldn't need this for pure OpenGL programming. What tutorial are you using?
You can add Xlib.h to your system by running the following...
sudo apt install libx11-dev
You can use CSS Flexbox instead another display value, The Flexbox Layout (Flexible Box) module aims at providing a more efficient way to lay out, align and distribute space among items in a container, even when their size is unknown and/or dynamic.
Example
/* CONTAINER */
#wrapper
{
width:300px;
height:300px;
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box; /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Chrome */
display: flex; /* NEW, Spec - Opera 12.1, Firefox 20+ */
-ms-flex-direction: column;
-moz-flex-direction: column;
-webkit-flex-direction: column;
flex-direction: column;
}
/* SOME ITEM CHILD ELEMENTS */
#first
{
width:300px;
height: 200px;
background-color:#F5DEB3;
}
#second
{
width:300px;
background-color: #9ACD32;
-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-flex: 1; /* OLD - Firefox 19- */
-webkit-flex: 1; /* Chrome */
-ms-flex: 1; /* IE 10 */
flex: 1; /* NEW, */
}
If you want to have full support for old browsers like IE9 or below, you will have to use a polyfills like flexy, this polyfill enable support for Flexbox model but only for 2012 spec of flexbox model.
Recently I found another polyfill to help you with Internet Explorer 8 & 9 or any older browser that not have support for flexbox model, I still have not tried it but I leave the link here
You can find a usefull and complete Guide to Flexbox model by Chris Coyer here
You can refer to event modifiers in vuejs to prevent form submission on enter
key.
It is a very common need to call
event.preventDefault()
orevent.stopPropagation()
inside event handlers.Although we can do this easily inside methods, it would be better if the methods can be purely about data logic rather than having to deal with DOM event details.
To address this problem, Vue provides event modifiers for
v-on
. Recall that modifiers are directive postfixes denoted by a dot.
<form v-on:submit.prevent="<method>">
...
</form>
As the documentation states, this is syntactical sugar for e.preventDefault()
and will stop the unwanted form submission on press of enter key.
Here is a working fiddle.
new Vue({_x000D_
el: '#myApp',_x000D_
data: {_x000D_
emailAddress: '',_x000D_
log: ''_x000D_
},_x000D_
methods: {_x000D_
validateEmailAddress: function(e) {_x000D_
if (e.keyCode === 13) {_x000D_
alert('Enter was pressed');_x000D_
} else if (e.keyCode === 50) {_x000D_
alert('@ was pressed');_x000D_
} _x000D_
this.log += e.key;_x000D_
},_x000D_
_x000D_
postEmailAddress: function() {_x000D_
this.log += '\n\nPosting';_x000D_
},_x000D_
noop () {_x000D_
// do nothing ?_x000D_
}_x000D_
}_x000D_
})
_x000D_
html, body, #editor {_x000D_
margin: 0;_x000D_
height: 100%;_x000D_
color: #333;_x000D_
}
_x000D_
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>_x000D_
<div id="myApp" style="padding:2rem; background-color:#fff;">_x000D_
<form v-on:submit.prevent="noop">_x000D_
<input type="text" v-model="emailAddress" v-on:keyup="validateEmailAddress" />_x000D_
<button type="button" v-on:click="postEmailAddress" >Subscribe</button> _x000D_
<br /><br />_x000D_
_x000D_
<textarea v-model="log" rows="4"></textarea> _x000D_
</form>_x000D_
</div>
_x000D_
I had a different approach , used bootstrap panel to show it little more rich. Just to help someone and improve the answer.
.text-on-pannel {_x000D_
background: #fff none repeat scroll 0 0;_x000D_
height: auto;_x000D_
margin-left: 20px;_x000D_
padding: 3px 5px;_x000D_
position: absolute;_x000D_
margin-top: -47px;_x000D_
border: 1px solid #337ab7;_x000D_
border-radius: 8px;_x000D_
}_x000D_
_x000D_
.panel {_x000D_
/* for text on pannel */_x000D_
margin-top: 27px !important;_x000D_
}_x000D_
_x000D_
.panel-body {_x000D_
padding-top: 30px !important;_x000D_
}
_x000D_
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />_x000D_
<div class="container">_x000D_
<div class="panel panel-primary">_x000D_
<div class="panel-body">_x000D_
<h3 class="text-on-pannel text-primary"><strong class="text-uppercase"> Title </strong></h3>_x000D_
<p> Your Code </p>_x000D_
</div>_x000D_
</div>_x000D_
<div>
_x000D_
Note: We need to change the styles in order to use different header size.
Simply you can write the following code snippet to convert an OpenCV image into a grey scale image
import cv2
image = cv2.imread('image.jpg',0)
cv2.imshow('grey scale image',image)
Observe that the image.jpg and the code must be saved in same folder.
Note that:
('image.jpg')
gives a RGB image('image.jpg',0)
gives Grey Scale Image.Easier still: return a pointer to a string that's been malloc'd with strdup.
#include <ncurses.h>
char * getStr(int length)
{
char word[length];
for (int i = 0; i < length; i++)
{
word[i] = getch();
}
word[i] = '\0';
return strdup(&word[0]);
}
int main()
{
char wordd[10];
initscr();
*wordd = getStr(10);
printw("The string is:\n");
printw("%s\n",*wordd);
getch();
endwin();
return 0;
}
If you're using Homebrew /usr/local/bin should already be at the front of $PATH
or at least come before /usr/bin. If you now run brew link --force openssl
in your terminal window, open a new one and run which openssl
in it. It should now show openssl
under /usr/local/bin.
Don't use SSL on port 465, it's been deprecated since 1998 and is only used by Microsoft products that didn't get the memo; use TLS on port 587 instead: So, the code below should work very well for you.
mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the
Here's the magic you want:
autocomplete="new-password"
Chrome intentionally ignores autocomplete="off"
and autocomplete="false"
. However, they put new-password
in as a special clause to stop new password forms from being auto-filled.
I put the above line in my password input, and now I can edit other fields in my form and the password is not auto-filled.
solve(c)
does give the correct inverse. The issue with your code is that you are using the wrong operator for matrix multiplication. You should use solve(c) %*% c
to invoke matrix multiplication in R.
R performs element by element multiplication when you invoke solve(c) * c
.
This might be too late but if you add
worksheet.Columns.AutoFit();
or
worksheet.Rows.AutoFit();
it also works.
It returns whether the statement can evaluate to false. eg:
!false // true
!true // false
!isValid() // is not valid
You can use it twice to coerce a value to boolean:
!!1 // true
!!0 // false
So, to more directly answer your question:
var myVar = !function(){ return false; }(); // myVar contains true
Edit: It has the side effect of changing the function declaration to a function expression. E.g. the following code is not valid because it is interpreted as a function declaration that is missing the required identifier (or function name):
function () { return false; }(); // syntax error
Depending on the sort order, you can do this :
int[] array = new int[] { 3, 1, 4, 5, 2 };
Array.Sort<int>(array,
new Comparison<int>(
(i1, i2) => i2.CompareTo(i1)
));
... or this :
int[] array = new int[] { 3, 1, 4, 5, 2 };
Array.Sort<int>(array,
new Comparison<int>(
(i1, i2) => i1.CompareTo(i2)
));
i1 and i2 are just reversed.
You failed to load the slick.js
file. Add this script file https://kenwheeler.github.io/slick/slick/slick.js
.
I updated your JSFiddle by adding an external file on left sidebar External Resources
. Then it doesn't report the error: $(...).slick is not a function
.
Hopefully it helps someone: I ran into this error and the cause was wrong permission on the log folder for phpfpm, after changing it so phpfpm could write to it, everything was fine.
Postgresql historically doesn't support procedural code at the command level - only within functions. However, in Postgresql 9, support has been added to execute an inline code block that effectively supports something like this, although the syntax is perhaps a bit odd, and there are many restrictions compared to what you can do with SQL Server. Notably, the inline code block can't return a result set, so can't be used for what you outline above.
In general, if you want to write some procedural code and have it return a result, you need to put it inside a function. For example:
CREATE OR REPLACE FUNCTION somefuncname() RETURNS int LANGUAGE plpgsql AS $$
DECLARE
one int;
two int;
BEGIN
one := 1;
two := 2;
RETURN one + two;
END
$$;
SELECT somefuncname();
The PostgreSQL wire protocol doesn't, as far as I know, allow for things like a command returning multiple result sets. So you can't simply map T-SQL batches or stored procedures to PostgreSQL functions.
Here is an implementation without using jQuery at all -
http://thezillion.wordpress.com/2012/09/27/javascript-draggable-2-no-jquery
Embed the JS file (http://zillionhost.xtreemhost.com/tzdragg/tzdragg.js) in your HTML code, and put the following code -
<script>
win.onload = function(){
tzdragg.drag('elem1, elem2, ..... elemn');
// ^ IDs of the draggable elements separated by a comma.
}
</script>
And the code is also easy to learn.
http://thezillion.wordpress.com/2012/08/29/javascript-draggable-no-jquery
Here's a linearization option on simple data that uses tools from scikit learn.
Given
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import FunctionTransformer
np.random.seed(123)
# General Functions
def func_exp(x, a, b, c):
"""Return values from a general exponential function."""
return a * np.exp(b * x) + c
def func_log(x, a, b, c):
"""Return values from a general log function."""
return a * np.log(b * x) + c
# Helper
def generate_data(func, *args, jitter=0):
"""Return a tuple of arrays with random data along a general function."""
xs = np.linspace(1, 5, 50)
ys = func(xs, *args)
noise = jitter * np.random.normal(size=len(xs)) + jitter
xs = xs.reshape(-1, 1) # xs[:, np.newaxis]
ys = (ys + noise).reshape(-1, 1)
return xs, ys
transformer = FunctionTransformer(np.log, validate=True)
Code
Fit exponential data
# Data
x_samp, y_samp = generate_data(func_exp, 2.5, 1.2, 0.7, jitter=3)
y_trans = transformer.fit_transform(y_samp) # 1
# Regression
regressor = LinearRegression()
results = regressor.fit(x_samp, y_trans) # 2
model = results.predict
y_fit = model(x_samp)
# Visualization
plt.scatter(x_samp, y_samp)
plt.plot(x_samp, np.exp(y_fit), "k--", label="Fit") # 3
plt.title("Exponential Fit")
Fit log data
# Data
x_samp, y_samp = generate_data(func_log, 2.5, 1.2, 0.7, jitter=0.15)
x_trans = transformer.fit_transform(x_samp) # 1
# Regression
regressor = LinearRegression()
results = regressor.fit(x_trans, y_samp) # 2
model = results.predict
y_fit = model(x_trans)
# Visualization
plt.scatter(x_samp, y_samp)
plt.plot(x_samp, y_fit, "k--", label="Fit") # 3
plt.title("Logarithmic Fit")
Details
General Steps
x
, y
or both)np.exp()
) and fit to original dataAssuming our data follows an exponential trend, a general equation+ may be:
We can linearize the latter equation (e.g. y = intercept + slope * x) by taking the log:
Given a linearized equation++ and the regression parameters, we could calculate:
A
via intercept (ln(A)
)B
via slope (B
)Summary of Linearization Techniques
Relationship | Example | General Eqn. | Altered Var. | Linearized Eqn.
-------------|------------|----------------------|----------------|------------------------------------------
Linear | x | y = B * x + C | - | y = C + B * x
Logarithmic | log(x) | y = A * log(B*x) + C | log(x) | y = C + A * (log(B) + log(x))
Exponential | 2**x, e**x | y = A * exp(B*x) + C | log(y) | log(y-C) = log(A) + B * x
Power | x**2 | y = B * x**N + C | log(x), log(y) | log(y-C) = log(B) + N * log(x)
+Note: linearizing exponential functions works best when the noise is small and C=0. Use with caution.
++Note: while altering x data helps linearize exponential data, altering y data helps linearize log data.
You might just have to install the packages.
yum install php-pdo php-mysqli
After they're installed, restart Apache.
httpd restart
or
apachectl restart
First of all, they both are the non-scalar objects (also known as a compound objects) in Python.
+
(brand new tuple will be created of course)(3,) # -> (3)
instead of (3) # -> 3
[3]
new_array = origin_array[:]
[x**2 for x in range(1,7)]
gives you
[1,4,9,16,25,36]
(Not readable)Using list may also cause an aliasing bug (two distinct paths pointing to the same object).
In our case the solution to this problem did not involve the "ISAPI and CGI Restrictions" settings. The error started occuring after operations staff had upgraded the server to .NET 4.5 by accident, then downgraded to .NET 4.0 again. This caused some of the IIS websites to forget their respective correct application pools, and it caused some of the application pools to switch from .NET Framework 4.0 to 2.0. Changing these settings back fixed the problem.
You can bind this
to your function by adding .bind(this)
directly to the end of your function definition. You would rewrite your code block as:
setTimeout(function () {
this.setState({ timePassed: true });
}.bind(this), 1000);
write.csv([enter name of dataframe here],file = file.choose(new = T))
After running above script this window will open :
Type the new file name with extension in the File name field and click Open, it'll ask you to create a new file to which you should select Yes and the file will be created and saved in the desired location.
IIRC ...
setSize
sets the size of the component.
setPreferredSize
sets the preferred size.
The Layoutmanager will try to arrange that much space for your component.
It depends on whether you're using a layout manager or not ...
If you are using the fixed pipeline (OpenGL < 3.3) or the compatibility profile you can use
//Turn on wireframe mode
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//Draw the scene with polygons as lines (wireframe)
renderScene();
//Turn off wireframe mode
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
In this case you can change the line width by calling glLineWidth
Otherwise you need to change the polygon mode inside your draw method (glDrawElements, glDrawArrays, etc) and you may end up with some rough results because your vertex data is for triangles and you are outputting lines. For best results consider using a Geometry shader or creating new data for the wireframe.
This annotation is commonly used to eliminate NullPointerExceptions
. @Nullable
says that this parameter might be null
. A good example of such behaviour can be found in Google Guice. In this lightweight dependency injection framework you can tell that this dependency might be null
. If you would try to pass null
without an annotation the framework would refuse to do it's job.
What is more @Nullable
might be used with @NotNull
annotation. Here you can find some tips on how to use them properly. Code inspection in IntelliJ checks the annotations and helps to debug the code.
Netcat sends one packet per newline. So you're fine. If you do anything more complex then you might need something else.
I was fooling around with Wireshark when I realized this. Don't know if it helps.
This code produces random numbers from n
to m
.
int random(int from, int to){
return rand() % (to - from + 1) + from;
}
example:
int main(){
srand(time(0));
cout << random(0, 99) << "\n";
}
import itertools
def chunks(iterable,size):
it = iter(iterable)
chunk = tuple(itertools.islice(it,size))
while chunk:
yield chunk
chunk = tuple(itertools.islice(it,size))
# though this will throw ValueError if the length of ints
# isn't a multiple of four:
for x1,x2,x3,x4 in chunks(ints,4):
foo += x1 + x2 + x3 + x4
for chunk in chunks(ints,4):
foo += sum(chunk)
Another way:
import itertools
def chunks2(iterable,size,filler=None):
it = itertools.chain(iterable,itertools.repeat(filler,size-1))
chunk = tuple(itertools.islice(it,size))
while len(chunk) == size:
yield chunk
chunk = tuple(itertools.islice(it,size))
# x2, x3 and x4 could get the value 0 if the length is not
# a multiple of 4.
for x1,x2,x3,x4 in chunks2(ints,4,0):
foo += x1 + x2 + x3 + x4
I really like the MySQL collection of of GUI Tools. They aren't too large or resource hungry.
There are quite a few options here as well. Of the applications presented on that page, I like SQL Buddy - it does require a web server, however.