Kotlin supports type aliases https://kotlinlang.org/docs/reference/type-aliases.html. You can rename types and function types.
Please go through this article. You may find this very useful:
http://mah.everybody.org/docs/ssh
Just in case the above link vanishes some day, I am capturing the main piece of the solution below:
This solution from Joseph M. Reagle by way of Daniel Starin:
Add this following to your
.bash_profile
SSH_ENV="$HOME/.ssh/agent-environment" function start_agent { echo "Initialising new SSH agent..." /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" echo succeeded chmod 600 "${SSH_ENV}" . "${SSH_ENV}" > /dev/null /usr/bin/ssh-add; } # Source SSH settings, if applicable if [ -f "${SSH_ENV}" ]; then . "${SSH_ENV}" > /dev/null #ps ${SSH_AGENT_PID} doesn't work under cywgin ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || { start_agent; } else start_agent; fi
This version is especially nice since it will see if you've already started ssh-agent and, if it can't find it, will start it up and store the settings so that they'll be usable the next time you start up a shell.
Offering a quick answer for people using Ionic. I need to show a tooltip only once so I used the $localStorage to achieve this. This is for playing a track, so when they push play, it shows the tooltip once.
$scope.storage = $localStorage; //connects an object to $localstorage
$scope.storage.hasSeenPopup = "false"; // they haven't seen it
$scope.showPopup = function() { // popup to tell people to turn sound on
$scope.data = {}
// An elaborate, custom popup
var myPopup = $ionicPopup.show({
template: '<p class="popuptext">Turn Sound On!</p>',
cssClass: 'popup'
});
$timeout(function() {
myPopup.close(); //close the popup after 3 seconds for some reason
}, 2000);
$scope.storage.hasSeenPopup = "true"; // they've now seen it
};
$scope.playStream = function(show) {
PlayerService.play(show);
$scope.audioObject = audioObject; // this allow for styling the play/pause icons
if ($scope.storage.hasSeenPopup === "false"){ //only show if they haven't seen it.
$scope.showPopup();
}
}
Try below code
I will recommend to use error handler while using vlookup because error might occur when the lookup_value is not found.
Private Sub ComboBox1_Change()
On Error Resume Next
Ret = Application.WorksheetFunction.VLookup(Me.ComboBox1.Value, Worksheets("Sheet3").Range("Names"), 2, False)
On Error GoTo 0
If Ret <> "" Then MsgBox Ret
End Sub
OR
On Error Resume Next
Result = Application.VLookup(Me.ComboBox1.Value, Worksheets("Sheet3").Range("Names"), 2, False)
If Result = "Error 2042" Then
'nothing found
ElseIf cell <> Result Then
MsgBox cell.Value
End If
On Error GoTo 0
In C++ the stack memory is where local variables get stored/constructed. The stack is also used to hold parameters passed to functions.
The stack is very much like the std::stack class: you push parameters onto it and then call a function. The function then knows that the parameters it expects can be found on the end of the stack. Likewise, the function can push locals onto the stack and pop them off it before returning from the function. (caveat - compiler optimizations and calling conventions all mean things aren't this simple)
The stack is really best understood from a low level and I'd recommend Art of Assembly - Passing Parameters on the Stack. Rarely, if ever, would you consider any sort of manual stack manipulation from C++.
Generally speaking, the stack is preferred as it is usually in the CPU cache, so operations involving objects stored on it tend to be faster. However the stack is a limited resource, and shouldn't be used for anything large. Running out of stack memory is called a Stack buffer overflow. It's a serious thing to encounter, but you really shouldn't come across one unless you have a crazy recursive function or something similar.
Heap memory is much as rskar says. In general, C++ objects allocated with new, or blocks of memory allocated with the likes of malloc end up on the heap. Heap memory almost always must be manually freed, though you should really use a smart pointer class or similar to avoid needing to remember to do so. Running out of heap memory can (will?) result in a std::bad_alloc.
This is one of the most annoying things about Maven. For me the following happens: If I add a dependency requesting more dependencies and more and more but have a slow connection, it seams to stop while downloading and timing out. While timing out all dependencies not yet fetched are marked with place holders in the .m2 cache and Maven will not (never) pick it up unless I remove the place holder entry from the cache (as other stated) by removing it.
So as far as I see it, Maven or more precise the Eclipse Maven plugin has a bug regarding this. Someone should report this.
Try with JSToolNpp and follow the snap like this then Plugins | JSTool | JSFormat.
This should work:
int hh, mm, ss;
struct tm when = {0};
sscanf_s(date, "%d:%d:%d", &hh, &mm, &ss);
when.tm_hour = hh;
when.tm_min = mm;
when.tm_sec = ss;
time_t converted;
converted = mktime(&when);
Modify as needed.
The first one should work:
> "a\nb".split("\n");
[ 'a', 'b' ]
> var a = "test.js\nagain.js"
undefined
> a.split("\n");
[ 'test.js', 'again.js' ]
Protected members can be accessed from derived classes. Private ones can't.
class Base {
private:
int MyPrivateInt;
protected:
int MyProtectedInt;
public:
int MyPublicInt;
};
class Derived : Base
{
public:
int foo1() { return MyPrivateInt;} // Won't compile!
int foo2() { return MyProtectedInt;} // OK
int foo3() { return MyPublicInt;} // OK
};??
class Unrelated
{
private:
Base B;
public:
int foo1() { return B.MyPrivateInt;} // Won't compile!
int foo2() { return B.MyProtectedInt;} // Won't compile
int foo3() { return B.MyPublicInt;} // OK
};
In terms of "best practice", it depends. If there's even a faint possibility that someone might want to derive a new class from your existing one and need access to internal members, make them Protected, not Private. If they're private, your class may become difficult to inherit from easily.
You can always check this out for more custom solutions:
x => ({}[x.name] = x);
it can been used the format specifier %x02
that format and output a hex value. For example:
>>> foo = b"tC\xfc}\x05i\x8d\x86\x05\xa5\xb4\xd3]Vd\x9cZ\x92~'6"
>>> res = ""
>>> for b in foo:
... res += "%02x" % b
...
>>> print(res)
7443fc7d05698d8605a5b4d35d56649c5a927e2736
Try this:
UPDATE business AS b
INNER JOIN business_geocode AS g ON b.business_id = g.business_id
SET b.mapx = g.latitude,
b.mapy = g.longitude
WHERE (b.mapx = '' or b.mapx = 0) and
g.latitude > 0
Since you said the query yielded a syntax error, I created some tables that I could test it against and confirmed that there is no syntax error in my query:
mysql> create table business (business_id int unsigned primary key auto_increment, mapx varchar(255), mapy varchar(255)) engine=innodb;
Query OK, 0 rows affected (0.01 sec)
mysql> create table business_geocode (business_geocode_id int unsigned primary key auto_increment, business_id int unsigned not null, latitude varchar(255) not null, longitude varchar(255) not null, foreign key (business_id) references business(business_id)) engine=innodb;
Query OK, 0 rows affected (0.01 sec)
mysql> UPDATE business AS b
-> INNER JOIN business_geocode AS g ON b.business_id = g.business_id
-> SET b.mapx = g.latitude,
-> b.mapy = g.longitude
-> WHERE (b.mapx = '' or b.mapx = 0) and
-> g.latitude > 0;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0 Changed: 0 Warnings: 0
See? No syntax error. I tested against MySQL 5.5.8.
I just used the @misir-jafarov and is working now with :
here is my code :
if (document.documentMode || /Edge/.test(navigator.userAgent)) {
jQuery('.art-img img').each(function(){
var t = jQuery(this),
s = 'url(' + t.attr('src') + ')',
p = t.parent(),
d = jQuery('<div></div>');
p.append(d);
d.css({
'height' : t.parent().css('height'),
'background-size' : 'cover',
'background-repeat' : 'no-repeat',
'background-position' : '50% 20%',
'background-image' : s
});
t.hide();
});
}
Hope it helps.
For the sake of completeness, here's another possible solution:
SELECT sensorID,timestamp,sensorField1,sensorField2
FROM sensorTable s1
WHERE timestamp = (SELECT MAX(timestamp) FROM sensorTable s2 WHERE s1.sensorID = s2.sensorID)
ORDER BY sensorID, timestamp;
Pretty self-explaining I think, but here's more info if you wish, as well as other examples. It's from the MySQL manual, but above query works with every RDBMS (implementing the sql'92 standard).
Javascript Regex Literal:
US Zip Codes: /(^\d{5}$)|(^\d{5}-\d{4}$)/
var isValidZip = /(^\d{5}$)|(^\d{5}-\d{4}$)/.test("90210");
Some countries use Postal Codes, which would fail this pattern.
One simple option is to just type form.instance.fieldName
in the template instead of form.fieldName
.
If you are using Json.Net attribute [JsonIgnore]
will simply ignore the field/property while serializing or deserialising.
public class Car
{
// included in JSON
public string Model { get; set; }
public DateTime Year { get; set; }
public List<string> Features { get; set; }
// ignored
[JsonIgnore]
public DateTime LastModified { get; set; }
}
Or you can use DataContract and DataMember attribute to selectively serialize/deserialize properties/fields.
[DataContract]
public class Computer
{
// included in JSON
[DataMember]
public string Name { get; set; }
[DataMember]
public decimal SalePrice { get; set; }
// ignored
public string Manufacture { get; set; }
public int StockCount { get; set; }
public decimal WholeSalePrice { get; set; }
public DateTime NextShipmentDate { get; set; }
}
Refer http://james.newtonking.com/archive/2009/10/23/efficient-json-with-json-net-reducing-serialized-json-size for more details
yes, thats possible. just use the rgba-syntax for your background-color.
.menue{
background-color: rgba(255, 0, 0, 0.5); //semi-transparent red
}
In XAMPP installation directory, open %XAMPP_HOME%/php/php.ini
file. Uncomment the following line:
extension=php_curl.dll
PS: If that doesn't work then check whether %XAMPP_HOME%/php/ext/php_curl.dll
file exist or not.
[Posted on behalf of fossuser] Thanks to "mu is too short" I was able to fix the bug. Here is my working code has been edited in for those looking for a nice example (since I couldn't find any others online).
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <dirent.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
void helper(DIR *, struct dirent *, struct stat, char *, int, char **);
void dircheck(DIR *, struct dirent *, struct stat, char *, int, char **);
int main(int argc, char *argv[]){
DIR *dip;
struct dirent *dit;
struct stat statbuf;
char currentPath[FILENAME_MAX];
int depth = 0; /*Used to correctly space output*/
/*Open Current Directory*/
if((dip = opendir(".")) == NULL)
return errno;
/*Store Current Working Directory in currentPath*/
if((getcwd(currentPath, FILENAME_MAX)) == NULL)
return errno;
/*Read all items in directory*/
while((dit = readdir(dip)) != NULL){
/*Skips . and ..*/
if(strcmp(dit->d_name, ".") == 0 || strcmp(dit->d_name, "..") == 0)
continue;
/*Correctly forms the path for stat and then resets it for rest of algorithm*/
getcwd(currentPath, FILENAME_MAX);
strcat(currentPath, "/");
strcat(currentPath, dit->d_name);
if(stat(currentPath, &statbuf) == -1){
perror("stat");
return errno;
}
getcwd(currentPath, FILENAME_MAX);
/*Checks if current item is of the type file (type 8) and no command line arguments*/
if(S_ISREG(statbuf.st_mode) && argv[1] == NULL)
printf("%s (%d bytes)\n", dit->d_name, (int)statbuf.st_size);
/*If a command line argument is given, checks for filename match*/
if(S_ISREG(statbuf.st_mode) && argv[1] != NULL)
if(strcmp(dit->d_name, argv[1]) == 0)
printf("%s (%d bytes)\n", dit->d_name, (int)statbuf.st_size);
/*Checks if current item is of the type directory (type 4)*/
if(S_ISDIR(statbuf.st_mode))
dircheck(dip, dit, statbuf, currentPath, depth, argv);
}
closedir(dip);
return 0;
}
/*Recursively called helper function*/
void helper(DIR *dip, struct dirent *dit, struct stat statbuf,
char currentPath[FILENAME_MAX], int depth, char *argv[]){
int i = 0;
if((dip = opendir(currentPath)) == NULL)
printf("Error: Failed to open Directory ==> %s\n", currentPath);
while((dit = readdir(dip)) != NULL){
if(strcmp(dit->d_name, ".") == 0 || strcmp(dit->d_name, "..") == 0)
continue;
strcat(currentPath, "/");
strcat(currentPath, dit->d_name);
stat(currentPath, &statbuf);
getcwd(currentPath, FILENAME_MAX);
if(S_ISREG(statbuf.st_mode) && argv[1] == NULL){
for(i = 0; i < depth; i++)
printf(" ");
printf("%s (%d bytes)\n", dit->d_name, (int)statbuf.st_size);
}
if(S_ISREG(statbuf.st_mode) && argv[1] != NULL){
if(strcmp(dit->d_name, argv[1]) == 0){
for(i = 0; i < depth; i++)
printf(" ");
printf("%s (%d bytes)\n", dit->d_name, (int)statbuf.st_size);
}
}
if(S_ISDIR(statbuf.st_mode))
dircheck(dip, dit, statbuf, currentPath, depth, argv);
}
/*Changing back here is necessary because of how stat is done*/
chdir("..");
closedir(dip);
}
void dircheck(DIR *dip, struct dirent *dit, struct stat statbuf,
char currentPath[FILENAME_MAX], int depth, char *argv[]){
int i = 0;
strcat(currentPath, "/");
strcat(currentPath, dit->d_name);
/*If two directories exist at the same level the path
is built wrong and needs to be corrected*/
if((chdir(currentPath)) == -1){
chdir("..");
getcwd(currentPath, FILENAME_MAX);
strcat(currentPath, "/");
strcat(currentPath, dit->d_name);
for(i = 0; i < depth; i++)
printf (" ");
printf("%s (subdirectory)\n", dit->d_name);
depth++;
helper(dip, dit, statbuf, currentPath, depth, argv);
}
else{
for(i =0; i < depth; i++)
printf(" ");
printf("%s (subdirectory)\n", dit->d_name);
chdir(currentPath);
depth++;
helper(dip, dit, statbuf, currentPath, depth, argv);
}
}
You aren't building your formula right.
Worksheets("EmployeeCosts").Range("B" & var1a).Formula = "=SUM(H5:H" & var1a & ")"
This does the same as the following lines do:
Dim myFormula As String
myFormula = "=SUM(H5:H"
myFormula = myFormula & var1a
myformula = myformula & ")"
which is what you are trying to do.
Also, you want to have the =
at the beginning of the formala.
Here are Windows wheel packages built by Chris Golke - Python Windows Binary packages - PyQt
In the filenames cp27
means C-python version 2.7, cp35
means python 3.5, etc.
Since Qt is a more complicated system with a compiled C++ codebase underlying the python interface it provides you, it can be more complex to build than just a pure python code package, which means it can be hard to install it from source.
Make sure you grab the correct Windows wheel file (python version, 32/64 bit), and then use pip to install it - e.g:
C:\path\where\wheel\is\> pip install PyQt4-4.11.4-cp35-none-win_amd64.whl
Should properly install if you are running an x64 build of Python 3.5.
<script>
function show_image(id)
{
if(id =='band')
{
$("#upload").hide();
$("#bandwith").show();
}
else if(id =='up')
{
$("#upload").show();
$("#bandwith").hide();
}
}
</script>
<a href="#" onclick="javascript:show_image('bandwidth');">Bandwidth</a>
<a href="#" onclick="javascript:show_image('upload');">Upload</a>
<img src="img/im.png" id="band" style="visibility: hidden;" />
<img src="img/im1.png" id="up" style="visibility: hidden;" />
I met similar problem. the log is like below
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to 0.0.0.0:443 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: bind() to [::]:80 failed (98: Address already in use)
2018/10/31 12:54:20 [emerg] 128005#128005: still could not bind()
2018/10/31 12:54:23 [alert] 127997#127997: unlink() "/run/nginx.pid" failed (2: No such file or directory)
2018/10/31 22:40:48 [info] 36948#36948: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:68
2018/10/31 22:50:40 [emerg] 37638#37638: duplicate listen options for [::]:80 in /etc/nginx/sites-enabled/default:18
2018/10/31 22:51:33 [info] 37787#37787: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:68
The last [emerg]
shows that duplicate listen options for [::]:80
which means that there are more than one nginx block file containing [::]:80
.
My solution is to remove one of the [::]:80
setting
P.S. you probably have default block file. My advice is to keep this file as default server for port 80. and remove [::]:80
from other block files
I´ve had experienced this problem, the intent
is not null but the information sent via this intent
is not received in onActionActivit()
This is a better solution using getContentResolver() :
private Uri imageUri;
private ImageView myImageView;
private Bitmap thumbnail;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
...
...
...
myImageview = (ImageView) findViewById(R.id.pic);
values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, "MyPicture");
values.put(MediaStore.Images.Media.DESCRIPTION, "Photo taken on " + System.currentTimeMillis());
imageUri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, PICTURE_RESULT);
}
the onActivityResult()
get a bitmap stored by getContentResolver() :
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_TAKE_PHOTO && resultCode == RESULT_OK) {
Bitmap bitmap;
try {
bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), imageUri);
myImageView.setImageBitmap(bitmap);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Check my example in github:
Example more... attr() is various, val() is just one! Prop is boolean are different.
//EXAMPLE 1 - RESULT_x000D_
$('div').append($('input.idone').attr('value')).append('<br>');_x000D_
$('div').append($('input[name=nametwo]').attr('family')).append('<br>');_x000D_
$('div').append($('input#idtwo').attr('name')).append('<br>');_x000D_
$('div').append($('input[name=nameone]').attr('value'));_x000D_
_x000D_
$('div').append('<hr>'); //EXAMPLE 2_x000D_
$('div').append($('input.idone').val()).append('<br>');_x000D_
_x000D_
$('div').append('<hr>'); //EXAMPLE 3 - MODIFY VAL_x000D_
$('div').append($('input.idone').val('idonenew')).append('<br>');_x000D_
$('input.idone').attr('type','initial');_x000D_
$('div').append('<hr>'); //EXAMPLE 3 - MODIFY VALUE_x000D_
$('div').append($('input[name=nametwo]').attr('value', 'new-jquery-pro')).append('<br>');_x000D_
$('input#idtwo').attr('type','initial');
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>_x000D_
<input type="hidden" class="idone" name="nameone" value="one-test" family="family-number-one">_x000D_
<input type="hidden" id="idtwo" name="nametwo" value="two-test" family="family-number-two">_x000D_
<br>_x000D_
<div></div>
_x000D_
Here is a simple letter-range implementation:
Code
def letter_range(start, stop="{", step=1):
"""Yield a range of lowercase letters."""
for ord_ in range(ord(start.lower()), ord(stop.lower()), step):
yield chr(ord_)
Demo
list(letter_range("a", "f"))
# ['a', 'b', 'c', 'd', 'e']
list(letter_range("a", "f", step=2))
# ['a', 'c', 'e']
Similar answers:
Here is a plunker: http://plnkr.co/edit/ziU8d826WF6SwQllHHQq?p=preview
app.directive("myDir", function($compile) {
return {
priority:1001, // compiles first
terminal:true, // prevent lower priority directives to compile after it
compile: function(el) {
el.removeAttr('my-dir'); // necessary to avoid infinite compile loop
el.attr('ng-click', 'fxn()');
var fn = $compile(el);
return function(scope){
fn(scope);
};
}
};
});
ngClick
at all:A plunker: http://plnkr.co/edit/jY10enUVm31BwvLkDIAO?p=preview
app.directive("myDir", function($parse) {
return {
compile: function(tElm,tAttrs){
var exp = $parse('fxn()');
return function (scope,elm){
elm.bind('click',function(){
exp(scope);
});
};
}
};
});
To answer the question How to delete specific columns in vba for excel. I use Array as below.
sub del_col()
dim myarray as variant
dim i as integer
myarray = Array(10, 9, 8)'Descending to Ascending
For i = LBound(myarray) To UBound(myarray)
ActiveSheet.Columns(myarray(i)).EntireColumn.Delete
Next i
end sub
This seems like a protocol version mismatch, this exception normally happens when there is a mismatch between SSL protocol version used by the client and the server. your clients should use a proctocol version supported by the server.
you can set android theme of the checkbox to get the color you want in your styles.xml add :
<style name="checkBoxStyle" parent="Base.Theme.AppCompat">
<item name="colorAccent">CHECKEDHIGHLIGHTCOLOR</item>
<item name="android:textColorSecondary">UNCHECKEDCOLOR</item>
</style>
then in your layout file :
<CheckBox
android:theme="@style/checkBoxStyle"
android:id="@+id/chooseItemCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
unlike using android:buttonTint="@color/CHECK_COLOR"
this method works under Api 23
The directory you're switching to is on another drive, you need to switch to that drive using :
C:\...\Admin> d:
then you can cd
into the directory you want.
C:\...\Admin> d:
D:\>cd "Docs\Java"
D:\Docs\Java>
If you have Microsoft Office installed, then you should be able to add a reference to Interop.Excel.
For example, the PC I'm typing this on has MSVS 2010 C# Express and Office 2010. I can add a reference to Microsoft.Office.Interop.Excel 11.0.0.0.
'Hope that helps
As you've noticed, you have no selectivity to your update statement so it is updating your entire table. If you want to update specific rows (ie where the IDs match) you probably want to do a coordinated subquery.
However, since you are using Oracle, it might be easier to create a materialized view for your query table and let Oracle's transaction mechanism handle the details. MVs work exactly like a table for querying semantics, are quite easy to set up, and allow you to specify the refresh interval.
If you want to remove the default value constraint, you can do:
ALTER TABLE <table> ALTER COLUMN <column> DROP DEFAULT;
.btn{
font-size: 20px;
color:black;
}
If a bash script
If [[ $input -gt number || $input -lt number ]]
then
echo .........
else
echo .........
fi
exit
Use the built in function zip
property_asel = [a for (a, truth) in zip(property_a, good_objects) if truth]
Just looking at the new features of 2.7. There is now a function in the itertools module which is similar to the above code.
http://docs.python.org/library/itertools.html#itertools.compress
itertools.compress('ABCDEF', [1,0,1,0,1,1]) =>
A, C, E, F
Given some C/C++ file foo.c
:
> clang -S -emit-llvm foo.c
Produces foo.ll
which is an LLVM IR file.
The -emit-llvm
option can also be passed to the compiler front-end directly, and not the driver by means of -cc1
:
> clang -cc1 foo.c -emit-llvm
Produces foo.ll
with the IR. -cc1
adds some cool options like -ast-print
. Check out -cc1 --help
for more details.
To compile LLVM IR further to assembly, use the llc
tool:
> llc foo.ll
Produces foo.s
with assembly (defaulting to the machine architecture you run it on). llc
is one of the LLVM tools - here is its documentation.
los.Aggregate((current, next) => current + "," + next);
Sweet and simple definitions, but fitting the need: Statically typed languages binds the type to a variable for its entire scope (Seg: SCALA) Dynamically typed languages bind the type to the actual value referenced by a variable.
For setting the Socket timeout, you need to follow these steps:
import socket
socks = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socks.settimeout(10.0) # settimeout is the attr of socks.
Same think can be done using lambda function. Here I am reading the data from a xlsx file.
import pandas as pd
df = pd.read_excel("data.xlsx", sheet_name = 4)
print df
Output:
cluster Unnamed: 1 date budget actual
0 a 2014-01-01 00:00:00 11000 10000
1 a 2014-02-01 00:00:00 1200 1000
2 a 2014-03-01 00:00:00 200 100
3 b 2014-04-01 00:00:00 200 300
4 b 2014-05-01 00:00:00 400 450
5 c 2014-06-01 00:00:00 700 1000
6 c 2014-07-01 00:00:00 1200 1000
7 c 2014-08-01 00:00:00 200 100
8 c 2014-09-01 00:00:00 200 300
Sum two columns into 3rd new one.
df['variance'] = df.apply(lambda x: x['budget'] + x['actual'], axis=1)
print df
Output:
cluster Unnamed: 1 date budget actual variance
0 a 2014-01-01 00:00:00 11000 10000 21000
1 a 2014-02-01 00:00:00 1200 1000 2200
2 a 2014-03-01 00:00:00 200 100 300
3 b 2014-04-01 00:00:00 200 300 500
4 b 2014-05-01 00:00:00 400 450 850
5 c 2014-06-01 00:00:00 700 1000 1700
6 c 2014-07-01 00:00:00 1200 1000 2200
7 c 2014-08-01 00:00:00 200 100 300
8 c 2014-09-01 00:00:00 200 300 500
To use unsafe code blocks, open the properties for the project, go to the Build tab and check the Allow unsafe code checkbox, then compile and run.
class myclass
{
public static void Main(string[] args)
{
unsafe
{
int iData = 10;
int* pData = &iData;
Console.WriteLine("Data is " + iData);
Console.WriteLine("Address is " + (int)pData);
}
}
}
Output:
Data is 10
Address is 1831848
A case statement should do the trick when selecting from your source table:
CASE
WHEN col1 = ' ' THEN NULL
ELSE col1
END col1
Also, one thing to note is that your LTRIM and RTRIM reduce the value from a space (' ') to blank (''). If you need to remove white space, then the case statement should be modified appropriately:
CASE
WHEN LTRIM(RTRIM(col1)) = '' THEN NULL
ELSE LTRIM(RTRIM(col1))
END col1
I believe VS2010 to be right this time, and I'd check if I had the standard handy, but currently I don't.
Now, it's exactly like the error message says: You can't capture stuff outside of the enclosing scope of the lambda.† grid
is not in the enclosing scope, but this
is (every access to grid
actually happens as this->grid
in member functions). For your usecase, capturing this
works, since you'll use it right away and you don't want to copy the grid
auto lambda = [this](){ std::cout << grid[0][0] << "\n"; }
If however, you want to store the grid and copy it for later access, where your puzzle
object might already be destroyed, you'll need to make an intermediate, local copy:
vector<vector<int> > tmp(grid);
auto lambda = [tmp](){}; // capture the local copy per copy
† I'm simplifying - Google for "reaching scope" or see §5.1.2 for all the gory details.
MVC 5 is already built into Visual Studios 2013.
Open a new project, on the left make sure you are under Templates > Visual C# > Web not Templates > Visual C# > Web > Visual Studios 2012.
Important: Now look near the top of the new project dialog box and select .NET 4.5 or higher. Once under web and the proper framework is selected click ASP.NET Web Application in the middle pane. Click OK
This will bring you to a page where you can select MVC as the project and start the wizard.
For me the solution was cleaning and rebuilding the Test Project
Build > Clean
Build > Build
I haven't read that in the answers above, that's why I add it :)
For Meteor, this can be solved by changing twbs:[email protected] to twbs:[email protected] in .versions
I've used it in the case where something may have gone awry in my @Before method.
public Object obj;
@Before
public void setUp() {
// Do some set up
obj = new Object();
}
@Test
public void testObjectManipulation() {
if(obj == null) {
fail("obj should not be null");
}
// Do some other valuable testing
}
This will safely remove only if token is at end of string.
StringUtils.removeEnd(string, ".xml");
Apache StringUtils functions are null-, empty-, and no match- safe
This function (ManagementQuery
) works on Windows XP and later:
private static string ManagementQuery(string query, string parameter, string scope = null) {
string result = string.Empty;
var searcher = string.IsNullOrEmpty(scope) ? new ManagementObjectSearcher(query) : new ManagementObjectSearcher(scope, query);
foreach (var os in searcher.Get()) {
try {
result = os[parameter].ToString();
}
catch {
//ignore
}
if (!string.IsNullOrEmpty(result)) {
break;
}
}
return result;
}
Usage:
Console.WriteLine(BytesToMb(Convert.ToInt64(ManagementQuery("SELECT TotalPhysicalMemory FROM Win32_ComputerSystem", "TotalPhysicalMemory", "root\\CIMV2"))));
You need to have typescript library installed and then you can use
npx tsc --init
If the response is error TS5023: Unknown compiler option 'init'.
that means the library is not installed
yarn add --dev typescript
and run npx
command again
There are many ways by which you can access one controller into another.
class Test1 extends CI_controller
{
function testfunction(){
return 1;
}
}
Then create another class, and include first Class in it, and extend it with your class.
include 'Test1.php';
class Test extends Test1
{
function myfunction(){
$this->test();
echo 1;
}
}
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY,17);
cal.set(Calendar.MINUTE,30);
cal.set(Calendar.SECOND,0);
cal.set(Calendar.MILLISECOND,0);
Date d = cal.getTime();
Also See
The pattern must have delimiters. Delimiters can be a forward slash (/) or any non alphanumeric characters(#,$,*,...). Examples
$pattern = "/My name is '(.*)' and im fine/";
$pattern = "#My name is '(.*)' and im fine#";
$pattern = "@My name is '(.*)' and im fine@";
Generally you can define the precision of a number in SQL by defining it with parameters. For most cases this will be NUMERIC(10,2)
or Decimal(10,2)
- will define a column as a Number with 10 total digits with a precision of 2 (decimal places).
Edited for clarity
For simplicity's sake: newList = list(set(oldList))
But there are better options out there if you'd like to get speed/ordering/optimization instead: http://www.peterbe.com/plog/uniqifiers-benchmark
Name FG BG
Black 30 40
Red 31 41
Green 32 42
Yellow 33 43
Blue 34 44
Magenta 35 45
Cyan 36 46
White 37 47
Bright Black 90 100
Bright Red 91 101
Bright Green 92 102
Bright Yellow 93 103
Bright Blue 94 104
Bright Magenta 95 105
Bright Cyan 96 106
Bright White 97 107
#include <iostream>
#include <string>
int main(int argc, char ** argv){
printf("\n");
printf("\x1B[31mTexting\033[0m\t\t");
printf("\x1B[32mTexting\033[0m\t\t");
printf("\x1B[33mTexting\033[0m\t\t");
printf("\x1B[34mTexting\033[0m\t\t");
printf("\x1B[35mTexting\033[0m\n");
printf("\x1B[36mTexting\033[0m\t\t");
printf("\x1B[36mTexting\033[0m\t\t");
printf("\x1B[36mTexting\033[0m\t\t");
printf("\x1B[37mTexting\033[0m\t\t");
printf("\x1B[93mTexting\033[0m\n");
printf("\033[3;42;30mTexting\033[0m\t\t");
printf("\033[3;43;30mTexting\033[0m\t\t");
printf("\033[3;44;30mTexting\033[0m\t\t");
printf("\033[3;104;30mTexting\033[0m\t\t");
printf("\033[3;100;30mTexting\033[0m\n");
printf("\033[3;47;35mTexting\033[0m\t\t");
printf("\033[2;47;35mTexting\033[0m\t\t");
printf("\033[1;47;35mTexting\033[0m\t\t");
printf("\t\t");
printf("\n");
return 0;
}
g++ cpp_interactive_terminal.cpp -o cpp_interactive_terminal.cgi
chmod +x cpp_interactive_terminal.cgi
./cpp_interactive_terminal.cgi
If you see the dollar sign ($) or double dollar sign ($$), and are curious as to what this means in the Prototype framework, here is your answer:
$$('div');
// -> all DIVs in the document. Same as document.getElementsByTagName('div')!
$$('#contents');
// -> same as $('contents'), only it returns an array anyway (even though IDs must be unique within a document).
$$('li.faux');
// -> all LI elements with class 'faux'
Source:
http://www.prototypejs.org/api/utility/dollar-dollar
Based on some post, i think position: fixed
works for me.
body {_x000D_
background: #eaeaed;_x000D_
-webkit-print-color-adjust: exact;_x000D_
}_x000D_
_x000D_
.my-footer {_x000D_
background: #2db34a;_x000D_
bottom: 0;_x000D_
left: 0;_x000D_
position: fixed;_x000D_
right: 0;_x000D_
}_x000D_
_x000D_
.my-header {_x000D_
background: red;_x000D_
top: 0;_x000D_
left: 0;_x000D_
position: fixed;_x000D_
right: 0;_x000D_
}
_x000D_
<html>_x000D_
_x000D_
<head>_x000D_
<meta charset=utf-8 />_x000D_
<title>Header & Footer</title>_x000D_
_x000D_
</head>_x000D_
_x000D_
<body>_x000D_
<div>_x000D_
<div class="my-header">Fixed Header</div>_x000D_
<div class="my-footer">Fixed Footer</div>_x000D_
<table>_x000D_
<thead>_x000D_
<tr>_x000D_
<th>TH 1</th>_x000D_
<th>TH 2</th>_x000D_
</tr>_x000D_
</thead>_x000D_
<tbody>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>TD 1</td>_x000D_
<td>TD 2</td>_x000D_
</tr>_x000D_
</tbody>_x000D_
</table>_x000D_
</div>_x000D_
</body>_x000D_
_x000D_
</html>
_x000D_
Press Ctrl+P in chrome see the header & footer text on each page. Hope it helps
Create DataTable:
DataTable MyTable = new DataTable(); // 1
DataTable MyTableByName = new DataTable("MyTableName"); // 2
Add column to table:
MyTable.Columns.Add("Id", typeof(int));
MyTable.Columns.Add("Name", typeof(string));
Add row to DataTable method 1:
DataRow row = MyTable.NewRow();
row["Id"] = 1;
row["Name"] = "John";
MyTable.Rows.Add(row);
Add row to DataTable method 2:
MyTable.Rows.Add(2, "Ivan");
Add row to DataTable method 3 (Add row from another table by same structure):
MyTable.ImportRow(MyTableByName.Rows[0]);
Add row to DataTable method 4 (Add row from another table):
MyTable.Rows.Add(MyTable2.Rows[0]["Id"], MyTable2.Rows[0]["Name"]);
Add row to DataTable method 5 (Insert row at an index):
MyTable.Rows.InsertAt(row, 8);
I believe a const
value is the same for all objects (and must be initialized with a literal expression), whereas readonly
can be different for each instantiation...
use
<activity android:name=".ActivityName"
android:theme="@android:style/Theme.NoTitleBar">
The compiler needs to know the size of the second dimension in your two dimensional array. For example:
void print_graph(g_node graph_node[], double weight[][5], int nodes);
I've found Django's FileField
to be really helpful for letting users upload and download files. The Django documentation has a section on managing files. You can store some information about the file in a table, along with a FileField
that points to the file itself. Then you can list the available files by searching the table.
df['new'] = 0
For in-place modification, perform direct assignment. This assignment is broadcasted by pandas for each row.
df = pd.DataFrame('x', index=range(4), columns=list('ABC'))
df
A B C
0 x x x
1 x x x
2 x x x
3 x x x
df['new'] = 'y'
# Same as,
# df.loc[:, 'new'] = 'y'
df
A B C new
0 x x x y
1 x x x y
2 x x x y
3 x x x y
If you want to add an column of empty lists, here is my advice:
object
columns are bad news in terms of performance. Rethink how your data is structured. If you must store a column of lists, ensure not to copy the same reference multiple times.
# Wrong
df['new'] = [[]] * len(df)
# Right
df['new'] = [[] for _ in range(len(df))]
df.assign(new=0)
If you need a copy instead, use DataFrame.assign
:
df.assign(new='y')
A B C new
0 x x x y
1 x x x y
2 x x x y
3 x x x y
And, if you need to assign multiple such columns with the same value, this is as simple as,
c = ['new1', 'new2', ...]
df.assign(**dict.fromkeys(c, 'y'))
A B C new1 new2
0 x x x y y
1 x x x y y
2 x x x y y
3 x x x y y
Finally, if you need to assign multiple columns with different values, you can use assign
with a dictionary.
c = {'new1': 'w', 'new2': 'y', 'new3': 'z'}
df.assign(**c)
A B C new1 new2 new3
0 x x x w y z
1 x x x w y z
2 x x x w y z
3 x x x w y z
I am using the bulk copy utility to achieve table-level backups
to export:
bcp.exe "select * from [MyDatabase].dbo.Customer " queryout "Customer.bcp" -N -S localhost -T -E
to import:
bcp.exe [MyDatabase].dbo.Customer in "Customer.bcp" -N -S localhost -T -E -b 10000
as you can see, you can export based on any query, so you can even do incremental backups with this. Plus, it is scriptable as opposed to the other methods mentioned here that use SSMS.
Take the width of the table and divide it by the number of cell ().
PerformanceTable {width:500px;}
PerformanceTable.td {width:100px;}
If the table dynamically widens or shrinks you could dynamically increase the cell size with a little javascript.
If you are using the Gradle Wrapper (the recommended option in Android Studio), you enable stacktrace by running gradlew compileDebug --stacktrace
from the command line in the root folder of your project (where the gradlew
file is).
If you are not using the gradle wrapper, you use gradle compileDebug --stacktrace
instead (presumably).
You don't really need to run with --stacktrace
though, running gradlew compileDebug
by itself, from the command line, should tell you where the error is.
I based this information on this comment:
Another alternative might be
Array.from(document.querySelectorAll("a")).map(x => x.href)
With your $$(
its even shorter
Array.from($$("a")).map(x => x.href)
Below script works fine in all browser:
function RadionButtonSelectedValueSet(name, SelectdValue) {
$('input[name="' + name + '"][value="' + SelectdValue + '"]').attr('checked',true);
}
In the service.ts file -
a. import 'of' from observable/of
b. create a json list
c. return json object using Observable.of()
Ex. -
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
@Injectable()
export class ClientListService {
private clientList;
constructor() {
this.clientList = [
{name: 'abc', address: 'Railpar'},
{name: 'def', address: 'Railpar 2'},
{name: 'ghi', address: 'Panagarh'},
{name: 'jkl', address: 'Panagarh 2'},
];
}
getClientList () {
return Observable.of(this.clientList);
}
};
In the component where we are calling the get function of the service -
this.clientListService.getClientList().subscribe(res => this.clientList = res);
Just in case everybody see's it, I added additional duplicating answer with an important line which will not break event propagation
$scope.clickOnUpload = function ($event) {
$event.stopPropagation(); // <-- this is important
$timeout(function() {
angular.element(domElement).trigger('click');
}, 0);
};
Specify maven.compiler.source and target versions.
1) Maven version which supports jdk you use. In my case JDK 11 and maven 3.6.0.
2) pom.xml
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
As an alternative, you can fully specify maven compiler plugin. See previous answers. It is shorter in my example :)
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
</plugins>
</build>
3) rebuild the project to avoid compile errors in your IDE.
4) If it still does not work. In Intellij Idea I prefer using terminal instead of using terminal from OS. Then in Idea go to file -> settings -> build tools -> maven. I work with maven I downloaded from apache (by default Idea uses bundled maven). Restart Idea then and run mvn clean install
again. Also make sure you have correct Path, MAVEN_HOME, JAVA_HOME environment variables.
I also saw this one-liner, but it does not work.
<maven.compiler.release>11</maven.compiler.release>
I made some quick starter projects, which I re-use in other my projects, feel free to check:
I use Wireshark in most cases, but I have found Fiddler to be less of a hassle when dealing with encrypted data.
In order to assign a variable safely you have to use the SET-SELECT statement:
SET @PrimaryContactKey = (SELECT c.PrimaryCntctKey
FROM tarcustomer c, tarinvoice i
WHERE i.custkey = c.custkey
AND i.invckey = @tmp_key)
Make sure you have both a starting and an ending parenthesis!
The reason the SET-SELECT version is the safest way to set a variable is twofold.
1. The SELECT returns several posts
What happens if the following select results in several posts?
SELECT @PrimaryContactKey = c.PrimaryCntctKey
FROM tarcustomer c, tarinvoice i
WHERE i.custkey = c.custkey
AND i.invckey = @tmp_key
@PrimaryContactKey
will be assigned the value from the last post in the result.
In fact @PrimaryContactKey
will be assigned one value per post in the result, so it will consequently contain the value of the last post the SELECT-command was processing.
Which post is "last" is determined by any clustered indexes or, if no clustered index is used or the primary key is clustered, the "last" post will be the most recently added post. This behavior could, in a worst case scenario, be altered every time the indexing of the table is changed.
With a SET-SELECT statement your variable will be set to null
.
2. The SELECT returns no posts
What happens, when using the second version of the code, if your select does not return a result at all?
In a contrary to what you may believe the value of the variable will not be null - it will retain it's previous value!
This is because, as stated above, SQL will assign a value to the variable once per post - meaning it won't do anything with the variable if the result contains no posts. So, the variable will still have the value it had before you ran the statement.
With the SET-SELECT statement the value will be null
.
Quoting the Forms Page in the HTML manual:
Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities: the BUTTON element may have content. For example, a BUTTON element that contains an image functions like and may resemble an INPUT element whose type is set to "image", but the BUTTON element type allows content.
I just knocked up a quick procedure to do this. It only works for a single row, so I create a temporary view that just selects the row I want, and then replace the pg_temp.temp_view with the actual table that I want to insert into.
CREATE OR REPLACE FUNCTION dv_util.gen_insert_statement(IN p_schema text, IN p_table text)
RETURNS text AS
$BODY$
DECLARE
selquery text;
valquery text;
selvalue text;
colvalue text;
colrec record;
BEGIN
selquery := 'INSERT INTO ' || quote_ident(p_schema) || '.' || quote_ident(p_table);
selquery := selquery || '(';
valquery := ' VALUES (';
FOR colrec IN SELECT table_schema, table_name, column_name, data_type
FROM information_schema.columns
WHERE table_name = p_table and table_schema = p_schema
ORDER BY ordinal_position
LOOP
selquery := selquery || quote_ident(colrec.column_name) || ',';
selvalue :=
'SELECT CASE WHEN ' || quote_ident(colrec.column_name) || ' IS NULL' ||
' THEN ''NULL''' ||
' ELSE '''' || quote_literal('|| quote_ident(colrec.column_name) || ')::text || ''''' ||
' END' ||
' FROM '||quote_ident(p_schema)||'.'||quote_ident(p_table);
EXECUTE selvalue INTO colvalue;
valquery := valquery || colvalue || ',';
END LOOP;
-- Replace the last , with a )
selquery := substring(selquery,1,length(selquery)-1) || ')';
valquery := substring(valquery,1,length(valquery)-1) || ')';
selquery := selquery || valquery;
RETURN selquery;
END
$BODY$
LANGUAGE plpgsql VOLATILE;
Invoked thus:
SELECT distinct dv_util.gen_insert_statement('pg_temp_' || sess_id::text,'my_data')
from pg_stat_activity
where procpid = pg_backend_pid()
I haven't tested this against injection attacks, please let me know if the quote_literal call isn't sufficient for that.
Also it only works for columns that can be simply cast to ::text and back again.
Also this is for Greenplum but I can't think of a reason why it wouldn't work on Postgres, CMIIW.
For any special characters you should use '\'. So, for matching parentheses - /\(/
You can indicate the new process should be started with elevated permissions by setting the Verb property of your startInfo object to 'runas', as follows:
startInfo.Verb = "runas";
This will cause Windows to behave as if the process has been started from Explorer with the "Run as Administrator" menu command.
This does mean the UAC prompt will come up and will need to be acknowledged by the user: if this is undesirable (for example because it would happen in the middle of a lengthy process), you'll need to run your entire host process with elevated permissions by Create and Embed an Application Manifest (UAC) to require the 'highestAvailable' execution level: this will cause the UAC prompt to appear as soon as your app is started, and cause all child processes to run with elevated permissions without additional prompting.
Edit: I see you just edited your question to state that "runas" didn't work for you. That's really strange, as it should (and does for me in several production apps). Requiring the parent process to run with elevated rights by embedding the manifest should definitely work, though.
In [Package Manager Console]
try the below
Install-Package NuGet.CommandLine
Use npm/bower to install bootstrap if you want to recompile it/change less files/test. With grunt it would be easier to do this, as shown on http://getbootstrap.com/getting-started/#grunt. If you only want to add precompiled libraries feel free to manually include files to project.
No, you have to do this by yourself or use separate grunt tool. For example 'grunt-contrib-concat' How to concatenate and minify multiple CSS and JavaScript files with Grunt.js (0.3.x)
My Android Studio is 3.0, please follow the two steps below,hope this will help;)
A simple way of "binarize" an image is to compare to a threshold: For example you can compare all elements in a matrix against a value with opencv in c++
cv::Mat img = cv::imread("image.jpg", CV_LOAD_IMAGE_GRAYSCALE);
cv::Mat bw = img > 128;
In this way, all pixels in the matrix greater than 128 now are white, and these less than 128 or equals will be black
Optionally, and for me gave good results is to apply blur
cv::blur( bw, bw, cv::Size(3,3) );
Later you can save it as said before with:
cv::imwrite("image_bw.jpg", bw);
Here is an example which might help someone:
Grid test = new Grid();
test.ColumnDefinitions.Add(new ColumnDefinition());
test.ColumnDefinitions.Add(new ColumnDefinition());
test.RowDefinitions.Add(new RowDefinition());
test.RowDefinitions.Add(new RowDefinition());
test.RowDefinitions.Add(new RowDefinition());
Label t1 = new Label();
t1.Content = "Test1";
Label t2 = new Label();
t2.Content = "Test2";
Label t3 = new Label();
t3.Content = "Test3";
Label t4 = new Label();
t4.Content = "Test4";
Label t5 = new Label();
t5.Content = "Test5";
Label t6 = new Label();
t6.Content = "Test6";
Grid.SetColumn(t1, 0);
Grid.SetRow(t1, 0);
test.Children.Add(t1);
Grid.SetColumn(t2, 1);
Grid.SetRow(t2, 0);
test.Children.Add(t2);
Grid.SetColumn(t3, 0);
Grid.SetRow(t3, 1);
test.Children.Add(t3);
Grid.SetColumn(t4, 1);
Grid.SetRow(t4, 1);
test.Children.Add(t4);
Grid.SetColumn(t5, 0);
Grid.SetRow(t5, 2);
test.Children.Add(t5);
Grid.SetColumn(t6, 1);
Grid.SetRow(t6, 2);
test.Children.Add(t6);
@jk1 answer is perfect, since @igor Ganapolsky asked, why can't we use Mockito.mock here? i post this answer.
For that we have provide one setter method for myobj and set the myobj value with mocked object.
class MyClass {
MyInterface myObj;
public void abc() {
myObj.myMethodToBeVerified (new String("a"), new String("b"));
}
public void setMyObj(MyInterface obj)
{
this.myObj=obj;
}
}
In our Test class, we have to write below code
class MyClassTest {
MyClass myClass = new MyClass();
@Mock
MyInterface myInterface;
@test
testAbc() {
myclass.setMyObj(myInterface); //it is good to have in @before method
myClass.abc();
verify(myInterface).myMethodToBeVerified(new String("a"), new String("b"));
}
}
And a third option is cx_Freeze
, which is cross-platform.
For Linux, "ps aux | grep kafka" see if kafka properties are shown in the results. E.g. /path/to/kafka/server.properties
Queue
is an interface that extends Collection
in Java. It has all the functions needed to support FIFO
architecture.
For concrete implementation you may use LinkedList
. LinkedList implements Deque
which in turn implements Queue
. All of these are a part of java.util
package.
For details about method with sample example you can refer FIFO based Queue implementation in Java.
PS: Above link goes to my personal blog that has additional details on this.
The same problem was coming for my phone and this resolved the problem:
Go to Application Manager
/ Apps
from Settings.
Select Google Play Services
.
Click Uninstall Updates
button to the right of the Force Stop
button.
Once the updates are uninstalled, you should see Disable
button
which means you are done.
You will see lots of free space available now.
You can simply go for: df.describe() that will provide you with all the relevant details you need, but to find the min, max or average value of a particular column (say 'weights' in your case), use:
df['weights'].mean(): For average value
df['weights'].max(): For maximum value
df['weights'].min(): For minimum value
There is no need for custom helper functions if all we need is to print the string of the form [D day[s], ][H]H:MM:SS[.UUUUUU]
. timedelta object supports str()
operation that will do this. It works even in Python 2.6.
>>> from datetime import timedelta
>>> timedelta(seconds=90136)
datetime.timedelta(1, 3736)
>>> str(timedelta(seconds=90136))
'1 day, 1:02:16'
I solved the problem by covering the download button of a audio controller with a transparent div that changes the symbol of the mouse-cursor to "not-allowed".
The div blocks the activation of the download button.
Height: 50px, Width: 35px, Left: (document-right -60), Top: (same as the audio controller).
You must set the z-index style of the div above the z-index of the audio-controller.
See sapplic.com/jive66 for an example that works for chrome on win7 and on win8.
if your field name is Roles and table name is table1 you can use following to search
DECLARE @Role varchar(50);
SELECT * FROM table1
WHERE Roles.exist ('/root/role = sql:variable("@Role")') = 1
Try to use Windows Task Scheduler. Create an exe which is not prompting for any user inputs.
https://docs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page
They are lists because you type them as lists in the dictionary:
bikes = {
# Bike designed for children"
"Trike": ["Trike", 20, 100],
# Bike designed for everyone"
"Kruzer": ["Kruzer", 50, 165]
}
You should use the bike-class instead:
bikes = {
# Bike designed for children"
"Trike": Bike("Trike", 20, 100),
# Bike designed for everyone"
"Kruzer": Bike("Kruzer", 50, 165)
}
This will allow you to get the cost of the bikes with bike.cost as you were trying to.
for bike in bikes.values():
profit = bike.cost * margin
print(bike.name + " : " + str(profit))
This will now print:
Kruzer : 33.0
Trike : 20.0
For anyone who wants to sort the variable in third layer:
<select ng-option="friend.pet.name for friend in friends"></select>
you can do it like this
<select ng-option="friend.pet.name for friend in friends | orderBy: 'pet.name'"></select>
Do you need to do it from mgmt studio? Here's how we do it from cmd line:
"C:\Program Files\Microsoft SQL Server\MSSQL\Binn\TEXTCOPY.exe" /S < Server> /D < DataBase> /T mytable /C mypictureblob /F "C:\picture.png" /W"where RecId=" /I
You can set the state of the checkbox based on the value:
$('#your-checkbox').prop('checked', value == 1);
As one single line (for 404 generic page):
from django.shortcuts import render_to_response
from django.template import RequestContext
return render_to_response('error/404.html', {'exception': ex},
context_instance=RequestContext(request), status=404)
It will be better to Create a New role, then grant execute, select ... etc permissions to this role and finally assign users to this role.
Create role
CREATE ROLE [db_SomeExecutor]
GO
Grant Permission to this role
GRANT EXECUTE TO db_SomeExecutor
GRANT INSERT TO db_SomeExecutor
to Add users database>security> > roles > databaseroles>Properties > Add ( bottom right ) you can search AD users and add then
OR
EXEC sp_addrolemember 'db_SomeExecutor', 'domainName\UserName'
Please refer this post
# better than Dumper --you're ready for the WWW....
use JSON::XS;
print encode_json \@some_array
Hmm, what's missing to see the remote branch "4.2" when I pull, as I do when I clone? Something's clearly not identical.
tmp$ mkdir some_repo
tmp$ cd some_repo
some_repo$ git init
Initialized empty Git repository in /tmp/some_repo/.git/
some_repo$ git pull https://github.ourplace.net/babelfish/some_repo.git
:
From https://github.ourplace.net/babelfish/some_repo
* branch HEAD -> FETCH_HEAD
some_repo$ git branch
* master
vs
tmp$ rm -rf some_repo
tmp$ git clone https://github.ourplace.net/babelfish/some_repo.git
Cloning into 'some_repo'...
:
Checking connectivity... done.
tmp$ cd some_repo
some_repo$ git branch
* 4.2
Bit late for an answer but came with following option. It is working for me but not sure if it is the correct way or not.
In my view I'm doing this:
<form name="formName">
<div ng-init="setForm(formName);"></div>
</form>
And in the controller:
$scope.setForm = function (form) {
$scope.myForm = form;
}
Now after doing this I have got my form in my controller variable which is $scope.myForm
Again, I stress that namespace, svc name and contract must be correctly specified in web.config file:
<service name="NAMESPACE.SvcFileName">
<endpoint contract="NAMESPACE.IContractName" />
</service>
Example:
<service name="MyNameSpace.FileService">
<endpoint contract="MyNameSpace.IFileService" />
</service>
(Unrelevant tags ommited in these samples)
If you want a vertical divider between 2 columns, all you need is add
class="col-6 border-left"
to one of your column div-s
BUT
In the world of responsive design, you may need to make it disappear sometimes.
The solution is disappearing <hr>
+ disappearing <div>
+ margin-left: -1px;
<div class="container">
<div class="row">
<div class="col-md-7">
1 of 2
</div>
<div class="border-left d-sm-none d-md-block" style="width: 0px;"></div>
<div class="col-md-5" style="margin-left: -1px;">
<hr class="d-sm-block d-md-none">
2 of 2
</div>
</div>
</div>
https://jsfiddle.net/8z1pag7s/
tested on Bootstrap 4.1
List<String> stringList = integerList.stream().map((Object s)->String.valueOf(s)).collect(Collectors.toList())
I will give my answer from a competitive programming(cp) perspective, but it applies to other domains as well.
Many a times while doing cp, constraints are quite large.
For example : I had a question with a variables N, M, Q
such that 1 = N, M, Q < 10^5
.
The mistake I was making was I declared a 2D integer array of size 10000 x 10000
in C++
and struggled with the SIGABRT
error at Codechef for almost 2 days.
Now, if we calculate :
Typical size of an integer : 4 bytes
No. of cells in our array : 10000 x 10000
Total size (in bytes) : 400000000 bytes = 4*10^8 ˜ 400 MB
Your solutions to such questions will work on your PC(not always) as it can afford this size.
But the resources at coding sites(online judges) is limited to few KBs.
Hence, the SIGABRT
error and other such errors.
Conclusion:
In such questions, we ought not to declare an array or vector or any other DS of this size, but our task is to make our algorithm such efficient that it works without them(DS) or with less memory.
PS : There might be other reasons for this error; above was one of them.
As already mentioned you can use Fine Code Coverage that visualize coverlet output. If you create a xunit test project
(dotnet new xunit
) you'll find coverlet reference already present in csproj
file because Coverlet
is the default coverage tool for every .NET Core and >= .NET 5 applications.
Microsoft has an example using ReportGenerator that converts coverage reports generated by coverlet, OpenCover, dotCover, Visual Studio, NCover, Cobertura, JaCoCo, Clover, gcov or lcov into human readable reports in various formats.
Example report:
While the article focuses on C# and xUnit as the test framework, both MSTest and NUnit would also work.
Guide:
If you want code coverage in .xml files you can run any of these commands:
dotnet test --collect:"XPlat Code Coverage"
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
Got the same problem but didn't found a good solution yet for detecting it automatically . Now im using PsPad (www.pspad.com) for that ;) Works fine
npm info YOUR_PACKAGE version
e.g.
npm info grunt version
0.4.5
CER is an X.509 certificate in binary form, DER encoded.
CRT is a binary X.509 certificate, encapsulated in text (base-64) encoding.
It is not the same encoding.
With naming conventions, it's usually safe to say "just pick one and stick to it", which makes sense.
However, after having to explain REST to lots of people, representing endpoints as paths on a file system is the most expressive way of doing it.
It is stateless (files either exist or don't exist), hierarchical, simple, and familiar - you already knows how to access static files, whether locally or via http.
And within that context, linguistic rules can only get you as far as the following:
A directory can contain multiple files and/or sub-directories, and therefore its name should be in plural form.
And I like that.
Although, on the other hand - it's your directory, you can name it "a-resource-or-multiple-resources" if that's what you want. That's not really the important thing.
What's important is that if you put a file named "123" under a directory named "resourceS" (resulting in /resourceS/123
), you cannot then expect it to be accessible via /resource/123
.
Don't try to make it smarter than it has to be - changing from plural to singluar depending on the count of resources you're currently accessing may be aesthetically pleasing to some, but it's not effective and it doesn't make sense in a hierarchical system.
Note: Technically, you can make "symbolic links", so that /resources/123
can also be accessed via /resource/123
, but the former still has to exist!
Use modulo
whenever a number x is a multiple of some number y, then always x % y equal to 0, which can be used as a check. So use
if (j % 4 == 0)
Here are shortcuts for the IPython Notebook.
Ctrl-m i
interrupts the kernel. (that is, the sole letter i after Ctrl-m
)
According to this answer, I
twice works as well.
To use the new date range picker, you can use the mat-date-range-input
and mat-date-range-picker
components.
Example
HTML
<mat-form-field>
<mat-label>Enter a date range</mat-label>
<mat-date-range-input [rangePicker]="picker">
<input matStartDate matInput placeholder="Start date">
<input matEndDate matInput placeholder="End date">
</mat-date-range-input>
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-date-range-picker #picker></mat-date-range-picker>
</mat-form-field>
You can read and learn more about this in their official documentation.
Unfortunately, they still haven't build a timepicker
on this release.
In 1985, individuals from companies throughout the computer industry joined together to develop the POSIX (Portable Operating System Interface for Computer Environments) standard, which is based largely on the UNIX System V Interface Definition (SVID) and other earlier standardization efforts. These efforts were spurred by the U.S. government, which needed a standard computing environment to minimize its training and procurement costs. Released in 1988, POSIX is a group of IEEE standards that define the API, shell, and utility interfaces for an operating system. Although aimed at UNIX-like systems, the standards can apply to any compatible operating system. Now that these stan- dards have gained acceptance, software developers are able to develop applications that run on all conforming versions of UNIX, Linux, and other operating systems.
From the book: A Practical Guide To Linux
There isn't a Truncate()
method on string, unfortunately. You have to write this kind of logic yourself. What you can do, however, is wrap this in an extension method so you don't have to duplicate it everywhere:
public static class StringExt
{
public static string Truncate(this string value, int maxLength)
{
if (string.IsNullOrEmpty(value)) return value;
return value.Length <= maxLength ? value : value.Substring(0, maxLength);
}
}
Now we can write:
var someString = "...";
someString = someString.Truncate(2);
private void button4_Click(object sender, EventArgs e)
{
String st = "DELETE FROM supplier WHERE supplier_id =" + textBox1.Text;
SqlCommand sqlcom = new SqlCommand(st, myConnection);
try
{
sqlcom.ExecuteNonQuery();
MessageBox.Show("????");
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
private void button6_Click(object sender, EventArgs e)
{
String st = "SELECT * FROM suppliers";
SqlCommand sqlcom = new SqlCommand(st, myConnection);
try
{
sqlcom.ExecuteNonQuery();
SqlDataReader reader = sqlcom.ExecuteReader();
DataTable datatable = new DataTable();
datatable.Load(reader);
dataGridView1.DataSource = datatable;
//MessageBox.Show("LEFT OUTER??");
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
After reading your question, I would say, generate special token to do request required. This token will live in specific time (lets say in one day).
Here is an example from to generate authentication token:
(day * 10) + (month * 100) + (year (last 2 digits) * 1000)
for example: 3 June 2011
(3 * 10) + (6 * 100) + (11 * 1000) =
30 + 600 + 11000 = 11630
then concatenate with user password, example "my4wesomeP4ssword!"
11630my4wesomeP4ssword!
Then do MD5 of that string:
05a9d022d621b64096160683f3afe804
When do you call a request, always use this token,
https://mywebservice.com/?token=05a9d022d621b64096160683f3afe804&op=getdata
This token is always unique everyday, so I guess this kind of protection is more than sufficient to always protect ur service.
Hope helps
:)
Just had the same problem myself.
What happens is, that even if you drop the database, innodb will still not release disk space. I had to export, stop mysql, remove the files manually, start mysql, create database and users, and then import. Thank god I only had 200MB worth of rows, but it spared 250GB of innodb file.
Fail by design.
First the bigint(20) not null auto_increment
will not work, simply use bigserial primary key
. Then datetime
is timestamp
in PostgreSQL. All in all:
CREATE TABLE article (
article_id bigserial primary key,
article_name varchar(20) NOT NULL,
article_desc text NOT NULL,
date_added timestamp default NULL
);
Here's a different, but super simple approach. To load multiple scripts you can simply append them to body.
var scriptsToLoad = [
"script1.js",
"script2.js",
"script3.js",
];
scriptsToLoad.forEach(function(src) {
var script = document.createElement('script');
script.src = src;
script.async = false;
document.body.appendChild(script);
});
2020 answer
CSS Filter works on all current browsers
<img>
tag.<img src="dotted-arrow.svg" class="filter-green"/>
For example, output for #00EE00
is
filter: invert(42%) sepia(93%) saturate(1352%) hue-rotate(87deg) brightness(119%) contrast(119%);
filter
into this class. .filter-green{
filter: invert(48%) sepia(79%) saturate(2476%) hue-rotate(86deg) brightness(118%) contrast(119%);
}
If you want to achieve the same for the jquery-ui selectmenu control then you have to set 'display: none' in the open event handler and add '-menu' to the id string.
<select id="myid">
<option value="" disabled="disabled" selected="selected">Please select name</option>
<option value="Tom">Tom</option>
<option value="Marry">Mary</option>
<option value="Jane">Jane</option>
<option value="Harry">Harry</option>
</select>
$('select#listsTypeSelect').selectmenu({
change: function( event, data ) {
alert($(this).val());
},
open: function( event, ui ) {
$('ul#myid-menu li:first-child').css('display', 'none');
}
});
I addition to the accepted answer, the error can also occur when the destination folder is read-only (Common when using TFS)
[^0-9][+-]?[0-9]{1,10}[^0-9]
In words: Optional + or - followed by a digit, repeated one up to ten times. Note that most libraries have a shortcut for a digit: \d
, hence the above could also be written as: \d{1,10}
.
You have a method called getArguments()
that belongs to Fragment
class.
In my limited experience with binary tree, I think:
It's like the COM registry done right, with respect to the physical files as well as their interface and location information. In COM, files were everywhere, with centralised metadata. The GAC centralises the bang shoot.
Given the general support of .innerHTML
these days, the only effective difference now is that .html()
will execute code in any <script>
tags if there are any in the html you give it. .innerHTML
, under HTML5, will not.
From the jQuery docs:
By design, any jQuery constructor or method that accepts an HTML string — jQuery(), .append(), .after(), etc. — can potentially execute code. This can occur by injection of script tags or use of HTML attributes that execute code (for example,
<img onload="">
). Do not use these methods to insert strings obtained from untrusted sources such as URL query parameters, cookies, or form inputs. Doing so can introduce cross-site-scripting (XSS) vulnerabilities. Remove or escape any user input before adding content to the document.
Note: both .innerHTML
and .html()
can execute js other ways (e.g the onerror
attribute).
A fast approach is to use the following according to ie that you want to focus (check the comments), inside your css files (where margin-top, set whatever css attribute you like):
margin-top: 10px\9; /*It will apply to all ie from 8 and below */
*margin-top: 10px; /*It will apply to ie 7 and below */
_margin-top: 10px; /*It will apply to ie 6 and below*/
A better approach would be to check user agent or a conditional if, in order to avoid the loading of unnecessary CSS in other browsers.
A base R solution is to combine the output of aggregate()
with a merge()
step. I find the formula interface to aggregate()
a little more useful than the standard interface, partly because the names on the output are nicer, so I'll use that:
The aggregate()
step is
maxs <- aggregate(Score ~ Group, data = dat, FUN = max)
and the merge()
step is simply
merge(maxs, dat)
This gives us the desired output:
R> maxs <- aggregate(Score ~ Group, data = dat, FUN = max)
R> merge(maxs, dat)
Group Score Info
1 1 3 c
2 2 4 d
You could, of course, stick this into a one-liner (the intermediary step was more for exposition):
merge(aggregate(Score ~ Group, data = dat, FUN = max), dat)
The main reason I used the formula interface is that it returns a data frame with the correct names
for the merge step; these are the names of the columns from the original data set dat
. We need to have the output of aggregate()
have the correct names so that merge()
knows which columns in the original and aggregated data frames match.
The standard interface gives odd names, whichever way you call it:
R> aggregate(dat$Score, list(dat$Group), max)
Group.1 x
1 1 3
2 2 4
R> with(dat, aggregate(Score, list(Group), max))
Group.1 x
1 1 3
2 2 4
We can use merge()
on those outputs, but we need to do more work telling R which columns match up.
In my case this was the error.
Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:917) at org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:282) at org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:356) at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2306) at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2289) at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2038) at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1532) at beans.Test.main(Test.java:24)
Solution: I just change ojdbc14.jar
to ojdbc6.jar
Confirm that the character encoding and collation for the two tables is the same.
In my own case, one of the tables was using utf8
and the other was using latin1
.
I had another case where the encoding was the same but the collation different. One utf8_general_ci
the other utf8_unicode_ci
You can run this command to set the encoding and collation for a table.
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
I hope this helps someone.
This error occurs when you have database is not in sync with your model and vice versa. To overcome this , follow the below steps -
a) Add a migration file using add-migration <{Migration File Name}> through the nuget package manager console. This migration file will have the script to sync anything not in sync between Db and code.
b) Update the database using update-database command. This will update the database with the latest changes in your model.
If this does not help, try these steps after adding the line of code in the Application_Start method of Global.asax.cs file -
Database.SetInitializer<VidlyDbContext>(new DropCreateDatabaseIfModelChanges<VidlyDbContext>());
Reference - http://robertgreiner.com/2012/05/unable-to-update-database-to-match-the-current-model-pending-changes/
It is possible on your restart some shards were not recovered, causing the cluster to stay red.
If you hit:
http://<yourhost>:9200/_cluster/health/?level=shards
you can look for red shards.
I have had issues on restart where shards end up in a non recoverable state. My solution was to simply delete that index completely. That is not an ideal solution for everyone.
It is also nice to visualize issues like this with a plugin like:
Elasticsearch Head
commit () records these changes in the database. flush () is always called as part of the commit () (1) call. When you use a Session object to query a database, the query returns results from both the database and the reddened parts of the unrecorded transaction it is performing.
Actually what you are searching is: Optional.map. Your code would then look like:
object.map(o -> "result" /* or your function */)
.orElseThrow(MyCustomException::new);
I would rather omit passing the Optional
if you can. In the end you gain nothing using an Optional
here. A slightly other variant:
public String getString(Object yourObject) {
if (Objects.isNull(yourObject)) { // or use requireNonNull instead if NullPointerException suffices
throw new MyCustomException();
}
String result = ...
// your string mapping function
return result;
}
If you already have the Optional
-object due to another call, I would still recommend you to use the map
-method, instead of isPresent
, etc. for the single reason, that I find it more readable (clearly a subjective decision ;-)).
You can use
$window.scrollTo(x, y);
where x
is the pixel along the horizontal axis and y
is the pixel along the vertical axis.
Scroll to top
$window.scrollTo(0, 0);
Focus on element
$window.scrollTo(0, angular.element('put here your element').offsetTop);
Update:
Also you can use $anchorScroll
With your example:
avgDists = np.array([1, 8, 6, 9, 4])
Obtain indexes of n maximal values:
ids = np.argpartition(avgDists, -n)[-n:]
Sort them in descending order:
ids = ids[np.argsort(avgDists[ids])[::-1]]
Obtain results (for n=4):
>>> avgDists[ids]
array([9, 8, 6, 4])
For completeness, since no-one has suggested it yet. .git/refs/heads/master
is a file that contains only one line: the hash of the latest commit on master
. So you could just read it from there.
Or, as as command:
cat .git/refs/heads/master
Update:
Note that git now supports storing some head refs in the pack-ref file instead of as a file in the /refs/heads/ folder. https://www.kernel.org/pub/software/scm/git/docs/git-pack-refs.html
Another sample :
declare @limit int
declare @offset int
set @offset = 2;
set @limit = 20;
declare @count int
declare @idxini int
declare @idxfim int
select @idxfim = @offset * @limit
select @idxini = @idxfim - (@limit-1);
WITH paging AS
(
SELECT
ROW_NUMBER() OVER (order by object_id) AS rowid, *
FROM
sys.objects
)
select *
from
(select COUNT(1) as rowqtd from paging) qtd,
paging
where
rowid between @idxini and @idxfim
order by
rowid;
The -i
flag specifies the private key (.pem file) to use. If you don't specify that flag (as in your first command) it will use your default ssh key (usually under ~/.ssh/
).
So in your first command, you are actually asking scp
to upload the .pem file itself using your default ssh key. I don't think that is what you want.
Try instead with:
scp -r -i /Applications/XAMPP/htdocs/keypairfile.pem uploads/* ec2-user@publicdns:/var/www/html/uploads
One way to do it will be to move all the php code above the HTML, copy the result to a variable and then add the result in the <input>
tag.
Try this -
<?php
//Adding the php to the top.
if(isset($_POST['submit']))
{
$value1=$_POST['value1'];
$value2=$_POST['value2'];
$sign=$_POST['sign'];
...
//Adding to $result variable
if($sign=='-') {
$result = $value1-$value2;
}
//Rest of your code...
}
?>
<html>
<!--Rest of your tags...-->
Result:<br><input type"text" name="result" value = "<?php echo (isset($result))?$result:'';?>">
With reference to man ssh-keygen
, the length of a DSA key is restricted to exactly 1024 bit to remain compliant with NIST's FIPS 186-2. Nonetheless, longer DSA keys are theoretically possible; FIPS 186-3 explicitly allows them. Furthermore, security is no longer guaranteed with 1024 bit long RSA or DSA keys.
In conclusion, a 2048 bit RSA key is currently the best choice.
Establishing a secure SSH connection entails more than selecting safe encryption key pair technology. In view of Edward Snowden's NSA revelations, one has to be even more vigilant than what previously was deemed sufficient.
To name just one example, using a safe key exchange algorithm is equally important. Here is a nice overview of current best SSH hardening practices.
I don't know a good free tool but winmerge is ok(ish). I've been using the beyond compare tools since 1999 and can't rate it enough - it costs about 50 USD and this investment has paid for it self in time savings more than I can possible imagine.
Sometimes tools should be paid for if they are very very good.
Double check the repository URL, Github will prompt you to login if the repo doesn't exist.
I'm guessing this is probably to check if it's a private repo you have access to. Possibly to make it harder to enumerate private repos. But this is all conjecture. /shrug
You may also want to try two backslashes (\\")
to escape the escape character.
just use a property
int _theVariable;
public int TheVariable{
get{return _theVariable;}
set{
_theVariable = value;
if ( _theVariable == 1){
//Do stuff here.
}
}
}
add this function to your global.asax
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
string cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie = Context.Request.Cookies[cookieName];
if (authCookie == null)
{
return;
}
FormsAuthenticationTicket authTicket = null;
try
{
authTicket = FormsAuthentication.Decrypt(authCookie.Value);
}
catch
{
return;
}
if (authTicket == null)
{
return;
}
string[] roles = authTicket.UserData.Split(new char[] { '|' });
FormsIdentity id = new FormsIdentity(authTicket);
GenericPrincipal principal = new GenericPrincipal(id, roles);
Context.User = principal;
}
then you can use HttpContext.Current.User.Identity.Name to get username. hope it helps
1) Use multiple classes inside the class attribute, separated by whitespace (ref):
<a class="c1 c2">aa</a>
2) To target elements that contain all of the specified classes, use this CSS selector (no space) (ref):
.c1.c2 {
}
The full modern solution to your problem is purely CSS-based, but note that older browsers won't support it, in which cases you'd need to fallback to solutions such as the others have provided.
So in pure CSS:
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
However the mouse cursor will still change to a caret when over the element's text, so you add to that:
cursor: default;
Modern CSS is pretty elegant.
If you want to use 32-bit references, your heap is limited to 32 GB.
However, if you are willing to use 64-bit references, the size is likely to be limited by your OS, just as it is with 32-bit JVM. e.g. on Windows 32-bit this is 1.2 to 1.5 GB.
Note: you will want your JVM heap to fit into main memory, ideally inside one NUMA region. That's about 1 TB on the bigger machines. If your JVM spans NUMA regions the memory access and the GC in particular will take much longer. If your JVM heap start swapping it might take hours to GC, or even make your machine unusable as it thrashes the swap drive.
Note: You can access large direct memory and memory mapped sizes even if you use 32-bit references in your heap. i.e. use well above 32 GB.
Compressed oops in the Hotspot JVM
Compressed oops represent managed pointers (in many but not all places in the JVM) as 32-bit values which must be scaled by a factor of 8 and added to a 64-bit base address to find the object they refer to. This allows applications to address up to four billion objects (not bytes), or a heap size of up to about 32Gb. At the same time, data structure compactness is competitive with ILP32 mode.
Its working for me
.line{_x000D_
width: 112px;_x000D_
height: 47px;_x000D_
border-bottom: 1px solid black;_x000D_
position: absolute;_x000D_
}
_x000D_
<div class="line"></div>
_x000D_
If you are constructing the connection string within the app then you would use your command of connString. If you are using a connection string in the web config. Then you use the "name" of that string.
JQuery load works, but it will strip out javascript and other elements from the source page. This makes sense because you might not want to introduce bad script on your page. I think this is a limitation and since you are doing a whole page and not just a div on the source page, you might not want to use it. (I am not sure about css, but I think it would also get stripped)
In this example, if you put a tag around the body of your source page, it will grab anything in between the tags and won't strip anything out. I wrap my source page with and .
This solution will grab everything between the above delimiters. I feel it is a much more robust solution than a simple load.
var content = $('.contentDiv');
content.load(urlAddress, function (response, status, xhr) {
var fullPageTextAsString = response;
var pageTextBetweenDelimiters = fullPageTextAsString.substring(fullPageTextAsString.indexOf("<jqueryloadmarkerstart />"), fullPageTextAsString.indexOf("<jqueryloadmarkerend />"));
content.html(pageTextBetweenDelimiters);
});
Maybe you are looking for jar
command to get the list of classes in terminal,
$ jar tf ~/.m2/repository/org/apache/spark/spark-assembly/1.2.0-SNAPSHOT/spark-assembly-1.2.0-SNAPSHOT-hadoop1.0.4.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/apache/
org/apache/spark/
org/apache/spark/unused/
org/apache/spark/unused/UnusedStubClass.class
META-INF/maven/
META-INF/maven/org.spark-project.spark/
META-INF/maven/org.spark-project.spark/unused/
META-INF/maven/org.spark-project.spark/unused/pom.xml
META-INF/maven/org.spark-project.spark/unused/pom.properties
META-INF/NOTICE
where,
-t list table of contents for archive
-f specify archive file name
Or, just grep above result to see .class
es only
$ jar tf ~/.m2/repository/org/apache/spark/spark-assembly/1.2.0-SNAPSHOT/spark-assembly-1.2.0-SNAPSHOT-hadoop1.0.4.jar | grep .class
org/apache/spark/unused/UnusedStubClass.class
To see number of class
es,
jar tvf launcher/target/usergrid-launcher-1.0-SNAPSHOT.jar | grep .class | wc -l
61079
prefer this links about properties in objective-c in iOS...
https://techguy1996.blogspot.com/2020/02/properties-in-objective-c-ios.html
And it's maybe also handy to know that BigTable is not a relational database (like MySQL) but a huge (distributed) hash table which has very different characteristics. You can play around with (a limited version) of BigTable yourself on the Google AppEngine platform.
Next to Hadoop mentioned above there are many other implementations that try to solve the same problems as BigTable (scalability, availability). I saw a nice blog post yesterday listing most of them here.
You could try as well:
let diceRoll = Int(arc4random_uniform(UInt32(6)))
I had to add "UInt32" to make it work.
A Scala version based on Zaz's answer.
case class DocumentEx(document: Document) {
def toXmlString(pretty: Boolean = false):Try[String] = {
getStringFromDocument(document, pretty)
}
}
implicit def documentToDocumentEx(document: Document):DocumentEx = {
DocumentEx(document)
}
def getStringFromDocument(doc: Document, pretty:Boolean): Try[String] = {
try
{
val domSource= new DOMSource(doc)
val writer = new StringWriter()
val result = new StreamResult(writer)
val tf = TransformerFactory.newInstance()
val transformer = tf.newTransformer()
if (pretty)
transformer.setOutputProperty(OutputKeys.INDENT, "yes")
transformer.transform(domSource, result)
Success(writer.toString);
}
catch {
case ex: TransformerException =>
Failure(ex)
}
}
With that, you can do either doc.toXmlString()
or call the getStringFromDocument(doc)
function.
This could be work for multiple match conditions
const query = [
{
$facet: {
cancelled: [
{ $match: { orderStatus: 'Cancelled' } },
{ $count: 'cancelled' }
],
pending: [
{ $match: { orderStatus: 'Pending' } },
{ $count: 'pending' }
],
total: [
{ $match: { isActive: true } },
{ $count: 'total' }
]
}
},
{
$project: {
cancelled: { $arrayElemAt: ['$cancelled.cancelled', 0] },
pending: { $arrayElemAt: ['$pending.pending', 0] },
total: { $arrayElemAt: ['$total.total', 0] }
}
}
]
Order.aggregate(query, (error, findRes) => {})
A Magento Module is a group of directories containing blocks, controllers, helpers, and models that are needed to create a specific store feature. It is the unit of customization in the Magento platform. Magento Modules can be created to perform multiple functions with supporting logic to influence user experience and storefront appearance. It has a life cycle that allows them to be installed, deleted, or disabled. From the perspective of both merchants and extension developers, modules are the central unit of the Magento platform.
Declaration of Module
We have to declare the module by using the configuration file. As Magento 2 search for configuration module in etc directory of the module. So now we will create configuration file module.xml.
The code will look like this:
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Cloudways_Mymodule" setup_version="1.0.0"></module> </config>
Registration of Module The module must be registered in the Magento 2 system by using Magento Component Registrar class. Now we will create the file registration.php in the module root directory:
app/code/Cloudways/Mymodule/registration.php
The Code will look like this:
?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Cloudways_Mymodule',
__DIR__
);
Check Module Status After following the steps above, we would have created a simple module. Now we are going to check the status of the module and whether it is enabled or disabled by using the following command line:
php bin/magento module:status
php bin/magento module:enable Cloudways_Mymodule
Share your feedback once you have gone through complete process
Here's a simple php4-friendly implementation:
/**
* Builds an http query string.
* @param array $query // of key value pairs to be used in the query
* @return string // http query string.
**/
function build_http_query( $query ){
$query_array = array();
foreach( $query as $key => $key_value ){
$query_array[] = urlencode( $key ) . '=' . urlencode( $key_value );
}
return implode( '&', $query_array );
}
No, there's no Python-specific limit on the memory usage of a Python application. I regularly work with Python applications that may use several gigabytes of memory. Most likely, your script actually uses more memory than available on the machine you're running on.
In that case, the solution is to rewrite the script to be more memory efficient, or to add more physical memory if the script is already optimized to minimize memory usage.
Edit:
Your script reads the entire contents of your files into memory at once (line = u.readlines()
). Since you're processing files up to 20 GB in size, you're going to get memory errors with that approach unless you have huge amounts of memory in your machine.
A better approach would be to read the files one line at a time:
for u in files:
for line in u: # This will iterate over each line in the file
# Read values from the line, do necessary calculations
Came across a scenario with remote sorting of data store in EXTJS 4.X where the string is sent to the server as a JSON array (of only 1 object).
Similar approach to what is presented previously for a simple string, just need conversion to JsonArray first prior to JsonObject.
String from client: [{"property":"COLUMN_NAME","direction":"ASC"}]
String jsonIn = "[{\"property\":\"COLUMN_NAME\",\"direction\":\"ASC\"}]";
JsonArray o = (JsonArray)new JsonParser().parse(jsonIn);
String sortColumn = o.get(0).getAsJsonObject().get("property").getAsString());
String sortDirection = o.get(0).getAsJsonObject().get("direction").getAsString());
You have a lot of variants for using @RequestParam
with additional optional elements, e.g.
@RequestParam(required = false, defaultValue = "someValue", value="someAttr") String someAttr
If you don't put required = false
- param will be required by default.
defaultValue = "someValue"
- the default value to use as a fallback when the request parameter is not provided or has an empty value.
If request and method param are the same - you don't need value = "someAttr"
You can turn on your PHP errors with error_reporting
:
error_reporting(E_ALL);
ini_set('display_errors', 'on');
Edit: It's possible that even after putting this, errors still don't show up. This can be caused if there is a fatal error in the script. From PHP Runtime Configuration:
Although display_errors may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.
You should set display_errors = 1
in your php.ini
file and restart the server.
Make sure you register Spring's CharacterEncodingFilter
in your web.xml
(must be the first filter in that file).
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
If you are on Tomcat you might not have set the URIEncoding
in your server.xml
. If you don't set it to UTF-8 it won't work. Definitely keep the CharacterEncodingFilter
. Nevertheless, here's a concise checklist to follow. It will definitely guide you to make this work.
the problem will be solved by clearing cache
php artisan config:cache
There are several of this same question (1, 2). One way of doing it is using canvas. Here's a working solution. Here you can see some working examples of using this library.
Adding current working solution for 'FLAG_FULLSCREEN' is deprecated
Add the following to your theme in themes.xml
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
Worked perfectly for me.
import platform
platform.architecture()
From the Python docs:
Queries the given executable (defaults to the Python interpreter binary) for various architecture information.
Returns a tuple (bits, linkage) which contain information about the bit architecture and the linkage format used for the executable. Both values are returned as strings.
Another point in favor of field access is that otherwise you are forced to expose setters for collections as well what, for me, is a bad idea as changing the persistent collection instance to an object not managed by Hibernate will definitely break your data consistency.
So I prefer having collections as protected fields initialized to empty implementations in the default constructor and expose only their getters. Then, only managed operations like clear()
, remove()
, removeAll()
etc are possible that will never make Hibernate unaware of changes.
Try c.ToString("F6");
(For a full explanation of numeric formatting, see MSDN)
Looking for a similar solution I just came across this brand new tutorial, which lets you bridge a Swift gradient background (https://github.com/soffes/GradientView) library while walking through every step to get a working React component.
It is a step-by-step tutorial, allowing you to build your own component by bridging the swift and objective-c component into a usable React Native component, which overrides the standard View component and allows you to define a gradient like the following:
<LinearGradient
style={styles.gradient}
locations={[0, 1.0]}
colors={['#5ED2A0', '#339CB1']}
/>
You can find the tutorial here: http://browniefed.com/blog/2015/11/28/react-native-how-to-bridge-a-swift-view/
You can use to automate this, you could define the foreign key constraint with ON DELETE CASCADE
.
I quote the the manual of foreign key constraints:
CASCADE
specifies that when a referenced row is deleted, row(s) referencing it should be automatically deleted as well.
You need to define height of ul or your div and set overflow equals to auto as below:
<ul style="width: 300px; height: 200px; overflow: auto">
<li>text</li>
<li>text</li>
If you wanna call a js function in your html page use onload event. The onload event occurs when the user agent finishes loading a window or all frames within a FRAMESET. This attribute may be used with BODY and FRAMESET elements.
<body onload="callFunction();">
....
</body>
If you are sure you want to remove all commit history, simply delete the .git
directory in your project root (note that it's hidden). Then initialize a new repository in the same folder and link it to the GitHub repository:
git init
git remote add origin [email protected]:user/repo
now commit your current version of code
git add *
git commit -am 'message'
and finally force the update to GitHub:
git push -f origin master
However, I suggest backing up the history (the .git
folder in the repository) before taking these steps!
Getting the friends like @nfvs describes is a good way. It outputs a multi-dimensional array with all friends with attributes id and name (ordered by id). You can see the friends photos like this:
foreach ($friends as $key=>$value) {
echo count($value) . ' Friends';
echo '<hr />';
echo '<ul id="friends">';
foreach ($value as $fkey=>$fvalue) {
echo '<li><img src="https://graph.facebook.com/' . $fvalue->id . '/picture" title="' . $fvalue->name . '"/></li>';
}
echo '</ul>';
}
If you are using Redux, then I would recommend using npm package react-router-redux. It allows you to dispatch Redux store navigation actions.
You have to create store as described in their Readme file.
The easiest use case:
import { push } from 'react-router-redux'
this.props.dispatch(push('/second page'));
Second use case with Container/Component:
Container:
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import Form from '../components/Form';
const mapDispatchToProps = dispatch => ({
changeUrl: url => dispatch(push(url)),
});
export default connect(null, mapDispatchToProps)(Form);
Component:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default class Form extends Component {
handleClick = () => {
this.props.changeUrl('/secondPage');
};
render() {
return (
<div>
<button onClick={this.handleClick}/>
</div>Readme file
);
}
}
First Step:File ? Settings ? Build, Execution, Deployment ? Instant Run and uncheck Enable Instant Run. Second step: Press Invalidate/Restart. done.... Enjoy.
If you want to use forward slashes in the format, the you need to escape with back slashes in the regex:
var pattern =/^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/;
It's by value according to the PHP Documentation.
By default, function arguments are passed by value (so that if the value of the argument within the function is changed, it does not get changed outside of the function). To allow a function to modify its arguments, they must be passed by reference.
To have an argument to a function always passed by reference, prepend an ampersand (&) to the argument name in the function definition.
<?php
function add_some_extra(&$string)
{
$string .= 'and something extra.';
}
$str = 'This is a string, ';
add_some_extra($str);
echo $str; // outputs 'This is a string, and something extra.'
?>
You can use pure Python to do it:
import json
list = [1, 2, (3, 4)] # Note that the 3rd element is a tuple (3, 4)
json.dumps(list) # '[1, 2, [3, 4]]'
If we can edit the markup, life can be easier, just remove text and be happy. But sometimes the markup was placed by JS code or we just aren't allowed to edit it at all, too bad css turned to be the only weapon placed at our disposal.
We cannot place a <span>
wrapping the text and hide the whole tag. By the way, some browsers do not only hides elements with display:none
but also disables the components inside.
Both font-size:0px
and color:transparent
may be good solutions, but some browsers don't understand them. We can't rely on them.
I suggest:
h1 {
background-image: url(/LOGO.png); /* Our image */
text-indent: -3000px; /* Send text out of viewable area */
height: 100px; width: 600px; /* height and width are a must, agree */
overflow:hidden; /* make sure our size is respected */
}
Using overflow:hidden
enforces our width & height. Some browsers (will not name them... IE) may read width and height as min-width
and min-height
. I want to prevent box to be enlarged.
In eclipse go to
Window-> Java -> Installed JREs
You can remove your current installed jre and add the jdk by specifying the path to where the jdk is installed.
brief mnemonics:
git reset HEAD : index = HEAD
git checkout : file_tree = index
git reset --hard HEAD : file_tree = index = HEAD
In Android the package name is in the AndroidManifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
package="com.example.appname">
In iOS the package name is the bundle identifier in Info.plist:
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
which is found in Runner.xcodeproj/project.pbxproj:
PRODUCT_BUNDLE_IDENTIFIER = com.example.appname;
The package name is found in more than one location, so to change the name you should search the whole project for occurrences of your old project name and change them all.
Android Studio and VS Code:
Thanks to diegoveloper for help with iOS.
After coming back to this page a few different times, I'm thinking it's just easier and cleaner to start a new project with the right name and then copy the old files over.
UPDATE: ViewDidUnload was deprecated in iOS 6, so updated the answer accordingly.
The UIViewController lifecycle is diagrammed here:
The advantage of using Xamarin Native/Mono Touch, is that it uses the native APIs, and so it follows the same ViewController lifecycle as you would find in Apple's Documentation.
Will this work / be faster?
uint32_t swapped, result;
((byte*)&swapped)[0] = ((byte*)&result)[3];
((byte*)&swapped)[1] = ((byte*)&result)[2];
((byte*)&swapped)[2] = ((byte*)&result)[1];
((byte*)&swapped)[3] = ((byte*)&result)[0];
You don't need to convert NumPy
array to Mat
because OpenCV cv2
module can accept NumPy
array.
The only thing you need to care for is that {0,1} is mapped to {0,255} and any value bigger than 1 in NumPy
array is equal to 255. So you should divide by 255 in your code, as shown below.
img = numpy.zeros([5,5,3])
img[:,:,0] = numpy.ones([5,5])*64/255.0
img[:,:,1] = numpy.ones([5,5])*128/255.0
img[:,:,2] = numpy.ones([5,5])*192/255.0
cv2.imwrite('color_img.jpg', img)
cv2.imshow("image", img)
cv2.waitKey()