You can use Named Sections.
_Layout.cshtml
<head>
<script type="text/javascript" src="@Url.Content("/Scripts/jquery-1.6.2.min.js")"></script>
@RenderSection("JavaScript", required: false)
</head>
_SomeView.cshtml
@section JavaScript
{
<script type="text/javascript" src="@Url.Content("/Scripts/SomeScript.js")"></script>
<script type="text/javascript" src="@Url.Content("/Scripts/AnotherScript.js")"></script>
}
Here is an independent and efficient method to count UTF-8 bytes of a string.
//count UTF-8 bytes of a string_x000D_
function byteLengthOf(s){_x000D_
//assuming the String is UCS-2(aka UTF-16) encoded_x000D_
var n=0;_x000D_
for(var i=0,l=s.length; i<l; i++){_x000D_
var hi=s.charCodeAt(i);_x000D_
if(hi<0x0080){ //[0x0000, 0x007F]_x000D_
n+=1;_x000D_
}else if(hi<0x0800){ //[0x0080, 0x07FF]_x000D_
n+=2;_x000D_
}else if(hi<0xD800){ //[0x0800, 0xD7FF]_x000D_
n+=3;_x000D_
}else if(hi<0xDC00){ //[0xD800, 0xDBFF]_x000D_
var lo=s.charCodeAt(++i);_x000D_
if(i<l&&lo>=0xDC00&&lo<=0xDFFF){ //followed by [0xDC00, 0xDFFF]_x000D_
n+=4;_x000D_
}else{_x000D_
throw new Error("UCS-2 String malformed");_x000D_
}_x000D_
}else if(hi<0xE000){ //[0xDC00, 0xDFFF]_x000D_
throw new Error("UCS-2 String malformed");_x000D_
}else{ //[0xE000, 0xFFFF]_x000D_
n+=3;_x000D_
}_x000D_
}_x000D_
return n;_x000D_
}_x000D_
_x000D_
var s="\u0000\u007F\u07FF\uD7FF\uDBFF\uDFFF\uFFFF";_x000D_
console.log("expect byteLengthOf(s) to be 14, actually it is %s.",byteLengthOf(s));
_x000D_
Note that the method may throw error if an input string is UCS-2 malformed
A Build Lifecycle is Made Up of Phases
Each of these build lifecycles is defined by a different list of build phases, wherein a build phase represents a stage in the lifecycle.
For example, the default lifecycle comprises of the following phases (for a complete list of the lifecycle phases, refer to the Lifecycle Reference):
These lifecycle phases (plus the other lifecycle phases not shown here) are executed sequentially to complete the default lifecycle. Given the lifecycle phases above, this means that when the default lifecycle is used, Maven will first validate the project, then will try to compile the sources, run those against the tests, package the binaries (e.g. jar), run integration tests against that package, verify the integration tests, install the verified package to the local repository, then deploy the installed package to a remote repository.
Source: https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
the accepted answer does not work any longer with laravel 5.3 because mailable tries to access ->email
and results in
ErrorException in Mailable.php line 376: Trying to get property of non-object
a working code for laravel 5.3 is this:
$users_temp = explode(',', '[email protected],[email protected]');
$users = [];
foreach($users_temp as $key => $ut){
$ua = [];
$ua['email'] = $ut;
$ua['name'] = 'test';
$users[$key] = (object)$ua;
}
Mail::to($users)->send(new OrderAdminSendInvoice($o));
==EDIT==
I checked your question again and have concluded this can't be done.
ProductName is not unique, It must either be part of the Group By
or excluded from your results.
For example how would SQL present these results to you if you Group By
only ProductID?
ProductID | ProductName | OrderQuantity
---------------------------------------
1234 | abc | 1
1234 | def | 1
1234 | ghi | 1
1234 | jkl | 1
ActiveXObject
is non-standard and only supported by Internet Explorer on Windows.
There is no native cross browser way to write to the file system without using plugins, even the draft File API gives read only access.
If you want to work cross platform, then you need to look at such things as signed Java applets (keeping in mind that that will only work on platforms for which the Java runtime is available).
It sounds like you have a form tag in a Master Page and in the Page that is throwing the error.
You can have only one.
If you hate numpy, get out RPy and your local copy of R, and use it instead.
(I would also echo to make you you really need to invert the matrix. In R, for example, linalg.solve and the solve() function don't actually do a full inversion, since it is unnecessary.)
Disclaimer: I am from 42matters, who provides this data already on https://42matters.com/api , feel free to check it out or drop us a line.
As lenik mentioned there are open-source libraries that already help with obtaining some data from GPlay. If you want to build one yourself you can try to parse the Google Play App page, but you should pay attention to the following:
So that in mind getting one page metadata is a matter of fetching the page html and parsing it properly. With JSoup you can try:
HttpClient httpClient = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(crawlUrl);
HttpResponse rsp = httpClient.execute(request);
int statusCode = rsp.getStatusLine().getStatusCode();
if (statusCode == 200) {
String content = EntityUtils.toString(rsp.getEntity());
Document doc = Jsoup.parse(content);
//parse content, whatever you need
Element price = doc.select("[itemprop=price]").first();
}
For that very simple use case that should get you started. However, the moment you want to do more interesting stuff, things get complicated:
The list goes on. If you don't want to do all this by yourself, you can consider 42matters API, which supports lookup and search, top google charts, advanced queries and filters. And this for 35 languages and more than 50 countries.
[2]:
Based on http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b,
EqualAll is the approach that best meets your needs.
public void Linq96()
{
var wordsA = new string[] { "cherry", "apple", "blueberry" };
var wordsB = new string[] { "cherry", "apple", "blueberry" };
bool match = wordsA.SequenceEqual(wordsB);
Console.WriteLine("The sequences match: {0}", match);
}
They are ASCII dec codes. A full table can be found here.
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Calculator</title>
</head>
<body>
<form method="GET">
<h1>Calculator</h1>
<p>This is a calculator made by Hau Teen Yee Fabrice and is free to use.</p>
<ul>
<ol> Multiplication: * </ol>
<ol> Substraction: - </ol>
<ol> Division: / </ol>
<ol> Addition: + </ol>
</ul>
<p>Enter first number:</p>
<input type="text" name="cal1">
<p>Enter second number:</p>
<input type="text" name="cal2">
<p>Enter the calculator symbol</p>
<input type="text" name="symbol">
<button>Calculate</button>
</form>
<?php
$cal1= $_GET['cal1'];
$cal2= $_GET['cal2'];
$symbol =$_GET['symbol'];
if($symbol == '+')
{
$add = $cal1 + $cal2;
echo "Addition is:".$add;
}
else if($symbol == '-')
{
$subs = $cal1 - $cal2;
echo "Substraction is:".$subs;
}
else if($symbol == '*')
{
$mul = $cal1 * $cal2;
echo "Multiply is:".$mul;
}
else if($symbol == '/')
{
$div = $cal1 / $cal2;
echo "Division is:".$div;
}
else
{
echo "Oops ,something wrong in your code son";
}
?>
</body>
</html>
Assuming you’ve literally got two date objects, you can subtract one from the other and query the resulting timedelta
object for the number of days:
>>> from datetime import date
>>> a = date(2011,11,24)
>>> b = date(2011,11,17)
>>> a-b
datetime.timedelta(7)
>>> (a-b).days
7
And it works with datetimes too — I think it rounds down to the nearest day:
>>> from datetime import datetime
>>> a = datetime(2011,11,24,0,0,0)
>>> b = datetime(2011,11,17,23,59,59)
>>> a-b
datetime.timedelta(6, 1)
>>> (a-b).days
6
The compileSdkVersion
should be newest stable version.
The targetSdkVersion
should be fully tested and less or equal to compileSdkVersion
.
Answer of @zolley is right. Just adding a Gif and steps for the reference.
Format > Conditional formatting..
Format cells if..
=countif(A:A,A1)>1
in field Custom formula is
A
with your own column.You can use something like this scopeValue[field]
, but if your field is in another object you will need another solution.
To solve all kind of situations, you can use this directive:
this.app.directive('dynamicModel', ['$compile', '$parse', function ($compile, $parse) {
return {
restrict: 'A',
terminal: true,
priority: 100000,
link: function (scope, elem) {
var name = $parse(elem.attr('dynamic-model'))(scope);
elem.removeAttr('dynamic-model');
elem.attr('ng-model', name);
$compile(elem)(scope);
}
};
}]);
Html example:
<input dynamic-model="'scopeValue.' + field" type="text">
J.F. Sebastian's answer is most elegant but requires python 2.6 as fortran pointed out.
For Python version < 2.6, here's the best I can come up with:
from itertools import repeat,ifilter,chain
chain(ifilter(predicate,seq),repeat(None)).next()
Alternatively if you needed a list later (list handles the StopIteration), or you needed more than just the first but still not all, you can do it with islice:
from itertools import islice,ifilter
list(islice(ifilter(predicate,seq),1))
UPDATE: Although I am personally using a predefined function called first() that catches a StopIteration and returns None, Here's a possible improvement over the above example: avoid using filter / ifilter:
from itertools import islice,chain
chain((x for x in seq if predicate(x)),repeat(None)).next()
This was a very important issue for me in order for my site to be multilingual. So here is my conclusion tested in Firefox and Chrome.
jQuery trigger comes in handy.
So this hides the standard boring type=file
labels. You can place any label you want and format anyway. I customized a script from http://demo.smarttutorials.net/ajax1/. The script allows multiple file uploads with thumbnail preview and uses PHP and MySQL.
<form enctype="multipart/form-data" name='imageform' role="form" ="imageform" method="post" action="upload_ajax.php">
<div class="form-group">
<div id="select_file">Select a file</div>
<input class='file' type="file" style="display: none " class="form-control" name="images_up" id="images_up" placeholder="Please choose your image">
<div id="my_file"></div>
<span class="help-block"></span>
</div>
<div id="loader" style="display: none;">
Please wait image uploading to server....
</div>
<input type="submit" value="Upload" name="image_upload" id="image_upload" class="btn"/>
</form>
$('#select_file').click(function() {
$('#images_up').trigger('click');
$('#images_up').change(function() {
var filename = $('#images_up').val();
if (filename.substring(3,11) == 'fakepath') {
filename = filename.substring(12);
} // Remove c:\fake at beginning from localhost chrome
$('#my_file').html(filename);
});
});
Tables ::
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'
columns ::
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
or
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='your_table_name'
when I try to run it, I get NoClassDefFoundError
Run it how? You're probably trying to run it with eclipse without having correctly imported your maven classpath. See the m2eclipse plugin for integrating maven with eclipse for that.
To verify that your maven config is correct, you could run your app with the exec plugin using:
mvn exec:java -D exec.mainClass=<your main class>
Update: First, regarding your error when running exec:java
, your main class is tr.edu.hacettepe.cs.b21127113.bil138_4.App
. When talking about class names, they're (almost) always dot-separated. The simple class name is just the last part: App
in your case. The fully-qualified name is the full package plus the simple class name, and that's what you give to maven or java when you want to run something. What you were trying to use was a file system path to a source file. That's an entirely different beast. A class name generally translates directly to a class file that's found in the class path, as compared to a source file in the file system. In your specific case, the class file in question would probably be at target/classes/tr/edu/hacettepe/cs/b21127113/bil138_4/App.class
because maven compiles to target/classes
, and java traditionally creates a directory for each level of packaging.
Your original problem is simply that you haven't put the Jackson jars on your class path. When you run a java program from the command line, you have to set the class path to let it know where it can load classes from. You've added your own jar, but not the other required ones. Your comment makes me think you don't understand how to manually build a class path. In short, the class path can have two things: directories containing class files and jars containing class files. Directories containing jars won't work. For more details on building a class path, see "Setting the class path" and the java and javac tool documentation.
Your class path would need to be at least, and without the line feeds:
target/bil138_4-0.0.1-SNAPSHOT.jar:
/home/utdemir/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.6/jackson-core-asl-1.9.6.jar:
/home/utdemir/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.6/jackson-mapper-asl-1.9.6.jar
Note that the separator on Windows is a semicolon (;).
I apologize for not noticing it sooner. The problem was sitting there in your original post, but I missed it.
As c-smile mentioned: Just need to remove the apostrophes in the url()
:
<div style="background-image: url(http://i54.tinypic.com/4zuxif.jpg)"></div>
There is a problem with the string you are calling a json. I have made some changes to it below. If you properly format the string to a correct json, the code below works.
$str = '{
"action" : "create",
"record": {
"type": "n$product",
"fields": {
"nname": "Bread",
"nprice": 2.11
},
"namespaces": { "my.demo": "n" }
}
}';
$response = json_decode($str, TRUE);
echo '<br> action' . $response["action"] . '<br><br>';
You could also do it like this
#include <fstream>
int main(){
std::ofstream ost {outputfile, std::ios_base::app};
ost.open(outputfile);
ost << "something you want to add to your outputfile";
ost.close();
return 0;
}
See the documentation on ?merge
, which states:
By default the data frames are merged on the columns with names they both have,
but separate specifications of the columns can be given by by.x and by.y.
This clearly implies that merge
will merge data frames based on more than one column. From the final example given in the documentation:
x <- data.frame(k1=c(NA,NA,3,4,5), k2=c(1,NA,NA,4,5), data=1:5)
y <- data.frame(k1=c(NA,2,NA,4,5), k2=c(NA,NA,3,4,5), data=1:5)
merge(x, y, by=c("k1","k2")) # NA's match
This example was meant to demonstrate the use of incomparables
, but it illustrates merging using multiple columns as well. You can also specify separate columns in each of x
and y
using by.x
and by.y
.
To create a non-empty list of fixed size (operations like add, remove, etc., are not supported):
List<Integer> list = Arrays.asList(1, 2); // but, list.set(...) is supported
To create a non-empty mutable list:
List<Integer> list = new ArrayList<>(Arrays.asList(3, 4));
Using a new List.of(...)
static factory methods:
List<Integer> immutableList = List.of(1, 2);
List<Integer> mutableList = new ArrayList<>(List.of(3, 4));
Using the Local Variable Type Inference:
var list1 = List.of(1, 2);
var list2 = new ArrayList<>(List.of(3, 4));
var list3 = new ArrayList<String>();
And follow best practices...
Since Java 5, generics have been a part of the language - you should use them:
List<String> list = new ArrayList<>(); // Good, List of String
List list = new ArrayList(); // Bad, don't do that!
For example, program to the List
interface:
List<Double> list = new ArrayList<>();
Instead of:
ArrayList<Double> list = new ArrayList<>(); // This is a bad idea!
Pre iOS 5 you could do it in code:
I use this snippet just before the @implementation
of the class where I need my fake heading and location data.
#if (TARGET_IPHONE_SIMULATOR)
@interface MyHeading : CLHeading
-(CLLocationDirection) magneticHeading;
-(CLLocationDirection) trueHeading;
@end
@implementation MyHeading
-(CLLocationDirection) magneticHeading { return 90; }
-(CLLocationDirection) trueHeading { return 91; }
@end
@implementation CLLocationManager (TemporaryLocationFix)
- (void)locationFix {
CLLocation *location = [[CLLocation alloc] initWithLatitude:55.932 longitude:12.321];
[[self delegate] locationManager:self didUpdateToLocation:location fromLocation:nil];
id heading = [[MyHeading alloc] init];
[[self delegate] locationManager:self didUpdateHeading: heading];
}
-(void)startUpdatingHeading {
[self performSelector:@selector(locationFix) withObject:nil afterDelay:0.1];
}
- (void)startUpdatingLocation {
[self performSelector:@selector(locationFix) withObject:nil afterDelay:0.1];
}
@end
#endif
After iOS 5 simply include a GPX file in your project like this to have the location updated continuously Hillerød.gpx:
<?xml version="1.0"?>
<gpx version="1.1" creator="Xcode">
<wpt lat="55.93619760" lon="12.29131930"></wpt>
<wpt lat="55.93625770" lon="12.29108330"></wpt>
<wpt lat="55.93631780" lon="12.29078290"></wpt>
<wpt lat="55.93642600" lon="12.29041810"></wpt>
<wpt lat="55.93653420" lon="12.28998890"></wpt>
<wpt lat="55.93660630" lon="12.28966710"></wpt>
<wpt lat="55.93670240" lon="12.28936670"></wpt>
<wpt lat="55.93677450" lon="12.28921650"></wpt>
<wpt lat="55.93709900" lon="12.28945250"></wpt>
<wpt lat="55.93747160" lon="12.28949540"></wpt>
<wpt lat="55.93770000" lon="12.28966710"></wpt>
<wpt lat="55.93785620" lon="12.28977440"></wpt>
<wpt lat="55.93809660" lon="12.28988170"></wpt>
<wpt lat="55.93832490" lon="12.28994600"></wpt>
<wpt lat="55.93845710" lon="12.28996750"></wpt>
<wpt lat="55.93856530" lon="12.29007480"></wpt>
<wpt lat="55.93872150" lon="12.29013910"></wpt>
<wpt lat="55.93886570" lon="12.28975290"></wpt>
<wpt lat="55.93898590" lon="12.28955980"></wpt>
<wpt lat="55.93910610" lon="12.28919500"></wpt>
<wpt lat="55.93861330" lon="12.28883020"></wpt>
<wpt lat="55.93845710" lon="12.28868000"></wpt>
<wpt lat="55.93827680" lon="12.28850840"></wpt>
<wpt lat="55.93809660" lon="12.28842250"></wpt>
<wpt lat="55.93796440" lon="12.28831520"></wpt>
<wpt lat="55.93780810" lon="12.28810070"></wpt>
<wpt lat="55.93755570" lon="12.28790760"></wpt>
<wpt lat="55.93739950" lon="12.28775730"></wpt>
<wpt lat="55.93726730" lon="12.28767150"></wpt>
<wpt lat="55.93707500" lon="12.28760710"></wpt>
<wpt lat="55.93690670" lon="12.28734970"></wpt>
<wpt lat="55.93675050" lon="12.28726380"></wpt>
<wpt lat="55.93649810" lon="12.28713510"></wpt>
<wpt lat="55.93625770" lon="12.28687760"></wpt>
<wpt lat="55.93596930" lon="12.28679180"></wpt>
<wpt lat="55.93587310" lon="12.28719940"></wpt>
<wpt lat="55.93575290" lon="12.28752130"></wpt>
<wpt lat="55.93564480" lon="12.28797190"></wpt>
<wpt lat="55.93554860" lon="12.28833670"></wpt>
<wpt lat="55.93550050" lon="12.28868000"></wpt>
<wpt lat="55.93535630" lon="12.28900190"></wpt>
<wpt lat="55.93515200" lon="12.28936670"></wpt>
<wpt lat="55.93505580" lon="12.28958120"></wpt>
<wpt lat="55.93481550" lon="12.29001040"></wpt>
<wpt lat="55.93468320" lon="12.29033230"></wpt>
<wpt lat="55.93452700" lon="12.29063270"></wpt>
<wpt lat="55.93438280" lon="12.29095450"></wpt>
<wpt lat="55.93425050" lon="12.29121200"></wpt>
<wpt lat="55.93413040" lon="12.29140520"></wpt>
<wpt lat="55.93401020" lon="12.29168410"></wpt>
<wpt lat="55.93389000" lon="12.29189870"></wpt>
<wpt lat="55.93372170" lon="12.29239220"></wpt>
<wpt lat="55.93385390" lon="12.29258530"></wpt>
<wpt lat="55.93409430" lon="12.29295010"></wpt>
<wpt lat="55.93421450" lon="12.29320760"></wpt>
<wpt lat="55.93433470" lon="12.29333630"></wpt>
<wpt lat="55.93445490" lon="12.29350800"></wpt>
<wpt lat="55.93463520" lon="12.29374400"></wpt>
<wpt lat="55.93479140" lon="12.29410880"></wpt>
<wpt lat="55.93491160" lon="12.29419460"></wpt>
<wpt lat="55.93515200" lon="12.29458090"></wpt>
<wpt lat="55.93545250" lon="12.29494570"></wpt>
<wpt lat="55.93571690" lon="12.29505300"></wpt>
<wpt lat="55.93593320" lon="12.29513880"></wpt>
<wpt lat="55.93617360" lon="12.29522460"></wpt>
<wpt lat="55.93622170" lon="12.29537480"></wpt>
<wpt lat="55.93713510" lon="12.29505300"></wpt>
<wpt lat="55.93776000" lon="12.29378700"></wpt>
<wpt lat="55.93904600" lon="12.29531040"></wpt>
<wpt lat="55.94004350" lon="12.29552500"></wpt>
<wpt lat="55.94023570" lon="12.29561090"></wpt>
<wpt lat="55.94019970" lon="12.29591130"></wpt>
<wpt lat="55.94017560" lon="12.29629750"></wpt>
<wpt lat="55.94017560" lon="12.29670520"></wpt>
<wpt lat="55.94017560" lon="12.29713430"></wpt>
<wpt lat="55.94019970" lon="12.29754200"></wpt>
<wpt lat="55.94024780" lon="12.29816430"></wpt>
<wpt lat="55.94051210" lon="12.29842180"></wpt>
<wpt lat="55.94084860" lon="12.29820720"></wpt>
<wpt lat="55.94105290" lon="12.29799270"></wpt>
<wpt lat="55.94123320" lon="12.29777810"></wpt>
<wpt lat="55.94140140" lon="12.29749910"></wpt>
<wpt lat="55.94142550" lon="12.29726310"></wpt>
<wpt lat="55.94147350" lon="12.29687690"></wpt>
<wpt lat="55.94155760" lon="12.29619020"></wpt>
<wpt lat="55.94161770" lon="12.29576110"></wpt>
<wpt lat="55.94148550" lon="12.29531040"></wpt>
<wpt lat="55.94093270" lon="12.29522460"></wpt>
<wpt lat="55.94041600" lon="12.29518170"></wpt>
<wpt lat="55.94056020" lon="12.29398010"></wpt>
<wpt lat="55.94024780" lon="12.29352950"></wpt>
<wpt lat="55.94001940" lon="12.29335780"></wpt>
<wpt lat="55.93992330" lon="12.29325050"></wpt>
<wpt lat="55.93969490" lon="12.29299300"></wpt>
<wpt lat="55.93952670" lon="12.29277840"></wpt>
<wpt lat="55.93928630" lon="12.29260680"></wpt>
<wpt lat="55.93915410" lon="12.29232780"></wpt>
<wpt lat="55.93928630" lon="12.29202740"></wpt>
<wpt lat="55.93933440" lon="12.29174850"></wpt>
<wpt lat="55.93947860" lon="12.29116910"></wpt>
<wpt lat="55.93965890" lon="12.29095450"></wpt>
<wpt lat="55.94001940" lon="12.29061120"></wpt>
<wpt lat="55.94041600" lon="12.29084730"></wpt>
<wpt lat="55.94076450" lon="12.29101890"></wpt>
<wpt lat="55.94080060" lon="12.29065410"></wpt>
<wpt lat="55.94086060" lon="12.29031080"></wpt>
<wpt lat="55.94092070" lon="12.28990310"></wpt>
<wpt lat="55.94099280" lon="12.28975290"></wpt>
<wpt lat="55.94119710" lon="12.28986020"></wpt>
<wpt lat="55.94134130" lon="12.28998890"></wpt>
<wpt lat="55.94147350" lon="12.29007480"></wpt>
<wpt lat="55.94166580" lon="12.29003190"></wpt>
<wpt lat="55.94176190" lon="12.28938810"></wpt>
<wpt lat="55.94183400" lon="12.28893750"></wpt>
<wpt lat="55.94194220" lon="12.28850840"></wpt>
<wpt lat="55.94199030" lon="12.28835820"></wpt>
<wpt lat="55.94215850" lon="12.28859420"></wpt>
<wpt lat="55.94250700" lon="12.28883020"></wpt>
<wpt lat="55.94267520" lon="12.28893750"></wpt>
<wpt lat="55.94284350" lon="12.28902330"></wpt>
<wpt lat="55.94304770" lon="12.28915210"></wpt>
<wpt lat="55.94325200" lon="12.28925940"></wpt>
<wpt lat="55.94348030" lon="12.28953830"></wpt>
<wpt lat="55.94366060" lon="12.28966710"></wpt>
<wpt lat="55.94388890" lon="12.28975290"></wpt>
<wpt lat="55.94399700" lon="12.28994600"></wpt>
<wpt lat="55.94379280" lon="12.29065410"></wpt>
<wpt lat="55.94364860" lon="12.29095450"></wpt>
<wpt lat="55.94350440" lon="12.29127640"></wpt>
<wpt lat="55.94340820" lon="12.29155540"></wpt>
<wpt lat="55.94331210" lon="12.29198450"></wpt>
<wpt lat="55.94315590" lon="12.29269260"></wpt>
<wpt lat="55.94310780" lon="12.29318610"></wpt>
<wpt lat="55.94301170" lon="12.29361530"></wpt>
<wpt lat="55.94292760" lon="12.29408740"></wpt>
<wpt lat="55.94290350" lon="12.29436630"></wpt>
<wpt lat="55.94287950" lon="12.29453800"></wpt>
<wpt lat="55.94283140" lon="12.29533190"></wpt>
<wpt lat="55.94274730" lon="12.29606150"></wpt>
<wpt lat="55.94278340" lon="12.29621170"></wpt>
<wpt lat="55.94280740" lon="12.29649060"></wpt>
<wpt lat="55.94284350" lon="12.29679100"></wpt>
<wpt lat="55.94284350" lon="12.29734890"></wpt>
<wpt lat="55.94308380" lon="12.29837890"></wpt>
<wpt lat="55.94315590" lon="12.29852910"></wpt>
<wpt lat="55.94263920" lon="12.29906550"></wpt>
<wpt lat="55.94237480" lon="12.29910850"></wpt>
<wpt lat="55.94220660" lon="12.29915140"></wpt>
<wpt lat="55.94208640" lon="12.29902260"></wpt>
<wpt lat="55.94196620" lon="12.29887240"></wpt>
<wpt lat="55.94176190" lon="12.29794970"></wpt>
<wpt lat="55.94156970" lon="12.29760640"></wpt>
</gpx>
I use GPSies.com to create the base file for the gpx data. A bit of cleanup is required though.
Activate by running the simulator and choosing your file
(source: castleandersen.dk)
For this you have to use HtmlAttributes, but there is a catch: HtmlAttributes and css class .
you can define it like this:
new { Attrubute="Value", AttributeTwo = IntegerValue, @class="className" };
and here is a more realistic example:
new { style="width:50px" };
new { style="width:50px", maxsize = 50 };
new {size=30, @class="required"}
and finally in:
MVC 1
<%= Html.TextBox("test", new { style="width:50px" }) %>
MVC 2
<%= Html.TextBox("test", null, new { style="width:50px" }) %>
MVC 3
@Html.TextBox("test", null, new { style="width:50px" })
You can use git rebase --interactive
, using the edit
command on the commit you want to amend.
First of all, input
element shouldn't have a closing tag (from http://www.w3.org/TR/html401/interact/forms.html#edef-INPUT : End tag: forbidden
).
Second thing, you need the after()
, not append()
function.
I think you are after this:
CONVERT(datetime, date_as_string, 103)
Notice, that datetime
hasn't any format. You think about its presentation. To get the data of datetime
in an appropriate format you can use
CONVERT(varchar, date_as_datetime, 103)
Do git rebase -i <sha before the branches diverged>
this will allow you to remove the merge commit and the log will be one single line as you wanted. You can also delete any commits that you do not want any more. The reason that your rebase wasn't working was that you weren't going back far enough.
WARNING: You are rewriting history doing this. Doing this with changes that have been pushed to a remote repo will cause issues. I recommend only doing this with commits that are local.
You need to escape the % with another...
del "D:\TEST\TEST 100%%\Archive*.TXT"
Oracle ADF http://www.oracle.com/technology/products/jdev/index.html
in web application in .cs page
txtbox.Style.Add("background-color","black");
in css specify it by using backcolor property
Use isinstance
:
if isinstance(e, list):
If you want to check that an object is a list or a tuple, pass several classes to isinstance
:
if isinstance(e, (list, tuple)):
Do any of the major JSON libraries support this? The org.json library simply does a reference comparison.
But org.json
does support this! Use similar()
instead of equals()
.
dates_dict[key] = dates_dict.get(key, []).append(date)
sets dates_dict[key]
to None
as list.append
returns None
.
In [5]: l = [1,2,3]
In [6]: var = l.append(3)
In [7]: print var
None
You should use collections.defaultdict
import collections
dates_dict = collections.defaultdict(list)
$('#yourTextBoxId').live('change keyup paste', function(){
if ($('#yourTextBoxId').val().length > 11) {
$('#yourTextBoxId').val($('#yourTextBoxId').val().substr(0,10));
}
});
I Used this along with vars and selectors caching for performance and that did the trick ..
Just FYI, as of today (22 October 2019) official Nginx docker images all have line:
CMD ["nginx", "-g", "daemon off;"]
Two ways out of possible solutions to achieve this are:
1. Create a .htaccess
file in root folder as under (just replace example.com and my_dir with your corresponding values):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_dir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_dir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_dir/index.php [L]
</IfModule>
Use RedirectMatch to only redirect the root URL “/” to another folder or URL,
RedirectMatch ^/$ http://www.example.com/my_dir
By default they are stored here:
%commonprogramfiles%/Microsoft Shared/web server extensions/12/Logs
Using %commonprogramfiles% make it works in non-english systems.
As @sinoroc suggested correct way of installing a package via pip is using separate process since pip may cause closing a thread or may require a restart of interpreter to load new installed package so this is the right way of using the API: subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'SomeProject'])
but since Python allows to access internal API and you know what you're using the API for you may want to use internal API anyway eg. if you're building own GUI package manager with alternative resourcess like https://www.lfd.uci.edu/~gohlke/pythonlibs/
Following soulution is OUT OF DATE, instead of downvoting suggest updates. see https://github.com/pypa/pip/issues/7498 for reference.
get_installed_distributions()
or main
method under import pip
instead use import pip._internal as pip
.
UPDATE ca. v.18 get_installed_distributions()
has been removed. Instead you may use generator freeze
like this:
from pip._internal.operations.freeze import freeze
print([package for package in freeze()])
# eg output ['pip==19.0.3']
import pip
package_names=['selenium', 'requests'] #packages to install
pip.main(['install'] + package_names + ['--upgrade'])
# --upgrade to install or update existing packages
If you need to update every installed package, use following:
import pip
for i in pip.get_installed_distributions():
pip.main(['install', i.key, '--upgrade'])
If you want to stop installing other packages if any installation fails, use it in one single pip.main([])
call:
import pip
package_names = [i.key for i in pip.get_installed_distributions()]
pip.main(['install'] + package_names + ['--upgrade'])
Note: When you install from list in file with -r
/ --requirement
parameter you do NOT need open() function.
pip.main(['install', '-r', 'filename'])
Warning: Some parameters as simple --help
may cause python interpreter to stop.
Curiosity: By using pip.exe
you actually use python interpreter and pip module anyway. If you unpack pip.exe
or pip3.exe
regardless it's python 2.x or 3.x, inside is the SAME single file __main__.py
:
# -*- coding: utf-8 -*-
import re
import sys
from pip import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
What is returned is milliseconds since epoch. You could do:
var d = new Date();
d.setTime(1245398693390);
document.write(d);
On how to format the date exactly as you want, see full Date
reference at http://www.w3schools.com/jsref/jsref_obj_date.asp
You could strip the non-digits by either parsing the integer (as suggested here):
var date = new Date(parseInt(jsonDate.substr(6)));
Or applying the following regular expression (from Tominator in the comments):
var jsonDate = jqueryCall(); // returns "/Date(1245398693390)/";
var re = /-?\d+/;
var m = re.exec(jsonDate);
var d = new Date(parseInt(m[0]));
Something like this should do:
function cleanLocalStorage() {
for(key in localStorage) {
delete localStorage[key];
}
}
Be careful about using this, though, as the user may have other data stored in localStorage
and would probably be pretty ticked if you deleted that. I'd recommend either a) not storing the user's data in localStorage
or b) storing the user's account stuff in a single variable, and then clearing that instead of deleting all the keys in localStorage
.
Edit: As Lyn pointed out, you'll be good with localStorage.clear()
. My previous points still stand, however.
I typically have a secrets.py
that is stored separately from my other python scripts and is not under version control. Then whenever required, you can do from secrets import <required_pwd_var>
. This way you can rely on the operating systems in-built file security system without re-inventing your own.
Using Base64
encoding/decoding is also another way to obfuscate the password though not completely secure
More here - Hiding a password in a python script (insecure obfuscation only)
It means that the algorithm is both big-O and big-Omega in the given function.
For example, if it is ?(n)
, then there is some constant k
, such that your function (run-time, whatever), is larger than n*k
for sufficiently large n
, and some other constant K
such that your function is smaller than n*K
for sufficiently large n
.
In other words, for sufficiently large n
, it is sandwiched between two linear functions :
For k < K
and n
sufficiently large, n*k < f(n) < n*K
This is a simple one line way to do it:
try {
URL url = new URL("http://....");
Bitmap image = BitmapFactory.decodeStream(url.openConnection().getInputStream());
} catch(IOException e) {
System.out.println(e);
}
Below is a class which will accomplish the very basics of what you want to do when reading data from a MySQL database into a JTable
in Java.
import java.awt.*;
import java.sql.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
public class TableFromMySqlDatabase extends JFrame
{
public TableFromMySqlDatabase()
{
ArrayList columnNames = new ArrayList();
ArrayList data = new ArrayList();
// Connect to an MySQL Database, run query, get result set
String url = "jdbc:mysql://localhost:3306/yourdb";
String userid = "root";
String password = "sesame";
String sql = "SELECT * FROM animals";
// Java SE 7 has try-with-resources
// This will ensure that the sql objects are closed when the program
// is finished with them
try (Connection connection = DriverManager.getConnection( url, userid, password );
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery( sql ))
{
ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();
// Get column names
for (int i = 1; i <= columns; i++)
{
columnNames.add( md.getColumnName(i) );
}
// Get row data
while (rs.next())
{
ArrayList row = new ArrayList(columns);
for (int i = 1; i <= columns; i++)
{
row.add( rs.getObject(i) );
}
data.add( row );
}
}
catch (SQLException e)
{
System.out.println( e.getMessage() );
}
// Create Vectors and copy over elements from ArrayLists to them
// Vector is deprecated but I am using them in this example to keep
// things simple - the best practice would be to create a custom defined
// class which inherits from the AbstractTableModel class
Vector columnNamesVector = new Vector();
Vector dataVector = new Vector();
for (int i = 0; i < data.size(); i++)
{
ArrayList subArray = (ArrayList)data.get(i);
Vector subVector = new Vector();
for (int j = 0; j < subArray.size(); j++)
{
subVector.add(subArray.get(j));
}
dataVector.add(subVector);
}
for (int i = 0; i < columnNames.size(); i++ )
columnNamesVector.add(columnNames.get(i));
// Create table with database data
JTable table = new JTable(dataVector, columnNamesVector)
{
public Class getColumnClass(int column)
{
for (int row = 0; row < getRowCount(); row++)
{
Object o = getValueAt(row, column);
if (o != null)
{
return o.getClass();
}
}
return Object.class;
}
};
JScrollPane scrollPane = new JScrollPane( table );
getContentPane().add( scrollPane );
JPanel buttonPanel = new JPanel();
getContentPane().add( buttonPanel, BorderLayout.SOUTH );
}
public static void main(String[] args)
{
TableFromMySqlDatabase frame = new TableFromMySqlDatabase();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setVisible(true);
}
}
In the NetBeans IDE which you are using - you will need to add the MySQL JDBC Driver in Project Properties as I display here:
Otherwise the code will throw an SQLException
stating that the driver cannot be found.
Now in my example, yourdb
is the name of the database and animals
is the name of the table that I am performing a query against.
Here is what will be output:
Parting note:
You stated that you were a novice and needed some help understanding some of the basic classes and concepts of Java. I will list a few here, but remember you can always browse the docs on Oracle's site.
I'm doing the same thing using invalidateViews() and that works for me. If you want it to invalidate immediately you could try calling postInvalidate after calling invalidateViews.
Expanding upon the accepted answer, your machine going to sleep, etc. may delay the timer from working. You can get a true time, at the cost of a little processing. This will give a true time left.
<span id="timer"></span>
<script>
var now = new Date();
var timeup = now.setSeconds(now.getSeconds() + 30);
//var timeup = now.setHours(now.getHours() + 1);
var counter = setInterval(timer, 1000);
function timer() {
now = new Date();
count = Math.round((timeup - now)/1000);
if (now > timeup) {
window.location = "/logout"; //or somethin'
clearInterval(counter);
return;
}
var seconds = Math.floor((count%60));
var minutes = Math.floor((count/60) % 60);
document.getElementById("timer").innerHTML = minutes + ":" + seconds;
}
</script>
Here is a little something I cooked up today. Seems to work for me. Basically you override the Add method in your base namespace to do a check and then call the base's Add method in order to actually add it. Hope this works for you
using System;
using System.Collections.Generic;
using System.Collections;
namespace Main
{
internal partial class Dictionary<TKey, TValue> : System.Collections.Generic.Dictionary<TKey, TValue>
{
internal new virtual void Add(TKey key, TValue value)
{
if (!base.ContainsKey(key))
{
base.Add(key, value);
}
}
}
internal partial class List<T> : System.Collections.Generic.List<T>
{
internal new virtual void Add(T item)
{
if (!base.Contains(item))
{
base.Add(item);
}
}
}
public class Program
{
public static void Main()
{
Dictionary<int, string> dic = new Dictionary<int, string>();
dic.Add(1,"b");
dic.Add(1,"a");
dic.Add(2,"c");
dic.Add(1, "b");
dic.Add(1, "a");
dic.Add(2, "c");
string val = "";
dic.TryGetValue(1, out val);
Console.WriteLine(val);
Console.WriteLine(dic.Count.ToString());
List<string> lst = new List<string>();
lst.Add("b");
lst.Add("a");
lst.Add("c");
lst.Add("b");
lst.Add("a");
lst.Add("c");
Console.WriteLine(lst[2]);
Console.WriteLine(lst.Count.ToString());
}
}
}
Thanks to Gruff Bunny and Louis' comments, I found the source of the issue.
As I use Backbone.js too, I loaded a special build of Lodash compatible with Backbone and Underscore that disables some features. In this example:
var clone = _.clone(data, true);
data[1].values.d = 'x';
_.isEqual(data, clone) === false
_.isEqual(data, clone) === true
I just replaced the Underscore build with the Normal build in my Backbone application and the application is still working. So I can now use the Lodash .clone with the expected behaviour.
Edit 2018: the Underscore build doesn't seem to exist anymore. If you are reading this in 2018, you could be interested by this documentation (Backbone and Lodash).
I've got a one liner to make HTML Tables look BootStrapped:
<table class="table table-striped table-bordered table-hover">
The theme suits other controls and it supports alternate row highlighting.
Conroy's answer was right. In the case you need only stuff from body tag, just use:
$('#my_iframe').contents().find('body').html();
Here is my version which adds the tcp port in case it's not 80 or 443:
function url(s) {
var l = window.location;
return ((l.protocol === "https:") ? "wss://" : "ws://") + l.hostname + (((l.port != 80) && (l.port != 443)) ? ":" + l.port : "") + l.pathname + s;
}
Edit 1: Improved version as by suggestion of @kanaka :
function url(s) {
var l = window.location;
return ((l.protocol === "https:") ? "wss://" : "ws://") + l.host + l.pathname + s;
}
Edit 2: Nowadays I create the WebSocket
this:
var s = new WebSocket(((window.location.protocol === "https:") ? "wss://" : "ws://") + window.location.host + "/ws");
Note that the file:///
scheme does not work on the compact framework, at least it doesn't with 5.0.
You will need to use the following:
string appDir = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().GetName().CodeBase);
webBrowser1.Url = new Uri(Path.Combine(appDir, @"Documentation\index.html"));
I tried many ways but this works.
Sample code is availalbe in DBCC SHRINKFILE
USE DBName;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE DBName
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (DBName_log, 1); --File name SELECT * FROM sys.database_files; query to get the file name
GO
-- Reset the database recovery model.
ALTER DATABASE DBName
SET RECOVERY FULL;
GO
If a non-static method is member of a class, you have to define it like that:
def Method(self, atributes..)
So, I suppose your 'e' is instance of some class with implemented method that tries to execute and has too much arguments.
logical data model
A logical data model describes the data in as much detail as possible, without regard to how they will be physical implemented in the database. Features of a logical data model include: · Includes all entities and relationships among them. · All attributes for each entity are specified. · The primary key for each entity is specified. · Foreign keys (keys identifying the relationship between different entities) are specified. · Normalization occurs at this level. conceptual data model
A conceptual data model identifies the highest-level relationships between the different entities. Features of conceptual data model include: · Includes the important entities and the relationships among them. · No attribute is specified. · No primary key is specified.
The message from Linus Torvalds may answer your question:
Modify/edit old commit messages
Short answer: you can not (if pushed).
extract (Linus refers to BitKeeper as BK):
Side note, just out of historical interest: in BK you could.
And if you're used to it (like I was) it was really quite practical. I would apply a patch-bomb from Andrew, notice something was wrong, and just edit it before pushing it out.
I could have done the same with git. It would have been easy enough to make just the commit message not be part of the name, and still guarantee that the history was untouched, and allow the "fix up comments later" thing.
But I didn't.
Part of it is purely "internal consistency". Git is simply a cleaner system thanks to everything being SHA1-protected, and all objects being treated the same, regardless of object type. Yeah, there are four different kinds of objects, and they are all really different, and they can't be used in the same way, but at the same time, even if their encoding might be different on disk, conceptually they all work exactly the same.
But internal consistency isn't really an excuse for being inflexible, and clearly it would be very flexible if we could just fix up mistakes after they happen. So that's not a really strong argument.
The real reason git doesn't allow you to change the commit message ends up being very simple: that way, you can trust the messages. If you allowed people to change them afterwards, the messages are inherently not very trustworthy.
To be complete, you could rewrite your local commit history in order to reflect what you want, as suggested by sykora (with some rebase and reset --hard, gasp!)
However, once you publish your revised history again (with a git push origin +master:master
, the +
sign forcing the push to occur, even if it doesn't result in a "fast-forward" commit)... you might get into some trouble.
Extract from this other SO question:
I actually once pushed with --force to git.git repository and got scolded by Linus BIG TIME. It will create a lot of problems for other people. A simple answer is "don't do it".
In Linux, there is different escape sequences for control terminal. For example, there is special escape sequence for erase whole line: \33[2K
and for move cursor to previous line: \33[1A
. So all you need is to print this every time you need to refresh the line. Here is the code which prints Line 1 (second variant)
:
System.out.println("Line 1 (first variant)");
System.out.print("\33[1A\33[2K");
System.out.println("Line 1 (second variant)");
There are codes for cursor navigation, clearing screen and so on.
I think there are some libraries which helps with it (ncurses
?).
I am using the following code in one of my current projects where i download data from the internet. It is all inside my activity class.
// ---------------------------- START DownloadFileAsync // -----------------------//
class DownloadFileAsync extends AsyncTask<String, String, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
// DIALOG_DOWNLOAD_PROGRESS is defined as 0 at start of class
showDialog(DIALOG_DOWNLOAD_PROGRESS);
}
@Override
protected String doInBackground(String... urls) {
try {
String xmlUrl = urls[0];
URL u = new URL(xmlUrl);
HttpURLConnection c = (HttpURLConnection) u.openConnection();
c.setRequestMethod("GET");
c.setDoOutput(true);
c.connect();
int lengthOfFile = c.getContentLength();
InputStream in = c.getInputStream();
byte[] buffer = new byte[1024];
int len1 = 0;
long total = 0;
while ((len1 = in.read(buffer)) > 0) {
total += len1; // total = total + len1
publishProgress("" + (int) ((total * 100) / lengthOfFile));
xmlContent += buffer;
}
} catch (Exception e) {
Log.d("Downloader", e.getMessage());
}
return null;
}
protected void onProgressUpdate(String... progress) {
Log.d("ANDRO_ASYNC", progress[0]);
mProgressDialog.setProgress(Integer.parseInt(progress[0]));
}
@Override
protected void onPostExecute(String unused) {
dismissDialog(DIALOG_DOWNLOAD_PROGRESS);
}
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DIALOG_DOWNLOAD_PROGRESS:
mProgressDialog = new ProgressDialog(this);
mProgressDialog.setMessage("Retrieving latest announcements...");
mProgressDialog.setIndeterminate(false);
mProgressDialog.setMax(100);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setCancelable(true);
mProgressDialog.show();
return mProgressDialog;
default:
return null;
}
}
In order to download a file to Download or Music Folder In SDCard
File downlodDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);// or DIRECTORY_PICTURES
And dont forget to add these permission in manifest
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
As pointed out by other answers, in python they return floats probably because of historical reasons to prevent overflow problems. However, they return integers in python 3.
>>> import math
>>> type(math.floor(3.1))
<class 'int'>
>>> type(math.ceil(3.1))
<class 'int'>
You can find more information in PEP 3141.
It is SO ridiculous that this is not super-easy... let alone next to impossible. Hands up, I defer to Apple/Spotlight...
mdfind 'kMDItemContentType=public.unix-executable'
At least it works!
Example-
For cells containing the values between 21-31, the formula is:
=COUNTIF(M$7:M$83,">21")-COUNTIF(M$7:M$83,">31")
CSS rules are inherited by default - hence the "cascading" name. To get what you want you need to use !important:
form div
{
font-size: 12px;
font-weight: bold;
}
div.content
{
// any rule you want here, followed by !important
}
If you have an array you can simply use a for
loop. (I'm sorry, but I'm not going to type out the code for a for
loop for you.)
The syntax:
ALTER TABLE `table1` CHANGE `itemId` `itemId` INT( 11 ) NOT NULL AUTO_INCREMENT
But the table needs a defined key (ex primary key on itemId).
As far as I understand it correctly, I think it's easiest to work with 4 lists: - Your sourceList - Your destinationList - A removedItemsList - A newlyAddedItemsList
One way to do it would be like this:
param(
[Parameter(Position=0)][String]$Vlan,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$Hosts
) ...
This would allow multiple hosts to be entered with spaces.
This is very tricky in Python.
I'll first comment on why you're having that problem and then I will mention two possible solutions.
You must take this paragraph from the Python documentation into consideration:
Note that relative imports are based on the name of the current module. Since the name of the main module is always "main", modules intended for use as the main module of a Python application must always use absolute imports.
And also the following from PEP 328:
Relative imports use a module's name attribute to determine that module's position in the package hierarchy. If the module's name does not contain any package information (e.g. it is set to 'main') then relative imports are resolved as if the module were a top level module, regardless of where the module is actually located on the file system.
Relative imports work from the filename (__name__
attribute), which can take two values:
package.test_A.test
Here Python knows the parent directories: before test
comes test_A
and then package
.
So you can use the dot notation for relative import.# package.test_A/test.py
from ..A import foo
You can then have like a root file in the root directory which calls test.py
:
# root.py
from package.test_A import test
test.py
) directly, it becomes the entry point to the program , so __name__
== __main__
. The filename has no indication of the directory structure, so Python doesn't know how to go up in the directory. For Python, test.py
becomes the top-level script, there is nothing above it. That's why you cannot use relative import.A) One way to solve this is to have a root file (in the root directory) which calls the modules/packages, like this:
root.py
imports test.py
. (entry point, __name__ == __main__
).test.py
(relative) imports foo.py
.foo.py
says the module has been imported.The output is:
package.A.foo has been imported
Module's name is: package.test_A.test
B) If you want to execute the code as a module and not as a top-level script, you can try this from the command line:
python -m package.test_A.test
Any suggestions are welcomed.
You should also check: Relative imports for the billionth time , specially BrenBarn's answer.
Previous answers might not work for later mysql versions. Try these steps if previous answers did not work for you:
Click on the wamp icon &rarr: mysql → mysql console
write following commands, one by one
use mysql;
update user set authentication_string=password('your_password') where user='root';
FLUSH PRIVILEGES;
quit
You can use the format
option, as described in the documentation
$("#timePicker").datetimepicker({
format: 'Y-m-d H:i'
});
it simple, select columns want to insert primary key and click on Key icon on header and save table
happy coding..,
This is by far the best solution I've found for having a fixed table header.
UPDATE 5/11: Fixed horizontal scrolling bug as pointed out by Kerry Johnson
Codepen: https://codepen.io/josephting/pen/demELL
;(function($) {_x000D_
$.fn.fixMe = function() {_x000D_
return this.each(function() {_x000D_
var $this = $(this),_x000D_
$t_fixed;_x000D_
function init() {_x000D_
$this.wrap('<div class="container" />');_x000D_
$t_fixed = $this.clone();_x000D_
$t_fixed.find("tbody").remove().end().addClass("fixed").insertBefore($this);_x000D_
resizeFixed();_x000D_
}_x000D_
function resizeFixed() {_x000D_
$t_fixed.width($this.outerWidth());_x000D_
$t_fixed.find("th").each(function(index) {_x000D_
$(this).css("width",$this.find("th").eq(index).outerWidth()+"px");_x000D_
});_x000D_
}_x000D_
function scrollFixed() {_x000D_
var offsetY = $(this).scrollTop(),_x000D_
offsetX = $(this).scrollLeft(),_x000D_
tableOffsetTop = $this.offset().top,_x000D_
tableOffsetBottom = tableOffsetTop + $this.height() - $this.find("thead").height(),_x000D_
tableOffsetLeft = $this.offset().left;_x000D_
if(offsetY < tableOffsetTop || offsetY > tableOffsetBottom)_x000D_
$t_fixed.hide();_x000D_
else if(offsetY >= tableOffsetTop && offsetY <= tableOffsetBottom && $t_fixed.is(":hidden"))_x000D_
$t_fixed.show();_x000D_
$t_fixed.css("left", tableOffsetLeft - offsetX + "px");_x000D_
}_x000D_
$(window).resize(resizeFixed);_x000D_
$(window).scroll(scrollFixed);_x000D_
init();_x000D_
});_x000D_
};_x000D_
})(jQuery);_x000D_
_x000D_
$(document).ready(function(){_x000D_
$("table").fixMe();_x000D_
$(".up").click(function() {_x000D_
$('html, body').animate({_x000D_
scrollTop: 0_x000D_
}, 2000);_x000D_
});_x000D_
});
_x000D_
body{_x000D_
font:1.2em normal Arial,sans-serif;_x000D_
color:#34495E;_x000D_
}_x000D_
_x000D_
h1{_x000D_
text-align:center;_x000D_
text-transform:uppercase;_x000D_
letter-spacing:-2px;_x000D_
font-size:2.5em;_x000D_
margin:20px 0;_x000D_
}_x000D_
_x000D_
.container{_x000D_
width:90%;_x000D_
margin:auto;_x000D_
}_x000D_
_x000D_
table{_x000D_
border-collapse:collapse;_x000D_
width:100%;_x000D_
}_x000D_
_x000D_
.blue{_x000D_
border:2px solid #1ABC9C;_x000D_
}_x000D_
_x000D_
.blue thead{_x000D_
background:#1ABC9C;_x000D_
}_x000D_
_x000D_
.purple{_x000D_
border:2px solid #9B59B6;_x000D_
}_x000D_
_x000D_
.purple thead{_x000D_
background:#9B59B6;_x000D_
}_x000D_
_x000D_
thead{_x000D_
color:white;_x000D_
}_x000D_
_x000D_
th,td{_x000D_
text-align:center;_x000D_
padding:5px 0;_x000D_
}_x000D_
_x000D_
tbody tr:nth-child(even){_x000D_
background:#ECF0F1;_x000D_
}_x000D_
_x000D_
tbody tr:hover{_x000D_
background:#BDC3C7;_x000D_
color:#FFFFFF;_x000D_
}_x000D_
_x000D_
.fixed{_x000D_
top:0;_x000D_
position:fixed;_x000D_
width:auto;_x000D_
display:none;_x000D_
border:none;_x000D_
}_x000D_
_x000D_
.scrollMore{_x000D_
margin-top:600px;_x000D_
}_x000D_
_x000D_
.up{_x000D_
cursor:pointer;_x000D_
}
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
<h1>↓ SCROLL ↓</h1>_x000D_
<table class="blue">_x000D_
<thead>_x000D_
<tr>_x000D_
<th>Colonne 1</th>_x000D_
<th>Colonne 2</th>_x000D_
<th>Colonne 3</th>_x000D_
</tr>_x000D_
</thead>_x000D_
<tbody>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>MaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMaisMais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
</tbody>_x000D_
</table>_x000D_
_x000D_
<h1 class="scrollMore">↓ SCROLL MORE ↓</h1>_x000D_
<table class="purple">_x000D_
<thead>_x000D_
<tr>_x000D_
<th>Colonne 1</th>_x000D_
<th>Colonne 2</th>_x000D_
<th>Colonne 3</th>_x000D_
</tr>_x000D_
</thead>_x000D_
<tbody>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Non</td>_x000D_
<td>Mais</td>_x000D_
<td>Allo !</td>_x000D_
</tr>_x000D_
</tbody>_x000D_
</table>_x000D_
<h1 class="up scrollMore">↑ UP ↑</h1>
_x000D_
This part of code worked fine for me:
WebRequest request = WebRequest.Create(url);
request.Method = WebRequestMethods.Http.Get;
NetworkCredential networkCredential = new NetworkCredential(logon, password); // logon in format "domain\username"
CredentialCache myCredentialCache = new CredentialCache {{new Uri(url), "Basic", networkCredential}};
request.PreAuthenticate = true;
request.Credentials = myCredentialCache;
using (WebResponse response = request.GetResponse())
{
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
using (Stream dataStream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(dataStream))
{
string responseFromServer = reader.ReadToEnd();
Console.WriteLine(responseFromServer);
}
}
}
In regards to Gordon M's answer above, the 1st and 2nd parameter in mysqli_real_escape_string ()
call should be swapped for the newer php versions,
according to: http://php.net/manual/en/mysqli.real-escape-string.php
The .addwithvalue needs dbnull. You could do something like this:
DateTime? someDate = null;
//...
if (someDate == null)
myCommand.Parameters.AddWithValue("@SurgeryDate", DBnull.value);
or use a method extension...
public static class Extensions
{
public static SqlParameter AddWithNullValue(this SqlParameterCollection collection, string parameterName, object value)
{
if (value == null)
return collection.AddWithValue(parameterName, DBNull.Value);
else
return collection.AddWithValue(parameterName, value);
}
}
Using new Array methods and =>
function syntax from ES6 standard (only Firefox at the time of writing).
By filling holes with undefined
:
Array(N).fill().map((_, i) => i + 1);
Array.from
turns "holes" into undefined
so Array.map
works as expected:
Array.from(Array(5)).map((_, i) => i + 1)
In this particular use case, you don't really want to abort the merge, just resolve the conflict in a particular way.
There is no particular need to reset and perform a merge with a different strategy, either. The conflicts have been correctly highlighted by git and the requirement to accept the other sides changes is only for this one file.
For an unmerged file in a conflict git makes available the common base, local and remote versions of the file in the index. (This is where they are read from for use in a 3-way diff tool by git mergetool
.) You can use git show
to view them.
# common base:
git show :1:_widget.html.erb
# 'ours'
git show :2:_widget.html.erb
# 'theirs'
git show :3:_widget.html.erb
The simplest way to resolve the conflict to use the remote version verbatim is:
git show :3:_widget.html.erb >_widget.html.erb
git add _widget.html.erb
Or, with git >= 1.6.1:
git checkout --theirs _widget.html.erb
It's new to SQL 2005 and offers a simplified way to group objects, especially for the purpose of securing the objects in that "group".
The following link offers a more in depth explanation as to what it is, why we would use it:
Understanding the Difference between Owners and Schemas in SQL Server
You can do it by a combination of javascript and php:
<div id="cont"></div>
And by the other side;
<script>
var h = window.location.hash;
var h1 = (win.substr(1));//string with no #
var q1 = '<input type="text" id="hash" name="hash" value="'+h1+'">';
setInterval(function(){
if(win1!="")
{
document.querySelector('#cont').innerHTML = q1;
} else alert("Something went wrong")
},1000);
</script>
Then, on form submit you can retrieve the value via $_POST['hash'] (set the form)
There is one caveat when you want to plot the histogram from a 2-d numpy array. You need to swap the 2 axes.
import numpy as np
import matplotlib.pyplot as plt
data = np.random.normal(size=(2, 300))
# swapped_data.shape == (300, 2)
swapped_data = np.swapaxes(x, axis1=0, axis2=1)
plt.hist(swapped_data, bins=30, label=['x', 'y'])
plt.legend()
plt.show()
JS Code:
function TodayDate(){
let data= new Date();
return data.getFullYear().toString()+'-' + (data.getMonth()+1).toString()+'-' + data.getDate().toString()
}
document.getElementById('today').innerHTML = '<input type="date" name="Data" value="'+TodayDate()+'" ><br>';
Html Code:
<div id="today" > </div>
A little bit rough but it works!
Salvaging (and extending) the list from an old version of the Wikipedia page:
Although the reference implementation of reStructuredText is written in Python, there are reStructuredText parsers in other languages too.
The main distribution of reStructuredText is the Python Docutils package. It contains several conversion tools:
Pandoc is a Haskell library for converting from one markup format to another, and a command-line tool that uses this library. It can read Markdown and (subsets of) reStructuredText, HTML, and LaTeX, and it can write Markdown, reStructuredText, HTML, LaTeX, ConTeXt, PDF, RTF, DocBook XML, OpenDocument XML, ODT, GNU Texinfo, MediaWiki markup, groff man pages, and S5 HTML slide shows.
There is an Pandoc online tool (POT) to try this library. Unfortunately, compared to the reStructuredText online renderer (ROR),
docutils
)JRst is a Java reStructuredText parser. It can currently output HTML, XHTML, DocBook xdoc and PDF, BUT seems to have serious problems: neither PDF or (X)HTML generation works using the current full download, result pages in (X)HTML are empty and PDF generation fails on IO problems with XSL files (not bundled??). Note that the original JRst has been removed from the website; a fork is found on GitHub.
Laika is a new library for transforming markup languages to other output formats. Currently it supports input from Markdown and reStructuredText and produce HTML output. The library is written in Scala but should be also usable from Java.
The Nim compiler features the commands rst2html
and rst2tex
which transform reStructuredText files to HTML and TeX files. The standard library provides the following modules (used by the compiler) to handle reStructuredText files programmatically:
Most (but not all) of these tools are based on Docutils (see above) and provide conversion to or from formats that might not be supported by the main distribution.
pip
-installable python package requires docutils
, which does the actual rendering. restview
's major ease-of-use feature is that, when you save changes to your document(s), it automagically re-renders and re-displays them. restview
docutils
to render your document(s) to HTMLSome projects use reStructuredText as a baseline to build on, or provide extra functionality extending the utility of the reStructuredText tools.
The Sphinx documentation generator translates a set of reStructuredText source files into various output formats, automatically producing cross-references, indices etc.
rest2web is a simple tool that lets you build your website from a single template (or as many as you want), and keep the contents in reStructuredText.
Pygments is a generic syntax highlighter for general use in all kinds of software such as forum systems, Wikis or other applications that need to prettify source code. See Using Pygments in reStructuredText documents.
While any plain text editor is suitable to write reStructuredText documents, some editors have better support than others.
The Emacs support via rst-mode comes as part of the Docutils package under /docutils/tools/editors/emacs/rst.el
The vim-common
package for that comes with most GNU/Linux distributions has reStructuredText syntax highlight and indentation support of reStructuredText out of the box:
There is a rst mode for the Jed programmers editor.
gedit, the official text editor of the GNOME desktop environment. There is a gedit reStructuredText plugin.
Geany, a small and lightweight Integrated Development Environment include support for reStructuredText from version 0.12 (October 10, 2007).
Leo, an outlining editor for programmers, supports reStructuredText via rst-plugin or via "@auto-rst" nodes (it's not well-documented, but @auto-rst nodes allow editing rst files directly, parsing the structure into the Leo outline).
It also provides a way to preview the resulting HTML, in a "viewrendered" pane.
The FTE Folding Text Editor - a free (licensed under the GNU GPL) text editor for developers. FTE has a mode for reStructuredText support. It provides color highlighting of basic RSTX elements and special menu that provide easy way to insert most popular RSTX elements to a document.
PyK is a successor of PyEdit and reStInPeace, written in Python with the help of the Qt4 toolkit.
The Eclipse IDE with the ReST Editor plug-in provides support for editing reStructuredText files.
NoTex is a browser based (general purpose) text editor, with integrated project management and syntax highlighting. Plus it enables to write books, reports, articles etc. using rST and convert them to LaTex, PDF or HTML. The PDF files are of high publication quality and are produced via Sphinx with the Texlive LaTex suite.
Notepad++ is a general purpose text editor for Windows. It has syntax highlighting for many languages built-in and support for reStructuredText via a user defined language for reStructuredText.
Visual Studio Code is a general purpose text editor for Windows/macOS/Linux. It has syntax highlighting for many languages built-in and supports reStructuredText via an extension from LeXtudio.
Sublime Text is a completely customizable and extensible source code editor available for Windows, OS X, and Linux. Registration is required for long-term use, but all functions are available in the unregistered version, with occasional reminders to purchase a license. Versions 2 and 3 (currently in beta) support reStructuredText syntax highlighting by default, and several plugins are available through the package manager Package Control to provide snippets and code completion, additional syntax highlighting, conversion to/from RST and other formats, and HTML preview in the browser.
BBEdit (and its free variant TextWrangler) for Mac can syntax-highlight reStructuredText using this codeless language module.
TextMate, a proprietary general-purpose GUI text editor for Mac OS X, has a bundle for reStructuredText.
Intype is a proprietary text editor for Windows, that support reStructuredText out of the box.
E is a proprietary Text Editor licensed under the "Open Company License". It supports TextMate's bundles, so it should support reStructuredText the same way TextMate does.
PyCharm (and other IntelliJ platform IDEs?) has ReST/Sphinx support (syntax highlighting, autocomplete and preview).)
here are some Wiki programs that support the reStructuredText markup as the native markup syntax, or as an add-on:
MediaWiki reStructuredText extension allows for reStructuredText markup in MediaWiki surrounded by <rst>
and </rst>
.
MoinMoin is an advanced, easy to use and extensible WikiEngine with a large community of users. Said in a few words, it is about collaboration on easily editable web pages.
There is a reStructuredText Parser for MoinMoin.
Trac is an enhanced wiki and issue tracking system for software development projects. There is a reStructuredText Support in Trac.
This Wiki is a Webware for Python Wiki written by Ian Bicking. This wiki uses ReStructuredText for its markup.
rstiki is a minimalist single-file personal wiki using reStructuredText syntax (via docutils) inspired by pwyky. It does not support authorship indication, versioning, hierarchy, chrome/framing/templating or styling. It leverages docutils/reStructuredText as the wiki syntax. As such, it's under 200 lines of code, and in a single file. You put it in a directory and it runs.
Ikiwiki is a wiki compiler. It converts wiki pages into HTML pages suitable for publishing on a website. Ikiwiki stores pages and history in a revision control system such as Subversion or Git. There are many other features, including support for blogging, as well as a large array of plugins. It's reStructuredText plugin, however is somewhat limited and is not recommended as its' main markup language at this time.
An Online reStructuredText editor can be used to play with the markup and see the results immediately.
WordPreSt reStructuredText plugin for WordPress. (PHP)
reStructuredText parser plugin for Zine (will become obsolete in version 0.2 when Zine is scheduled to get a native reStructuredText support). Zine is discontinued. (Python)
Pelican is a static blog generator that supports writing articles in ReST. (Python)
Hyde is a static website generator that supports ReST. (Python)
Acrylamid is a static blog generator that supports writing articles in ReST. (Python)
Nikola is a Static Site and Blog Generator that supports ReST. (Python)
Ipsum genera is a static blog generator written in Nim.
Yozuch is a static blog generator written in Python.
I went through a similar issue. If you consider your "YeagerTechResources.Resources", it means that your Resources.resx is at the root folder of your project.
Be careful to include the full path eg : "project\subfolder(s)\file[.resx]" to the ResourceManager constructor.
Alternatively, in plain text: (also available as a a screenshot)
Bracket Matching -. .- Line Numbering
Smart Indent -. | | .- UML Editing / Viewing
Source Control Integration -. | | | | .- Code Folding
Error Markup -. | | | | | | .- Code Templates
Integrated Python Debugging -. | | | | | | | | .- Unit Testing
Multi-Language Support -. | | | | | | | | | | .- GUI Designer (Qt, Eric, etc)
Auto Code Completion -. | | | | | | | | | | | | .- Integrated DB Support
Commercial/Free -. | | | | | | | | | | | | | | .- Refactoring
Cross Platform -. | | | | | | | | | | | | | | | |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Atom |Y |F |Y |Y*|Y |Y |Y |Y |Y |Y | |Y |Y | | | | |*many plugins
Editra |Y |F |Y |Y | | |Y |Y |Y |Y | |Y | | | | | |
Emacs |Y |F |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y | | | |
Eric Ide |Y |F |Y | |Y |Y | |Y | |Y | |Y | |Y | | | |
Geany |Y |F |Y*|Y | | | |Y |Y |Y | |Y | | | | | |*very limited
Gedit |Y |F |Y¹|Y | | | |Y |Y |Y | | |Y²| | | | |¹with plugin; ²sort of
Idle |Y |F |Y | |Y | | |Y |Y | | | | | | | | |
IntelliJ |Y |CF|Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |
JEdit |Y |F | |Y | | | | |Y |Y | |Y | | | | | |
KDevelop |Y |F |Y*|Y | | |Y |Y |Y |Y | |Y | | | | | |*no type inference
Komodo |Y |CF|Y |Y |Y |Y |Y |Y |Y |Y | |Y |Y |Y | |Y | |
NetBeans* |Y |F |Y |Y |Y | |Y |Y |Y |Y |Y |Y |Y |Y | | |Y |*pre-v7.0
Notepad++ |W |F |Y |Y | |Y*|Y*|Y*|Y |Y | |Y |Y*| | | | |*with plugin
Pfaide |W |C |Y |Y | | | |Y |Y |Y | |Y |Y | | | | |
PIDA |LW|F |Y |Y | | | |Y |Y |Y | |Y | | | | | |VIM based
PTVS |W |F |Y |Y |Y |Y |Y |Y |Y |Y | |Y | | |Y*| |Y |*WPF bsed
PyCharm |Y |CF|Y |Y*|Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |*JavaScript
PyDev (Eclipse) |Y |F |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y |Y | | | |
PyScripter |W |F |Y | |Y |Y | |Y |Y |Y | |Y |Y |Y | | | |
PythonWin |W |F |Y | |Y | | |Y |Y | | |Y | | | | | |
SciTE |Y |F¹| |Y | |Y | |Y |Y |Y | |Y |Y | | | | |¹Mac version is
ScriptDev |W |C |Y |Y |Y |Y | |Y |Y |Y | |Y |Y | | | | | commercial
Spyder |Y |F |Y | |Y |Y | |Y |Y |Y | | | | | | | |
Sublime Text |Y |CF|Y |Y | |Y |Y |Y |Y |Y | |Y |Y |Y*| | | |extensible w/Python,
TextMate |M |F | |Y | | |Y |Y |Y |Y | |Y |Y | | | | | *PythonTestRunner
UliPad |Y |F |Y |Y |Y | | |Y |Y | | | |Y |Y | | | |
Vim |Y |F |Y |Y |Y |Y |Y |Y |Y |Y | |Y |Y |Y | | | |
Visual Studio |W |CF|Y |Y |Y |Y |Y |Y |Y |Y |? |Y |? |? |Y |? |Y |
Visual Studio Code|Y |F |Y |Y |Y |Y |Y |Y |Y |Y |? |Y |? |? |? |? |Y |uses plugins
WingIde |Y |C |Y |Y*|Y |Y |Y |Y |Y |Y | |Y |Y |Y | | | |*support for C
Zeus |W |C | | | | |Y |Y |Y |Y | |Y |Y | | | | |
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
Cross Platform -' | | | | | | | | | | | | | | | |
Commercial/Free -' | | | | | | | | | | | | | | '- Refactoring
Auto Code Completion -' | | | | | | | | | | | | '- Integrated DB Support
Multi-Language Support -' | | | | | | | | | | '- GUI Designer (Qt, Eric, etc)
Integrated Python Debugging -' | | | | | | | | '- Unit Testing
Error Markup -' | | | | | | '- Code Templates
Source Control Integration -' | | | | '- Code Folding
Smart Indent -' | | '- UML Editing / Viewing
Bracket Matching -' '- Line Numbering
Acronyms used:
L - Linux
W - Windows
M - Mac
C - Commercial
F - Free
CF - Commercial with Free limited edition
? - To be confirmed
I don't mention basics like syntax highlighting as I expect these by default.
This is a just dry list reflecting your feedback and comments, I am not advocating any of these tools. I will keep updating this list as you keep posting your answers.
PS. Can you help me to add features of the above editors to the list (like auto-complete, debugging, etc.)?
We have a comprehensive wiki page for this question https://wiki.python.org/moin/IntegratedDevelopmentEnvironments
For Windows, here's a link to an example batch file that only allows changes to the log message (not other properties):
http://ayria.livejournal.com/33438.html
Basically copy the code below into a text file and name it pre-revprop-change.bat
and save it in the \hooks
subdirectory for your repository.
@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set revision=%2
set userName=%3
set propertyName=%4
set action=%5
:: Only allow the log message to be changed, but not author, etc.
if /I not "%propertyName%" == "svn:log" goto ERROR_PROPNAME
:: Only allow modification of a log message, not addition or deletion.
if /I not "%action%" == "M" goto ERROR_ACTION
:: Make sure that the new svn:log message is not empty.
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
set bIsEmpty=false
)
if "%bIsEmpty%" == "true" goto ERROR_EMPTY
goto :eof
:ERROR_EMPTY
echo Empty svn:log messages are not allowed. >&2
goto ERROR_EXIT
:ERROR_PROPNAME
echo Only changes to svn:log messages are allowed. >&2
goto ERROR_EXIT
:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT
:ERROR_EXIT
exit /b 1
If you need to format your strings using String.format(String, Object...), then you can do so by putting your format arguments in the string resource. For example, with the following resource:
<string name="welcome_messages">Hello, %1$s! You have %2$d new messages.</string>
In this example, the format string has two arguments: %1$s is a string and %2$d is a decimal number. You can format the string with arguments from your application like this:
Resources res = getResources(); String text = String.format(res.getString(R.string.welcome_messages), username, mailCount);
If you wish more look at: http://developer.android.com/intl/pt-br/guide/topics/resources/string-resource.html#FormattingAndStyling
Did you try list(x)??
y = '+123-456-7890'
c =list(y)
c
['+', '1', '2', '3', '-', '4', '5', '6', '-', '7', '8', '9', '0']
I simply do this:
UIWebView *webView = [[[UIWebView alloc] init] autorelease];
NSURL *url = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html"];
NSURLRequest* request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
Where "index.html" relatively references images, CSS, javascript, etc.
Another alternative:
Use the code from the unicodecsv package ...
https://pypi.python.org/pypi/unicodecsv/
>>> import unicodecsv as csv
>>> from io import BytesIO
>>> f = BytesIO()
>>> w = csv.writer(f, encoding='utf-8')
>>> _ = w.writerow((u'é', u'ñ'))
>>> _ = f.seek(0)
>>> r = csv.reader(f, encoding='utf-8')
>>> next(r) == [u'é', u'ñ']
True
This module is API compatible with the STDLIB csv module.
http://msdn.microsoft.com/en-us/library/ms173767.aspx
Business Intelligence Development Studio is Microsoft Visual Studio 2008 with additional project types that are specific to SQL Server business intelligence. Business Intelligence Development Studio is the primary environment that you will use to develop business solutions that include Analysis Services, Integration Services, and Reporting Services projects. Each project type supplies templates for creating the objects required for business intelligence solutions, and provides a variety of designers, tools, and wizards to work with the objects.
If you already have Visual Studio installed, the new project types will be installed along with SQL Server.
You could replace all spaces by an empty string, all comas by dots and then parse it.
var str = "110 000,23";
var num = parseFloat(str.replace(/\s/g, "").replace(",", "."));
console.log(num);
I used a regex in the first one to be able to match all spaces, not just the first one.
You could try using vw
for height.
https://developer.mozilla.org/en/docs/Web/CSS/length
Something like
div#map {
width: 100%;
height: 60vw;
}
This would set the width of the div to 60% of the viewport width. You will probably need to use calc to adjust to take padding into account …
Go back to Windows, tell Eclipse to change the encoding to UTF-8, then back to Unix and run d2u
on the files.
That's not possible using the built-in Array.prototype.map
. However, you could use a simple for
-loop instead, if you do not intend to map
any values:
var hasValueLessThanTen = false;
for (var i = 0; i < myArray.length; i++) {
if (myArray[i] < 10) {
hasValueLessThanTen = true;
break;
}
}
Or, as suggested by @RobW
, use Array.prototype.some
to test if there exists at least one element that is less than 10. It will stop looping when some element that matches your function is found:
var hasValueLessThanTen = myArray.some(function (val) {
return val < 10;
});
UNION ALL
once, aggregate once:
SELECT sum(hours) AS total_hours
FROM (
SELECT hours FROM resource
UNION ALL
SELECT hours FROM "projects-time" -- illegal name without quotes in most RDBMS
) x
To install mcrypt from http://namhuy.net/641/centos-6-install-mcrypt-for-phpmyadmin.html
i386
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
x86_64
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
then just use yum command to install the mcrypt package
yum install php-mcrypt
It could be that you are using gradle in offline mode.
To uncheck it go to File > Settings > Gradle
, uncheck the Offline Work
checkbox, and click Apply
Make sure you have internet connection and sync the project again.
There might be a lot of reasons behind the blank screen without errors. I have faced this problem many times whenever I want to upload laravel project in shared hosting.
Reason: Incorrect PHP Version
In my case, issue was because of incorrect php version. I had php 7.1 version in local computer where as in shared hosting cpanel, there was php 5.6 version. Switching up the version from 5.6 to 7.1 worked for me.
You can change php version in cpanel from multiphp manager available in cpanel home page.
to make your code look better when viewing source
$variable = 'foo';
echo "this is my php variable $variable \n";
echo "this is another php echo here $variable\n";
your code when view source will look like, with nice line returns thanks to \n
this is my php variable foo
this is another php echo here foo
There are few named constructors in GridView
for different scenarios,
Constructors
GridView
GridView.builder
GridView.count
GridView.custom
GridView.extent
Below is a example of GridView
constructor:
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: ExampleGrid(),
),
);
class ExampleGrid extends StatelessWidget {
List<String> images = [
"https://uae.microless.com/cdn/no_image.jpg",
"https://images-na.ssl-images-amazon.com/images/I/81aF3Ob-2KL._UX679_.jpg",
"https://www.boostmobile.com/content/dam/boostmobile/en/products/phones/apple/iphone-7/silver/device-front.png.transform/pdpCarousel/image.jpg",
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSgUgs8_kmuhScsx-J01d8fA1mhlCR5-1jyvMYxqCB8h3LCqcgl9Q",
"https://ae01.alicdn.com/kf/HTB11tA5aiAKL1JjSZFoq6ygCFXaw/Unlocked-Samsung-GALAXY-S2-I9100-Mobile-Phone-Android-Wi-Fi-GPS-8-0MP-camera-Core-4.jpg_640x640.jpg",
"https://media.ed.edmunds-media.com/gmc/sierra-3500hd/2018/td/2018_gmc_sierra-3500hd_f34_td_411183_1600.jpg",
"https://hips.hearstapps.com/amv-prod-cad-assets.s3.amazonaws.com/images/16q1/665019/2016-chevrolet-silverado-2500hd-high-country-diesel-test-review-car-and-driver-photo-665520-s-original.jpg",
"https://www.galeanasvandykedodge.net/assets/stock/ColorMatched_01/White/640/cc_2018DOV170002_01_640/cc_2018DOV170002_01_640_PSC.jpg",
"https://media.onthemarket.com/properties/6191869/797156548/composite.jpg",
"https://media.onthemarket.com/properties/6191840/797152761/composite.jpg",
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: GridView(
physics: BouncingScrollPhysics(), // if you want IOS bouncing effect, otherwise remove this line
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),//change the number as you want
children: images.map((url) {
return Card(child: Image.network(url));
}).toList(),
),
);
}
}
If you want your GridView items to be dynamic according to the content, you can few lines to do that but the simplest way to use StaggeredGridView
package. I have provided an answer with example here.
Below is an example for a GridView.count
:
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: ExampleGrid(),
),
);
class ExampleGrid extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: GridView.count(
crossAxisCount: 4,
children: List.generate(40, (index) {
return Card(
child: Image.network("https://robohash.org/$index"),
); //robohash.org api provide you different images for any number you are giving
}),
),
);
}
}
Screenshot for above snippet:
Example for a SliverGridView
:
import 'package:flutter/material.dart';
void main() => runApp(
MaterialApp(
home: ExampleGrid(),
),
);
class ExampleGrid extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
primary: false,
slivers: <Widget>[
SliverPadding(
padding: const EdgeInsets.all(20.0),
sliver: SliverGrid.count(
crossAxisSpacing: 10.0,
crossAxisCount: 2,
children: List.generate(20, (index) {
return Card(child: Image.network("https://robohash.org/$index"));
}),
),
),
],
)
);
}
}
$.getJSon expects a callback functions either you pass it to the callback function or in callback function assign it to global variale.
var globalJsonVar;
$.getJSON("http://127.0.0.1:8080/horizon-update", function(json){
//do some thing with json or assign global variable to incoming json.
globalJsonVar=json;
});
IMO best is to call the callback function. which is nicer to eyes, readability aspects.
$.getJSON("http://127.0.0.1:8080/horizon-update", callbackFuncWithData);
function callbackFuncWithData(data)
{
// do some thing with data
}
Try the outline property W3Schools - CSS Outline
Outline will not interfere with widths and lenghts of the elements/divs!
Please click the link I provided at the bottom to see working demos of the the different ways you can make borders, and inner/inline borders, even ones that do not disrupt the dimensions of the element! No need to add extra divs every time, as mentioned in another answer!
You can also combine borders with outlines, and if you like, box-shadows (also shown via link)
<head>
<style type="text/css" ref="stylesheet">
div {
width:22px;
height:22px;
outline:1px solid black;
}
</style>
</head>
<div>
outlined
</div>
Usually by default, 'border:' puts the border on the outside of the width, measurement, adding to the overall dimensions, unless you use the 'inset' value:
div {border: inset solid 1px black};
But 'outline:' is an extra border outside of the border, and of course still adds extra width/length to the element.
Hope this helps
PS: I also was inspired to make this for you : Using borders, outlines, and box-shadows
This is the best possible way that I have tried out. If it should help anyone...
+ (UIViewController*) topMostController
{
UIViewController *topController = [UIApplication sharedApplication].keyWindow.rootViewController;
while (topController.presentedViewController) {
topController = topController.presentedViewController;
}
return topController;
}
If you use Python 3.6 (possibly 3.5 or later), it doesn't give that error to me anymore. I had a similar issue, because I was using v3.4, but it went away after I uninstalled and reinstalled.
const ClassToggleFC= () =>{
const [isClass, setClass] = useState(false);
const toggle =() => {
setClass( prevState => !prevState)
}
return(
<>
<h1 className={ isClass ? "heading" : ""}> Hiii There </h1>
<button onClick={toggle}>Toggle</button>
</>
)
}
I simply created a Function Component. Inside I take a state and set initial value is false..
I have a button for toggling state..
Whenever we change state rerender component and if state value (isClass) is false h1's className should be "" and if state value (isClass) is true h1's className is "heading"
For modern browsers, use td:nth-child(2)
for the second td
, and td:nth-child(3)
for the third. Remember that these retrieve the second and third td
for every row.
If you need compatibility with IE older than version 9, use sibling combinators or JavaScript as suggested by Tim. Also see my answer to this related question for an explanation and illustration of his method.
If you have to remove the first few characters that are preceded by a special character like #
, this is a good one:
UPDATE tblInvalidID
SET [ColumnName] =stuff(ColumnName, 1, charindex('#', ColumnName), ' ')
use DATE
and CURDATE()
SELECT * FROM `table` WHERE DATE(`timestamp`) = CURDATE()
Warning! This query doesn't use an index efficiently. For the more efficient solution see the answer below
This expands on the answer by Denis Bubnov.
I used this to find child values of array elements—namely if there was a anchor field in paragraphs on a Drupal 8 site to build a table of contents.
{% set count = 0 %}
{% for anchor in items %}
{% if anchor.content['#paragraph'].field_anchor_link.0.value %}
{% set count = count + 1 %}
{% endif %}
{% endfor %}
{% if count > 0 %}
--- build the toc here --
{% endif %}
get_categories(number){
return this.http.post( url, body, {headers: headers, withCredentials:true})
.map(t=> {
this.total = t.json();
return total;
}).share();
);
}
then
this.get_category(1).subscribe(t=> {
this.callfunc();
});
First, Google created the "use less secure accounts method" function:
https://myaccount.google.com/security
Then created the another permission:
https://accounts.google.com/b/0/DisplayUnlockCaptcha
Hope it helps.
In systemd unit files you can set environment variables directory or through an EnvironmentFile
. I would propose doing things this way since it seems to be the least amount of friction.
$ cat /etc/systemd/system/hello-world.service
[Unit]
Description=Hello World Service
After=systend-user-sessions.service
[Service]
EnvironmentFile=/etc/sysconfig/hello-world
Type=simple
ExecStart=/usr/bin/java ... hello-world.jar
Then setup a file under /etc/sysconfig/hello-world
which includes uppercase names of your Spring Boot variables. For example, a variable called server.port
would follow the form SERVER_PORT
as an environment variable:
$ cat /etc/sysconfig/hello-world
SERVER_PORT=8081
The mechanism being exploited here is that Spring Boot applications will take the list of properties and then translate them, making everything uppercase, and replacing dots with underscores. Once the Spring Boot app goes through this process, it then looks for environment variables that match, and uses any found accordingly.
This is highlighted in more detail in this SO Q&A titled: How to set a Spring Boot property with an underscore in its name via Environment Variables?
In my case problem arose due to gradle version upgradation from 6.2 all to 6.6 all in gradle wrapper. So i wiped out data of avd and restarted it and then deleted .gradle folder in android/.gradle and then run yarn start --reset-cache and yarn android. Then it worked for me
One important issue with long polling is error handling. There are two types of errors:
The request might timeout in which case the client should reestablish the connection immediately. This is a normal event in long polling when no messages have arrived.
A network error or an execution error. This is an actual error which the client should gracefully accept and wait for the server to come back on-line.
The main issue is that if your error handler reestablishes the connection immediately also for a type 2 error, the clients would DOS the server.
Both answers with code sample miss this.
function longPoll() {
var shouldDelay = false;
$.ajax({
url: 'poll.php',
async: true, // by default, it's async, but...
dataType: 'json', // or the dataType you are working with
timeout: 10000, // IMPORTANT! this is a 10 seconds timeout
cache: false
}).done(function (data, textStatus, jqXHR) {
// do something with data...
}).fail(function (jqXHR, textStatus, errorThrown ) {
shouldDelay = textStatus !== "timeout";
}).always(function() {
// in case of network error. throttle otherwise we DOS ourselves. If it was a timeout, its normal operation. go again.
var delay = shouldDelay ? 10000: 0;
window.setTimeout(longPoll, delay);
});
}
longPoll(); //fire first handler
For saving Current time to firebase database I use Unic Epoch Conversation:
let timestamp = NSDate().timeIntervalSince1970
and For Decoding Unix Epoch time to Date().
let myTimeInterval = TimeInterval(timestamp)
let time = NSDate(timeIntervalSince1970: TimeInterval(myTimeInterval))
please, be sure your connected to a ubuntu server, I Had the same problem but I was connected to other distro, check the AMI value in your details instance, it should be something like
AMI: ubuntu/images/ebs/ubuntu-precise-12.04-amd64-server-20130411.1
hope it helps
Set the default password in the .pgpass file. If the server does not save the password, it is because it is not set in the .pgpass file, or the permissions are open and the file is therefore ignored.
Read more about the password file here.
Also, be sure to check the permissions: on *nix systems the permissions on .pgpass must disallow any access to world or group; achieve this by the command chmod 0600 ~/.pgpass. If the permissions are less strict than this, the file will be ignored.
Have you tried logging-in using PGAdmin? You can save the password there, and modify the pgpass file.
You could also consider to maven-dependency-plugin to your pom:
<plugins>
...
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
...
</plugins>
Than you can run "mvn package" and maven will copy all needed dependencies to your_project_path/target/your_project_name/WEB-INF/lib/ directory. From there you can copy them to your project/lib dir and add as external jars (configuring your project settings buildpath)
Form validation is very much straight forward in Angular 2
Here is an example,
<form (ngSubmit)="onSubmit()" #myForm="ngForm">
<div class="form-group">
<label for="firstname">First Name</label>
<input type="text" class="form-control" id="firstname"
required [(ngModel)]="firstname" name="firstname">
</div>
<div class="form-group">
<label for="middlename">Middle Name</label>
<input type="text" class="form-control" id="middlename"
[(ngModel)]="middlename" name="middlename">
</div>
<div class="form-group">
<label for="lastname">Last Name</label>
<input type="text" class="form-control" id="lastname"
required minlength = '2' maxlength="6" [(ngModel)] = "lastname" name="lastname">
</div>
<div class="form-group">
<label for="mobnumber">Mob Number</label>
<input type="text" class="form-control" id="mobnumber"
minlength = '2' maxlength="10" pattern="^[0-9()\-+\s]+$"
[(ngModel)] = "mobnumber" name="mobnumber">
</div>
<button type="submit" [disabled]="!myForm.form.valid">Submit</button>
</form>
Here's a way using the switch
statement:
df <- data.frame(name = c('cow','pig','eagle','pigeon'),
stringsAsFactors = FALSE)
df$type <- sapply(df$name, switch,
cow = 'animal',
pig = 'animal',
eagle = 'bird',
pigeon = 'bird')
> df
name type
1 cow animal
2 pig animal
3 eagle bird
4 pigeon bird
The one downside of this is that you have to keep writing the category name (animal
, etc) for each item. It is syntactically more convenient to be able to define our categories as below (see the very similar question How do add a column in a data frame in R )
myMap <- list(animal = c('cow', 'pig'), bird = c('eagle', 'pigeon'))
and we want to somehow "invert" this mapping. I write my own invMap function:
invMap <- function(map) {
items <- as.character( unlist(map) )
nams <- unlist(Map(rep, names(map), sapply(map, length)))
names(nams) <- items
nams
}
and then invert the above map as follows:
> invMap(myMap)
cow pig eagle pigeon
"animal" "animal" "bird" "bird"
And then it's easy to use this to add the type
column in the data-frame:
df <- transform(df, type = invMap(myMap)[name])
> df
name type
1 cow animal
2 pig animal
3 eagle bird
4 pigeon bird
Enumerator
includes Enumerable
. Since 2.1
, Enumerable
also has a method #to_h
. That's why, we can write :-
a = ["item 1", "item 2", "item 3", "item 4"]
a.each_slice(2).to_h
# => {"item 1"=>"item 2", "item 3"=>"item 4"}
Because #each_slice
without block gives us Enumerator
, and as per the above explanation, we can call the #to_h
method on the Enumerator
object.
I'm pretty sure C-style casting syntax works in Objective C, so try that, too:
int myInt = (int) myFloat;
It might silence a compiler warning, at least.
To check dataset is empty or not You have to check null and tables count.
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sqlString, sqlConn);
da.Fill(ds);
if(ds != null && ds.Tables.Count > 0)
{
// your code
}
It is rather messy but you need to do something like the following:
START "do something window" dir
FOR /F "tokens=2" %I in ('TASKLIST /NH /FI "WINDOWTITLE eq do something window"' ) DO SET PID=%I
ECHO %PID%
TASKKILL /PID %PID%
Found this on this page.
(This kind of thing is much easier if you have a UNIX / LINUX system ... or if you run Cygwin or similar on Windows.)
To add to the alternatives, using @akrun's sample data, I would do the following:
d1[] <- lapply(d1, function(x) {
x[is.na(x)] <- mean(x, na.rm = TRUE)
x
})
d1
There are 3 ways to do it:
A bit of overkill since you don't need a pool of Thread
//----------------------SCHEDULER-------------------------
private final ScheduledThreadPoolExecutor executor_ =
new ScheduledThreadPoolExecutor(1);
ScheduledFuture<?> schedulerFuture;
public void startScheduler() {
schedulerFuture= executor_.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
//DO YOUR THINGS
pageIndexSwitcher.setVisibility(View.GONE);
}
}, 0L, 5*MILLI_SEC, TimeUnit.MILLISECONDS);
}
public void stopScheduler() {
pageIndexSwitcher.setVisibility(View.VISIBLE);
schedulerFuture.cancel(false);
startScheduler();
}
Old Android Style
//----------------------TIMER TASK-------------------------
private Timer carousalTimer;
private void startTimer() {
carousalTimer = new Timer(); // At this line a new Thread will be created
carousalTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
//DO YOUR THINGS
pageIndexSwitcher.setVisibility(INVISIBLE);
}
}, 0, 5 * MILLI_SEC); // delay
}
void stopTimer() {
carousalTimer.cancel();
}
Modern Android Style
//----------------------HANDLER-------------------------
private Handler taskHandler = new android.os.Handler();
private Runnable repeatativeTaskRunnable = new Runnable() {
public void run() {
//DO YOUR THINGS
}
};
void startHandler() {
taskHandler.postDelayed(repeatativeTaskRunnable, 5 * MILLI_SEC);
}
void stopHandler() {
taskHandler.removeCallbacks(repeatativeTaskRunnable);
}
Non-Leaky Handler with Activity / Context
Declare an inner Handler class which does not leak Memory in your Activity/Fragment class
/**
* Instances of static inner classes do not hold an implicit
* reference to their outer class.
*/
private static class NonLeakyHandler extends Handler {
private final WeakReference<FlashActivity> mActivity;
public NonLeakyHandler(FlashActivity activity) {
mActivity = new WeakReference<FlashActivity>(activity);
}
@Override
public void handleMessage(Message msg) {
FlashActivity activity = mActivity.get();
if (activity != null) {
// ...
}
}
}
Declare a runnable which will perform your repetitive task in your Activity/Fragment class
private Runnable repeatativeTaskRunnable = new Runnable() {
public void run() {
new Handler(getMainLooper()).post(new Runnable() {
@Override
public void run() {
//DO YOUR THINGS
}
};
Initialize Handler object in your Activity/Fragment (here FlashActivity is my activity class)
//Task Handler
private Handler taskHandler = new NonLeakyHandler(FlashActivity.this);
To repeat a task after fix time interval
taskHandler.postDelayed(repeatativeTaskRunnable , DELAY_MILLIS);
To stop the repetition of task
taskHandler .removeCallbacks(repeatativeTaskRunnable );
//update interval for widget
override val UPDATE_INTERVAL = 1000L
//Handler to repeat update
private val updateWidgetHandler = Handler()
//runnable to update widget
private var updateWidgetRunnable: Runnable = Runnable {
run {
//Update UI
updateWidget()
// Re-run it after the update interval
updateWidgetHandler.postDelayed(updateWidgetRunnable, UPDATE_INTERVAL)
}
}
// SATART updating in foreground
override fun onResume() {
super.onResume()
updateWidgetHandler.postDelayed(updateWidgetRunnable, UPDATE_INTERVAL)
}
// REMOVE callback if app in background
override fun onPause() {
super.onPause()
updateWidgetHandler.removeCallbacks(updateWidgetRunnable);
}
Its a very old question but I think it will help newbies line me who are learning python. If you have Python 3.4 or above, the pathlib library comes with the default distribution.
To use it, you just pass a path or filename into a new Path() object using forward slashes and it handles the rest. To indicate that the path is a raw string, put r
in front of the string with your actual path.
For example,
from pathlib import Path
dataFolder = Path(r'D:\Desktop dump\example.txt')
Source: The easy way to deal with file paths on Windows, Mac and Linux
Yes you can target those specificaly using input[type=submit]
e.g.
.myFormClass input[type=submit] {
margin: 10px;
color: white;
background-color: blue;
}
Using Retrofit 2.0 you may use this:
@Multipart
@POST("uploadImage")
Call<ResponseBody> uploadImage(@Part("file\"; fileName=\"myFile.png\" ")RequestBody requestBodyFile, @Part("image") RequestBody requestBodyJson);
Make a request:
File imgFile = new File("YOUR IMAGE FILE PATH");
RequestBody requestBodyFile = RequestBody.create(MediaType.parse("image/*"), imgFile);
RequestBody requestBodyJson = RequestBody.create(MediaType.parse("text/plain"),
retrofitClient.getJsonObject(uploadRequest));
//make sync call
Call<ResponseBody> uploadBundle = uploadImpl.uploadImage(requestBodyFile, requestBodyJson);
Response<BaseResponse> response = uploadBundle.execute();
please refer https://square.github.io/retrofit/
As @Peter Cullen answer mention, your script will meet browser timeout first. So its good idea to provide some log output, then flush()
, but connection have buffer and you'll not see anything unless much output provided. Here are code snippet what helps provide reliable log:
set_time_limit(0);
...
print "log message";
print "<!--"; print str_repeat (' ', 4000); print "-->"; flush();
print "log message";
print "<!--"; print str_repeat (' ', 4000); print "-->"; flush();
nano ~/.profile
add these lines:
export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
save the file:
Ctrl + X
then Y
then Enter
then render the changes:
source ~/.profile
For those with a C++ background, you may be interested in a comparison with the C++ equivalent:
class S
{
private: // this is not quite true, in Ruby you can still access these
static int k = 23;
int s = 15;
public:
int get_s() { return s; }
static int get_k() { return k; }
};
std::cerr << S::k() << "\n";
S instance;
std::cerr << instance.s() << "\n";
std::cerr << instance.k() << "\n";
As we can see, k
is a static
like variable. This is 100% like a global variable, except that it's owned by the class (scoped to be correct). This makes it easier to avoid clashes between similarly named variables. Like any global variable, there is just one instance of that variable and modifying it is always visible by all.
On the other hand, s
is an object specific value. Each object has its own instance of the value. In C++, you must create an instance to have access to that variable. In Ruby, the class definition is itself an instance of the class (in JavaScript, this is called a prototype), therefore you can access s
from the class without additional instantiation. The class instance can be modified, but modification of s
is going to be specific to each instance (each object of type S
). So modifying one will not change the value in another.
If the Path is omitted the file will be saved automaticaly in the current directory. Try something like this:
ActiveWorkbook.SaveAs "Filename.xslx"
Use a relative layout and set the button the be align left of the edit text view, and set the left padding of your text view to the size of your button. I can't think of a good way to do it without hard coding the padding :/
You can also use apk tool to sorta unzip the facebook apk and take a look at its layout files.
It's incorrect syntax that causes MySQL to think you're trying to do something with a column or parameter that has the incorrect type "DOUBLE".
In my case I updated the varchar column in a table setting NULL
where the value 0
stood. My update query was like this:
UPDATE myTable SET myValue = NULL WHERE myValue = 0;
Now, since the actual type of myValue
is VARCHAR(255)
this gives the warning:
+---------+------+-----------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'value xyz' |
+---------+------+-----------------------------------------------+
And now myTable
is practically empty, because myValue
is now NULL
for EVERY ROW in the table! How did this happen?
*internal screaming*
Over 30k rows now have missing data.
*internal screaming intensifies*
Thank goodness for backups. I was able to recover all the data.
*internal screaming intensity lowers*
The corrected query is as follows:
UPDATE myTable SET myValue = NULL WHERE myValue = '0';
^^^
Quotation here!
I wish this was more than just a warning so it's less dangerous to forget those quotes.
*End internal screaming*
ORDER BY article_rating ASC , article_time DESC
DESC
at the end will sort by both columns descending. You have to specify ASC
if you want it otherwise
That solution will open up a new browser window without the normal features such as address bar and similar.
To implement a modal popup, I suggest you to take a look at jQuery and SimpleModal, which is really slick.
(Here are some simple demos using SimpleModal: http://www.ericmmartin.com/projects/simplemodal-demos/)
If you don't want to define a function before it's used, and defining it afterwards is impossible, what about defining it in some other module?
Technically you still define it first, but it's clean.
You could create a recursion like the following:
def foo():
bar()
def bar():
foo()
Python's functions are anonymous just like values are anonymous, yet they can be bound to a name.
In the above code, foo()
does not call a function with the name foo, it calls a function that happens to be bound to the name foo
at the point the call is made. It is possible to redefine foo
somewhere else, and bar
would then call the new function.
Your problem cannot be solved because it's like asking to get a variable which has not been declared.
The CONVERT
function helps.Check this:
declare @erro_event_timestamp as Timestamp;
set @erro_event_timestamp = CONVERT(Timestamp, '2020-07-06 05:19:44.380', 121);
The magic number 121 I found here: https://www.w3schools.com/SQL/func_sqlserver_convert.asp
Here's a more functional approach using Key-Value Coding:
@implementation NSArray (Additions)
- (instancetype)arrayByRemovingObject:(id)object {
return [self filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF != %@", object]];
}
@end
Pay super close attention to umerk44's solution above. getMimeTypeFromExtension
invokes guessMimeTypeTypeFromExtension
and is CASE SENSITIVE. I spent an afternoon on this then took a closer look - getMimeTypeFromExtension
will return NULL
if you pass it "JPG" whereas it will return "image/jpeg" if you pass it "jpg".
This is full degree image rotation code. I recommend you to check the below example app in the jsfiddle.
https://jsfiddle.net/casamia743/xqh48gno/
The process flow of this example app is
function init() {
...
image.onload = function() {
app.boundaryRad = Math.atan(image.width / image.height);
}
...
}
/**
* NOTE : When source rect is rotated at some rad or degrees,
* it's original width and height is no longer usable in the rendered page.
* So, calculate projected rect size, that each edge are sum of the
* width projection and height projection of the original rect.
*/
function calcProjectedRectSizeOfRotatedRect(size, rad) {
const { width, height } = size;
const rectProjectedWidth = Math.abs(width * Math.cos(rad)) + Math.abs(height * Math.sin(rad));
const rectProjectedHeight = Math.abs(width * Math.sin(rad)) + Math.abs(height * Math.cos(rad));
return { width: rectProjectedWidth, height: rectProjectedHeight };
}
/**
* @callback rotatedImageCallback
* @param {DOMString} dataURL - return value of canvas.toDataURL()
*/
/**
* @param {HTMLImageElement} image
* @param {object} angle
* @property {number} angle.degree
* @property {number} angle.rad
* @param {rotatedImageCallback} cb
*
*/
function getRotatedImage(image, angle, cb) {
const canvas = document.createElement('canvas');
const { degree, rad: _rad } = angle;
const rad = _rad || degree * Math.PI / 180 || 0;
debug('rad', rad);
const { width, height } = calcProjectedRectSizeOfRotatedRect(
{ width: image.width, height: image.height }, rad
);
debug('image size', image.width, image.height);
debug('projected size', width, height);
canvas.width = Math.ceil(width);
canvas.height = Math.ceil(height);
const ctx = canvas.getContext('2d');
ctx.save();
const sin_Height = image.height * Math.abs(Math.sin(rad))
const cos_Height = image.height * Math.abs(Math.cos(rad))
const cos_Width = image.width * Math.abs(Math.cos(rad))
const sin_Width = image.width * Math.abs(Math.sin(rad))
debug('sin_Height, cos_Width', sin_Height, cos_Width);
debug('cos_Height, sin_Width', cos_Height, sin_Width);
let xOrigin, yOrigin;
if (rad < app.boundaryRad) {
debug('case1');
xOrigin = Math.min(sin_Height, cos_Width);
yOrigin = 0;
} else if (rad < Math.PI / 2) {
debug('case2');
xOrigin = Math.max(sin_Height, cos_Width);
yOrigin = 0;
} else if (rad < Math.PI / 2 + app.boundaryRad) {
debug('case3');
xOrigin = width;
yOrigin = Math.min(cos_Height, sin_Width);
} else if (rad < Math.PI) {
debug('case4');
xOrigin = width;
yOrigin = Math.max(cos_Height, sin_Width);
} else if (rad < Math.PI + app.boundaryRad) {
debug('case5');
xOrigin = Math.max(sin_Height, cos_Width);
yOrigin = height;
} else if (rad < Math.PI / 2 * 3) {
debug('case6');
xOrigin = Math.min(sin_Height, cos_Width);
yOrigin = height;
} else if (rad < Math.PI / 2 * 3 + app.boundaryRad) {
debug('case7');
xOrigin = 0;
yOrigin = Math.max(cos_Height, sin_Width);
} else if (rad < Math.PI * 2) {
debug('case8');
xOrigin = 0;
yOrigin = Math.min(cos_Height, sin_Width);
}
debug('xOrigin, yOrigin', xOrigin, yOrigin)
ctx.translate(xOrigin, yOrigin)
ctx.rotate(rad);
ctx.drawImage(image, 0, 0);
if (DEBUG) drawMarker(ctx, 'red');
ctx.restore();
const dataURL = canvas.toDataURL('image/jpg');
cb(dataURL);
}
function render() {
getRotatedImage(app.image, {degree: app.degree}, renderResultImage)
}
"There are no safe means of assigning multiple recipients to a single mailto: link via HTML. There are safe, non-HTML, ways of assigning multiple recipients from a mailto: link."
http://www.sightspecific.com/~mosh/www_faq/multrec.html
For a quick fix to your problem, change your ;
to a comma ,
and eliminate the spaces between email addresses
<a href='mailto:[email protected],[email protected]'>Email Us</a>
Microsoft has a special note on this (https://msdn.microsoft.com/en-us/library/bb531344.aspx#BK_CRT):
The printf and scanf family of functions are now defined inline.
The definitions of all of the printf and scanf functions have been moved inline into stdio.h, conio.h, and other CRT headers. This is a breaking change that leads to a linker error (LNK2019, unresolved external symbol) for any programs that declared these functions locally without including the appropriate CRT headers. If possible, you should update the code to include the CRT headers (that is, add #include ) and the inline functions, but if you do not want to modify your code to include these header files, an alternative solution is to add an additional library to your linker input, legacy_stdio_definitions.lib.
To add this library to your linker input in the IDE, open the context menu for the project node, choose Properties, then in the Project Properties dialog box, choose Linker, and edit the Linker Input to add legacy_stdio_definitions.lib to the semi-colon-separated list.
If your project links with static libraries that were compiled with a release of Visual C++ earlier than 2015, the linker might report an unresolved external symbol. These errors might reference internal stdio definitions for _iob, _iob_func, or related imports for certain stdio functions in the form of __imp_*. Microsoft recommends that you recompile all static libraries with the latest version of the Visual C++ compiler and libraries when you upgrade a project. If the library is a third-party library for which source is not available, you should either request an updated binary from the third party or encapsulate your usage of that library into a separate DLL that you compile with the older version of the Visual C++ compiler and libraries.
Why don't you style it out:
<canvas id="canvas" width="800" height="600" style="background: url('./images/image.jpg')">
Your browser does not support the canvas element.
</canvas>
<embed ... autostart="0">
Replace false with 0
There is Firebug Lite which gives a lot of Firebug functionality in IE.
Tell the option element to be 13pt
select option{
font-size: 13pt;
}
and then the first option element to be 7pt
select option:first-child {
font-size: 7pt;
}
Running demo: http://jsfiddle.net/VggvD/1/
__VA_ARGS__
is the standard way to do it. Don't use compiler-specific hacks if you don't have to.
I'm really annoyed that I can't comment on the original post. In any case, C++ is not a superset of C. It is really silly to compile your C code with a C++ compiler. Don't do what Donny Don't does.
I've tested this using the following powershell script and using (,) between the addresses. It worked for me!
$EmailFrom = "<[email protected]>";
$EmailPassword = "<password>";
$EmailTo = "<[email protected]>,<[email protected]>";
$SMTPServer = "<smtp.server.com>";
$SMTPPort = <port>;
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer,$SMTPPort);
$SMTPClient.EnableSsl = $true;
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential($EmailFrom, $EmailPassword);
$Subject = "Notification from XYZ";
$Body = "this is a notification from XYZ Notifications..";
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body);
You can determine if as certain word is found in a cell by using
If InStr(cell.Value, "Word1") > 0 Then
If Word1 is found in the string the InStr()
function will return the location of the first character of Word1 in the string.
Inserting data into the middle of a text file is not a simple task. If possible, you should append it to the end of your file.
The easiest way to append data some text file is to use build-in fs.appendFile(filename, data[, options], callback)
function from fs
module:
var fs = require('fs')
fs.appendFile('log.txt', 'new data', function (err) {
if (err) {
// append failed
} else {
// done
}
})
But if you want to write data to log file several times, then it'll be best to use fs.createWriteStream(path[, options])
function instead:
var fs = require('fs')
var logger = fs.createWriteStream('log.txt', {
flags: 'a' // 'a' means appending (old data will be preserved)
})
logger.write('some data') // append string to your file
logger.write('more data') // again
logger.write('and more') // again
Node will keep appending new data to your file every time you'll call .write
, until your application will be closed, or until you'll manually close the stream calling .end
:
logger.end() // close string
One solution is to use a background image centered within an element sized to the cropped dimensions.
.center-cropped {_x000D_
width: 100px;_x000D_
height: 100px;_x000D_
background-position: center center;_x000D_
background-repeat: no-repeat;_x000D_
}
_x000D_
<div class="center-cropped" _x000D_
style="background-image: url('http://placehold.it/200x200');">_x000D_
</div>
_x000D_
img
tagThis version retains the img
tag so that we do not lose the ability to drag or right-click to save the image. Credit to Parker Bennett for the opacity trick.
.center-cropped {_x000D_
width: 100px;_x000D_
height: 100px;_x000D_
background-position: center center;_x000D_
background-repeat: no-repeat;_x000D_
overflow: hidden;_x000D_
}_x000D_
_x000D_
/* Set the image to fill its parent and make transparent */_x000D_
.center-cropped img {_x000D_
min-height: 100%;_x000D_
min-width: 100%;_x000D_
/* IE 8 */_x000D_
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";_x000D_
/* IE 5-7 */_x000D_
filter: alpha(opacity=0);_x000D_
/* modern browsers */_x000D_
opacity: 0;_x000D_
}
_x000D_
<div class="center-cropped" _x000D_
style="background-image: url('http://placehold.it/200x200');">_x000D_
<img src="http://placehold.it/200x200" />_x000D_
</div>
_x000D_
object-fit
/-position
The CSS3 Images specification defines the object-fit
and object-position
properties which together allow for greater control over the scale and position of the image content of an img
element. With these, it will be possible to achieve the desired effect:
.center-cropped {_x000D_
object-fit: none; /* Do not scale the image */_x000D_
object-position: center; /* Center the image within the element */_x000D_
height: 100px;_x000D_
width: 100px;_x000D_
}
_x000D_
<img class="center-cropped" src="http://placehold.it/200x200" />
_x000D_
Here is another site that will help you with all the code you need as long as you have a correctly formated JSON string available:
This worked for me . In my case 2 tables foo and boo have to be joined based on 3 different columns.Please note in my case ,in boo the 3 common columns are not primary key
i.e., one to one mapping based on 3 different columns
@Entity
@Table(name = "foo")
public class foo implements Serializable
{
@Column(name="foocol1")
private String foocol1;
//add getter setter
@Column(name="foocol2")
private String foocol2;
//add getter setter
@Column(name="foocol3")
private String foocol3;
//add getter setter
private Boo boo;
private int id;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "brsitem_id", updatable = false)
public int getId()
{
return this.id;
}
public void setId(int id)
{
this.id = id;
}
@OneToOne
@JoinColumns(
{
@JoinColumn(updatable=false,insertable=false, name="foocol1", referencedColumnName="boocol1"),
@JoinColumn(updatable=false,insertable=false, name="foocol2", referencedColumnName="boocol2"),
@JoinColumn(updatable=false,insertable=false, name="foocol3", referencedColumnName="boocol3")
}
)
public Boo getBoo()
{
return boo;
}
public void setBoo(Boo boo)
{
this.boo = boo;
}
}
@Entity
@Table(name = "boo")
public class Boo implements Serializable
{
private int id;
@Column(name="boocol1")
private String boocol1;
//add getter setter
@Column(name="boocol2")
private String boocol2;
//add getter setter
@Column(name="boocol3")
private String boocol3;
//add getter setter
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "item_id", updatable = false)
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
}
To clean up some mess, trap
can be used. It can provide a list of stuff executed when a specific signal arrives:
trap "echo hello" SIGINT
but can also be used to execute something if the shell exits:
trap "killall background" EXIT
It's a builtin, so help trap
will give you information (works with bash). If you only want to kill background jobs, you can do
trap 'kill $(jobs -p)' EXIT
Watch out to use single '
, to prevent the shell from substituting the $()
immediately.
You can use dateutil.rrule:
In [1]: from dateutil.rrule import *
In [2]: rrule(DAILY, bymonthday=1)[0].date()
Out[2]: datetime.date(2018, 10, 1)
In [3]: rrule(DAILY, bymonthday=1)[1].date()
Out[3]: datetime.date(2018, 11, 1)
Code coverage is a measurement of how many lines/blocks/arcs of your code are executed while the automated tests are running.
Code coverage is collected by using a specialized tool to instrument the binaries to add tracing calls and run a full set of automated tests against the instrumented product. A good tool will give you not only the percentage of the code that is executed, but also will allow you to drill into the data and see exactly which lines of code were executed during a particular test.
Our team uses Magellan - an in-house set of code coverage tools. If you are a .NET shop, Visual Studio has integrated tools to collect code coverage. You can also roll some custom tools, like this article describes.
If you are a C++ shop, Intel has some tools that run for Windows and Linux, though I haven't used them. I've also heard there's the gcov tool for GCC, but I don't know anything about it and can't give you a link.
As to how we use it - code coverage is one of our exit criteria for each milestone. We have actually three code coverage metrics - coverage from unit tests (from the development team), scenario tests (from the test team) and combined coverage.
BTW, while code coverage is a good metric of how much testing you are doing, it is not necessarily a good metric of how well you are testing your product. There are other metrics you should use along with code coverage to ensure the quality.
Padding is a way to add kind of a margin inside the Div.
Just Use
div { padding-left: 20px; }
And to mantain the size, you would have to -20px from the original width of the Div.
I had the same error statement following a "Failed to access resource" error message:
Command
#cat callflow-java-logger-1.log.0
Output
Dec 09, 2015 8:09:03 AM org.apache.catalina.loader.WebappLoader startInternal
SEVERE: LifecycleException
java.io.IOException: Failed to access resource /WEB-INF/lib/ojdbc14.jar
In my case the solution was changing the connector permissions
-rw------- 1 owner creator size date ojdbc14.jar
This file in question wasn't initially located at /WEB-INF/lib, which was probably due to how BIRT works. It can be tricky if you are dealing with a higher number of files.
I had a similar problem on Internet Explorer, and got the same error number. The culprit was an HTML comment. I know it sounds unbelievable, so here is the story.
I saw a series of 6 articles on the Internet. I liked them, so I decided to download the 6 Web-Pages and store them on my Hard Drive. At the top of each page, was a couple of HTML <a>
Tags, that would allow you to go to the next article or the previous article. So I changed the href attribute to point to the next folder on my Hard Drive, instead of the next URL on the Internet.
After all of the links had been re-directed, the Browser refused to display any of the Web-Pages when I clicked on the Links. The message in the Console was the Error Number that was mentioned at the top of this page.
However, the real problem was a Comment. Whenever you download a Web-Page using Google Chrome, the Chrome Browser inserts a Comment at the very top of the page that includes the URL of the location that you got the Web-Page from. After I removed the Comment at the top of each one of the 6 Pages, all of the Links worked fine ( although I continued to get the same Error Message in the Console. )
Please have a look at http://jsfiddle.net/2dJAN/59/
$("#submit").click(function () {
var url = $(location).attr('href');
$('#spn_url').html('<strong>' + url + '</strong>');
});
I had the same issue for my angular project, then I make it work in Chrome by changing the setting. Go to Chrome setting -->site setting -->Insecure content --> click add button of allow, then add your domain name [*.]XXXX.biz
Now problem will be solved.
If you are looking for something easier:
public MyTextView extends TextView{
public void resize(String text, float textViewWidth, float textViewHeight) {
Paint p = new Paint();
Rect bounds = new Rect();
p.setTextSize(1);
p.getTextBounds(text, 0, text.length(), bounds);
float widthDifference = (textViewWidth)/bounds.width();
float heightDifference = (textViewHeight);
textSize = Math.min(widthDifference, heightDifference);
setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
}
Below, I have written an answer for n
equals to 5, but you can apply same approach to draw DFAs for any value of n
and 'any positional number system' e.g binary, ternary...
First lean the term 'Complete DFA', A DFA defined on complete domain in d:Q × S?Q is called 'Complete DFA'. In other words we can say; in transition diagram of complete DFA there is no missing edge (e.g. from each state in Q there is one outgoing edge present for every language symbol in S). Note: Sometime we define partial DFA as d ? Q × S?Q (Read: How does “d:Q × S?Q” read in the definition of a DFA).
Step-1: When you divide a number ? by n
then reminder can be either 0, 1, ..., (n - 2) or (n - 1). If remainder is 0
that means ? is divisible by n
otherwise not. So, in my DFA there will be a state qr that would be corresponding to a remainder value r
, where 0 <= r <= (n - 1)
, and total number of states in DFA is n
.
After processing a number string ? over S, the end state is qr implies that ? % n => r (% reminder operator).
In any automata, the purpose of a state is like memory element. A state in an atomata stores some information like fan's switch that can tell whether the fan is in 'off' or in 'on' state. For n = 5, five states in DFA corresponding to five reminder information as follows:
Using above information, we can start drawing transition diagram TD of five states as follows:
Figure-1
So, 5 states for 5 remainder values. After processing a string ? if end-state becomes q0 that means decimal equivalent of input string is divisible by 5. In above figure q0 is marked final state as two concentric circle.
Additionally, I have defined a transition rule d:(q0, 0)?q0 as a self loop for symbol '0'
at state q0, this is because decimal equivalent of any string consist of only '0'
is 0 and 0 is a divisible by n
.
Step-2: TD above is incomplete; and can only process strings of '0'
s. Now add some more edges so that it can process subsequent number's strings. Check table below, shows new transition rules those can be added next step:
+-------------------------------------+ ¦Number¦Binary¦Remainder(%5)¦End-state¦ +------+------+-------------+---------¦ ¦One ¦1 ¦1 ¦q1 ¦ +------+------+-------------+---------¦ ¦Two ¦10 ¦2 ¦q2 ¦ +------+------+-------------+---------¦ ¦Three ¦11 ¦3 ¦q3 ¦ +------+------+-------------+---------¦ ¦Four ¦100 ¦4 ¦q4 ¦ +-------------------------------------+
'1'
there should be a transition rule d:(q0, 1)?q1 '10'
, end-state should be q2, and to process '10'
, we just need to add one more transition rule d:(q1, 0)?q2'11'
, end-state is q3, and we need to add a transition rule d:(q1, 1)?q3'100'
, end-state is q4. TD already processes prefix string '10'
and we just need to add a new transition rule d:(q2, 0)?q4Figure-2
Step-3: Five = 101
Above transition diagram in figure-2 is still incomplete and there are many missing edges, for an example no transition is defined for d:(q2, 1)-?. And the rule should be present to process strings like '101'
.
Because '101'
= 5 is divisible by 5, and to accept '101'
I will add d:(q2, 1)?q0 in above figure-2.
Path: ?(q0)-1?(q1)-0?(q2)-1?(q0)
with this new rule, transition diagram becomes as follows:
Figure-3
Below in each step I pick next subsequent binary number to add a missing edge until I get TD as a 'complete DFA'.
Step-4: Six = 110.
We can process '11'
in present TD in figure-3 as: ?(q0)-11?(q3) -0?(?). Because 6 % 5 = 1 this means to add one rule d:(q3, 0)?q1.
Figure-4
Step-5: Seven = 111
+--------------------------------------------------------------+ ¦Number¦Binary¦Remainder(%5)¦End-state¦ Path ¦ Add ¦ +------+------+-------------+---------+------------+-----------¦ ¦Seven ¦111 ¦7 % 5 = 2 ¦q2 ¦ q0-11?q3 ¦ q3-1?q2 ¦ +--------------------------------------------------------------+
Figure-5
Step-6: Eight = 1000
+----------------------------------------------------------+ ¦Number¦Binary¦Remainder(%5)¦End-state¦ Path ¦ Add ¦ +------+------+-------------+---------+----------+---------¦ ¦Eight ¦1000 ¦8 % 5 = 3 ¦q3 ¦q0-100?q4 ¦ q4-0?q3 ¦ +----------------------------------------------------------+
Figure-6
Step-7: Nine = 1001
+----------------------------------------------------------+ ¦Number¦Binary¦Remainder(%5)¦End-state¦ Path ¦ Add ¦ +------+------+-------------+---------+----------+---------¦ ¦Nine ¦1001 ¦9 % 5 = 4 ¦q4 ¦q0-100?q4 ¦ q4-1?q4 ¦ +----------------------------------------------------------+
Figure-7
In TD-7, total number of edges are 10 == Q × S = 5 × 2. And it is a complete DFA that can accept all possible binary strings those decimal equivalent is divisible by 5.
Step-1 Exactly same as for binary, use figure-1.
Step-2 Add Zero, One, Two
+------------------------------------------------------+ ¦Decimal¦Ternary¦Remainder(%5)¦End-state¦ Add ¦ +-------+-------+-------------+---------+--------------¦ ¦Zero ¦0 ¦0 ¦q0 ¦ d:(q0,0)?q0 ¦ +-------+-------+-------------+---------+--------------¦ ¦One ¦1 ¦1 ¦q1 ¦ d:(q0,1)?q1 ¦ +-------+-------+-------------+---------+--------------¦ ¦Two ¦2 ¦2 ¦q2 ¦ d:(q0,2)?q3 ¦ +------------------------------------------------------+
Figure-8
Step-3 Add Three, Four, Five
+-----------------------------------------------------+ ¦Decimal¦Ternary¦Remainder(%5)¦End-state¦ Add ¦ +-------+-------+-------------+---------+-------------¦ ¦Three ¦10 ¦3 ¦q3 ¦ d:(q1,0)?q3 ¦ +-------+-------+-------------+---------+-------------¦ ¦Four ¦11 ¦4 ¦q4 ¦ d:(q1,1)?q4 ¦ +-------+-------+-------------+---------+-------------¦ ¦Five ¦12 ¦0 ¦q0 ¦ d:(q1,2)?q0 ¦ +-----------------------------------------------------+
Figure-9
Step-4 Add Six, Seven, Eight
+-----------------------------------------------------+ ¦Decimal¦Ternary¦Remainder(%5)¦End-state¦ Add ¦ +-------+-------+-------------+---------+-------------¦ ¦Six ¦20 ¦1 ¦q1 ¦ d:(q2,0)?q1 ¦ +-------+-------+-------------+---------+-------------¦ ¦Seven ¦21 ¦2 ¦q2 ¦ d:(q2,1)?q2 ¦ +-------+-------+-------------+---------+-------------¦ ¦Eight ¦22 ¦3 ¦q3 ¦ d:(q2,2)?q3 ¦ +-----------------------------------------------------+
Figure-10
Step-5 Add Nine, Ten, Eleven
+-----------------------------------------------------+ ¦Decimal¦Ternary¦Remainder(%5)¦End-state¦ Add ¦ +-------+-------+-------------+---------+-------------¦ ¦Nine ¦100 ¦4 ¦q4 ¦ d:(q3,0)?q4 ¦ +-------+-------+-------------+---------+-------------¦ ¦Ten ¦101 ¦0 ¦q0 ¦ d:(q3,1)?q0 ¦ +-------+-------+-------------+---------+-------------¦ ¦Eleven ¦102 ¦1 ¦q1 ¦ d:(q3,2)?q1 ¦ +-----------------------------------------------------+
Figure-11
Step-6 Add Twelve, Thirteen, Fourteen
+------------------------------------------------------+ ¦Decimal ¦Ternary¦Remainder(%5)¦End-state¦ Add ¦ +--------+-------+-------------+---------+-------------¦ ¦Twelve ¦110 ¦2 ¦q2 ¦ d:(q4,0)?q2 ¦ +--------+-------+-------------+---------+-------------¦ ¦Thirteen¦111 ¦3 ¦q3 ¦ d:(q4,1)?q3 ¦ +--------+-------+-------------+---------+-------------¦ ¦Fourteen¦112 ¦4 ¦q4 ¦ d:(q4,2)?q4 ¦ +------------------------------------------------------+
Figure-12
Total number of edges in transition diagram figure-12 are 15 = Q × S = 5 * 3 (a complete DFA). And this DFA can accept all strings consist over {0, 1, 2} those decimal equivalent is divisible by 5.
If you notice at each step, in table there are three entries because at each step I add all possible outgoing edge from a state to make a complete DFA (and I add an edge so that qr state gets for remainder is r
)!
To add further, remember union of two regular languages are also a regular. If you need to design a DFA that accepts binary strings those decimal equivalent is either divisible by 3 or 5, then draw two separate DFAs for divisible by 3 and 5 then union both DFAs to construct target DFA (for 1 <= n <= 10 your have to union 10 DFAs).
If you are asked to draw DFA that accepts binary strings such that decimal equivalent is divisible by 5 and 3 both then you are looking for DFA of divisible by 15 ( but what about 6 and 8?).
Note: DFAs drawn with this technique will be minimized DFA only when there is no common factor between number n
and base e.g. there is no between 5 and 2 in first example, or between 5 and 3 in second example, hence both DFAs constructed above are minimized DFAs. If you are interested to read further about possible mini states for number n
and base b
read paper: Divisibility and State Complexity.
below I have added a Python script, I written it for fun while learning Python library pygraphviz. I am adding it I hope it can be helpful for someone in someway.
So we can apply above trick to draw DFA to recognize number strings in any base 'b'
those are divisible a given number 'n'
. In that DFA total number of states will be n
(for n
remainders) and number of edges should be equal to 'b' * 'n' — that is complete DFA: 'b' = number of symbols in language of DFA and 'n' = number of states.
Using above trick, below I have written a Python Script to Draw DFA for input base
and number
. In script, function divided_by_N
populates DFA's transition rules in base * number
steps. In each step-num, I convert num
into number string num_s
using function baseN()
. To avoid processing each number string, I have used a temporary data-structure lookup_table
. In each step, end-state for number string num_s
is evaluated and stored in lookup_table
to use in next step.
For transition graph of DFA, I have written a function draw_transition_graph
using Pygraphviz library (very easy to use). To use this script you need to install graphviz
. To add colorful edges in transition diagram, I randomly generates color codes for each symbol get_color_dict
function.
#!/usr/bin/env python
import pygraphviz as pgv
from pprint import pprint
from random import choice as rchoice
def baseN(n, b, syms="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
""" converts a number `n` into base `b` string """
return ((n == 0) and syms[0]) or (
baseN(n//b, b, syms).lstrip(syms[0]) + syms[n % b])
def divided_by_N(number, base):
"""
constructs DFA that accepts given `base` number strings
those are divisible by a given `number`
"""
ACCEPTING_STATE = START_STATE = '0'
SYMBOL_0 = '0'
dfa = {
str(from_state): {
str(symbol): 'to_state' for symbol in range(base)
}
for from_state in range(number)
}
dfa[START_STATE][SYMBOL_0] = ACCEPTING_STATE
# `lookup_table` keeps track: 'number string' -->[dfa]--> 'end_state'
lookup_table = { SYMBOL_0: ACCEPTING_STATE }.setdefault
for num in range(number * base):
end_state = str(num % number)
num_s = baseN(num, base)
before_end_state = lookup_table(num_s[:-1], START_STATE)
dfa[before_end_state][num_s[-1]] = end_state
lookup_table(num_s, end_state)
return dfa
def symcolrhexcodes(symbols):
"""
returns dict of color codes mapped with alphabets symbol in symbols
"""
return {
symbol: '#'+''.join([
rchoice("8A6C2B590D1F4E37") for _ in "FFFFFF"
])
for symbol in symbols
}
def draw_transition_graph(dfa, filename="filename"):
ACCEPTING_STATE = START_STATE = '0'
colors = symcolrhexcodes(dfa[START_STATE].keys())
# draw transition graph
tg = pgv.AGraph(strict=False, directed=True, decorate=True)
for from_state in dfa:
for symbol, to_state in dfa[from_state].iteritems():
tg.add_edge("Q%s"%from_state, "Q%s"%to_state,
label=symbol, color=colors[symbol],
fontcolor=colors[symbol])
# add intial edge from an invisible node!
tg.add_node('null', shape='plaintext', label='start')
tg.add_edge('null', "Q%s"%START_STATE,)
# make end acception state as 'doublecircle'
tg.get_node("Q%s"%ACCEPTING_STATE).attr['shape'] = 'doublecircle'
tg.draw(filename, prog='circo')
tg.close()
def print_transition_table(dfa):
print("DFA accepting number string in base '%(base)s' "
"those are divisible by '%(number)s':" % {
'base': len(dfa['0']),
'number': len(dfa),})
pprint(dfa)
if __name__ == "__main__":
number = input ("Enter NUMBER: ")
base = input ("Enter BASE of number system: ")
dfa = divided_by_N(number, base)
print_transition_table(dfa)
draw_transition_graph(dfa)
Execute it:
~/study/divide-5/script$ python script.py
Enter NUMBER: 5
Enter BASE of number system: 4
DFA accepting number string in base '4' those are divisible by '5':
{'0': {'0': '0', '1': '1', '2': '2', '3': '3'},
'1': {'0': '4', '1': '0', '2': '1', '3': '2'},
'2': {'0': '3', '1': '4', '2': '0', '3': '1'},
'3': {'0': '2', '1': '3', '2': '4', '3': '0'},
'4': {'0': '1', '1': '2', '2': '3', '3': '4'}}
~/study/divide-5/script$ ls
script.py filename.png
~/study/divide-5/script$ display filename
Output:
DFA accepting number strings in base 4 those are divisible by 5
Similarly, enter base = 4 and number = 7 to generate - dfa accepting number string in base '4' those are divisible by '7'
Btw, try changing filename
to .png
or .jpeg
.
References those I use to write this script:
➊ Function baseN
from "convert integer to a string in a given numeric base in python"
➋ To install "pygraphviz": "Python does not see pygraphviz"
➌ To learn use of Pygraphviz: "Python-FSM"
➍ To generate random hex color codes for each language symbol: "How would I make a random hexdigit code generator using .join and for loops?"
Here is a new solution you can try. Works well for me. In the event handler for the changed event programmatically remove the handler from the designer output a message if desired then programmatically add the handler back. example:
public void fileSystemWatcher1_Changed( object sender, System.IO.FileSystemEventArgs e )
{
fileSystemWatcher1.Changed -= new System.IO.FileSystemEventHandler( fileSystemWatcher1_Changed );
MessageBox.Show( "File has been uploaded to destination", "Success!" );
fileSystemWatcher1.Changed += new System.IO.FileSystemEventHandler( fileSystemWatcher1_Changed );
}
Reusable invalidate
function which works with setInterval
:
var myFunc = function (){
if (invalidate(arguments)) return;
console.log('called once and never again!'); // your stuff here
};
const invalidate = function(a) {
var fired = a.callee.fired;
a.callee.fired = true;
return fired;
}
setInterval(myFunc, 1000);
Try it on JSBin: https://jsbin.com/vicipar/edit?js,console
Variation of answer from Bunyk
Just in case someone is wondering why the original poster's solution is not working:
var str = "I have a cat, a dog, and a goat.";
str = str.replace(/cat/gi, "dog");
// now str = "I have a dog, a dog, and a goat."
str = str.replace(/dog/gi, "goat");
// now str = "I have a goat, a goat, and a goat."
str = str.replace(/goat/gi, "cat");
// now str = "I have a cat, a cat, and a cat."
Having the same problem (with jQuery " done..." strings), but only in Notepad++, I asked, received good friendly replies (that made me understand what I had missed), then spent the time to build a detailed step-by-step explanation, see Finding Line Beginning using Regular expression in Notepad++
Versailles, Tue 27 Apr 2010 22:53:25 +0200
PRINT DATEDIFF(DAY, '1/1/2011', '3/1/2011')
will give you what you're after.
This gives the number of times the midnight boundary is crossed between the two dates. You may decide to need to add one to this if you're including both dates in the count - or subtract one if you don't want to include either date.
you can use the zenity to displays the query output as html table.
first implement bash script with following code:
cat > '/tmp/sql.op'; zenity --text-info --html --filename='/tmp/sql.op';
save it like mypager.sh
Then export the environment variable PAGER by set full path of the script as value.
for example:- export PAGER='/path/mypager.sh'
Then login to the psql program then execute the command \H
And finally execute any query,the tabled output will displayed in the zenity in html table format.
This is a bit of a work around, but one way you can achieve this is by adding a breakpoint at the start of the javascript file or block you want to manipulate.
Then when you reload, the debugger will pause on that breakpoint, and you can make any changes you want to the source, save the file and then run the debugger through the modified code.
But as everyone has said, next reload the changes will be gone - at least it let's you run some slightly modified JS client side.
In c#, View.BringSubviewToFront(childView); YourView.Layer.ZPosition = 1; both should work.
In the java project, open .settings folder. there locate the file named "org.eclipse.wst.common.component" . Change tag <wb-module deploy-name="NEW_NAME"> .
Also you may want to change context root in project properties
It is much simpler, no need for anything additional. In my example I declare variable "open" and then use it.
<mat-accordion class="accord-align" #open>
<mat-expansion-panel hideToggle="true" (opened)="open.value=true" (closed)="open.value=false">
<mat-expansion-panel-header>
<span class="accord-title">Review Policy Summary</span>
<span class="spacer"></span>
<a *ngIf="!open.value" class="f-accent">SHOW</a>
<a *ngIf="open.value" class="f-accent">HIDE</a>
</mat-expansion-panel-header>
<mat-divider></mat-divider>
<!-- Quote Details Component -->
<quote-details [quote]="quote"></quote-details>
</mat-expansion-panel>
</mat-accordion>
Or you can simply use PRINT
command instead of SELECT
command. Try this,
PRINT dbo.fn_HomePageSlider(9, 3025)
The geocoder has quota and rate limits. From experience, you can geocode ~10 locations without hitting the query limit (the actual number probably depends on server loading). The best solution is to delay when you get OVER_QUERY_LIMIT errors, then retry. See these similar posts:
The difference between test, [ and [[ is explained in great details in the BashFAQ.
To cut a long story short: test implements the old, portable syntax of the command. In almost all shells (the oldest Bourne shells are the exception), [ is a synonym for test (but requires a final argument of ]). Although all modern shells have built-in implementations of [, there usually still is an external executable of that name, e.g. /bin/[.
[[ is a new improved version of it, which is a keyword, not a program. This has beneficial effects on the ease of use, as shown below. [[ is understood by KornShell and BASH (e.g. 2.03), but not by the older POSIX or BourneShell.
And the conclusion:
When should the new test command [[ be used, and when the old one [? If portability to the BourneShell is a concern, the old syntax should be used. If on the other hand the script requires BASH or KornShell, the new syntax is much more flexible.
If you like a chained operation, you can also use compress
function:
test = pd.Series({
383: 3.000000,
663: 1.000000,
726: 1.000000,
737: 9.000000,
833: 8.166667
})
test.compress(lambda x: x != 1)
# 383 3.000000
# 737 9.000000
# 833 8.166667
# dtype: float64
Swift 5 : If you continuously want input from keyboard , without ending the program, like a stream of input, Use below steps:
Create new project of type comnnad line tool
Add below code in main.swift file:
var inputArray = [String]()
while let input = readLine() {
guard input != "quit" else {
break
}
inputArray.append(input)
print("You entered: \(input)")
print(inputArray)
print("Enter a word:")
}
I would suggest a small improvement to Bruce's solution which is to prevent overdrawing the same shape on top of each other and to simply use stroke instead of solid. It would look like this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding android:top="1dp" android:right="1dp" android:bottom="1dp" android:left="1dp" />
<stroke android:color="#02000000" android:width="1dp" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape>
<padding android:top="1dp" android:right="1dp" android:bottom="1dp" android:left="1dp" />
<stroke android:color="#05000000" android:width="1dp" />
<corners android:radius="7dp" />
</shape>
</item>
<item>
<shape>
<padding android:top="1dp" android:right="1dp" android:bottom="1dp" android:left="1dp" />
<stroke android:color="#10000000" android:width="1dp" />
<corners android:radius="6dp" />
</shape>
</item>
<item>
<shape>
<padding android:top="1dp" android:right="1dp" android:bottom="1dp" android:left="1dp" />
<stroke android:color="#15000000" android:width="1dp" />
<corners android:radius="5dp" />
</shape>
</item>
<item>
<shape>
<padding android:top="1dp" android:right="1dp" android:bottom="1dp" android:left="1dp" />
<stroke android:color="#20000000" android:width="1dp" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape>
<padding android:top="1dp" android:right="1dp" android:bottom="1dp" android:left="1dp" />
<stroke android:color="#25000000" android:width="1dp" />
<corners android:radius="3dp" />
</shape>
</item>
<item>
<shape>
<padding android:top="1dp" android:right="1dp" android:bottom="1dp" android:left="1dp" />
<stroke android:color="#30000000" android:width="1dp" />
<corners android:radius="3dp" />
</shape>
</item>
<!-- Background -->
<item>
<shape>
<solid android:color="#FFF" />
<corners android:radius="3dp" />
</shape>
</item>
</layer-list>
Lastly I wanted to point out for people who would like a shadow in a specific direction that all you have to do is set the top, bottom, left or right to 0dp (for a solid line) or -1dp (for nothing)
declare @temp as varchar
set @temp='Measure'
if(@temp = 'Measure')
Select Measure from Measuretable
else
Select OtherMeasure from Measuretable
The problem is that you aren't correctly escaping the input string, try:
echo "\"member\":\"time\"" | grep -e "member\""
Alternatively, you can use unescaped double quotes within single quotes:
echo '"member":"time"' | grep -e 'member"'
It's a matter of preference which you find clearer, although the second approach prevents you from nesting your command within another set of single quotes (e.g. ssh 'cmd'
).
You can use OpenXml SDK for *.xlsx files. It works very quickly. I made simple C# IDataReader implementation for this sdk. See here. Now you can easy read excel file to DataTable and you can import excel file to sql server database (use SqlBulkCopy). ExcelDataReader reads very fast. On my machine 10000 records less 3 sec and 60000 less 8 sec.
Read to DataTable example:
class Program
{
static void Main(string[] args)
{
var dt = new DataTable();
using (var reader = new ExcelDataReader(@"data.xlsx"))
dt.Load(reader);
Console.WriteLine("done: " + dt.Rows.Count);
Console.ReadKey();
}
}
import sys
import types
def str_to_class(field):
try:
identifier = getattr(sys.modules[__name__], field)
except AttributeError:
raise NameError("%s doesn't exist." % field)
if isinstance(identifier, (types.ClassType, types.TypeType)):
return identifier
raise TypeError("%s is not a class." % field)
This accurately handles both old-style and new-style classes.
If you use apachectl to start or stop, then you can find it with this command
apachectl -t -D DUMP_RUN_CFG
I'm using angular2-moment, but usage must be similar.
import { MomentModule } from "angular2-moment";
import moment = require("moment");
export class AppModule {
constructor() {
moment.locale('ru');
}
}
See Google's API Design Guide: Resource Names for another take on naming resources.
The guide requires collections to be named with plurals.
|--------------------------+---------------+-------------------+---------------+--------------|
| API Service Name | Collection ID | Resource ID | Collection ID | Resource ID |
|--------------------------+---------------+-------------------+---------------+--------------|
| //mail.googleapis.com | /users | /[email protected] | /settings | /customFrom |
| //storage.googleapis.com | /buckets | /bucket-id | /objects | /object-id |
|--------------------------+---------------+-------------------+---------------+--------------|
It's worthwhile reading if you're thinking about this subject.
You can now use string interpolation and expression bodied properties in C# 6.
private decimal _amount;
public string FormattedAmount => $"{_amount:C}";
You could create a list of Object like List<Object> list = new ArrayList<Object>()
. As all classes implementation extends implicit or explicit from java.lang.Object
class, this list can hold any object, including instances of Employee
, Integer
, String
etc.
When you retrieve an element from this list, you will be retrieving an Object
and no longer an Employee
, meaning you need to perform a explicit cast in this case as follows:
List<Object> list = new ArrayList<Object>();
list.add("String");
list.add(Integer.valueOf(1));
list.add(new Employee());
Object retrievedObject = list.get(2);
Employee employee = (Employee)list.get(2); // explicit cast
Here is a query, you can run it in SQL Developer (or SQL*Plus):
SELECT DS.TABLESPACE_NAME, SEGMENT_NAME, ROUND(SUM(DS.BYTES) / (1024 * 1024)) AS MB
FROM DBA_SEGMENTS DS
WHERE SEGMENT_NAME IN (SELECT TABLE_NAME FROM DBA_TABLES)
GROUP BY DS.TABLESPACE_NAME,
SEGMENT_NAME;
It really depends on the implementation of the language being used! There is a common step in any implementation, though: your code is first compiled (translated) to intermediate code - something between your code and machine (binary) code - called bytecode (stored into .pyc files). Note that this is a one-time step that will not be repeated unless you modify your code.
And that bytecode is executed every time you are running the program. How? Well, when we run the program, this bytecode (inside a .pyc file) is passed as input to a Virtual Machine (VM)1 - the runtime engine allowing our programs to be executed - that executes it.
Depending on the language implementation, the VM will either interpret the bytecode (in the case of CPython2 implementation) or JIT-compile3 it (in the case of PyPy4 implementation).
Notes:
1 an emulation of a computer system
2 a bytecode interpreter; the reference implementation of the language, written in C and Python - most widely used
3 compilation that is being done during the execution of a program (at runtime)
4 a bytecode JIT compiler; an alternative implementation to CPython, written in RPython (Restricted Python) - often runs faster than CPython