The if
attribute does not exist for <copy>
. It should be applied to the <target>
.
Below is an example of how you can use the depends
attribute of a target and the if
and unless
attributes to control execution of dependent targets. Only one of the two should execute.
<target name="prepare-copy" description="copy file based on condition"
depends="prepare-copy-true, prepare-copy-false">
</target>
<target name="prepare-copy-true" description="copy file based on condition"
if="copy-condition">
<echo>Get file based on condition being true</echo>
<copy file="${some.dir}/true" todir="." />
</target>
<target name="prepare-copy-false" description="copy file based on false condition"
unless="copy-condition">
<echo>Get file based on condition being false</echo>
<copy file="${some.dir}/false" todir="." />
</target>
If you are using ANT 1.8+, then you can use property expansion and it will evaluate the value of the property to determine the boolean value. So, you could use if="${copy-condition}"
instead of if="copy-condition"
.
In ANT 1.7.1 and earlier, you specify the name of the property. If the property is defined and has any value (even an empty string), then it will evaluate to true.
You want a proc object:
gaussian = Proc.new do |dist, *args|
sigma = args.first || 10.0
...
end
def weightedknn(data, vec1, k = 5, weightf = gaussian)
...
weight = weightf.call(dist)
...
end
Just note that you can't set a default argument in a block declaration like that. So you need to use a splat and setup the default in the proc code itself.
Or, depending on your scope of all this, it may be easier to pass in a method name instead.
def weightedknn(data, vec1, k = 5, weightf = :gaussian)
...
weight = self.send(weightf)
...
end
In this case you are just calling a method that is defined on an object rather than passing in a complete chunk of code. Depending on how you structure this you may need replace self.send
with object_that_has_the_these_math_methods.send
Last but not least, you can hang a block off the method.
def weightedknn(data, vec1, k = 5)
...
weight =
if block_given?
yield(dist)
else
gaussian.call(dist)
end
end
...
end
weightedknn(foo, bar) do |dist|
# square the dist
dist * dist
end
But it sounds like you would like more reusable chunks of code here.
You need to do something like the following to disable cell selection within the cellForRowAtIndexPath
method:
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
[cell setUserInteractionEnabled:NO];
To show the cell grayed out, put the following within the tableView:WillDisplayCell:forRowAtIndexPath
method:
[cell setAlpha:0.5];
One method allows you to control the interactivity, the other allows you to control the UI appearance.
Here is better solution if you want to make multiple text to bold. I've improved Eitan's code. thanks Eitan.
public static SpannableStringBuilder makeSectionOfTextBold(String text, String... textToBold) {
SpannableStringBuilder builder = new SpannableStringBuilder(text);
for (String textItem :
textToBold) {
if (textItem.length() > 0 && !textItem.trim().equals("")) {
//for counting start/end indexes
String testText = text.toLowerCase(Locale.US);
String testTextToBold = textItem.toLowerCase(Locale.US);
int startingIndex = testText.indexOf(testTextToBold);
int endingIndex = startingIndex + testTextToBold.length();
if (startingIndex >= 0 && endingIndex >= 0) {
builder.setSpan(new StyleSpan(Typeface.BOLD), startingIndex, endingIndex, 0);
}
}
}
return builder;
}
You will want to move the loop for the files outside of the loop for the folders. In addition you will need to pass the data structure holding the collection of files to each call of the method. That way all files go into a single list.
public static List<string> DirSearch(string sDir, List<string> files)
{
foreach (string f in Directory.GetFiles(sDir, "*.xml"))
{
string extension = Path.GetExtension(f);
if (extension != null && (extension.Equals(".xml")))
{
files.Add(f);
}
}
foreach (string d in Directory.GetDirectories(sDir))
{
DirSearch(d, files);
}
return files;
}
Then call it like this.
List<string> files = DirSearch("c:\foo", new List<string>());
Update:
Well unbeknownst to me, until I read the other answer anyway, there is already a builtin mechanism for doing this. I will leave my answer in case you are interested in seeing how your code needs to be modified to make it work.
I have created this easy to use library that does exactly what you are looking for: ss-search
import { search } from "ss-search"
const data = [
{
"foo" : "bar",
"bar" : "sit"
},
{
"foo" : "lorem",
"bar" : "ipsum"
},
{
"foo" : "dolor",
"bar" : "amet"
}
]
const searchKeys = ["foor", "bar"]
const searchText = "dolor"
const results = search(data, keys, searchText)
// results: [{ "foo": "dolor", "bar": "amet" }]
you can use html entity as •
For reference—future Python possibilities:
Starting with Python 2.6 you can express binary literals using the prefix 0b or 0B:
>>> 0b101111
47
You can also use the new bin function to get the binary representation of a number:
>>> bin(173)
'0b10101101'
Development version of the documentation: What's New in Python 2.6
MAX_EXECUTION_TIME is also an important parameter for long running queries.Will work for MySQL 5.7 or later.
Check the current value
SELECT @@GLOBAL.MAX_EXECUTION_TIME, @@SESSION.MAX_EXECUTION_TIME;
Then set it according to your needs.
SET SESSION MAX_EXECUTION_TIME=2000;
SET GLOBAL MAX_EXECUTION_TIME=2000;
check this same effect with less code
$(".item").mouseover(function(){
$('.info').animate({ marginTop: '-50px' , opacity: 0.5 }, 1000);
});
The only solution I can find so far for myself is to re-initialize the chart from scratch:
var myLineChart = new Chart(ctx).Line(data, options);
However this seems a bit hokey to me. Any better, more standard solution anybody?
An old thread, but it may help someone like me. I resolved the issue by setting up SMTP server value to a legitimate value in PHP.ini
Backspace and tab both move the cursor position. Neither is truly a 'printable' character.
Your code says:
To get the output you expect, you need printf("foo\b \tbar")
. Note the extra 'space'. That says:
Most of the time it is inappropriate to use tabs and backspace for formatting your program output. Learn to use printf()
formatting specifiers. Rendering of tabs can vary drastically depending on how the output is viewed.
This little script shows one way to alter your terminal's tab rendering. Tested on Ubuntu + gnome-terminal:
#!/bin/bash
tabs -8
echo -e "\tnormal tabstop"
for x in `seq 2 10`; do
tabs $x
echo -e "\ttabstop=$x"
done
tabs -8
echo -e "\tnormal tabstop"
Also see man setterm
and regtabs
.
And if you redirect your output or just write to a file, tabs will quite commonly be displayed as fewer than the standard 8 chars, especially in "programming" editors and IDEs.
So in otherwords:
printf("%-8s%s", "foo", "bar"); /* this will ALWAYS output "foo bar" */
printf("foo\tbar"); /* who knows how this will be rendered */
IMHO, tabs in general are rarely appropriate for anything. An exception might be generating output for a program that requires tab-separated-value input files (similar to comma separated value).
Backspace '\b'
is a different story... it should never be used to create a text file since it will just make a text editor spit out garbage. But it does have many applications in writing interactive command line programs that cannot be accomplished with format strings alone. If you find yourself needing it a lot, check out "ncurses", which gives you much better control over where your output goes on the terminal screen. And typically, since it's 2011 and not 1995, a GUI is usually easier to deal with for highly interactive programs. But again, there are exceptions. Like writing a telnet server or console for a new scripting language.
It is the CSS child selector. Example:
div > p
selects all paragraphs that are direct children of div.
See this
I read all the above answers and those are actually good.
look at this code:
for i in range(1, 4):
print("Before change:", i)
i = 20 # changing i variable
print("After change:", i) # this line will always print 20
When we execute above code the output is like below,
Before Change: 1
After change: 20
Before Change: 2
After change: 20
Before Change: 3
After change: 20
in python for loop is not trying to increase i
value. for loop is just assign values to i
which we gave. Using range(4)
what we are doing is we give the values to for loop which need assign to the i.
You can use while loop
instead of for loop
to do same thing what you want,
i = 0
while i < 6:
print(i)
j = 0
while j < 5:
i += 2 # to increase `i` by 2
This will give,
0
2
4
Thank you !
Use Autohotkey to make a macro. AHK is free and dead simple to install. www.autohotkey.com
You could assign the macro to, say, alt-p:
!p::send print(){Left}
That will make alt-p put out print() and move your cursor to inside the parens.
Or, even better, to directly solve your problem, you define an autoreplace and limit its scope to when the open file has the .py extension:
#IfWinActive .py ;;; scope limiter
:b*:print ::print(){Left} ;;; I forget what b* does. The rest should be clear
#IfWinActive ;;; remove the scope limitation
This is a guaranteed, painless, transparent solution.
You could designate a class for each cell in the second column.
<table>
<tr><td>Column 1</td><td class="col2">Col 2</td></tr>
<tr><td>Column 1</td><td class="col2">Col 2</td></tr>
<tr><td>Column 1</td><td class="col2">Col 2</td></tr>
<tr><td>Column 1</td><td class="col2">Col 2</td></tr>
</table>
I had the same issue as OP (I think!), but I couldn't get it to work in the way that Lastalda specified. I don't know if I have interpreted the question properly, but I have found another solution (it probably is a really bad way of doing it though).
This was the way that I did it:
plt.hist([1,11,21,31,41], bins=[0,10,20,30,40,50], weights=[10,1,40,33,6]);
Which creates this:
So the first parameter basically 'initialises' the bin - I'm specifically creating a number that is in between the range I set in the bins parameter.
To demonstrate this, look at the array in the first parameter ([1,11,21,31,41]) and the 'bins' array in the second parameter ([0,10,20,30,40,50]):
Then I'm using the 'weights' parameter to define the size of each bin. This is the array used for the weights parameter: [10,1,40,33,6].
So the 0 to 10 bin is given the value 10, the 11 to 20 bin is given the value of 1, the 21 to 30 bin is given the value of 40, etc.
You add to the back state from the FragmentTransaction
and remove from the backstack using FragmentManager
pop methods:
FragmentManager manager = getActivity().getSupportFragmentManager();
FragmentTransaction trans = manager.beginTransaction();
trans.remove(myFrag);
trans.commit();
manager.popBackStack();
Also, if you don't mind using numpy arrays (or in fact already are dealing with numpy arrays...), here is another nice solution:
people = ['Jim', 'Pam', 'Micheal', 'Dwight']
ages = [27, 25, 4, 9]
import numpy
people = numpy.array(people)
ages = numpy.array(ages)
inds = ages.argsort()
sortedPeople = people[inds]
I found it here: http://scienceoss.com/sort-one-list-by-another-list/
Not sure if it's what you mean, but you can do this:
plot(1:10, xaxt = "n", xlab='Some Letters')
axis(1, at=1:10, labels=letters[1:10])
which then gives you the graph:
Solution:
Add the below line in your application
tag:
android:usesCleartextTraffic="true"
As shown below:
<application
....
android:usesCleartextTraffic="true"
....>
UPDATE: If you have network security config such as: android:networkSecurityConfig="@xml/network_security_config"
No Need to set clear text traffic to true as shown above, instead use the below code:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
....
....
</domain-config>
<base-config cleartextTrafficPermitted="false"/>
</network-security-config>
Set the cleartextTrafficPermitted
to true
Hope it helps.
Use this expression:
/\(([^()]+)\)/g
e.g:
function()
{
var mts = "something/([0-9])/([a-z])".match(/\(([^()]+)\)/g );
alert(mts[0]);
alert(mts[1]);
}
It is not strictly possible in default db due to the many public executes that each user gains automatically through public.
If you're using Android Studio (1.3):
When you start the app from the GUI, adb logcat
might show you the corresponding action/category/component:
$ adb logcat
[...]
I/ActivityManager( 1607): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.browser/.BrowserActivity} from pid 1792
[...]
For my part, and without any plug-in, simply saving the file either from the File menu or with keyboards shortcuts
CTRL + S (Windows, Linux) or CMD + S (Mac OS)
briefly displays the current encoding - between parentheses - in the status bar, at the bottom of the editor's window. This suggestion works in Sublime Text 2 and 3.
Note that the displayed encoding to the right in the status bar of Sublime Text 3, may display the wrong encoding of the file if you have attempted to save the file with an encoding that can't represent all the characters in your file. In this case you would have seen an informational dialog and Sublime telling you it's falling back to UTF-8. This may not be the case, so be careful.
I wrote small function for myself that works recursively in Postgres 9.4. Here is the function (I hope it works well for you):
CREATE OR REPLACE FUNCTION jsonb_update(val1 JSONB,val2 JSONB)
RETURNS JSONB AS $$
DECLARE
result JSONB;
v RECORD;
BEGIN
IF jsonb_typeof(val2) = 'null'
THEN
RETURN val1;
END IF;
result = val1;
FOR v IN SELECT key, value FROM jsonb_each(val2) LOOP
IF jsonb_typeof(val2->v.key) = 'object'
THEN
result = result || jsonb_build_object(v.key, jsonb_update(val1->v.key, val2->v.key));
ELSE
result = result || jsonb_build_object(v.key, v.value);
END IF;
END LOOP;
RETURN result;
END;
$$ LANGUAGE plpgsql;
Here is sample use:
select jsonb_update('{"a":{"b":{"c":{"d":5,"dd":6},"cc":1}},"aaa":5}'::jsonb, '{"a":{"b":{"c":{"d":15}}},"aa":9}'::jsonb);
jsonb_update
---------------------------------------------------------------------
{"a": {"b": {"c": {"d": 15, "dd": 6}, "cc": 1}}, "aa": 9, "aaa": 5}
(1 row)
As you can see it analyze deep down and update/add values where needed.
Scripts are usually loaded in the end of the html page, and MVC recommends the using of bundles, just saying. So my best bet is that your jquery.validate
files got altered in some way or are not updated to the latest version, since they do validate e-mail inputs.
So you could either update/refresh your nuget package or write your own function, really.
Here's an example which you would add in an extra file after jquery.validate.unobtrusive
:
$.validator.addMethod(
"email",
function (value, element) {
return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
},
"This e-mail is not valid"
);
This is just a copy and paste of the current jquery.validate
Regex, but this way you could set your custom error message/add extra methods to fields you might want to validate in the near future.
I had this weird error and the culprit is a white space on the beginning of the PHP open tag
even without the ob_flush
and ob_end_clean
Just make sure there are no extra white spaces
on or after any <?php ?>
block
I know its been a while since the original post but I like using CTE's and this worked for me:
WITH cte_table_a
AS
(
SELECT [id] [id]
, MAX([value]) [value]
FROM table_a
GROUP BY [id]
)
UPDATE table_b
SET table_b.code = CASE WHEN cte_table_a.[value] IS NOT NULL THEN cte_table_a.[value] ELSE 124 END
FROM table_b
LEFT OUTER JOIN cte_table_a
ON table_b.id = cte_table_a.id
Since January 7th, 2019, it is possible: unlimited free private repositories on GitHub!
... But for up to three collaborators per private repository.
Nat Friedman just announced it by twitter:
Today(!) we’re thrilled to announce unlimited free private repos for all GitHub users, and a new simplified Enterprise offering:
"New year, new GitHub: Announcing unlimited free private repos and unified Enterprise offering"
For the first time, developers can use GitHub for their private projects with up to three collaborators per repository for free.
Many developers want to use private repos to apply for a job, work on a side project, or try something out in private before releasing it publicly.
Starting today, those scenarios, and many more, are possible on GitHub at no cost.Public repositories are still free (of course—no changes there) and include unlimited collaborators.
The better solution is to simply move the position of the viewport based on the change in the zoom. The zoom point is simply the point in the old zoom and the new zoom that you want to remain the same. Which is to say the viewport pre-zoomed and the viewport post-zoomed have the same zoompoint relative to the viewport. Given that we're scaling relative to the origin. You can adjust the viewport position accordingly:
scalechange = newscale - oldscale;
offsetX = -(zoomPointX * scalechange);
offsetY = -(zoomPointY * scalechange);
So really you can just pan over down and to the right when you zoom in, by a factor of how much you zoomed in, relative to the point you zoomed at.
If you want the fastest way for numpy arrays, use numba, which if you use conda should be already installed
The code will be fast because it will be compiled by numba
import numba
@numba.jit
def issorted(vec, ascending=True):
if len(vec) < 2:
return True
if ascending:
for i in range(1, len(vec)):
if vec[i-1] > vec[i]:
return False
return True
else:
for i in range(1, len(vec)):
if vec[i-1] < vec[i]:
return False
return True
and then:
>>> issorted(array([4,9,100]))
>>> True
You just need to create a class which extends Exception (for a checked exception) or any subclass of Exception, or RuntimeException (for a runtime exception) or any subclass of RuntimeException.
Then, in your code, just use
if (word.contains(" "))
throw new MyException("some message");
}
Read the Java tutorial. This is basic stuff that every Java developer should know: http://docs.oracle.com/javase/tutorial/essential/exceptions/
You don't have all digit characters in your string. So you have to split by space
QString Abcd = "123.5 Kb";
Abcd.split(" ")[0].toInt(); //convert the first part to Int
Abcd.split(" ")[0].toDouble(); //convert the first part to double
Abcd.split(" ")[0].toFloat(); //convert the first part to float
Update: I am updating an old answer. That was a straight forward answer to the specific question, with a strict assumption. However as noted by @DomTomCat in comments and @Mikhail in answer, In general one should always check whether the operation is successful or not. So using a boolean flag is necessary.
bool flag;
double v = Abcd.split(" ")[0].toDouble(&flag);
if(flag){
// use v
}
Also if you are taking that string as user input, then you should also be doubtful about whether the string is really splitable with space. If there is a possibility that the assumption may break then a regex verifier is more preferable. A regex like the following will extract the floating point value and the prefix character of 'b'. Then you can safely convert the captured strings to double.
([0-9]*\.?[0-9]+)\s+(\w[bB])
You can have an utility function like the following
QPair<double, QString> split_size_str(const QString& str){
QRegExp regex("([0-9]*\\.?[0-9]+)\\s+(\\w[bB])");
int pos = regex.indexIn(str);
QStringList captures = regex.capturedTexts();
if(captures.count() > 1){
double value = captures[1].toDouble(); // should succeed as regex matched
QString unit = captures[2]; // should succeed as regex matched
return qMakePair(value, unit);
}
return qMakePair(0.0f, QString());
}
I already had running postgres on host machine and didn't want to allow connections from network, so I did run temporary postgres instance in container and created database in just two lines:
# Run PostgreSQL
docker run --name postgres-container -e POSTGRES_PASSWORD=password -it -p 5433:5432 postgres
# Create database
docker exec -it postgres-container createdb -U postgres my-db
You can avoid declaration of global variables by adding them directly to the global object:
(function(global) {
...
global.varName = someValue;
...
}(this));
A disadvantage of this method is that global.varName won't exist until that specific line of code is executed, but that can be easily worked around.
You might also consider an application architecture where such globals are held in a closure common to all functions that need them, or as properties of a suitably accessible data storage object.
public string GenerateToken(int length)
{
using (RNGCryptoServiceProvider cryptRNG = new RNGCryptoServiceProvider())
{
byte[] tokenBuffer = new byte[length];
cryptRNG.GetBytes(tokenBuffer);
return Convert.ToBase64String(tokenBuffer);
}
}
(You could also have the class where this method lives implement IDisposable, hold a reference to the RNGCryptoServiceProvider
, and dispose of it properly, to avoid repeatedly instantiating it.)
It's been noted that as this returns a base-64 string, the output length is always a multiple of 4, with the extra space using =
as a padding character. The length
parameter specifies the length of the byte buffer, not the output string (and is therefore perhaps not the best name for that parameter, now I think about it). This controls how many bytes of entropy the password will have. However, because base-64 uses a 4-character block to encode each 3 bytes of input, if you ask for a length that's not a multiple of 3, there will be some extra "space", and it'll use =
to fill the extra.
If you don't like using base-64 strings for any reason, you can replace the Convert.ToBase64String()
call with either a conversion to regular string, or with any of the Encoding
methods; eg. Encoding.UTF8.GetString(tokenBuffer)
- just make sure you pick a character set that can represent the full range of values coming out of the RNG, and that produces characters that are compatible with wherever you're sending or storing this. Using Unicode, for example, tends to give a lot of Chinese characters. Using base-64 guarantees a widely-compatible set of characters, and the characteristics of such a string shouldn't make it any less secure as long as you use a decent hashing algorithm.
Console.OutputEncoding Property
https://docs.microsoft.com/en-us/dotnet/api/system.console.outputencoding
Note that successfully displaying Unicode characters to the console requires the following:
- The console must use a TrueType font, such as Lucida Console or Consolas, to display characters.
Here is your code. I'm assuming you're using python 3 based on the your use of print()
and input()
:
import random
def main():
#random.seed() --> don't need random.seed()
#Prompts the user to enter the number of tickets they wish to play.
#python 3 version:
tickets = int(input("How many lottery tickets do you want?\n"))
#Creates the dictionaries "winning_numbers" and "guess." Also creates the variable "winnings" for total amount of money won.
winning_numbers = []
winnings = 0
#Generates the winning lotto numbers.
for i in range(tickets * 5):
#del winning_numbers[:] what is this line for?
randNum = random.randint(1,30)
while randNum in winning_numbers:
randNum = random.randint(1,30)
winning_numbers.append(randNum)
print(winning_numbers)
guess = getguess(tickets)
nummatches = checkmatch(winning_numbers, guess)
print("Ticket #"+str(i+1)+": The winning combination was",winning_numbers,".You matched",nummatches,"number(s).\n")
winningRanks = [0, 0, 10, 500, 20000, 1000000]
winnings = sum(winningRanks[:nummatches + 1])
print("You won a total of",winnings,"with",tickets,"tickets.\n")
#Gets the guess from the user.
def getguess(tickets):
guess = []
for i in range(tickets):
bubble = [int(i) for i in input("What numbers do you want to choose for ticket #"+str(i+1)+"?\n").split()]
guess.extend(bubble)
print(bubble)
return guess
#Checks the user's guesses with the winning numbers.
def checkmatch(winning_numbers, guess):
match = 0
for i in range(5):
if guess[i] == winning_numbers[i]:
match += 1
return match
main()
For the UITextField text comparison I am using below code and working fine for me, let me know if you find any error.
if(txtUsername.text.isEmpty || txtPassword.text.isEmpty)
{
//Do some stuff
}
else if(txtUsername.text == "****" && txtPassword.text == "****")
{
//Do some stuff
}
Also see:
core.whitespace = cr-at-eol
or equivalently,
[core]
whitespace = cr-at-eol
where whitespace
is preceded by a tab character.
Button ok= view.findViewById(R.id.btSettingOK);
Fragment me=this;
ok.setOnClickListener( new View.OnClickListener(){
public void onClick(View v){
getActivity().getFragmentManager().beginTransaction().remove(me).commit();
}
});
If you develop browser extensions you can try browser.cookies.getAll()
It can be achieved in 2 steps:
AppBar.brightness
propertyIf you have an AppBar
:
@override
Widget build(BuildContext context) {
FlutterStatusbarcolor.setStatusBarColor(Colors.white);
return Scaffold(
appBar: AppBar(
brightness: Brightness.light,
// Other AppBar properties
),
body: Container()
);
}
If you don't want to show the app bar in the page:
@override
Widget build(BuildContext context) {
FlutterStatusbarcolor.setStatusBarColor(Colors.white);
return Scaffold(
appBar: AppBar(
brightness: Brightness.light,
elevation: 0.0,
toolbarHeight: 0.0, // Hide the AppBar
),
body: Container()
}
you can do this easily by using jquery using .css property... try this one: http://api.jquery.com/css/
This might help
def union(a,b):
for e in b:
if e not in a:
a.append(e)
The union function merges the second list into first, with out duplicating an element of a, if it's already in a. Similar to set union operator. This function does not change b. If a=[1,2,3] b=[2,3,4]. After union(a,b) makes a=[1,2,3,4] and b=[2,3,4]
You need to use the target
selector.
Here is a fiddle with another example: http://jsfiddle.net/YYPKM/3/
You can flow this code:
Scanner obj= new Scanner(System.in);
String s = obj.nextLine();
According to the man page the -P flag is:
-P prefix --directory-prefix=prefix Set directory prefix to prefix. The directory prefix is the directory where all other files and subdirectories will be saved to, i.e. the top of the retrieval tree. The default is . (the current directory).
This mean that it only specifies the destination but where to save the directory tree. It does not flatten the tree into just one directory. As mentioned before the -nd flag actually does that.
@Jon in the future it would be beneficial to describe what the flag does so we understand how something works.
Perhaps useful online checker PEP8 : http://pep8online.com/
To clarify for anyone who is looking for what is the difference between the 3 on a simpler level. You can expose your service with minimal ClusterIp (within k8s cluster) or larger exposure with NodePort (within cluster external to k8s cluster) or LoadBalancer (external world or whatever you defined in your LB).
ClusterIp exposure < NodePort exposure < LoadBalancer exposure
ip/name:port
ip/name:port
Go to:
Files -> Settings -> Project -> *"Your Project Name"* -> Project Interpreter
There you can see which external libraries you have installed for python2 and which for python3.
Select the required python version according to your requirements.
Solution:
use incognito new tab then test it again.
reason:
in my case another user logged in with my admin panel
Save the file as *.txt
and then rename the file and change the file extension to json
I would not recommend installing CUDA/cuDNN on the host if you can use docker. Since at least CUDA 8 it has been possible to "stand on the shoulders of giants" and use nvidia/cuda
base images maintained by NVIDIA in their Docker Hub repo. Go for the newest and biggest one (with cuDNN if doing deep learning) if unsure which version to choose.
A starter CUDA container:
mkdir ~/cuda11
cd ~/cuda11
echo "FROM nvidia/cuda:11.0-cudnn8-devel-ubuntu18.04" > Dockerfile
echo "CMD [\"/bin/bash\"]" >> Dockerfile
docker build --tag mirekphd/cuda11 .
docker run --rm -it --gpus 1 mirekphd/cuda11 nvidia-smi
Sample output:
(if nvidia-smi
is not found in the container, do not try install it there - it was already installed on thehost with NVIDIA GPU driver and should be made available from the host to the container system if docker has access to the GPU(s)):
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.57 Driver Version: 450.57 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 108... Off | 00000000:01:00.0 On | N/A |
| 0% 50C P8 17W / 280W | 409MiB / 11177MiB | 7% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
Prerequisites
Appropriate NVIDIA driver with the latest CUDA version support to be installed first on the host (download it from NVIDIA Driver Downloads and then mv driver-file.run driver-file.sh && chmod +x driver-file.sh && ./driver-file.sh
). These are have been forward-compatible since CUDA 10.1.
GPU access enabled in docker
by installing sudo apt get update && sudo apt get install nvidia-container-toolkit
(and then restarting docker daemon using sudo systemctl restart docker
).
Only a few characters in the Windows code page 1252 (Latin-1) are not allowed as names. Note that the Windows Explorer will strip leading spaces from names and not allow you to call a files space dot something (like ?.txt
), although this is allowed in the file system! Only a space and no file extension is invalid however.
If you create files through e.g. a Python script (this is what I did), then you can easily find out what is actually allowed and in what order the characters get sorted. The sort order varies based on your locale! Below are the results of my script, run with Python 2.7.15 on a German Windows 10 Pro 64bit:
Allowed:
32 20 SPACE
! 33 21 EXCLAMATION MARK
# 35 23 NUMBER SIGN
$ 36 24 DOLLAR SIGN
% 37 25 PERCENT SIGN
& 38 26 AMPERSAND
' 39 27 APOSTROPHE
( 40 28 LEFT PARENTHESIS
) 41 29 RIGHT PARENTHESIS
+ 43 2B PLUS SIGN
, 44 2C COMMA
- 45 2D HYPHEN-MINUS
. 46 2E FULL STOP
/ 47 2F SOLIDUS
0 48 30 DIGIT ZERO
1 49 31 DIGIT ONE
2 50 32 DIGIT TWO
3 51 33 DIGIT THREE
4 52 34 DIGIT FOUR
5 53 35 DIGIT FIVE
6 54 36 DIGIT SIX
7 55 37 DIGIT SEVEN
8 56 38 DIGIT EIGHT
9 57 39 DIGIT NINE
; 59 3B SEMICOLON
= 61 3D EQUALS SIGN
@ 64 40 COMMERCIAL AT
A 65 41 LATIN CAPITAL LETTER A
B 66 42 LATIN CAPITAL LETTER B
C 67 43 LATIN CAPITAL LETTER C
D 68 44 LATIN CAPITAL LETTER D
E 69 45 LATIN CAPITAL LETTER E
F 70 46 LATIN CAPITAL LETTER F
G 71 47 LATIN CAPITAL LETTER G
H 72 48 LATIN CAPITAL LETTER H
I 73 49 LATIN CAPITAL LETTER I
J 74 4A LATIN CAPITAL LETTER J
K 75 4B LATIN CAPITAL LETTER K
L 76 4C LATIN CAPITAL LETTER L
M 77 4D LATIN CAPITAL LETTER M
N 78 4E LATIN CAPITAL LETTER N
O 79 4F LATIN CAPITAL LETTER O
P 80 50 LATIN CAPITAL LETTER P
Q 81 51 LATIN CAPITAL LETTER Q
R 82 52 LATIN CAPITAL LETTER R
S 83 53 LATIN CAPITAL LETTER S
T 84 54 LATIN CAPITAL LETTER T
U 85 55 LATIN CAPITAL LETTER U
V 86 56 LATIN CAPITAL LETTER V
W 87 57 LATIN CAPITAL LETTER W
X 88 58 LATIN CAPITAL LETTER X
Y 89 59 LATIN CAPITAL LETTER Y
Z 90 5A LATIN CAPITAL LETTER Z
[ 91 5B LEFT SQUARE BRACKET
\\ 92 5C REVERSE SOLIDUS
] 93 5D RIGHT SQUARE BRACKET
^ 94 5E CIRCUMFLEX ACCENT
_ 95 5F LOW LINE
` 96 60 GRAVE ACCENT
a 97 61 LATIN SMALL LETTER A
b 98 62 LATIN SMALL LETTER B
c 99 63 LATIN SMALL LETTER C
d 100 64 LATIN SMALL LETTER D
e 101 65 LATIN SMALL LETTER E
f 102 66 LATIN SMALL LETTER F
g 103 67 LATIN SMALL LETTER G
h 104 68 LATIN SMALL LETTER H
i 105 69 LATIN SMALL LETTER I
j 106 6A LATIN SMALL LETTER J
k 107 6B LATIN SMALL LETTER K
l 108 6C LATIN SMALL LETTER L
m 109 6D LATIN SMALL LETTER M
n 110 6E LATIN SMALL LETTER N
o 111 6F LATIN SMALL LETTER O
p 112 70 LATIN SMALL LETTER P
q 113 71 LATIN SMALL LETTER Q
r 114 72 LATIN SMALL LETTER R
s 115 73 LATIN SMALL LETTER S
t 116 74 LATIN SMALL LETTER T
u 117 75 LATIN SMALL LETTER U
v 118 76 LATIN SMALL LETTER V
w 119 77 LATIN SMALL LETTER W
x 120 78 LATIN SMALL LETTER X
y 121 79 LATIN SMALL LETTER Y
z 122 7A LATIN SMALL LETTER Z
{ 123 7B LEFT CURLY BRACKET
} 125 7D RIGHT CURLY BRACKET
~ 126 7E TILDE
\x7f 127 7F DELETE
\x80 128 80 EURO SIGN
\x81 129 81
\x82 130 82 SINGLE LOW-9 QUOTATION MARK
\x83 131 83 LATIN SMALL LETTER F WITH HOOK
\x84 132 84 DOUBLE LOW-9 QUOTATION MARK
\x85 133 85 HORIZONTAL ELLIPSIS
\x86 134 86 DAGGER
\x87 135 87 DOUBLE DAGGER
\x88 136 88 MODIFIER LETTER CIRCUMFLEX ACCENT
\x89 137 89 PER MILLE SIGN
\x8a 138 8A LATIN CAPITAL LETTER S WITH CARON
\x8b 139 8B SINGLE LEFT-POINTING ANGLE QUOTATION
\x8c 140 8C LATIN CAPITAL LIGATURE OE
\x8d 141 8D
\x8e 142 8E LATIN CAPITAL LETTER Z WITH CARON
\x8f 143 8F
\x90 144 90
\x91 145 91 LEFT SINGLE QUOTATION MARK
\x92 146 92 RIGHT SINGLE QUOTATION MARK
\x93 147 93 LEFT DOUBLE QUOTATION MARK
\x94 148 94 RIGHT DOUBLE QUOTATION MARK
\x95 149 95 BULLET
\x96 150 96 EN DASH
\x97 151 97 EM DASH
\x98 152 98 SMALL TILDE
\x99 153 99 TRADE MARK SIGN
\x9a 154 9A LATIN SMALL LETTER S WITH CARON
\x9b 155 9B SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
\x9c 156 9C LATIN SMALL LIGATURE OE
\x9d 157 9D
\x9e 158 9E LATIN SMALL LETTER Z WITH CARON
\x9f 159 9F LATIN CAPITAL LETTER Y WITH DIAERESIS
\xa0 160 A0 NON-BREAKING SPACE
\xa1 161 A1 INVERTED EXCLAMATION MARK
\xa2 162 A2 CENT SIGN
\xa3 163 A3 POUND SIGN
\xa4 164 A4 CURRENCY SIGN
\xa5 165 A5 YEN SIGN
\xa6 166 A6 PIPE, BROKEN VERTICAL BAR
\xa7 167 A7 SECTION SIGN
\xa8 168 A8 SPACING DIAERESIS - UMLAUT
\xa9 169 A9 COPYRIGHT SIGN
\xaa 170 AA FEMININE ORDINAL INDICATOR
\xab 171 AB LEFT DOUBLE ANGLE QUOTES
\xac 172 AC NOT SIGN
\xad 173 AD SOFT HYPHEN
\xae 174 AE REGISTERED TRADE MARK SIGN
\xaf 175 AF SPACING MACRON - OVERLINE
\xb0 176 B0 DEGREE SIGN
\xb1 177 B1 PLUS-OR-MINUS SIGN
\xb2 178 B2 SUPERSCRIPT TWO - SQUARED
\xb3 179 B3 SUPERSCRIPT THREE - CUBED
\xb4 180 B4 ACUTE ACCENT - SPACING ACUTE
\xb5 181 B5 MICRO SIGN
\xb6 182 B6 PILCROW SIGN - PARAGRAPH SIGN
\xb7 183 B7 MIDDLE DOT - GEORGIAN COMMA
\xb8 184 B8 SPACING CEDILLA
\xb9 185 B9 SUPERSCRIPT ONE
\xba 186 BA MASCULINE ORDINAL INDICATOR
\xbb 187 BB RIGHT DOUBLE ANGLE QUOTES
\xbc 188 BC FRACTION ONE QUARTER
\xbd 189 BD FRACTION ONE HALF
\xbe 190 BE FRACTION THREE QUARTERS
\xbf 191 BF INVERTED QUESTION MARK
\xc0 192 C0 LATIN CAPITAL LETTER A WITH GRAVE
\xc1 193 C1 LATIN CAPITAL LETTER A WITH ACUTE
\xc2 194 C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
\xc3 195 C3 LATIN CAPITAL LETTER A WITH TILDE
\xc4 196 C4 LATIN CAPITAL LETTER A WITH DIAERESIS
\xc5 197 C5 LATIN CAPITAL LETTER A WITH RING ABOVE
\xc6 198 C6 LATIN CAPITAL LETTER AE
\xc7 199 C7 LATIN CAPITAL LETTER C WITH CEDILLA
\xc8 200 C8 LATIN CAPITAL LETTER E WITH GRAVE
\xc9 201 C9 LATIN CAPITAL LETTER E WITH ACUTE
\xca 202 CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX
\xcb 203 CB LATIN CAPITAL LETTER E WITH DIAERESIS
\xcc 204 CC LATIN CAPITAL LETTER I WITH GRAVE
\xcd 205 CD LATIN CAPITAL LETTER I WITH ACUTE
\xce 206 CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX
\xcf 207 CF LATIN CAPITAL LETTER I WITH DIAERESIS
\xd0 208 D0 LATIN CAPITAL LETTER ETH
\xd1 209 D1 LATIN CAPITAL LETTER N WITH TILDE
\xd2 210 D2 LATIN CAPITAL LETTER O WITH GRAVE
\xd3 211 D3 LATIN CAPITAL LETTER O WITH ACUTE
\xd4 212 D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
\xd5 213 D5 LATIN CAPITAL LETTER O WITH TILDE
\xd6 214 D6 LATIN CAPITAL LETTER O WITH DIAERESIS
\xd7 215 D7 MULTIPLICATION SIGN
\xd8 216 D8 LATIN CAPITAL LETTER O WITH SLASH
\xd9 217 D9 LATIN CAPITAL LETTER U WITH GRAVE
\xda 218 DA LATIN CAPITAL LETTER U WITH ACUTE
\xdb 219 DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX
\xdc 220 DC LATIN CAPITAL LETTER U WITH DIAERESIS
\xdd 221 DD LATIN CAPITAL LETTER Y WITH ACUTE
\xde 222 DE LATIN CAPITAL LETTER THORN
\xdf 223 DF LATIN SMALL LETTER SHARP S
\xe0 224 E0 LATIN SMALL LETTER A WITH GRAVE
\xe1 225 E1 LATIN SMALL LETTER A WITH ACUTE
\xe2 226 E2 LATIN SMALL LETTER A WITH CIRCUMFLEX
\xe3 227 E3 LATIN SMALL LETTER A WITH TILDE
\xe4 228 E4 LATIN SMALL LETTER A WITH DIAERESIS
\xe5 229 E5 LATIN SMALL LETTER A WITH RING ABOVE
\xe6 230 E6 LATIN SMALL LETTER AE
\xe7 231 E7 LATIN SMALL LETTER C WITH CEDILLA
\xe8 232 E8 LATIN SMALL LETTER E WITH GRAVE
\xe9 233 E9 LATIN SMALL LETTER E WITH ACUTE
\xea 234 EA LATIN SMALL LETTER E WITH CIRCUMFLEX
\xeb 235 EB LATIN SMALL LETTER E WITH DIAERESIS
\xec 236 EC LATIN SMALL LETTER I WITH GRAVE
\xed 237 ED LATIN SMALL LETTER I WITH ACUTE
\xee 238 EE LATIN SMALL LETTER I WITH CIRCUMFLEX
\xef 239 EF LATIN SMALL LETTER I WITH DIAERESIS
\xf0 240 F0 LATIN SMALL LETTER ETH
\xf1 241 F1 LATIN SMALL LETTER N WITH TILDE
\xf2 242 F2 LATIN SMALL LETTER O WITH GRAVE
\xf3 243 F3 LATIN SMALL LETTER O WITH ACUTE
\xf4 244 F4 LATIN SMALL LETTER O WITH CIRCUMFLEX
\xf5 245 F5 LATIN SMALL LETTER O WITH TILDE
\xf6 246 F6 LATIN SMALL LETTER O WITH DIAERESIS
\xf7 247 F7 DIVISION SIGN
\xf8 248 F8 LATIN SMALL LETTER O WITH SLASH
\xf9 249 F9 LATIN SMALL LETTER U WITH GRAVE
\xfa 250 FA LATIN SMALL LETTER U WITH ACUTE
\xfb 251 FB LATIN SMALL LETTER U WITH CIRCUMFLEX
\xfc 252 FC LATIN SMALL LETTER U WITH DIAERESIS
\xfd 253 FD LATIN SMALL LETTER Y WITH ACUTE
\xfe 254 FE LATIN SMALL LETTER THORN
\xff 255 FF LATIN SMALL LETTER Y WITH DIAERESIS
Forbidden:
\x00 0 00 NULL CHAR
\x01 1 01 START OF HEADING
\x02 2 02 START OF TEXT
\x03 3 03 END OF TEXT
\x04 4 04 END OF TRANSMISSION
\x05 5 05 ENQUIRY
\x06 6 06 ACKNOWLEDGEMENT
\x07 7 07 BELL
\x08 8 08 BACK SPACE
\t 9 09 HORIZONTAL TAB
\n 10 0A LINE FEED
\x0b 11 0B VERTICAL TAB
\x0c 12 0C FORM FEED
\r 13 0D CARRIAGE RETURN
\x0e 14 0E SHIFT OUT / X-ON
\x0f 15 0F SHIFT IN / X-OFF
\x10 16 10 DATA LINE ESCAPE
\x11 17 11 DEVICE CONTROL 1 (OFT. XON)
\x12 18 12 DEVICE CONTROL 2
\x13 19 13 DEVICE CONTROL 3 (OFT. XOFF)
\x14 20 14 DEVICE CONTROL 4
\x15 21 15 NEGATIVE ACKNOWLEDGEMENT
\x16 22 16 SYNCHRONOUS IDLE
\x17 23 17 END OF TRANSMIT BLOCK
\x18 24 18 CANCEL
\x19 25 19 END OF MEDIUM
\x1a 26 1A SUBSTITUTE
\x1b 27 1B ESCAPE
\x1c 28 1C FILE SEPARATOR
\x1d 29 1D GROUP SEPARATOR
\x1e 30 1E RECORD SEPARATOR
\x1f 31 1F UNIT SEPARATOR
" 34 22 QUOTATION MARK
* 42 2A ASTERISK
: 58 3A COLON
< 60 3C LESS-THAN SIGN
> 62 3E GREATER-THAN SIGN
? 63 3F QUESTION MARK
| 124 7C VERTICAL LINE
Screenshot of how Explorer sorts the files for me:
The highlighted file with the ? white smiley face was added manually by me (Alt+1) to show where this Unicode character (U+263A) ends up, see Jimbugs' answer.
The first file has a space as name (0x20), the second is the non-breaking space (0xa0). The files in the bottom half of the third row which look like they have no name use the characters with hex codes 0x81, 0x8D, 0x8F, 0x90, 0x9D (in this order from top to bottom).
If you need to change the background colour of the navbar, you can do the following:
<nav class="navbar navbar-expand-lg navbar-light" style="background-color=#e3f2fd">
And to change the text:
<a class="nav-link" href="#" style="color:#ccc">
Jquery.map makes more sense when you are doing work on arrays as it performs very well with arrays.
Jquery.each is best used when iterating through selector items. Which is evidenced in that the map function does not use a selector.
$(selector).each(...)
$.map(arr....)
as you can see, map is not intended to be used with selectors.
If you are using tcsh, then edit your ~/.cshrc
file to include the lines:
setenv CLICOLOR 1
setenv LSCOLORS dxfxcxdxbxegedabagacad
Where, like Martin says, LSCOLORS specifies the color scheme you want to use.
To generate the LSCOLORS you want to use, checkout this site
hi array is one object so it null type or blank
<?php
if($error!=null)
echo "array is blank or null or not array";
//OR
if(!empty($error))
echo "array is blank or null or not array";
//OR
if(is_array($error))
echo "array is blank or null or not array";
?>
In case somebody is wondering how to just run an executable file:
..... > .\file.exe
or
......> full\path\to\file.exe
Guava provides the adapter you want as Int.asList(). There is an equivalent for each primitive type in the associated class, e.g., Booleans
for boolean
, etc.
int foo[] = {1,2,3,4,5,6,7,8,9,0};
Iterable<Integer> fooBar = Ints.asList(foo);
for(Integer i : fooBar) {
System.out.println(i);
}
The suggestions above to use Arrays.asList
won't work, even if they compile because you get an Iterator<int[]>
rather than Iterator<Integer>
. What happens is that rather than creating a list backed by your array, you created a 1-element list of arrays, containing your array.
Use the stringInsert function rather than the putinplace function. I was using the later function to parse a mysql query. Although the output looked alright, the query resulted in a error which took me a while to track down. The following is my version of the stringInsert function requiring only one parameter.
function stringInsert($str,$insertstr,$pos)
{
$str = substr($str, 0, $pos) . $insertstr . substr($str, $pos);
return $str;
}
Your Code
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
Replace it By
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
According to this page https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/Attributes.html it is only available if (Enabled only in a UIWebView with the allowsInlineMediaPlayback property set to YES.) I understand in Mobile Safari this is YES on iPad and NO on iPhone and iPod Touch.
In order to not waste space in the terminal with special characters to pieces of information, you can differentiate information using multiple colors.
Eg. in order to get this desired effect:
You can do the following to your prompt:
PROMPT='%F{magenta}${PWD/#$HOME/~} %F{green}${vcs_info_msg_0_} %F{cyan}$%F{reset_color} '
The way it works is every time you set a color using $F{myColor}
the color from that point onward will stick to that. It's important to add in %{reset_color}
at the end so that the input text goes back to the original color (or you could set it to something else if you'd like).
You can also use the extension "Configuration Transform" works the same as "SlowCheetah",
i don't like the idea of using Reflection for that.
Not only dangerous for missing it in some refactoring, but it can also be denied by SecurityManager
.
FutureTask
is a good option as the other options from the java.util.concurrent package.
My favorite for simple tasks:
Executors.newSingleThreadExecutor().submit(task);
little bit shorter than creating a Thread (task is a Callable or a Runnable)
Cast to long or cast to int, be aware of the following.
These functions are one of the view functions in Excel VBA that are depending on the system regional settings. So if you use a comma in your double like in some countries in Europe, you will experience an error in the US.
E.g., in european excel-version 0,5 will perform well with CDbl(), but in US-version it will result in 5. So I recommend to use the following alternative:
Public Function CastLong(var As Variant)
' replace , by .
var = Replace(var, ",", ".")
Dim l As Long
On Error Resume Next
l = Round(Val(var))
' if error occurs, l will be 0
CastLong = l
End Function
' similar function for cast-int, you can add minimum and maximum value if you like
' to prevent that value is too high or too low.
Public Function CastInt(var As Variant)
' replace , by .
var = Replace(var, ",", ".")
Dim i As Integer
On Error Resume Next
i = Round(Val(var))
' if error occurs, i will be 0
CastInt = i
End Function
Of course you can also think of cases where people use commas and dots, e.g., three-thousand as 3,000.00. If you require functionality for these kind of cases, then you have to check for another solution.
PHP sends headers automatically if set up to use internal encoding:
ini_set('default_charset', 'utf-8');
And here is a quick benchmark for both #sample
and #rand
:
irb(main):014:0* Benchmark.bm do |x|
irb(main):015:1* x.report('sample') { 1_000_000.times { (1..100).to_a.sample } }
irb(main):016:1> x.report('rand') { 1_000_000.times { rand(1..100) } }
irb(main):017:1> end
user system total real
sample 3.870000 0.020000 3.890000 ( 3.888147)
rand 0.150000 0.000000 0.150000 ( 0.153557)
So, doing rand(a..b)
is the right thing
To build off what Martjin was saying. I'd use string interpolation/formatting.
In Python 2.x which seems to be what you're using due to the lack of parenthesis around the print function you do:
print 'Value is "%d"' % value
In Python 3.x you'd use the format method instead, so you're code would look like this.
message = 'Value is "{}"'
print(message.format(value))
In layman's terms, I've always said an API is like a translator between two people who speak different languages. In software, data can be consumed or distributed using an API (or translator) so that two different kinds of software can communicate. Good software has a strong translator (API) that follows rules and protocols for security and data cleanliness.
I"m a Marketer, not a coder. This all might not be quite right, but it's what I"ve tried to express for about 10 years now...
You can use the different states of the link for different images example
You can also use the same image (css sprite) which combines all the different states and then just play with the padding and position to show only the one you want to display.
Another option would be using javascript to replace the image, that would give you more flexibility
reading through this 6yrs later and thought I'd also take a hack at it, also in the TIMTOWTDI vein...:D, hoping it isn't incorrect 'JS etiquette'.
I usually set up a var with the condition and then refer to it later on..i.e;
// var set up globally OR locally depending on your requirements
var hC;
function(el) {
var $this = el;
hC = $this.hasClass("test");
// use the variable in the conditional statement
if (!hC) {
//
}
}
Although I should mention that I do this because I mainly use the conditional ternary operator and want clean code. So in this case, all i'd have is this:
hC ? '' : foo(x, n) ;
// OR -----------
!hC ? foo(x, n) : '' ;
...instead of this:
$this.hasClass("test") ? '' : foo(x, n) ;
// OR -----------
(!$this.hasClass("test")) ? foo(x, n) : '' ;
Same problem for me on apache http client 4.5.5 adding default header
Connection: close
resolve the problem
<script src="http://code.angularjs.org/1.2.0-rc.2/angular.js"></script>
<script type="text/javascript">
function controller($scope) {
$scope.data = {
show: true,
hide: false
};
}
</script>
<div ng-controller="controller">
<div ng-show="data.show"> If true the show otherwise hide. </div>
<div ng-hide="!(data.hide)"> If true the show otherwise hide.</div>
</div>
Let's suppose that you have a system running Ubuntu 16.04, 16.10, or 17.04, and you want Python 3.6 to be the default Python.
If you're using Ubuntu 16.04 LTS, you'll need to use a PPA:
sudo add-apt-repository ppa:jonathonf/python-3.6 # (only for 16.04 LTS)
Then, run the following (this works out-of-the-box on 16.10 and 17.04):
sudo apt update
sudo apt install python3.6
sudo apt install python3.6-dev
sudo apt install python3.6-venv
wget https://bootstrap.pypa.io/get-pip.py
sudo python3.6 get-pip.py
sudo ln -s /usr/bin/python3.6 /usr/local/bin/python3
sudo ln -s /usr/local/bin/pip /usr/local/bin/pip3
# Do this only if you want python3 to be the default Python
# instead of python2 (may be dangerous, esp. before 2020):
# sudo ln -s /usr/bin/python3.6 /usr/local/bin/python
When you have completed all of the above, each of the following shell commands should indicate Python 3.6.1
(or a more recent version of Python 3.6):
python --version # (this will reflect your choice, see above)
python3 --version
$(head -1 `which pip` | tail -c +3) --version
$(head -1 `which pip3` | tail -c +3) --version
A query's projection can only have one instance of a given name. As your WHERE clause shows, you have several tables with a column called ID. Because you are selecting *
your projection will have several columns called ID. Or it would have were it not for the compiler hurling ORA-00918.
The solution is quite simple: you will have to expand the projection to explicitly select named columns. Then you can either leave out the duplicate columns, retaining just (say) COACHES.ID or use column aliases: coaches.id as COACHES_ID
.
Perhaps that strikes you as a lot of typing, but it is the only way. If it is any comfort, SELECT *
is regarded as bad practice in production code: explicitly named columns are much safer.
I had the same issue today recently installing VS2015 Community Edition Update 1.
I fixed the problem by just adding the "SQL Server Data Tools" from the VS2015 setup installer... When I ran the installer the first time I selected the "Custom" installation type instead of the "Default". I wanted to see what install options were available but not select anything different than what was already ticked. My assumption was that whatever was already ticked was essentially the default install. But its not.
I see steps are scattered in different answers. Based on my recent experience with this pytesseract error on Windows, writing different steps in sequence to make it easier to resolve the error:
1. Install tesseract using windows installer available at: https://github.com/UB-Mannheim/tesseract/wiki
2. Note the tesseract path from the installation. Default installation path at the time of this edit was: C:\Users\USER\AppData\Local\Tesseract-OCR
. It may change so please check the installation path.
3. pip install pytesseract
4. Set the tesseract path in the script before calling image_to_string
:
pytesseract.pytesseract.tesseract_cmd = r'C:\Users\USER\AppData\Local\Tesseract-OCR\tesseract.exe'
Your solution is nearly correct. You could add DISTINCT:
SELECT
people.pe_name,
COUNT(distinct orders.ord_id) AS num_orders,
COUNT(items.item_id) AS num_items
FROM
people
INNER JOIN orders ON (orders.pe_id = people.pe_id)
INNER JOIN items ON items.pe_id = people.pe_id
GROUP BY
people.pe_id;
For the record, if you wouldn't be using credentials, this error also shows when you are setting the request validator in your POST/PUT method to "validate body, query string parameters and HEADERS", or the other option "validate query string parameters and HEADERS"....in that case it will look for the credentials on the header and reject the request. To sum it up, if you don't intend to send credentials and want to keep it open you should not set that option in request validator(set it to either NONE or to validate body)
Adding to the answers above -
To use in a script, use the following :-
result=`ps aux | grep -i "myscript.sh" | grep -v "grep" | wc -l`
if [ $result -ge 1 ]
then
echo "script is running"
else
echo "script is not running"
fi
There is a typo error in define arguments, change DB_HOST into DB_SERVER and DB_USER into DB_USERNAME:
<?php
define("DB_SERVER", "localhost");
define("DB_USERNAME", "root");
define("DB_PASSWORD", "");
define("DB_DATABASE", "databasename");
$db = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
?>
Below solution worked for me: Navigate to Project->Clean.. Clean all the projects referenced by Tomcat server Refresh the project you're trying to run on Tomcat
Try to run the server afterwards
Figured it out for myself in the end. It is simple, I was just missing the ** operator to unpack the dictionary
So my example becomes:
d = dict(p1=1, p2=2)
def f2(p1,p2):
print p1, p2
f2(**d)
I was struggling with the same thing, running a shell script that set variables, then wanting to use the variables in the shared-pom. The goal was to have environment variables replace strings in my project files using the com.google.code.maven-replacer-plugin.
Using ${env.foo}
or ${env.FOO}
didn't work for me. Maven just wasn't finding the variable. What worked was passing the variable in as a command-line parameter in Maven. Here's the setup:
Set the variable in the shell script. If you're launching Maven in a sub-script, make sure the variable is getting set, e.g. using source ./maven_script.sh
to call it from the parent script.
In shared-pom, create a command-line param that grabs the environment variable:
<plugin> ... <executions> <executions> ... <execution> ... <configuration> <param>${foo}</param> <!-- Note this is *not* ${env.foo} --> </configuration>
In com.google.code.maven-replacer-plugin, make the replacement value ${foo}
.
In my shell script that calls maven, add this to the command: -Dfoo=$foo
What ever attribute is added to the button/anchor/link to disable it, bootstrap is just adding style to it and user will still be able to click it while there is still onclick event. So my simple solution is to check if it is disabled and remove/add onclick event:
if (!('#button').hasAttr('disabled'))
$('#button').attr('onclick', 'someFunction();');
else
$('#button').removeattr('onclick');
$.ajax({
url: 'http://url.of.my.server/submit',
dataType: "jsonp",
jsonp: 'callback',
jsonpCallback: 'jsonp_callback'
});
jsonp is the querystring parameter name that is defined to be acceptable by the server while the jsonpCallback is the javascript function name to be executed at the client.
When you use such url:
url: 'http://url.of.my.server/submit?callback=?'
the question mark ? at the end instructs jQuery to generate a random function while the predfined behavior of the autogenerated function will just invoke the callback -the sucess function in this case- passing the json data as a parameter.
$.ajax({
url: 'http://url.of.my.server/submit?callback=?',
success: function (data, status) {
mySurvey.closePopup();
},
error: function (xOptions, textStatus) {
mySurvey.closePopup();
}
});
The same goes here if you are using $.getJSON with ? placeholder it will generate a random function while the predfined behavior of the autogenerated function will just invoke the callback:
$.getJSON('http://url.of.my.server/submit?callback=?',function(data){
//process data here
});
Below is an example of the correct way I think. At least it is what I use. You need to do Response.Clear to get rid of any headers that are already populated. You need to pass the correct ContentType of text/xml. That is the way you serve xml. In general you want to serve it as charset UTF-8 as that is what most parsers are expecting. But I don't think it has to be that. But if you change it make sure to change your xml document declaration and indicate the charset in there. You need to use the XmlWriter so you can actually write in UTF-8 and not whatever charset is the default. And to have it properly encode your xml data in UTF-8.
' -----------------------------------------------------------------------------
' OutputDataSetAsXML
'
' Description: outputs the given dataset as xml to the response object
'
' Arguments:
' dsSource - source data set
'
' Dependencies:
'
' History
' 2006-05-02 - WSR : created
'
Private Sub OutputDataSetAsXML(ByRef dsSource As System.Data.DataSet)
Dim xmlDoc As System.Xml.XmlDataDocument
Dim xmlDec As System.Xml.XmlDeclaration
Dim xmlWriter As System.Xml.XmlWriter
' setup response
Me.Response.Clear()
Me.Response.ContentType = "text/xml"
Me.Response.Charset = "utf-8"
xmlWriter = New System.Xml.XmlTextWriter(Me.Response.OutputStream, System.Text.Encoding.UTF8)
' create xml data document with xml declaration
xmlDoc = New System.Xml.XmlDataDocument(dsSource)
xmlDoc.DataSet.EnforceConstraints = False
xmlDec = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", Nothing)
xmlDoc.PrependChild(xmlDec)
' write xml document to response
xmlDoc.WriteTo(xmlWriter)
xmlWriter.Flush()
xmlWriter.Close()
Response.End()
End Sub
' -----------------------------------------------------------------------------
For those who are trying to use gulp for swagger local deployment, following code will help
var gulp = require("gulp");
var yaml = require("js-yaml");
var path = require("path");
var fs = require("fs");
//Converts yaml to json
gulp.task("swagger", done => {
var doc = yaml.safeLoad(fs.readFileSync(path.join(__dirname,"api/swagger/swagger.yaml")));
fs.writeFileSync(
path.join(__dirname,"../yourjsonfile.json"),
JSON.stringify(doc, null, " ")
);
done();
});
//Watches for changes
gulp.task('watch', function() {
gulp.watch('api/swagger/swagger.yaml', gulp.series('swagger'));
});
FWIW, htpasswd -n username
will output the result directly to stdout, and avoid touching files altogether.
You have no storage allocated for word
- it's just a dangling pointer.
Change:
char * word;
to:
char word[256];
Note that 256 is an arbitrary choice here - the size of this buffer needs to be greater than the largest possible string that you might encounter.
Note also that fgets is a better (safer) option then scanf for reading arbitrary length strings, in that it takes a size
argument, which in turn helps to prevent buffer overflows:
fgets(word, sizeof(word), stdin);
(Taken from my comment)
pip
won't handle system level dependencies. You'll have to apt-get install libfreetype6-dev
before continuing. (It even says so right in your output. Try skimming over it for such errors next time, usually build outputs are very detailed)
The code below will write the 4 unicode chars (represented by decimals) for the word "be" in Japanese. Yes, the verb "be" in Japanese has 4 chars! The value of characters is in decimal and it has been read into an array of String[] -- using split for instance. If you have Octal or Hex, parseInt take a radix as well.
// pseudo code
// 1. init the String[] containing the 4 unicodes in decima :: intsInStrs
// 2. allocate the proper number of character pairs :: c2s
// 3. Using Integer.parseInt (... with radix or not) get the right int value
// 4. place it in the correct location of in the array of character pairs
// 5. convert c2s[] to String
// 6. print
String[] intsInStrs = {"12354", "12426", "12414", "12377"}; // 1.
char [] c2s = new char [intsInStrs.length * 2]; // 2. two chars per unicode
int ii = 0;
for (String intString : intsInStrs) {
// 3. NB ii*2 because the 16 bit value of Unicode is written in 2 chars
Character.toChars(Integer.parseInt(intsInStrs[ii]), c2s, ii * 2 ); // 3 + 4
++ii; // advance to the next char
}
String symbols = new String(c2s); // 5.
System.out.println("\nLooooonger code point: " + symbols); // 6.
// I tested it in Eclipse and Java 7 and it works. Enjoy
It is fairly easy to understand. The "-1" stands for "unknown dimension" which can should be infered from another dimension. In this case, if you set your matrix like this:
a = numpy.matrix([[1, 2, 3, 4], [5, 6, 7, 8]])
Modify your matrix like this:
b = numpy.reshape(a, -1)
It will call some deafult operations to the matrix a, which will return a 1-d numpy array/martrix.
However, I don't think it is a good idea to use code like this. Why not try:
b = a.reshape(1,-1)
It will give you the same result and it's more clear for readers to understand: Set b as another shape of a. For a, we don't how much columns it should have(set it to -1!), but we want a 1-dimension array(set the first parameter to 1!).
Sure you just need to setup a local web server. Check out XAMPP: http://www.apachefriends.org/en/xampp.html
That will get you up and running in about 10 minutes.
There is now a way to run php locally without installing a server: https://stackoverflow.com/a/21872484/672229
Yes but the files need to be processed. For example you can install test servers like mamp / lamp / wamp depending on your plateform.
Basically you need apache / php running.
Simply add Templates URL:
<a href="{% url 'service_data' d.id %}">
...XYZ
</a>
Used in django 2.0
Better way to reset your form with jQuery is Simply trigger
a reset
event on your form.
$("#btn1").click(function () {
$("form").trigger("reset");
});
Jason Robinson's answer and Sami Eltamawy answer are excelent.
Just an improvement to complete the aproach, you should use compat ExifInterface.
com.android.support:exifinterface:${lastLibVersion}
You will be able to instantiate the ExifInterface(pior API <24) with InputStream
(from ContentResolver
) instead of uri paths avoiding "File not found exceptions"
https://android-developers.googleblog.com/2016/12/introducing-the-exifinterface-support-library.html
HttpContext.Response.AddHeader("content-disposition","attachment; filename=form.pdf");
if the filename is generating dynamically then how to define filename here, it is generating through guid here.
If you have a text as
var sampleText ="ä_öü_ßÄ_ TESTED Ö_Ü!@#$%^&())(&&++===.XYZ"
To replace all special character (!@#$%^&())(&&++= ==.) without replacing the characters(including umlaut)
Use below regex
sampleText = sampleText.replace(/[`~!@#$%^&*()|+-=?;:'",.<>{}[]\/\s]/gi,'');
OUTPUT : sampleText = "ä_öü_ßÄ____TESTED_Ö_Ü_____________________XYZ"
This would replace all with an underscore which is provided as second argument to the replace function.You can add whatever you want as per your requirement
I'm not sure about SQL server, but in postgres you could do something like this:
SELECT
SUBSTRING(fullname, '(\\w+)') as firstname,
SUBSTRING(fullname, '\\w+\\s(\\w+)\\s\\w+') as middle,
COALESCE(SUBSTRING(fullname, '\\w+\\s\\w+\\s(\\w+)'), SUBSTRING(fullname, '\\w+\\s(\\w+)')) as lastname
FROM
public.person
The regex expressions could probably be a bit more concise; but you get the point. This does by the way not work for persons having two double names (in the Netherlands we have this a lot 'Jan van der Ploeg') so I'd be very careful with the results.
private void drawArrows(Point[] point, Canvas canvas, Paint paint) {
float [] points = new float[8];
points[0] = point[0].x;
points[1] = point[0].y;
points[2] = point[1].x;
points[3] = point[1].y;
points[4] = point[2].x;
points[5] = point[2].y;
points[6] = point[0].x;
points[7] = point[0].y;
canvas.drawVertices(VertexMode.TRIANGLES, 8, points, 0, null, 0, null, 0, null, 0, 0, paint);
Path path = new Path();
path.moveTo(point[0].x , point[0].y);
path.lineTo(point[1].x,point[1].y);
path.lineTo(point[2].x,point[2].y);
canvas.drawPath(path,paint);
}
Try:
Excel.Application oXL;
Excel._Workbook oWB;
Excel._Worksheet oSheet;
Excel.Range oRng;
oXL = new Excel.Application();
oXL.Visible = true;
oWB = (Excel._Workbook)(oXL.Workbooks.Add(Missing.Value));
oSheet = (Excel._Worksheet)oWB.Worksheets;
oSheet.Activate();
oSheet.Cells[3, 9] = "Some Text"
You should use val
instead of value
.
<script type="text/javascript" language="javascript">
$(document).ready(function () {
$('input[name="testing"]').val('Work!');
});
</script>
You can leverage Apache Commons StringUtils.isEmpty(str)
, which checks for empty strings and handles null
gracefully.
Example:
System.out.println(StringUtils.isEmpty("")); // true
System.out.println(StringUtils.isEmpty(null)); // true
Google Guava also provides a similar, probably easier-to-read method: Strings.isNullOrEmpty(str)
.
Example:
System.out.println(Strings.isNullOrEmpty("")); // true
System.out.println(Strings.isNullOrEmpty(null)); // true
'Static' files in App Engine aren't directly accessible by your app. You either need to upload them twice, or serve the static files yourself, rather than using a static handler.
If the error says it can't find Info.plist and it's looking in the wrong path, do the following:
I get the same error when I run Oracle XE instance on the same machine. As my database is Oracle, I preferred changing Glassfish's default port:
<network-listener port="9090" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>_x000D_
_x000D_
I read the comments about contacts app and how it use a theme for each contact.
Probably, contacts app has some predefine themes (for each material primary color from here: http://www.google.com/design/spec/style/color.html).
You can apply a theme before a the setContentView method inside onCreate method.
Then the contacts app can apply a theme randomly to each user.
This method is:
setTheme(R.style.MyRandomTheme);
But this method has a problem, for example it can change the toolbar color, the scroll effect color, the ripple color, etc, but it cant change the status bar color and the navigation bar color (if you want to change it too).
Then for solve this problem, you can use the method before and:
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setNavigationBarColor(getResources().getColor(R.color.md_red_500));
getWindow().setStatusBarColor(getResources().getColor(R.color.md_red_700));
}
This two method change the navigation and status bar color. Remember, if you set your navigation bar translucent, you can't change its color.
This should be the final code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.MyRandomTheme);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setNavigationBarColor(getResources().getColor(R.color.myrandomcolor1));
getWindow().setStatusBarColor(getResources().getColor(R.color.myrandomcolor2));
}
setContentView(R.layout.activity_main);
}
You can use a switch and generate random number to use random themes, or, like in contacts app, each contact probably has a predefine number associated.
A sample of theme:
<style name="MyRandomTheme" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/myrandomcolor1</item>
<item name="colorPrimaryDark">@color/myrandomcolor2</item>
<item name="android:navigationBarColor">@color/myrandomcolor1</item>
</style>
Sorry for my english.
As Shubham Jain stated, this is working to me: driver.findElement(By.id("invoice_supplier_id")).sendKeys("value"??, "new value");
function refreshPage()
{
jQuery.mobile.changePage(window.location.href, {
allowSamePageTransition: true,
transition: 'none',
reloadPage: true
});
}
Taken from here http://scottwb.com/blog/2012/06/29/reload-the-same-page-without-blinking-on-jquery-mobile/ also tested on jQuery Mobile 1.2.0
By far the easiest way to create DOC files on Linux, using PHP is with the Zend Framework component phpLiveDocx.
From the project web site:
"phpLiveDocx allows developers to generate documents by combining structured data from PHP with a template, created in a word processor. The resulting document can be saved as a PDF, DOCX, DOC or RTF file. The concept is the same as with mail-merge."
Use this code:
@for (int i = 0; i < Model.EmploymentType.Count; i++)
{
@Html.HiddenFor(m => m.EmploymentType[i].Text)
@Html.CheckBoxFor(m => m.EmploymentType[i].Checked, new { id = "YourId" })
}
I found that while adding
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
helps, sometimes it's a matter of your querying that determines how express handles it.
For instance, it could be that your parameters are passed in the URL rather than in the body
In such a case, you need to capture both the body and url parameters and use whichever is available (with preference for the body parameters in the case below)
app.route('/echo')
.all((req,res)=>{
let pars = (Object.keys(req.body).length > 0)?req.body:req.query;
res.send(pars);
});
People have recommended MailChimp which is a good vendor for bulk email. If you're looking for a good vendor for transactional email, I might be able to help.
Over the past 6 months, we used four different SMTP vendors with the goal of figuring out which was the best one.
Here's a summary of what we found...
Conclusion
SendGrid was the best with Postmark coming in second place. We never saw any hesitation in send times with either of those two - in some cases we sent several hundred emails at once - and they both have the best ROI, given a solid featureset.
In CodeIgniter you can store your session value as single or also in array format as below:
If you want store any user’s data in session like userId, userName, userContact etc, then you should store in array:
<?php
$this->load->library('session');
$this->session->set_userdata(array(
'userId' => $user->userId,
'userName' => $user->userName,
'userContact ' => $user->userContact
));
?>
Get in details with Example Demo :
http://devgambit.com/how-to-store-and-get-session-value-in-codeigniter/
Try to use the function DECODE
Ex: Decode(MYDATE, NULL, ' ', MYDATE)
If date is NULL then display ' ' (BLANK) else display the date.
The following will cover all browsers worth covering:
text-shadow: 0 0 2px #fff; /* Firefox 3.5+, Opera 9+, Safari 1+, Chrome, IE10 */
filter: progid:DXImageTransform.Microsoft.Glow(Color=#ffffff,Strength=1); /* IE<10 */
No. The method for appending an entire sequence is list.extend()
.
>>> L = [1, 2]
>>> L.extend((3, 4, 5))
>>> L
[1, 2, 3, 4, 5]
Here's some code that may help:
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
string serial_number="";
foreach (ManagementObject wmi_HD in searcher.Get())
{
serial_number = wmi_HD["SerialNumber"].ToString();
}
MessageBox.Show(serial_number);
I've never used Lua before, but I Googled it and came up with this:
Check question 1.26.
This is a common complaint. The Lua authors felt that continue was only one of a number of possible new control flow mechanisms (the fact that it cannot work with the scope rules of repeat/until was a secondary factor.)
In Lua 5.2, there is a goto statement which can be easily used to do the same job.
I had some struggle to access the previous url inside a guard.
Without implementing a custom solution, this one is working for me.
public constructor(private readonly router: Router) {
};
public ngOnInit() {
this.router.getCurrentNavigation().previousNavigation.initialUrl.toString();
}
The initial url will be the previous url page.
You have set the upstream of that branch
(see:
--set-upstream-to
all the time?"git branch -f --track my_local_branch origin/my_remote_branch # OR (if my_local_branch is currently checked out): $ git branch --set-upstream-to my_local_branch origin/my_remote_branch
(git branch -f --track
won't work if the branch is checked out: use the second command git branch --set-upstream-to
instead, or you would get "fatal: Cannot force update the current branch.
")
That means your branch is already configured with:
branch.my_local_branch.remote origin
branch.my_local_branch.merge my_remote_branch
Git already has all the necessary information.
In that case:
# if you weren't already on my_local_branch branch:
git checkout my_local_branch
# then:
git pull
is enough.
If you hadn't establish that upstream branch relationship when it came to push your 'my_local_branch
', then a simple git push -u origin my_local_branch:my_remote_branch
would have been enough to push and set the upstream branch.
After that, for the subsequent pulls/pushes, git pull
or git push
would, again, have been enough.
Assuming you have a test.json
file with the following content:
{"67790": {"1": {"kwh": 319.4}}}
Then, the code below will load
the json file, update the data inside using dict.update()
and dump
into the test.json
file:
import json
a_dict = {'new_key': 'new_value'}
with open('test.json') as f:
data = json.load(f)
data.update(a_dict)
with open('test.json', 'w') as f:
json.dump(data, f)
Then, in test.json
, you'll have:
{"new_key": "new_value", "67790": {"1": {"kwh": 319.4}}}
Hope this is what you wanted.
Thanks Jahmic for the answer. Worked properly for me.
another useful code snippet that read the values and return a string:
public static string ReadSetting(string key)
{
System.Configuration.Configuration cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
System.Configuration.AppSettingsSection appSettings = (System.Configuration.AppSettingsSection)cfg.GetSection("appSettings");
return appSettings.Settings[key].Value;
}
Got a gotcha for those with their headspace in Pandas and moving to pyspark
from pyspark import SparkConf, SparkContext
from pyspark.sql import SQLContext
spark_conf = SparkConf().setMaster("local").setAppName("MyAppName")
sc = SparkContext(conf = spark_conf)
sqlContext = SQLContext(sc)
records = [
{"colour": "red"},
{"colour": "blue"},
{"colour": None},
]
pandas_df = pd.DataFrame.from_dict(records)
pyspark_df = sqlContext.createDataFrame(records)
So if we wanted the rows that are not red:
pandas_df[~pandas_df["colour"].isin(["red"])]
Looking good, and in our pyspark DataFrame
pyspark_df.filter(~pyspark_df["colour"].isin(["red"])).collect()
So after some digging, I found this: https://issues.apache.org/jira/browse/SPARK-20617 So to include nothingness in our results:
pyspark_df.filter(~pyspark_df["colour"].isin(["red"]) | pyspark_df["colour"].isNull()).show()
When filtering a DataFrame with string values, I find that the pyspark.sql.functions
lower
and upper
come in handy, if your data could have column entries like "foo" and "Foo":
import pyspark.sql.functions as sql_fun
result = source_df.filter(sql_fun.lower(source_df.col_name).contains("foo"))
Check out this article. I believe it should help you get what you are wanting. If your table already exists, and it has data in it already, the error you are getting may be due to the auto_increment trying to assign a value that already exists for other records.
In short, as others have already mentioned in comments, sequences, as they are thought of and handled in Oracle, do not exist in MySQL. However, you can likely use auto_increment to accomplish what you want.
Without additional details on the specific error, it is difficult to provide more specific help.
UPDATE
CREATE TABLE ORD (
ORDID INT NOT NULL AUTO_INCREMENT,
//Rest of table code
PRIMARY KEY (ordid)
)
AUTO_INCREMENT = 622;
This link is also helpful for describing usage of auto_increment. Setting the AUTO_INCREMENT value appears to be a table option, and not something that is specified as a column attribute specifically.
Also, per one of the links from above, you can alternatively set the auto increment start value via an alter to your table.
ALTER TABLE ORD AUTO_INCREMENT = 622;
UPDATE 2
Here is a link to a working sqlfiddle example, using auto increment.
I hope this info helps.
in this example we run 2 line insert into query and if all of them true it run but if not no run anything and ROLLBACK
DECLARE @rowcount int set @rowcount = 0 ;
BEGIN TRANSACTION [Tran1]
BEGIN TRY
insert into [database].[dbo].[tbl1] (fld1) values('1') ;
set @rowcount = (@rowcount + @@ROWCOUNT);
insert into [database].[dbo].[tbl2] (fld1) values('2') ;
set @rowcount = (@rowcount + @@ROWCOUNT);
IF @rowcount = 2
COMMIT TRANSACTION[Tran1]
ELSE
ROLLBACK TRANSACTION[Tran1]
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION[Tran1]
END CATCH
I have the same problem, because I have angular
two times in index.html
:
<script src="https://handsontable.github.io/ngHandsontable/node_modules/angular/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
Note that the warning arises only when html5
mode is true, when my html5
mode was false, I did not see this warning.
So removing the first angular.js
solves the problem.
An easier solution has been outlined here: Validate select box
Make the value be empty and add the required attribute
<select id="select" class="required">
<option value="">Choose an option</option>
<option value="option1">Option1</option>
<option value="option2">Option2</option>
<option value="option3">Option3</option>
</select>
top5 = array[:5]
array[start:stop:step]
array[start:]
, array[:stop]
, array[::step]
import itertools
top5 = itertools.islice(my_list, 5) # grab the first five elements
You can't slice a generator directly in Python. itertools.islice()
will wrap an object in a new slicing generator using the syntax itertools.islice(generator, start, stop, step)
Remember, slicing a generator will exhaust it partially. If you want to keep the entire generator intact, perhaps turn it into a tuple or list first, like: result = tuple(generator)
I figured out the answer to the question I had that brought me to this page. Since no one has actually suggested the answer to my question, I thought I'd post it.
class k:
pass
a = k()
k2 = a.__class__
a2 = k2()
At this point, a and a2 are both instances of the same class (class k).
Add this to the stylesheet:
table {
border-collapse: collapse;
}
The reason why it behaves this way is actually described pretty well in the specification:
There are two distinct models for setting borders on table cells in CSS. One is most suitable for so-called separated borders around individual cells, the other is suitable for borders that are continuous from one end of the table to the other.
... and later, for collapse
setting:
In the collapsing border model, it is possible to specify borders that surround all or part of a cell, row, row group, column, and column group.
Just use plt.tight_layout()
before plt.show()
. It works well.
HTML5 provides Canvas.toDataURL(mimetype) which is implemented in Opera, Firefox, and Safari 4 beta. There are a number of security restrictions, however (mostly to do with drawing content from another origin onto the canvas).
So you don't need an additional library.
e.g.
<canvas id=canvas width=200 height=200></canvas>
<script>
window.onload = function() {
var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");
context.fillStyle = "green";
context.fillRect(50, 50, 100, 100);
// no argument defaults to image/png; image/jpeg, etc also work on some
// implementations -- image/png is the only one that must be supported per spec.
window.location = canvas.toDataURL("image/png");
}
</script>
Theoretically this should create and then navigate to an image with a green square in the middle of it, but I haven't tested.
Most answers here are pretty old.
In the past when un managed nand was the most popular storage technology, yaffs2 was the most common file system. This days there are few devices using un-managed nand, and those still in use are slowly migrating to ubifs.
Today most common storage is emmc (managed nand), for such devices ext4 is far more popular, but, this file system is slowly clears its way for f2fs (flash friendly fs).
Edit: f2fs will probably won't make it as the common fs for flash devices (including android)
I looked at most the solutions posted, but came across a different one that I prefer. It's simple, doesn't use threads, and works for what I want it to.
http://weblogs.asp.net/kennykerr/archive/2004/11/26/where-is-form-s-loaded-event.aspx
I added to the solution in the article and moved the code into a base class that all my forms inherit from. Now I just call one function: ShowWaitForm() during the frm_load() event of any form that needs a wait dialogue box while the form is loading. Here's the code:
public class MyFormBase : System.Windows.Forms.Form
{
private MyWaitForm _waitForm;
protected void ShowWaitForm(string message)
{
// don't display more than one wait form at a time
if (_waitForm != null && !_waitForm.IsDisposed)
{
return;
}
_waitForm = new MyWaitForm();
_waitForm.SetMessage(message); // "Loading data. Please wait..."
_waitForm.TopMost = true;
_waitForm.StartPosition = FormStartPosition.CenterScreen;
_waitForm.Show();
_waitForm.Refresh();
// force the wait window to display for at least 700ms so it doesn't just flash on the screen
System.Threading.Thread.Sleep(700);
Application.Idle += OnLoaded;
}
private void OnLoaded(object sender, EventArgs e)
{
Application.Idle -= OnLoaded;
_waitForm.Close();
}
}
MyWaitForm is the name of a form you create to look like a wait dialogue. I added a SetMessage() function to customize the text on the wait form.
I know this already has a great answer by BalusC but here is a little trick I use to get the container to tell me the correct clientId.
Here is code example as my words may not describe it best.
<p:tabView id="tabs">
<p:tab id="search" title="Search">
<h:form id="insTable">
<p:dataTable id="table" var="lndInstrument" value="#{instrumentBean.instruments}">
<p:column>
<p:commandLink id="select"
Remove the failing update within this component
oncomplete="dlg.show()">
<f:setPropertyActionListener value="#{lndInstrument}"
target="#{instrumentBean.selectedInstrument}" />
<h:outputText value="#{lndInstrument.name}" />
</p:commandLink>
</p:column>
</p:dataTable>
<p:dialog id="dlg" modal="true" widgetVar="dlg">
<h:panelGrid id="display">
Add a component within the component of the id you are trying to update using an update that will fail
<p:commandButton id="BogusButton" update="BogusUpdate"></p:commandButton>
<h:outputText value="Name:" />
<h:outputText value="#{instrumentBean.selectedInstrument.name}" />
</h:panelGrid>
</p:dialog>
</h:form>
</p:tab>
</p:tabView>
Hit this page and view the error. The error is: javax.servlet.ServletException: Cannot find component for expression "BogusUpdate" referenced from tabs:insTable: BogusButton
So the correct clientId to use would then be the bold plus the id of the target container (display in this case)
tabs:insTable:display
Just add this in the .htaccess file:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
You could use an asymmetrical border to make curves with CSS.
border-radius: 50%/100px 100px 0 0;
.box {_x000D_
width: 500px; _x000D_
height: 100px; _x000D_
border: solid 5px #000;_x000D_
border-color: #000 transparent transparent transparent;_x000D_
border-radius: 50%/100px 100px 0 0;_x000D_
}
_x000D_
<div class="box"></div>
_x000D_
>>> {i:i for i in range(1, 11)}
{1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10}
I'm late to the party, but I had this same issue working with Java 8.
This is what worked for me, on the HttpServletRequest request
object.
request.getHeader("origin");
and
request.getHeader("referer");
How I came to that conclusion:
I have a java app running on http://localhost:3000 making a Http Post to another java app I have running on http://localhost:8080.
From the Java code running on http://localhost:8080 I couldn't get the http://localhost:3000 from the HttpServletRequest using the answers above. For me using the getHeader
method with the correct string input worked.
request.getHeader("origin")
gave me "http://localhost:3000" which is what I wanted.
request.getHeader("referer")
gave me "http://localhost:3000/xxxx" where xxxx is full URL I have from the requesting app.
Simple method to sending data using java script and ajex call.
First right your form like this
<form id="frm_details" method="post" name="frm_details">
<input id="email" name="email" placeholder="Your Email id" type="text" />
<button class="subscribe-box__btn" type="submit">Need Assistance</button>
</form>
javascript logic target on form id #frm_details after sumbit
$(function(){
$("#frm_details").on("submit", function(event) {
event.preventDefault();
var formData = {
'email': $('input[name=email]').val() //for get email
};
console.log(formData);
$.ajax({
url: "/tsmisc/api/subscribe-newsletter",
type: "post",
data: formData,
success: function(d) {
alert(d);
}
});
});
})
General
Request URL:https://test.abc
Request Method:POST
Status Code:200
Remote Address:13.76.33.57:443
From Data
email:[email protected]
Piping output to xargs
will concatenate each line of output to a single line with spaces:
grep pattern file | xargs
Or any command, eg. ls | xargs
. The default limit of xargs
output is ~4096 characters, but can be increased with eg. xargs -s 8192
.
Apparently the free NetDrive software from Novell can access SFTP file servers.
This is caused when your request response is not received in given time(by timeout
request module option).
Basically to catch that error first, you need to register a handler on error
, so the unhandled error won't be thrown anymore: out.on('error', function (err) { /* handle errors here */ })
. Some more explanation here.
In the handler you can check if the error is ETIMEDOUT and apply your own logic: if (err.message.code === 'ETIMEDOUT') { /* apply logic */ }
.
If you want to request for the file again, I suggest using node-retry or node-backoff modules. It makes things much simpler.
If you want to wait longer, you can set timeout
option of request yourself. You can set it to 0 for no timeout.
I used the RowHeight
property of a range (which means cells as well). If it's zero then it's hidden.
So just loop through all rows as you would normally but in the if
condition check for that property as in If myRange.RowHeight > 0 then DoStuff
where DoStuff
is something you want to do with the visible cells.
You could use sum
function to achieve that as @EdChum mentioned in the comment:
df['C'] = df[['A', 'B']].sum(axis=1)
In [245]: df
Out[245]:
A B C
0 1 4 5
1 2 6 8
2 3 9 12
Java Language Support extension provides basic features for the Java programming language. Current editing features include:
And if you wish to contribute then the project has been moved to its own GitHub repository
We can use params
, new feature of the UI-Router:
API Reference / ui.router.state / $stateProvider
params
A map which optionally configures parameters declared in the url, or defines additional non-url parameters. For each parameter being configured, add a configuration object keyed to the name of the parameter.
See the part: "...or defines additional non-url parameters..."
So the state def would be:
$stateProvider
.state('home', {
url: "/home",
templateUrl: 'tpl.html',
params: { hiddenOne: null, }
})
Few examples form the doc mentioned above:
// define a parameter's default value
params: {
param1: { value: "defaultValue" }
}
// shorthand default values
params: {
param1: "defaultValue",
param2: "param2Default"
}
// param will be array []
params: {
param1: { array: true }
}
// handling the default value in url:
params: {
param1: {
value: "defaultId",
squash: true
} }
// squash "defaultValue" to "~"
params: {
param1: {
value: "defaultValue",
squash: "~"
} }
EXTEND - working example: http://plnkr.co/edit/inFhDmP42AQyeUBmyIVl?p=info
Here is an example of a state definition:
$stateProvider
.state('home', {
url: "/home",
params : { veryLongParamHome: null, },
...
})
.state('parent', {
url: "/parent",
params : { veryLongParamParent: null, },
...
})
.state('parent.child', {
url: "/child",
params : { veryLongParamChild: null, },
...
})
This could be a call using ui-sref:
<a ui-sref="home({veryLongParamHome:'Home--f8d218ae-d998-4aa4-94ee-f27144a21238'
})">home</a>
<a ui-sref="parent({
veryLongParamParent:'Parent--2852f22c-dc85-41af-9064-d365bc4fc822'
})">parent</a>
<a ui-sref="parent.child({
veryLongParamParent:'Parent--0b2a585f-fcef-4462-b656-544e4575fca5',
veryLongParamChild:'Child--f8d218ae-d998-4aa4-94ee-f27144a61238'
})">parent.child</a>
Check the example here
You can also use constants instead of strings to specify the mode you want. The benefit is if you make a typo in a constant name, your program will raise an runtime exception.
The constants are File::RDONLY
or File::WRONLY
or File::CREAT
. You can also combine them if you like.
I have users who have not been completing all required data.
<cfset unloadCheck=0>//a ColdFusion precheck in my page generation to see if unload check is needed
var erMsg="";
$(document).ready(function(){
<cfif q.myData eq "">
<cfset unloadCheck=1>
$("#myInput").change(function(){
verify(); //function elsewhere that checks all fields and populates erMsg with error messages for any fail(s)
if(erMsg=="") window.onbeforeunload = null; //all OK so let them pass
else window.onbeforeunload = confirmExit(); //borrowed from Jantimon above;
});
});
<cfif unloadCheck><!--- if any are outstanding, set the error message and the unload alert --->
verify();
window.onbeforeunload = confirmExit;
function confirmExit() {return "Data is incomplete for this Case:"+erMsg;}
</cfif>
I wasn't going to answer this question but there are two answers here (that are getting voted up!) that are just plain wrong. Consider these expressions:
String a = "a" + "b" + "c";
String b = System.getProperty("blah") + "b";
The first is evaluated at compile-time. The second is evaluated at run-time.
So never replace constant concatenations (of any type) with StringBuilder, StringBuffer or the like. Only use those where variables are invovled and generally only when you're appending a lot of operands or you're appending in a loop.
If the characters are constant, this is fine:
String s = "" + 'a' + 'b' + 'c';
If however they aren't, consider this:
String concat(char... chars) {
if (chars.length == 0) {
return "";
}
StringBuilder s = new StringBuilder(chars.length);
for (char c : chars) {
s.append(c);
}
return s.toString();
}
as an appropriate solution.
However some might be tempted to optimise:
String s = "Name: '" + name + "'"; // String name;
into this:
String s = new StringBuilder().append("Name: ").append(name).append("'").toString();
While this is well-intentioned, the bottom line is DON'T.
Why? As another answer correctly pointed out: the compiler does this for you. So in doing it yourself, you're not allowing the compiler to optimise the code or not depending if its a good idea, the code is harder to read and its unnecessarily complicated.
For low-level optimisation the compiler is better at optimising code than you are.
Let the compiler do its job. In this case the worst case scenario is that the compiler implicitly changes your code to exactly what you wrote. Concatenating 2-3 Strings might be more efficient than constructing a StringBuilder so it might be better to leave it as is. The compiler knows whats best in this regard.
Apparently, I needed to run OpenSSL as root in order for it to have permission to the seeding file.
Is there any 64 bit Visual Studio at all?
Yes literally there is one called "Visual Studio" and is 64bit, but well,, on Mac not on Windows
Why not?
Decision making is electro-chemical reaction made in our brain and that have an activation point (Nerdest answer I can come up with, but follow). Same situation happened in history: Windows 64!...
So in order to answer this fully I want you to remember old days. Imagine reasons for "why not we see 64bit Windows" are there at the time. I think at the time for Windows64 they had exact same reasons others have enlisted here about "reasons why not 64bit VS on windows" were on "reasons why not 64bit Windows" too. Then why they did start development for Windows 64bit? Simple! If they didn't succeed in making 64bit Windows I bet M$ would have been a history nowadays. If same reasons forcing M$ making 64bit Windows starts to appear on need for 64Bit VS then I bet we will see 64bit VS, even though very same reasons everyone else here enlisted will stay same! In time the limitations of 32bit may hit VS as well, so most likely something like below start to happen:
I put my bets on Visual Studio Code taking the place in time; I guess bifurcation point for it will be some CPU manufacturer X starts to compete x86_64 architecture taking its place on mainstream market for laptop and/or workstation,
You can use linking property <Text style={{color: 'skyblue'}} onPress={() => Linking.openURL('http://yahoo.com')}> Yahoo
You may create local repository on your project
For example if you have libs
folder in project structure
In libs
folder you should create directory structure like: /groupId/artifactId/version/artifactId-version.jar
In your pom.xml you should register repository
<repository>
<id>ProjectRepo</id>
<name>ProjectRepo</name>
<url>file://${project.basedir}/libs</url>
</repository>
and add dependency as usual
<dependency>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<version>version</version>
</dependency>
That is all.
For detailed information: How to add external libraries in Maven
This fixed issues for me:
<style>
.super-centered {
position:absolute;
width:100%;
height:100%;
text-align:center;
vertical-align:middle;
z-index: 9999;
}
</style>
<table class="super-centered"><tr><td style="width:100%;height:100%;" align="center" valign="middle" >
<img alt="Loading ..." src="/ALHTheme/themes/html/ALHTheme/images/loading.gif">
</td></tr></table>
I ran into the same scenario
I opened "System Preferences", clicked "MySQL", then clicked "Initialize Database" button. I entered a new password and saved it in a safe place. After that i restarted the MySql Instance (in the System Preferences dialog as well). After that i opened MySqlWorkbench and opened the default connection, entered the password i set before and: Viola, i can do whatever i want :-)
import os
for root, dirs, files in os.walk(top, topdown=False):
for name in dirs:
print os.path.join(root, name)
Walk is a good built-in for what you are doing
insert into tbl2
select field1,field2,... from tbl1
where not exists
(
select field1,field2,...
from person2
where (tbl1.field1=tbl2.field1 and
tbl1.field2=tbl2.field2 and .....)
)
This variant allows getting desired precision:
>>> a = 1234.5678
>>> (lambda x, y: (int(x), int(x*y) % y/y))(a, 1e0)
(1234, 0.0)
>>> (lambda x, y: (int(x), int(x*y) % y/y))(a, 1e1)
(1234, 0.5)
>>> (lambda x, y: (int(x), int(x*y) % y/y))(a, 1e15)
(1234, 0.5678)
Use onclick="this.value=''"
:
<input name="Name" value="Enter Your Name" onclick="this.value=''">
Based on Antony Hatchkins's answer:
The official way to disable the popup seems to be like this:
Pack your extension (chrome://extensions/
, tick at 'Developer mode', hit 'Pack extension...') and install it via drag-and-dropping the .crx
file into the chrome://extensions
page.
(Since the extension is not from Chrome Web Store, it will be disabled by default.)
Then for Windows:
nmgnihglilniboicepgjclfiageofdfj
Start
> Run
, and type regedit
<ENTER>
HKLM\Software\Policies\Google\Chrome\ExtensionInstallWhitelist
(create it if not exists), create a new string for each extension you want to enable with sequential names (indices), e.g. 1, 2, ...1
and value nmgnihglilniboicepgjclfiageofdfj
That's it!
Note: When you update a whitelisted extension, you do not have to follow the same steps since the ID of the extension will not change.
You can use DATEPART(dw, GETDATE())
but be aware that the result will rely on SQL server setting @@DATEFIRST
value which is the first day of week setting (In Europe default value 7 which is Sunday).
If you want to change the first day of week to another value, you could use SET DATEFIRST
but this may affect everywhere in your query session which you do not want.
Alternative way is to explicitly specify the first day of week value as parameter and avoid depending on @@DATEFIRST
setting. You can use the following formula to achieve that when need it:
(DATEPART(dw, GETDATE()) + @@DATEFIRST + 6 - @WeekStartDay) % 7 + 1
where @WeekStartDay
is the first day of the week you want for your system (from 1 to 7 which means from Monday to Sunday).
I have wrapped it into below function so we can reuse it easily:
CREATE FUNCTION [dbo].[GetDayInWeek](@InputDateTime DATETIME, @WeekStartDay INT)
RETURNS INT
AS
BEGIN
--Note: @WeekStartDay is number from [1 - 7] which is from Monday to Sunday
RETURN (DATEPART(dw, @InputDateTime) + @@DATEFIRST + 6 - @WeekStartDay) % 7 + 1
END
Example usage:
GetDayInWeek('2019-02-04 00:00:00', 1)
It is equivalent to following (but independent to SQL server DATEFIRST setting):
SET DATEFIRST 1
DATEPART(dw, '2019-02-04 00:00:00')
$output = preg_replace('/\s+/', ' ',$input);
\s is shorthand for [ \t\n\r]
. Multiple spaces will be replaced with single space.
It works , but sometimes it doesn't (check the below example)
<?php
session_start();
$_SESSION['name']="shankar";
if(isset($_SESSION['name']))
{
echo $_SESSION['name']; // Outputs shankar
}
session_destroy();
echo $_SESSION['name']; // Still outputs shankar
Weird!! Right ?
In the above scenario , if you replace session_destroy();
with unset($_SESSION['name']);
it works as expected.
But i want to destroy all variables not just a single one !
Yeah there is a fix for this too. Just unset the $_SESSION
array. [Credits Ivo Pereira]
unset($_SESSION);
Doing
df.index = pd.to_datetime(df.index, errors='coerce')
the data type of the index has changed to
Try something like below to achieve your desired result
input {
max-width: 100%;
}
If you're not using entities but Native SQL as shown here then you might want to get the last inserted id as shown below:
$entityManager->getConnection()->lastInsertId()
For databases with sequences such as PostgreSQL please note that you can provide the sequence name as the first parameter of the lastInsertId
method.
$entityManager->getConnection()->lastInsertId($seqName = 'my_sequence')
For more information take a look at the code on GitHub here and here.
if the applications are C#, you can use ClickOnce deployment, which is a good option if you can't guarentee the user will have the app, however you'll have to re-build the apps with deployment options and grab some boilerplate code from each project.
You can also use Javascript.
Or you can register an application to handle a new web protocol you can define. This could also be an "app selection" protocol, so each time an app is clicked it would link to a page on your new protocol, all handling of this protocol is then passed to your "selection app" which uses arguments to find and launch an app on the clients PC.
HTH
I was stuck here too. copy-webpack-plugin worked for me.
However, 'copy-webpack-plugin' was not necessary in my case (i learned later).
webpack ignores root paths
example
<img src="/images/logo.png'>
Hence, to make this work without using 'copy-webpack-plugin' use '~' in paths
<img src="~images/logo.png'>
'~' tells webpack to consider 'images' as a module
note: you might have to add the parent directory of images directory in
resolve: {
modules: [
'parent-directory of images',
'node_modules'
]
}
Better and clean example using JS only
Reference: TheDeveloperBlog.com
Step 1 - Create your java script and place it in your HTML page.
<script type="text/javascript">
function ShowLoading(e) {
var div = document.createElement('div');
var img = document.createElement('img');
img.src = 'loading_bar.GIF';
div.innerHTML = "Loading...<br />";
div.style.cssText = 'position: fixed; top: 5%; left: 40%; z-index: 5000; width: 422px; text-align: center; background: #EDDBB0; border: 1px solid #000';
div.appendChild(img);
document.body.appendChild(div);
return true;
// These 2 lines cancel form submission, so only use if needed.
//window.event.cancelBubble = true;
//e.stopPropagation();
}
</script>
in your form call the java script function on submit event.
<form runat="server" onsubmit="ShowLoading()">
</form>
Soon after you submit the form, it will show you the loading image.
It worked for me by executing "python37 -m pip install openpyxl"
MYISAM:
INNODB:
For correlations you can just use the corr function (statistics toolbox)
corr(A_1(:), A_2(:))
Note that you can also just use
corr(A_1, A_2)
But the linear indexing guarantees that your vectors don't need to be transposed.
Empty array for empty collections and null
for everything else.
If a value contains a comma, a newline character or a double quote, then the string must be enclosed in double quotes. E.g: "Newline char in this field \n".
You can use below online tool to escape "" and , operators. https://www.freeformatter.com/csv-escape.html#ad-output
To wrap in single quotes (for example) ciw'<C-r>"'<esc>
works, but repeat won't work. Try:
ciw'<C-r><C-o>"'<esc>
This puts the contents of the default register "literally". Now you can press .
on any word to wrap it in quotes. To learn more see :h[elp] i_ctrl-r
and more about text objects at :h text-objects
Source: http://vimcasts.org/episodes/pasting-from-insert-mode/
I created custom styles by just overriding jQuery classes in inline style. So on top of the page, you have the jQuery CSS linked and right after that override the classes you need to modify:
<head>
<link href="/Content/theme/base/jquery.ui.all.css" rel="stylesheet"/>
<style type="text/css">
.ui-dialog .ui-dialog-content
{
position: relative;
border: 0;
padding: .5em 1em;
background: none;
overflow: auto;
zoom: 1;
background-color: #ffd;
border: solid 1px #ea7;
}
.ui-dialog .ui-dialog-titlebar
{
display:none;
}
.ui-widget-content
{
border:none;
}
</style>
</head>
You can send email without Outlook in VBScript using the CDO.Message object. You will need to know the address of your SMTP server to use this:
Set MyEmail=CreateObject("CDO.Message")
MyEmail.Subject="Subject"
MyEmail.From="[email protected]"
MyEmail.To="[email protected]"
MyEmail.TextBody="Testing one two three."
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'SMTP Server
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"
'SMTP Port
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
MyEmail.Configuration.Fields.Update
MyEmail.Send
set MyEmail=nothing
If your SMTP server requires a username and password then paste these lines in above the MyEmail.Configuration.Fields.Update
line:
'SMTP Auth (For Windows Auth set this to 2)
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
'Username
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername")="username"
'Password
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword")="password"
More information on using CDO to send email with VBScript can be found on the link below: http://www.paulsadowski.com/wsh/cdo.htm
You can deep copy automatically with XStream, from http://x-stream.github.io/:
XStream is a simple library to serialize objects to XML and back again.
Add it to your project (if using maven)
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
Then
DummyBean dum = new DummyBean();
dum.setDummy("foo");
DummyBean dumCopy = (DummyBean) XSTREAM.fromXML(XSTREAM.toXML(dum));
With this you have a copy without the need to implement any cloning interface.
Not seeing the need for any object malarky myself. Simple have a variable which is an integer. When you start a request, increment the number. When one completes, decrement it. When it's zero, there are no requests in progress, so you're done.
$('#button').click(function() {
var inProgress = 0;
function handleBefore() {
inProgress++;
};
function handleComplete() {
if (!--inProgress) {
// do what's in here when all requests have completed.
}
};
$.ajax({
beforeSend: handleBefore,
complete: function () {
// whatever
handleComplete();
// whatever
}
});
$.ajax({
beforeSend: handleBefore,
complete: function () {
// whatever
handleComplete();
// whatever
}
});
$.ajax({
beforeSend: handleBefore,
complete: function () {
// whatever
handleComplete();
// whatever
}
});
});
If you are using NumPy arrays, shape can be used. For example
>>> a = numpy.array([[[1,2,3],[1,2,3]],[[12,3,4],[2,1,3]]])
>>> a
array([[[ 1, 2, 3],
[ 1, 2, 3]],
[[12, 3, 4],
[ 2, 1, 3]]])
>>> a.shape
(2, 2, 3)
Some online API's work pretty well: ocr.space and Google Cloud Vision. Both of these are free, as long as you do less than 1000 OCR's per month. You can drag & drop an image to do a quick manual test to see how they perform for your images.
I find OCR.space easier to use (no messing around with nuget libraries), but, for my purpose, Google Cloud Vision provided slightly better results than OCR.space.
Google Cloud Vision example:
GoogleCredential cred = GoogleCredential.FromJson(json);
Channel channel = new Channel(ImageAnnotatorClient.DefaultEndpoint.Host, ImageAnnotatorClient.DefaultEndpoint.Port, cred.ToChannelCredentials());
ImageAnnotatorClient client = ImageAnnotatorClient.Create(channel);
Image image = Image.FromStream(stream);
EntityAnnotation googleOcrText = client.DetectText(image).First();
Console.Write(googleOcrText.Description);
OCR.space example:
string uri = $"https://api.ocr.space/parse/imageurl?apikey=helloworld&url={imageUri}";
string responseString = WebUtilities.DoGetRequest(uri);
OcrSpaceResult result = JsonConvert.DeserializeObject<OcrSpaceResult>(responseString);
if ((!result.IsErroredOnProcessing) && !String.IsNullOrEmpty(result.ParsedResults[0].ParsedText))
return result.ParsedResults[0].ParsedText;
I use VSPerfMon which is the StandAlone Visual Studio Profiler. I wrote a GUI tool to help me run it and look at the results.
I simply solve this problem like this, which should work in all browsers:
ul li {
color: red
}
ul li span {
color: blue;
}
_x000D_
<ul>
<li><span>Foo</span></li>
<li><span>Bar</span></li>
<li><span>Bat</span></li>
</ul>
_x000D_
This will check for empty textarea as well as will not allow only Spaces in textarea coz that looks empty too.
var txt_msg = $("textarea").val();
if (txt_msg.replace(/^\s+|\s+$/g, "").length == 0 || txt_msg=="") {
return false;
}
Go to first line
:1
or Ctrl + Home
Go to last line
:%
or Ctrl + End
Go to another line (f.i. 27)
:27
[Works On VIM 7.4 (2016) and 8.0 (2018)]
Add the annotation @GeneratedValue to the bean you are inserting.
The answer using jQuery that everyone seems to like has a major flaw, which is it is not scalable (at least as it is written). I think Martin Hansen has the right idea, which is to use HTML5 data-*
attributes. And you can even use the apostrophe correctly:
html:
<div class="task" data-task-owner="Joe">mop kitchen</div>
<div class="task" data-task-owner="Charles" data-apos="1">vacuum hallway</div>
css:
div.task:before { content: attr(data-task-owner)"'s task - " ; }
div.task[data-apos]:before { content: attr(data-task-owner)"' task - " ; }
output:
Joe's task - mop kitchen
Charles' task - vacuum hallway
You could use this query to get the no of indexes as well as the index names of each table in specified database.
SELECT TABLE_NAME,
COUNT(1) index_count,
GROUP_CONCAT(DISTINCT(index_name) SEPARATOR ',\n ') indexes
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = 'mydb'
AND INDEX_NAME != 'primary'
GROUP BY TABLE_NAME
ORDER BY COUNT(1) DESC;
our problem was that the hard drive was down to zero space available.