Your project supports .Net Framework 4.0 and .Net Framework 4.5. If you have upgrade issues
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
instead of can use;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
Your issue is a very interesting one. Hadoop setup could be frustrating some time due to the complexity of the system and many moving parts involved. I think the issue you faced is definitely a firewall one. My hadoop cluster has similar setup. With a firewall rule added with command:
sudo iptables -A INPUT -p tcp --dport 9000 -j REJECT
I'm able to see the exact issue:
15/03/02 23:46:10 INFO client.RMProxy: Connecting to ResourceManager at /0.0.0.0:8032
java.net.ConnectException: Call From mybox/127.0.1.1 to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
You can verify your firewall settings with command:
/usr/local/hadoop/etc$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
REJECT tcp -- anywhere anywhere tcp dpt:9000 reject-with icmp-port-unreachable
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Once the suspicious rule is identified, it could be deleted with a command like:
sudo iptables -D INPUT -p tcp --dport 9000 -j REJECT
Now, the connection should go through.
According to Transport Layer Security (TLS) best practices with the .NET Framework:
To ensure .NET Framework applications remain secure, the TLS version should not be hardcoded. Instead set the registry keys: SystemDefaultTlsVersions
and SchUseStrongCrypto
:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v2.0.50727]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SystemDefaultTlsVersions"=dword:00000001
"SchUseStrongCrypto"=dword:00000001
In a previous answer, it was suggested to use this line of code for .Net 4.5:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // .NET 4.5
I would encourage you to OR that value in to whatever the existing values are like this:
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; // .NET 4.5
If you look at the list of values, you notice that they are a power of two. This way, in the future when things shift to TLS 2.0 for example, your code will still work.
I found the simplest solution is to add two registry entries as follows (run this in a command prompt with admin privileges):
reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SchUseStrongCrypto /t REG_DWORD /d 1 /reg:32
reg add HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 /v SchUseStrongCrypto /t REG_DWORD /d 1 /reg:64
These entries seem to affect how the .NET CLR chooses a protocol when making a secure connection as a client.
There is more information about this registry entry here:
https://docs.microsoft.com/en-us/security-updates/SecurityAdvisories/2015/2960358#suggested-actions
Not only is this simpler, but assuming it works for your case, far more robust than a code-based solution, which requires developers to track protocol and development and update all their relevant code. Hopefully, similar environment changes can be made for TLS 1.3 and beyond, as long as .NET remains dumb enough to not automatically choose the highest available protocol.
NOTE: Even though, according to the article above, this is only supposed to disable RC4, and one would not think this would change whether the .NET client is allowed to use TLS1.2+ or not, for some reason it does have this effect.
NOTE: As noted by @Jordan Rieger in the comments, this is not a solution for POODLE, since it does not disable the older protocols a -- it merely allows the client to work with newer protocols e.g. when a patched server has disabled the older protocols. However, with a MITM attack, obviously a compromised server will offer the client an older protocol, which the client will then happily use.
TODO: Try to disable client-side use of TLS1.0 and TLS1.1 with these registry entries, however I don't know if the .NET http client libraries respect these settings or not:
https://docs.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings#tls-10
https://docs.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings#tls-11
Using a HTTP debugging proxy can cause this - such as Fiddler.
I was loading a PFX certificate from a local file (authentication to Apple.com) and it failed because Fiddler wasn't able to pass this certificate on.
Try disabling Fiddler to check and if that is the solution then you need to probably install the certificate on your machine or in some way that Fiddler can use it.
This cannot work because ppCombined
is a collection of objects in memory and you cannot join a set of data in the database with another set of data that is in memory. You can try instead to extract the filtered items personProtocol
of the ppCombined
collection in memory after you have retrieved the other properties from the database:
var persons = db.Favorites
.Where(f => f.userId == userId)
.Join(db.Person, f => f.personId, p => p.personId, (f, p) =>
new // anonymous object
{
personId = p.personId,
addressId = p.addressId,
favoriteId = f.favoriteId,
})
.AsEnumerable() // database query ends here, the rest is a query in memory
.Select(x =>
new PersonDTO
{
personId = x.personId,
addressId = x.addressId,
favoriteId = x.favoriteId,
personProtocol = ppCombined
.Where(p => p.personId == x.personId)
.Select(p => new PersonProtocol
{
personProtocolId = p.personProtocolId,
activateDt = p.activateDt,
personId = p.personId
})
.ToList()
});
document.getElementById("fname").style.borderTopColor = 'red';
document.getElementById("fname").style.borderBottomColor = 'red';
This is the error that is returned when the Windows Firewall blocks the port (out-going). We have a strict web server so the outgoing ports are blocked by default. All I had to do was to create a rule to allow the TCP port number in wf.msc.
Try put this before send e-mail
ServicePointManager.ServerCertificateValidationCallback =
delegate(object s, X509Certificate certificate, X509Chain chain,
SslPolicyErrors sslPolicyErrors) { return true; };
Remenber to add the using libs!
I doubt that this is what you want but your question is a little bit vague
Dim totalCount As Int32 = DataTable1.Columns.Count * DataTable1.Rows.Count
If all your columns are numeric-columns you might want this:
You could use DataTable.Compute to Sum
all values in the column.
Dim totalCount As Double
For Each col As DataColumn In DataTable1.Columns
totalCount += Double.Parse(DataTable1.Compute(String.Format("SUM({0})", col.ColumnName), Nothing).ToString)
Next
After you've edited your question and added more informations, this should work:
Dim totalRow = DataTable1.NewRow
For Each col As DataColumn In DataTable1.Columns
totalRow(col.ColumnName) = Double.Parse(DataTable1.Compute("SUM(" & col.ColumnName & ")", Nothing).ToString)
Next
DataTable1.Rows.Add(totalRow)
Windows 7 Professional I Modified @mongoose_za's answer to make it easier to change the python version:
Add the following to the existing variable:
%PY_HOME%;%PY_HOME%\Lib;%PY_HOME%\DLLs;%PY_HOME%\Lib\lib-tk;
Click [OK] to close all of the windows.
As a final sanity check open a command prompt and enter python. You should see
>python [whatever version you are using]
If you need to switch between versions, you only need to modify the PY_HOME variable to point to the proper directory. This is bit easier to manage if you need multiple python versions installed.
As the main answer is using CIFSPacket type, which is not (or no longer) available in C#, I wrote correct methods:
static byte[] getBytes(object str)
{
int size = Marshal.SizeOf(str);
byte[] arr = new byte[size];
IntPtr ptr = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(str, ptr, true);
Marshal.Copy(ptr, arr, 0, size);
Marshal.FreeHGlobal(ptr);
return arr;
}
static T fromBytes<T>(byte[] arr)
{
T str = default(T);
int size = Marshal.SizeOf(str);
IntPtr ptr = Marshal.AllocHGlobal(size);
Marshal.Copy(arr, 0, ptr, size);
str = (T)Marshal.PtrToStructure(ptr, str.GetType());
Marshal.FreeHGlobal(ptr);
return str;
}
Tested, they work.
How about
$([your selector]).attr('colspan',3);
I would imagine that to work but have no way to test at the moment. Using .attr()
would be the usual jQuery way of setting attributes of elements in the wrapped set.
As has been mentioned in another answer, in order to get this to work would require removing the td elements that have no text in them from the DOM. It may be easier to do this all server side
EDIT:
As was mentioned in the comments, there is a bug in attempting to set colspan using attr() in IE, but the following works in IE6 and FireFox 3.0.13.
notice the use of the attribute colSpan
and not colspan
- the former works in both IE and Firefox, but the latter does not work in IE. Looking at jQuery 1.3.2 source, it would appear that attr()
attempts to set the attribute as a property of the element if
colSpan
exists as a property and defaults to 1 on <td>
HTMLElements in IE and FireFox) using colSpan
as opposed to colspan
works with attr()
because the former is a property defined on the element whereas the latter is not.
the fall-through for attr()
is to attempt to use setAttribute()
on the element in question, setting the value to a string, but this causes problems in IE (bug #1070 in jQuery)
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
In the demo, for each row, the text in each cell is evaluated. If the text is a blank string, then the cell is removed and a counter incremented. The first cell in the row that does not have class="colTime"
has a colspan attribute set to the value of the counter + 1 (for the span it occupies itself).
After this, for each row, the text in the cell with class="colspans"
is set to the colspan attribute values of each cell in the row from left to right.
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<title>Sandbox</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
body { background-color: #000; font: 16px Helvetica, Arial; color: #fff; }
td { text-align: center; }
</style>
</head>
<body>
<table class="tblSimpleAgenda" cellpadding="5" cellspacing="0">
<tbody>
<tr>
<th align="left">Time</th>
<th align="left">Room 1</th>
<th align="left">Room 2</th>
<th align="left">Room 3</th>
<th align="left">Colspans (L -> R)</th>
</tr>
<tr valign="top">
<td class="colTime">09:00 – 10:00</td>
<td class="col1"></td>
<td class="col2">Meeting 2</td>
<td class="col3"></td>
<td class="colspans">holder</td>
</tr>
<tr valign="top">
<td class="colTime">10:00 – 10:45</td>
<td class="col1">Meeting 1</td>
<td class="col2">Meeting 2</td>
<td class="col3">Meeting 3</td>
<td class="colspans">holder</td>
</tr>
<tr valign="top">
<td class="colTime">11:00 – 11:45</td>
<td class="col1">Meeting 1</td>
<td class="col2">Meeting 2</td>
<td class="col3">Meeting 3</td>
<td class="colspans">holder</td>
</tr>
<tr valign="top">
<td class="colTime">11:00 – 11:45</td>
<td class="col1">Meeting 1</td>
<td class="col2">Meeting 2</td>
<td class="col3"></td>
<td class="colspans">holder</td>
</tr>
</tbody>
</table>
</body>
</html>
jQuery code
$(function() {
$('table.tblSimpleAgenda tr').each(function() {
var tr = this;
var counter = 0;
$('td', tr).each(function(index, value) {
var td = $(this);
if (td.text() == "") {
counter++;
td.remove();
}
});
if (counter !== 0) {
$('td:not(.colTime):first', tr)
.attr('colSpan', '' + parseInt(counter + 1,10) + '');
}
});
$('td.colspans').each(function(){
var td = $(this);
var colspans = [];
td.siblings().each(function() {
colspans.push(($(this).attr('colSpan')) == null ? 1 : $(this).attr('colSpan'));
});
td.text(colspans.join(','));
});
});
This is just a demonstration to show that attr()
can be used, but to be aware of it's implementation and the cross-browser quirks that come with it. I've also made some assumptions about your table layout in the demo (i.e. apply the colspan to the first "non-Time" cell in each row), but hopefully you get the idea.
I worked with Unity and had some problem with the BeginConnect and other async methods from socket.
There is something than I don't understand but the code samples before doesn't work for me.
So I wrote this piece of code to make it work. I test it on an adhoc network with android and pc, also in local on my computer. Hope it can help.
using System.Net.Sockets;
using System.Threading;
using System.Net;
using System;
using System.Diagnostics;
class ConnexionParameter : Guardian
{
public TcpClient client;
public string address;
public int port;
public Thread principale;
public Thread thisthread = null;
public int timeout;
private EventWaitHandle wh = new AutoResetEvent(false);
public ConnexionParameter(TcpClient client, string address, int port, int timeout, Thread principale)
{
this.client = client;
this.address = address;
this.port = port;
this.principale = principale;
this.timeout = timeout;
thisthread = new Thread(Connect);
}
public void Connect()
{
WatchDog.Start(timeout, this);
try
{
client.Connect(IPAddress.Parse(address), port);
}
catch (Exception)
{
UnityEngine.Debug.LogWarning("Unable to connect service (Training mode? Or not running?)");
}
OnTimeOver();
//principale.Resume();
}
public bool IsConnected = true;
public void OnTimeOver()
{
try
{
if (!client.Connected)
{
/*there is the trick. The abort method from thread doesn't
make the connection stop immediately(I think it's because it rise an exception
that make time to stop). Instead I close the socket while it's trying to
connect , that make the connection method return faster*/
IsConnected = false;
client.Close();
}
wh.Set();
}
catch(Exception)
{
UnityEngine.Debug.LogWarning("Connexion already closed, or forcing connexion thread to end. Ignore.");
}
}
public void Start()
{
thisthread.Start();
wh.WaitOne();
//principale.Suspend();
}
public bool Get()
{
Start();
return IsConnected;
}
}
public static class Connexion
{
public static bool Connect(this TcpClient client, string address, int port, int timeout)
{
ConnexionParameter cp = new ConnexionParameter(client, address, port, timeout, Thread.CurrentThread);
return cp.Get();
}
//http://stackoverflow.com/questions/19653588/timeout-at-acceptsocket
public static Socket AcceptSocket(this TcpListener tcpListener, int timeoutms, int pollInterval = 10)
{
TimeSpan timeout = TimeSpan.FromMilliseconds(timeoutms);
var stopWatch = new Stopwatch();
stopWatch.Start();
while (stopWatch.Elapsed < timeout)
{
if (tcpListener.Pending())
return tcpListener.AcceptSocket();
Thread.Sleep(pollInterval);
}
return null;
}
}
and there a very simple watchdog on C# to make it work:
using System.Threading;
public interface Guardian
{
void OnTimeOver();
}
public class WatchDog {
int m_iMs;
Guardian m_guardian;
public WatchDog(int a_iMs, Guardian a_guardian)
{
m_iMs = a_iMs;
m_guardian = a_guardian;
Thread thread = new Thread(body);
thread.Start(this);
}
private void body(object o)
{
WatchDog watchdog = (WatchDog)o;
Thread.Sleep(watchdog.m_iMs);
watchdog.m_guardian.OnTimeOver();
}
public static void Start(int a_iMs, Guardian a_guardian)
{
new WatchDog(a_iMs, a_guardian);
}
}
I know I am pretty late in this game, but I haven't seen an answer here pointing to the system.diagnostics logs for the TLS Stream.
Before you do any changes to your code, make sure you understand what the problem is about. The AuthenticationException
is one of that very generic exception which does not tell much. To learn what's going under the hood edit the app.config file for your application (or create a new one) and make sure you have System.Net trace source enabled in the system.diagnostics
section, for example:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<trace autoflush="true" />
<sharedListeners>
<add name="file" initializeData="c:\network.log" type="System.Diagnostics.TextWriterTraceListener" />
</sharedListeners>
<sources>
<source name="System.Net" switchValue="Verbose">
<listeners>
<add name="file" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
Rerun your application and check the c:\network.log file. You should see there detailed information about your TLS (SSL) connection, for example:
System.Net Information: 0 : [12764] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = f44368:535f958, targetName = localhost, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [12764] InitializeSecurityContext(In-Buffers count=2, Out-Buffer length=0, returned code=OK).
System.Net Information: 0 : [12764] Remote certificate: [Version]
V3
[Subject]
CN=test
Simple Name: test
DNS Name: example.com
[Issuer]
CN=Root CA
Simple Name: Root CA
DNS Name: Root CA
...
[Signature Algorithm]
sha256RSA(1.2.840.113549.1.1.11)
[Public Key]
Algorithm: RSA
Length: 2048
Key Blob: ....
System.Net Information: 0 : [12764] SecureChannel#38496415 - Remote certificate has errors:
System.Net Information: 0 : [12764] SecureChannel#38496415 - Certificate name mismatch.
System.Net Information: 0 : [12764] SecureChannel#38496415 - Remote certificate was verified as invalid by the user.
System.Net Error: 0 : [12764] Exception in AppDomain#10923418::UnhandledExceptionHandler - The remote certificate is invalid according to the validation procedure..
Knowing what causes the problem, you should be able to resolve it or at least narrow your Google searches.
There's also UJMP
In my case the issue had nothing to do with MARS connection string but with json serialization. After upgrading my project from NetCore2 to 3 i got this error.
More information can be found here
MacPorts is the way to go.
Like @user475443 pointed, MacPorts has many many more packages. With brew you'll find yourself trapped soon because the formula you need doesn't exist.
MacPorts is a native application: C + TCL. You don't need Ruby at all. To install Ruby on Mac OS X you might need MacPorts, so just go with MacPorts and you'll be happy.
MacPorts is really stable, in 8 years I never had a problem with it, and my entire Unix ecosystem relay on it.
If you are a PHP developer you can install the last version of Apache (Mac OS X uses 2.2), PHP and all the extensions you need, then upgrade all with one command. Forget to do the same with Homebrew.
MacPorts support groups.
foo@macpro:~/ port select --summary
Name Selected Options
==== ======== =======
db none db46 none
gcc none gcc42 llvm-gcc42 mp-gcc48 none
llvm none mp-llvm-3.3 none
mysql mysql56 mysql56 none
php php55 php55 php56 none
postgresql postgresql94 postgresql93 postgresql94 none
python none python24 python25-apple python26-apple python27 python27-apple none
If you have both PHP55 and PHP56 installed (with many different extensions), you can swap between them with just one command. All the relative extensions are part of the group and they will be activated within the chosen group: php55 or php56. I'm not sure Homebrew has this feature.
Rubists like to rewrite everything in Ruby, because the only thing they are at ease is Ruby itself.
I had the same issue. Tried all the above answers. It was actually complained about a .dll file. I clean the project in Visual Studio but the .dll file still remains, so I deleted in manually from the bin folder and it worked.
You can add onclick=""
to hovered element. Hover will work after that.
Edit: But you really shouldn't add anything style related to your markup, just posted it as an alternative.
You need to specify the domain:
$('.button1').click(function() {
window.location = 'www.example.com/index.php?id=' + this.id;
});
If you want to filter on a grandchild (or deeper) of the given object, you can continue to build out your object hierarchy. For example, if you want to filter on 'thing.properties.title', you can do the following:
<div ng-repeat="thing in things | filter: { properties: { title: title_filter } }">
You can also filter on multiple properties of an object just by adding them to your filter object:
<div ng-repeat="thing in things | filter: { properties: { title: title_filter, id: id_filter } }">
Make sure that you update your php.ini
for CLI
. For my case this was C:\wamp\bin\php\php5.4.3\php.ini
and uncomment extension=php_openssl.dll
line.
Perl one-liner:
perl -e 'local $/; print unpack "H*", <>' file
Laravel tries to guess the name of the table, you have to specify it directly so that it does not give you that error..
Try this:
class NameModel extends Model {
public $table = 'name_exact_of_the_table';
I hope that helps!
Very easy..
int (name of integer) = [(name of string, no ()) intValue];
List of entire available timezones.
$time_zones = array (
0 => 'Africa/Abidjan',
1 => 'Africa/Accra',
2 => 'Africa/Addis_Ababa',
3 => 'Africa/Algiers',
4 => 'Africa/Asmara',
5 => 'Africa/Asmera',
6 => 'Africa/Bamako',
7 => 'Africa/Bangui',
8 => 'Africa/Banjul',
9 => 'Africa/Bissau',
10 => 'Africa/Blantyre',
11 => 'Africa/Brazzaville',
12 => 'Africa/Bujumbura',
13 => 'Africa/Cairo',
14 => 'Africa/Casablanca',
15 => 'Africa/Ceuta',
16 => 'Africa/Conakry',
17 => 'Africa/Dakar',
18 => 'Africa/Dar_es_Salaam',
19 => 'Africa/Djibouti',
20 => 'Africa/Douala',
21 => 'Africa/El_Aaiun',
22 => 'Africa/Freetown',
23 => 'Africa/Gaborone',
24 => 'Africa/Harare',
25 => 'Africa/Johannesburg',
26 => 'Africa/Juba',
27 => 'Africa/Kampala',
28 => 'Africa/Khartoum',
29 => 'Africa/Kigali',
30 => 'Africa/Kinshasa',
31 => 'Africa/Lagos',
32 => 'Africa/Libreville',
33 => 'Africa/Lome',
34 => 'Africa/Luanda',
35 => 'Africa/Lubumbashi',
36 => 'Africa/Lusaka',
37 => 'Africa/Malabo',
38 => 'Africa/Maputo',
39 => 'Africa/Maseru',
40 => 'Africa/Mbabane',
41 => 'Africa/Mogadishu',
42 => 'Africa/Monrovia',
43 => 'Africa/Nairobi',
44 => 'Africa/Ndjamena',
45 => 'Africa/Niamey',
46 => 'Africa/Nouakchott',
47 => 'Africa/Ouagadougou',
48 => 'Africa/Porto-Novo',
49 => 'Africa/Sao_Tome',
50 => 'Africa/Timbuktu',
51 => 'Africa/Tripoli',
52 => 'Africa/Tunis',
53 => 'Africa/Windhoek',
54 => 'America/Adak',
55 => 'America/Anchorage',
56 => 'America/Anguilla',
57 => 'America/Antigua',
58 => 'America/Araguaina',
59 => 'America/Argentina/Buenos_Aires',
60 => 'America/Argentina/Catamarca',
61 => 'America/Argentina/ComodRivadavia',
62 => 'America/Argentina/Cordoba',
63 => 'America/Argentina/Jujuy',
64 => 'America/Argentina/La_Rioja',
65 => 'America/Argentina/Mendoza',
66 => 'America/Argentina/Rio_Gallegos',
67 => 'America/Argentina/Salta',
68 => 'America/Argentina/San_Juan',
69 => 'America/Argentina/San_Luis',
70 => 'America/Argentina/Tucuman',
71 => 'America/Argentina/Ushuaia',
72 => 'America/Aruba',
73 => 'America/Asuncion',
74 => 'America/Atikokan',
75 => 'America/Atka',
76 => 'America/Bahia',
77 => 'America/Bahia_Banderas',
78 => 'America/Barbados',
79 => 'America/Belem',
80 => 'America/Belize',
81 => 'America/Blanc-Sablon',
82 => 'America/Boa_Vista',
83 => 'America/Bogota',
84 => 'America/Boise',
85 => 'America/Buenos_Aires',
86 => 'America/Cambridge_Bay',
87 => 'America/Campo_Grande',
88 => 'America/Cancun',
89 => 'America/Caracas',
90 => 'America/Catamarca',
91 => 'America/Cayenne',
92 => 'America/Cayman',
93 => 'America/Chicago',
94 => 'America/Chihuahua',
95 => 'America/Coral_Harbour',
96 => 'America/Cordoba',
97 => 'America/Costa_Rica',
98 => 'America/Creston',
99 => 'America/Cuiaba',
100 => 'America/Curacao',
101 => 'America/Danmarkshavn',
102 => 'America/Dawson',
103 => 'America/Dawson_Creek',
104 => 'America/Denver',
105 => 'America/Detroit',
106 => 'America/Dominica',
107 => 'America/Edmonton',
108 => 'America/Eirunepe',
109 => 'America/El_Salvador',
110 => 'America/Ensenada',
111 => 'America/Fort_Nelson',
112 => 'America/Fort_Wayne',
113 => 'America/Fortaleza',
114 => 'America/Glace_Bay',
115 => 'America/Godthab',
116 => 'America/Goose_Bay',
117 => 'America/Grand_Turk',
118 => 'America/Grenada',
119 => 'America/Guadeloupe',
120 => 'America/Guatemala',
121 => 'America/Guayaquil',
122 => 'America/Guyana',
123 => 'America/Halifax',
124 => 'America/Havana',
125 => 'America/Hermosillo',
126 => 'America/Indiana/Indianapolis',
127 => 'America/Indiana/Knox',
128 => 'America/Indiana/Marengo',
129 => 'America/Indiana/Petersburg',
130 => 'America/Indiana/Tell_City',
131 => 'America/Indiana/Vevay',
132 => 'America/Indiana/Vincennes',
133 => 'America/Indiana/Winamac',
134 => 'America/Indianapolis',
135 => 'America/Inuvik',
136 => 'America/Iqaluit',
137 => 'America/Jamaica',
138 => 'America/Jujuy',
139 => 'America/Juneau',
140 => 'America/Kentucky/Louisville',
141 => 'America/Kentucky/Monticello',
142 => 'America/Knox_IN',
143 => 'America/Kralendijk',
144 => 'America/La_Paz',
145 => 'America/Lima',
146 => 'America/Los_Angeles',
147 => 'America/Louisville',
148 => 'America/Lower_Princes',
149 => 'America/Maceio',
150 => 'America/Managua',
151 => 'America/Manaus',
152 => 'America/Marigot',
153 => 'America/Martinique',
154 => 'America/Matamoros',
155 => 'America/Mazatlan',
156 => 'America/Mendoza',
157 => 'America/Menominee',
158 => 'America/Merida',
159 => 'America/Metlakatla',
160 => 'America/Mexico_City',
161 => 'America/Miquelon',
162 => 'America/Moncton',
163 => 'America/Monterrey',
164 => 'America/Montevideo',
165 => 'America/Montreal',
166 => 'America/Montserrat',
167 => 'America/Nassau',
168 => 'America/New_York',
169 => 'America/Nipigon',
170 => 'America/Nome',
171 => 'America/Noronha',
172 => 'America/North_Dakota/Beulah',
173 => 'America/North_Dakota/Center',
174 => 'America/North_Dakota/New_Salem',
175 => 'America/Ojinaga',
176 => 'America/Panama',
177 => 'America/Pangnirtung',
178 => 'America/Paramaribo',
179 => 'America/Phoenix',
180 => 'America/Port-au-Prince',
181 => 'America/Port_of_Spain',
182 => 'America/Porto_Acre',
183 => 'America/Porto_Velho',
184 => 'America/Puerto_Rico',
185 => 'America/Rainy_River',
186 => 'America/Rankin_Inlet',
187 => 'America/Recife',
188 => 'America/Regina',
189 => 'America/Resolute',
190 => 'America/Rio_Branco',
191 => 'America/Rosario',
192 => 'America/Santa_Isabel',
193 => 'America/Santarem',
194 => 'America/Santiago',
195 => 'America/Santo_Domingo',
196 => 'America/Sao_Paulo',
197 => 'America/Scoresbysund',
198 => 'America/Shiprock',
199 => 'America/Sitka',
200 => 'America/St_Barthelemy',
201 => 'America/St_Johns',
202 => 'America/St_Kitts',
203 => 'America/St_Lucia',
204 => 'America/St_Thomas',
205 => 'America/St_Vincent',
206 => 'America/Swift_Current',
207 => 'America/Tegucigalpa',
208 => 'America/Thule',
209 => 'America/Thunder_Bay',
210 => 'America/Tijuana',
211 => 'America/Toronto',
212 => 'America/Tortola',
213 => 'America/Vancouver',
214 => 'America/Virgin',
215 => 'America/Whitehorse',
216 => 'America/Winnipeg',
217 => 'America/Yakutat',
218 => 'America/Yellowknife',
219 => 'Antarctica/Casey',
220 => 'Antarctica/Davis',
221 => 'Antarctica/DumontDUrville',
222 => 'Antarctica/Macquarie',
223 => 'Antarctica/Mawson',
224 => 'Antarctica/McMurdo',
225 => 'Antarctica/Palmer',
226 => 'Antarctica/Rothera',
227 => 'Antarctica/South_Pole',
228 => 'Antarctica/Syowa',
229 => 'Antarctica/Troll',
230 => 'Antarctica/Vostok',
231 => 'Arctic/Longyearbyen',
232 => 'Asia/Aden',
233 => 'Asia/Almaty',
234 => 'Asia/Amman',
235 => 'Asia/Anadyr',
236 => 'Asia/Aqtau',
237 => 'Asia/Aqtobe',
238 => 'Asia/Ashgabat',
239 => 'Asia/Ashkhabad',
240 => 'Asia/Baghdad',
241 => 'Asia/Bahrain',
242 => 'Asia/Baku',
243 => 'Asia/Bangkok',
244 => 'Asia/Beirut',
245 => 'Asia/Bishkek',
246 => 'Asia/Brunei',
247 => 'Asia/Calcutta',
248 => 'Asia/Chita',
249 => 'Asia/Choibalsan',
250 => 'Asia/Chongqing',
251 => 'Asia/Chungking',
252 => 'Asia/Colombo',
253 => 'Asia/Dacca',
254 => 'Asia/Damascus',
255 => 'Asia/Dhaka',
256 => 'Asia/Dili',
257 => 'Asia/Dubai',
258 => 'Asia/Dushanbe',
259 => 'Asia/Gaza',
260 => 'Asia/Harbin',
261 => 'Asia/Hebron',
262 => 'Asia/Ho_Chi_Minh',
263 => 'Asia/Hong_Kong',
264 => 'Asia/Hovd',
265 => 'Asia/Irkutsk',
266 => 'Asia/Istanbul',
267 => 'Asia/Jakarta',
268 => 'Asia/Jayapura',
269 => 'Asia/Jerusalem',
270 => 'Asia/Kabul',
271 => 'Asia/Kamchatka',
272 => 'Asia/Karachi',
273 => 'Asia/Kashgar',
274 => 'Asia/Kathmandu',
275 => 'Asia/Katmandu',
276 => 'Asia/Khandyga',
277 => 'Asia/Kolkata',
278 => 'Asia/Krasnoyarsk',
279 => 'Asia/Kuala_Lumpur',
280 => 'Asia/Kuching',
281 => 'Asia/Kuwait',
282 => 'Asia/Macao',
283 => 'Asia/Macau',
284 => 'Asia/Magadan',
285 => 'Asia/Makassar',
286 => 'Asia/Manila',
287 => 'Asia/Muscat',
288 => 'Asia/Nicosia',
289 => 'Asia/Novokuznetsk',
290 => 'Asia/Novosibirsk',
291 => 'Asia/Omsk',
292 => 'Asia/Oral',
293 => 'Asia/Phnom_Penh',
294 => 'Asia/Pontianak',
295 => 'Asia/Pyongyang',
296 => 'Asia/Qatar',
297 => 'Asia/Qyzylorda',
298 => 'Asia/Rangoon',
299 => 'Asia/Riyadh',
300 => 'Asia/Saigon',
301 => 'Asia/Sakhalin',
302 => 'Asia/Samarkand',
303 => 'Asia/Seoul',
304 => 'Asia/Shanghai',
305 => 'Asia/Singapore',
306 => 'Asia/Srednekolymsk',
307 => 'Asia/Taipei',
308 => 'Asia/Tashkent',
309 => 'Asia/Tbilisi',
310 => 'Asia/Tehran',
311 => 'Asia/Tel_Aviv',
312 => 'Asia/Thimbu',
313 => 'Asia/Thimphu',
314 => 'Asia/Tokyo',
315 => 'Asia/Ujung_Pandang',
316 => 'Asia/Ulaanbaatar',
317 => 'Asia/Ulan_Bator',
318 => 'Asia/Urumqi',
319 => 'Asia/Ust-Nera',
320 => 'Asia/Vientiane',
321 => 'Asia/Vladivostok',
322 => 'Asia/Yakutsk',
323 => 'Asia/Yekaterinburg',
324 => 'Asia/Yerevan',
325 => 'Atlantic/Azores',
326 => 'Atlantic/Bermuda',
327 => 'Atlantic/Canary',
328 => 'Atlantic/Cape_Verde',
329 => 'Atlantic/Faeroe',
330 => 'Atlantic/Faroe',
331 => 'Atlantic/Jan_Mayen',
332 => 'Atlantic/Madeira',
333 => 'Atlantic/Reykjavik',
334 => 'Atlantic/South_Georgia',
335 => 'Atlantic/St_Helena',
336 => 'Atlantic/Stanley',
337 => 'Australia/ACT',
338 => 'Australia/Adelaide',
339 => 'Australia/Brisbane',
340 => 'Australia/Broken_Hill',
341 => 'Australia/Canberra',
342 => 'Australia/Currie',
343 => 'Australia/Darwin',
344 => 'Australia/Eucla',
345 => 'Australia/Hobart',
346 => 'Australia/LHI',
347 => 'Australia/Lindeman',
348 => 'Australia/Lord_Howe',
349 => 'Australia/Melbourne',
350 => 'Australia/North',
351 => 'Australia/NSW',
352 => 'Australia/Perth',
353 => 'Australia/Queensland',
354 => 'Australia/South',
355 => 'Australia/Sydney',
356 => 'Australia/Tasmania',
357 => 'Australia/Victoria',
358 => 'Australia/West',
359 => 'Australia/Yancowinna',
360 => 'Europe/Amsterdam',
361 => 'Europe/Andorra',
362 => 'Europe/Athens',
363 => 'Europe/Belfast',
364 => 'Europe/Belgrade',
365 => 'Europe/Berlin',
366 => 'Europe/Bratislava',
367 => 'Europe/Brussels',
368 => 'Europe/Bucharest',
369 => 'Europe/Budapest',
370 => 'Europe/Busingen',
371 => 'Europe/Chisinau',
372 => 'Europe/Copenhagen',
373 => 'Europe/Dublin',
374 => 'Europe/Gibraltar',
375 => 'Europe/Guernsey',
376 => 'Europe/Helsinki',
377 => 'Europe/Isle_of_Man',
378 => 'Europe/Istanbul',
379 => 'Europe/Jersey',
380 => 'Europe/Kaliningrad',
381 => 'Europe/Kiev',
382 => 'Europe/Lisbon',
383 => 'Europe/Ljubljana',
384 => 'Europe/London',
385 => 'Europe/Luxembourg',
386 => 'Europe/Madrid',
387 => 'Europe/Malta',
388 => 'Europe/Mariehamn',
389 => 'Europe/Minsk',
390 => 'Europe/Monaco',
391 => 'Europe/Moscow',
392 => 'Europe/Nicosia',
393 => 'Europe/Oslo',
394 => 'Europe/Paris',
395 => 'Europe/Podgorica',
396 => 'Europe/Prague',
397 => 'Europe/Riga',
398 => 'Europe/Rome',
399 => 'Europe/Samara',
400 => 'Europe/San_Marino',
401 => 'Europe/Sarajevo',
402 => 'Europe/Simferopol',
403 => 'Europe/Skopje',
404 => 'Europe/Sofia',
405 => 'Europe/Stockholm',
406 => 'Europe/Tallinn',
407 => 'Europe/Tirane',
408 => 'Europe/Tiraspol',
409 => 'Europe/Uzhgorod',
410 => 'Europe/Vaduz',
411 => 'Europe/Vatican',
412 => 'Europe/Vienna',
413 => 'Europe/Vilnius',
414 => 'Europe/Volgograd',
415 => 'Europe/Warsaw',
416 => 'Europe/Zagreb',
417 => 'Europe/Zaporozhye',
418 => 'Europe/Zurich',
419 => 'Indian/Antananarivo',
420 => 'Indian/Chagos',
421 => 'Indian/Christmas',
422 => 'Indian/Cocos',
423 => 'Indian/Comoro',
424 => 'Indian/Kerguelen',
425 => 'Indian/Mahe',
426 => 'Indian/Maldives',
427 => 'Indian/Mauritius',
428 => 'Indian/Mayotte',
429 => 'Indian/Reunion',
430 => 'Pacific/Apia',
431 => 'Pacific/Auckland',
432 => 'Pacific/Bougainville',
433 => 'Pacific/Chatham',
434 => 'Pacific/Chuuk',
435 => 'Pacific/Easter',
436 => 'Pacific/Efate',
437 => 'Pacific/Enderbury',
438 => 'Pacific/Fakaofo',
439 => 'Pacific/Fiji',
440 => 'Pacific/Funafuti',
441 => 'Pacific/Galapagos',
442 => 'Pacific/Gambier',
443 => 'Pacific/Guadalcanal',
444 => 'Pacific/Guam',
445 => 'Pacific/Honolulu',
446 => 'Pacific/Johnston',
447 => 'Pacific/Kiritimati',
448 => 'Pacific/Kosrae',
449 => 'Pacific/Kwajalein',
450 => 'Pacific/Majuro',
451 => 'Pacific/Marquesas',
452 => 'Pacific/Midway',
453 => 'Pacific/Nauru',
454 => 'Pacific/Niue',
455 => 'Pacific/Norfolk',
456 => 'Pacific/Noumea',
457 => 'Pacific/Pago_Pago',
458 => 'Pacific/Palau',
459 => 'Pacific/Pitcairn',
460 => 'Pacific/Pohnpei',
461 => 'Pacific/Ponape',
462 => 'Pacific/Port_Moresby',
463 => 'Pacific/Rarotonga',
464 => 'Pacific/Saipan',
465 => 'Pacific/Samoa',
466 => 'Pacific/Tahiti',
467 => 'Pacific/Tarawa',
468 => 'Pacific/Tongatapu',
469 => 'Pacific/Truk',
470 => 'Pacific/Wake',
471 => 'Pacific/Wallis',
472 => 'Pacific/Yap',
473 => 'Brazil/Acre',
474 => 'Brazil/DeNoronha',
475 => 'Brazil/East',
476 => 'Brazil/West',
477 => 'Canada/Atlantic',
478 => 'Canada/Central',
479 => 'Canada/East-Saskatchewan',
480 => 'Canada/Eastern',
481 => 'Canada/Mountain',
482 => 'Canada/Newfoundland',
483 => 'Canada/Pacific',
484 => 'Canada/Saskatchewan',
485 => 'Canada/Yukon',
486 => 'CET',
487 => 'Chile/Continental',
488 => 'Chile/EasterIsland',
489 => 'CST6CDT',
490 => 'Cuba',
491 => 'EET',
492 => 'Egypt',
493 => 'Eire',
494 => 'EST',
495 => 'EST5EDT',
496 => 'Etc/GMT',
497 => 'Etc/GMT+0',
498 => 'Etc/GMT+1',
499 => 'Etc/GMT+10',
500 => 'Etc/GMT+11',
501 => 'Etc/GMT+12',
502 => 'Etc/GMT+2',
503 => 'Etc/GMT+3',
504 => 'Etc/GMT+4',
505 => 'Etc/GMT+5',
506 => 'Etc/GMT+6',
507 => 'Etc/GMT+7',
508 => 'Etc/GMT+8',
509 => 'Etc/GMT+9',
510 => 'Etc/GMT-0',
511 => 'Etc/GMT-1',
512 => 'Etc/GMT-10',
513 => 'Etc/GMT-11',
514 => 'Etc/GMT-12',
515 => 'Etc/GMT-13',
516 => 'Etc/GMT-14',
517 => 'Etc/GMT-2',
518 => 'Etc/GMT-3',
519 => 'Etc/GMT-4',
520 => 'Etc/GMT-5',
521 => 'Etc/GMT-6',
522 => 'Etc/GMT-7',
523 => 'Etc/GMT-8',
524 => 'Etc/GMT-9',
525 => 'Etc/GMT0',
526 => 'Etc/Greenwich',
527 => 'Etc/UCT',
528 => 'Etc/Universal',
529 => 'Etc/UTC',
530 => 'Etc/Zulu',
531 => 'Factory',
532 => 'GB',
533 => 'GB-Eire',
534 => 'GMT',
535 => 'GMT+0',
536 => 'GMT-0',
537 => 'GMT0',
538 => 'Greenwich',
539 => 'Hongkong',
540 => 'HST',
541 => 'Iceland',
542 => 'Iran',
543 => 'Israel',
544 => 'Jamaica',
545 => 'Japan',
546 => 'Kwajalein',
547 => 'Libya',
548 => 'MET',
549 => 'Mexico/BajaNorte',
550 => 'Mexico/BajaSur',
551 => 'Mexico/General',
552 => 'MST',
553 => 'MST7MDT',
554 => 'Navajo',
555 => 'NZ',
556 => 'NZ-CHAT',
557 => 'Poland',
558 => 'Portugal',
559 => 'PRC',
560 => 'PST8PDT',
561 => 'ROC',
562 => 'ROK',
563 => 'Singapore',
564 => 'Turkey',
565 => 'UCT',
566 => 'Universal',
567 => 'US/Alaska',
568 => 'US/Aleutian',
569 => 'US/Arizona',
570 => 'US/Central',
571 => 'US/East-Indiana',
572 => 'US/Eastern',
573 => 'US/Hawaii',
574 => 'US/Indiana-Starke',
575 => 'US/Michigan',
576 => 'US/Mountain',
577 => 'US/Pacific',
578 => 'US/Pacific-New',
579 => 'US/Samoa',
580 => 'UTC',
581 => 'W-SU',
582 => 'WET',
583 => 'Zulu',
)
You will have to make sure that your dates are valid date objects.
Try this:
$date1=date('d/m/y');
$tempArr=explode('_', '31_12_11');
$date2 = date("d/m/y", mktime(0, 0, 0, $tempArr[1], $tempArr[0], $tempArr[2]));
You can then perform the strtotime()
method to get the difference.
Sorry, but at this time is not possible resize arrays, and may be never will be.
So my recommendation, is to think more to find a solution that allow you get from the beginning of the process, the size of the arrays that you will requiere. This often will implicate that your code need a little more time (lines) to run, but you will save a lot of memory resources.
if you are using nvm
node version manager, use this command to create a symlink:
sudo ln -s "$(which node)" /usr/bin/node
sudo ln -s "$(which npm)" /usr/bin/npm
node
npm
The right way to do this, starting with Spring 4.1, is to use a @TestPropertySource
annotation.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:whereever/context.xml")
@TestPropertySource(properties = {"myproperty = foo"})
public class TestWarSpringContext {
...
}
See @TestPropertySource in the Spring docs and Javadocs.
DECLARE @str AS VARCHAR(100)
SET @str='1,2 , 3, 4, 5,6'
SELECT COALESCE(LTRIM(CAST(('<X>'+REPLACE(@str,',' ,'</X><X>')+'</X>') AS XML).value('(/X)[1]', 'varchar(128)')), ''),
COALESCE(LTRIM(CAST(('<X>'+REPLACE(@str,',' ,'</X><X>')+'</X>') AS XML).value('(/X)[2]', 'varchar(128)')), ''),
COALESCE(LTRIM(CAST(('<X>'+REPLACE(@str,',' ,'</X><X>')+'</X>') AS XML).value('(/X)[3]', 'varchar(128)')), ''),
COALESCE(LTRIM(CAST(('<X>'+REPLACE(@str,',' ,'</X><X>')+'</X>') AS XML).value('(/X)[4]', 'varchar(128)')), ''),
COALESCE(LTRIM(CAST(('<X>'+REPLACE(@str,',' ,'</X><X>')+'</X>') AS XML).value('(/X)[5]', 'varchar(128)')), ''),
COALESCE(LTRIM(CAST(('<X>'+REPLACE(@str,',' ,'</X><X>')+'</X>') AS XML).value('(/X)[6]', 'varchar(128)')), ''),
COALESCE(LTRIM(CAST(('<X>'+REPLACE(@str,',' ,'</X><X>')+'</X>') AS XML).value('(/X)[7]', 'varchar(128)')), ''),
COALESCE(LTRIM(CAST(('<X>'+REPLACE(@str,',' ,'</X><X>')+'</X>') AS XML).value('(/X)[8]', 'varchar(128)')), ''),
COALESCE(LTRIM(CAST(('<X>'+REPLACE(@str,',' ,'</X><X>')+'</X>') AS XML).value('(/X)[9]', 'varchar(128)')), '')
After struggling with this for hours trying to get it to work in IE8, 9, and 10 here's what worked for me.
This stripped-down CSS works in FF 26, Chrome 32, Opera 18, and IE9 -11 as of 1/7/2014:
.wrap
{
width: 320px;
height: 192px;
padding: 0;
overflow: hidden;
}
.frame
{
width: 1280px;
height: 786px;
border: 0;
-ms-transform: scale(0.25);
-moz-transform: scale(0.25);
-o-transform: scale(0.25);
-webkit-transform: scale(0.25);
transform: scale(0.25);
-ms-transform-origin: 0 0;
-moz-transform-origin: 0 0;
-o-transform-origin: 0 0;
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
}
For IE8, set the width/height to match the iframe, and add -ms-zoom to the .wrap container div:
.wrap
{
width: 1280px; /* same size as frame */
height: 768px;
-ms-zoom: 0.25; /* for IE 8 ONLY */
}
Just use your favorite method for browser sniffing to conditionally include the appropriate CSS, see Is there a way to do browser specific conditional CSS inside a *.css file? for some ideas.
IE7 was a lost cause since -ms-zoom did not exist until IE8.
Here's the actual HTML I tested with:
<div class="wrap">
<iframe class="frame" src="http://time.is"></iframe>
</div>
<div class="wrap">
<iframe class="frame" src="http://apple.com"></iframe>
</div>
{{-- dynamic select/dropdown --}}
<select class="form-control m-bot15" name="district_id"
onchange ="location = this.options[this.selectedIndex].value;"
>
<option value="">--Select--</option>
<option value="?">All</option>
@foreach($location as $district)
<option value="?district_id={{ $district->district_id }}" >
{{ $district->district }}
</option>
@endforeach
</select>
I had the same problem, but calling this.form.controls['name'].disable() did not fixed it because I was reloading my view (using router.navigate()).
In my case I had to reset my form before reloading:
this.form = undefined; this.router.navigate([path]);
The header field name registry is defined in RFC3864, and there's nothing special with "X-".
As far as I can tell, there are no guidelines for private headers; in doubt, avoid them. Or have a look at the HTTP Extension Framework (RFC 2774).
It would be interesting to understand more of the use case; why can't the information be added to the message body?
int
is predefined in library function c# but in java we can create object of Integer
No jQuery:
// Return an array of the selected opion values
// select is an HTML select element
function getSelectValues(select) {
var result = [];
var options = select && select.options;
var opt;
for (var i=0, iLen=options.length; i<iLen; i++) {
opt = options[i];
if (opt.selected) {
result.push(opt.value || opt.text);
}
}
return result;
}
Quick example:
<select multiple>
<option>opt 1 text
<option value="opt 2 value">opt 2 text
</select>
<button onclick="
var el = document.getElementsByTagName('select')[0];
alert(getSelectValues(el));
">Show selected values</button>
[textfield setValue:your_color forKeyPath:@"_placeholderLabel.textColor"];
Hope it helps.
Note: Apple may reject (0.01% chances) your app as we are accessing private API. I am using this in all my projects since two years, but Apple didn't ask for this.
It looks like you're passing in Null for every argument except for PropertyValueID and DropDownOptionID, right? I don't think any of your IF statements will fire if only these two values are not-null. In short, I think you have a logic error.
Other than that, I would suggest two things...
First, instead of testing for NULL, use this kind syntax on your if statements (it's safer)...
ELSE IF ISNULL(@UnitValue, 0) != 0 AND ISNULL(@UnitOfMeasureID, 0) = 0
Second, add a meaningful PRINT statement before each UPDATE. That way, when you run the sproc in MSSQL, you can look at the messages and see how far it's actually getting.
This is called fire and forget, and there is an extension for that.
Consumes a task and doesn't do anything with it. Useful for fire-and-forget calls to async methods within async methods.
Install nuget package.
Use:
MyAsyncMethod().Forget();
Neil's answer is by far the best one. However things get messy really fast. My suggestion would be to use variables to store elements and append them to the DOM hierarchy.
HTML
<table id="tableID">
<tbody>
</tbody>
</table>
JAVASCRIPT
// Reference to the table body
var body = $("#tableID").find('tbody');
// Create a new row element
var row = $('<tr>');
// Create a new column element
var column = $('<td>');
// Create a new image element
var image = $('<img>');
image.attr('src', 'img.png');
image.text('Image cell');
// Append the image to the column element
column.append(image);
// Append the column to the row element
row.append(column);
// Append the row to the table body
body.append(row);
We could make that not so easy by hiding context menu, like this:
<video oncontextmenu="return false;" controls>
<source src="https://yoursite.com/yourvideo.mp4" >
</video>
Got the following to work May 2018 with ES6 React Docs as a reference: https://reactjs.org/docs/refs-and-the-dom.html
import React, { Component } from "react";
class AddImage extends Component {
constructor(props) {
super(props);
this.fileUpload = React.createRef();
this.showFileUpload = this.showFileUpload.bind(this);
}
showFileUpload() {
this.fileUpload.current.click();
}
render() {
return (
<div className="AddImage">
<input
type="file"
id="my_file"
style={{ display: "none" }}
ref={this.fileUpload}
/>
<input
type="image"
src="http://www.graphicssimplified.com/wp-content/uploads/2015/04/upload-cloud.png"
width="30px"
onClick={this.showFileUpload}
/>
</div>
);
}
}
export default AddImage;
There is a lot of confusion about IdentityDbContext, a quick search in Stackoverflow and you'll find these questions:
"
Why is Asp.Net Identity IdentityDbContext a Black-Box?
How can I change the table names when using Visual Studio 2013 AspNet Identity?
Merge MyDbContext with IdentityDbContext"
To answer to all of these questions we need to understand that IdentityDbContext is just a class inherited from DbContext.
Let's take a look at IdentityDbContext source:
/// <summary>
/// Base class for the Entity Framework database context used for identity.
/// </summary>
/// <typeparam name="TUser">The type of user objects.</typeparam>
/// <typeparam name="TRole">The type of role objects.</typeparam>
/// <typeparam name="TKey">The type of the primary key for users and roles.</typeparam>
/// <typeparam name="TUserClaim">The type of the user claim object.</typeparam>
/// <typeparam name="TUserRole">The type of the user role object.</typeparam>
/// <typeparam name="TUserLogin">The type of the user login object.</typeparam>
/// <typeparam name="TRoleClaim">The type of the role claim object.</typeparam>
/// <typeparam name="TUserToken">The type of the user token object.</typeparam>
public abstract class IdentityDbContext<TUser, TRole, TKey, TUserClaim, TUserRole, TUserLogin, TRoleClaim, TUserToken> : DbContext
where TUser : IdentityUser<TKey, TUserClaim, TUserRole, TUserLogin>
where TRole : IdentityRole<TKey, TUserRole, TRoleClaim>
where TKey : IEquatable<TKey>
where TUserClaim : IdentityUserClaim<TKey>
where TUserRole : IdentityUserRole<TKey>
where TUserLogin : IdentityUserLogin<TKey>
where TRoleClaim : IdentityRoleClaim<TKey>
where TUserToken : IdentityUserToken<TKey>
{
/// <summary>
/// Initializes a new instance of <see cref="IdentityDbContext"/>.
/// </summary>
/// <param name="options">The options to be used by a <see cref="DbContext"/>.</param>
public IdentityDbContext(DbContextOptions options) : base(options)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="IdentityDbContext" /> class.
/// </summary>
protected IdentityDbContext()
{ }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of Users.
/// </summary>
public DbSet<TUser> Users { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of User claims.
/// </summary>
public DbSet<TUserClaim> UserClaims { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of User logins.
/// </summary>
public DbSet<TUserLogin> UserLogins { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of User roles.
/// </summary>
public DbSet<TUserRole> UserRoles { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of User tokens.
/// </summary>
public DbSet<TUserToken> UserTokens { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of roles.
/// </summary>
public DbSet<TRole> Roles { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of role claims.
/// </summary>
public DbSet<TRoleClaim> RoleClaims { get; set; }
/// <summary>
/// Configures the schema needed for the identity framework.
/// </summary>
/// <param name="builder">
/// The builder being used to construct the model for this context.
/// </param>
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<TUser>(b =>
{
b.HasKey(u => u.Id);
b.HasIndex(u => u.NormalizedUserName).HasName("UserNameIndex").IsUnique();
b.HasIndex(u => u.NormalizedEmail).HasName("EmailIndex");
b.ToTable("AspNetUsers");
b.Property(u => u.ConcurrencyStamp).IsConcurrencyToken();
b.Property(u => u.UserName).HasMaxLength(256);
b.Property(u => u.NormalizedUserName).HasMaxLength(256);
b.Property(u => u.Email).HasMaxLength(256);
b.Property(u => u.NormalizedEmail).HasMaxLength(256);
b.HasMany(u => u.Claims).WithOne().HasForeignKey(uc => uc.UserId).IsRequired();
b.HasMany(u => u.Logins).WithOne().HasForeignKey(ul => ul.UserId).IsRequired();
b.HasMany(u => u.Roles).WithOne().HasForeignKey(ur => ur.UserId).IsRequired();
});
builder.Entity<TRole>(b =>
{
b.HasKey(r => r.Id);
b.HasIndex(r => r.NormalizedName).HasName("RoleNameIndex");
b.ToTable("AspNetRoles");
b.Property(r => r.ConcurrencyStamp).IsConcurrencyToken();
b.Property(u => u.Name).HasMaxLength(256);
b.Property(u => u.NormalizedName).HasMaxLength(256);
b.HasMany(r => r.Users).WithOne().HasForeignKey(ur => ur.RoleId).IsRequired();
b.HasMany(r => r.Claims).WithOne().HasForeignKey(rc => rc.RoleId).IsRequired();
});
builder.Entity<TUserClaim>(b =>
{
b.HasKey(uc => uc.Id);
b.ToTable("AspNetUserClaims");
});
builder.Entity<TRoleClaim>(b =>
{
b.HasKey(rc => rc.Id);
b.ToTable("AspNetRoleClaims");
});
builder.Entity<TUserRole>(b =>
{
b.HasKey(r => new { r.UserId, r.RoleId });
b.ToTable("AspNetUserRoles");
});
builder.Entity<TUserLogin>(b =>
{
b.HasKey(l => new { l.LoginProvider, l.ProviderKey });
b.ToTable("AspNetUserLogins");
});
builder.Entity<TUserToken>(b =>
{
b.HasKey(l => new { l.UserId, l.LoginProvider, l.Name });
b.ToTable("AspNetUserTokens");
});
}
}
Based on the source code if we want to merge IdentityDbContext with our DbContext we have two options:
First Option:
Create a DbContext which inherits from IdentityDbContext and have access to the classes.
public class ApplicationDbContext
: IdentityDbContext
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
static ApplicationDbContext()
{
Database.SetInitializer<ApplicationDbContext>(new ApplicationDbInitializer());
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
// Add additional items here as needed
}
Extra Notes:
1) We can also change asp.net Identity default table names with the following solution:
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(): base("DefaultConnection")
{
}
protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<IdentityUser>().ToTable("user");
modelBuilder.Entity<ApplicationUser>().ToTable("user");
modelBuilder.Entity<IdentityRole>().ToTable("role");
modelBuilder.Entity<IdentityUserRole>().ToTable("userrole");
modelBuilder.Entity<IdentityUserClaim>().ToTable("userclaim");
modelBuilder.Entity<IdentityUserLogin>().ToTable("userlogin");
}
}
2) Furthermore we can extend each class and add any property to classes like 'IdentityUser', 'IdentityRole', ...
public class ApplicationRole : IdentityRole<string, ApplicationUserRole>
{
public ApplicationRole()
{
this.Id = Guid.NewGuid().ToString();
}
public ApplicationRole(string name)
: this()
{
this.Name = name;
}
// Add any custom Role properties/code here
}
// Must be expressed in terms of our custom types:
public class ApplicationDbContext
: IdentityDbContext<ApplicationUser, ApplicationRole,
string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim>
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
static ApplicationDbContext()
{
Database.SetInitializer<ApplicationDbContext>(new ApplicationDbInitializer());
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
// Add additional items here as needed
}
To save time we can use AspNet Identity 2.0 Extensible Project Template to extend all the classes.
Second Option:(Not recommended)
We actually don't have to inherit from IdentityDbContext if we write all the code ourselves.
So basically we can just inherit from DbContext and implement our customized version of "OnModelCreating(ModelBuilder builder)" from the IdentityDbContext source code
I know it's an old post but I had the same issue today, what I did is simple : changing my script that send my playbook from my local host to the server, before sending it with maven command, I did this :
cat common_vars.yml > vars.yml
cat snapshot_vars.yml >> vars.yml
# or
#cat release_vars.yml >> vars.yml
mvn ....
Inspired by an article discussing immutable implementations of recursive data structures I put an alternate solution together using Swift.
The leading answer documents solution by highlighting the following topics:
I have called these out where applicable in the solution below.
/**
Node is a class that stores an arbitrary value of generic type T
and a pointer to another Node of the same time. This is a recursive
data structure representative of a member of a unidirectional linked
list.
*/
public class Node<T> {
public let value: T
public let next: Node<T>?
public init(value: T, next: Node<T>?) {
self.value = value
self.next = next
}
public func reversedList() -> Node<T> {
if let next = self.next {
// 3. The reverse of the second element on followed by the first element.
return next.reversedList() + value
} else {
// 2. Reverse of a one element list is itself
return self
}
}
}
/**
@return Returns a newly created Node consisting of the lhs list appended with rhs value.
*/
public func +<T>(lhs: Node<T>, rhs: T) -> Node<T> {
let tail: Node<T>?
if let next = lhs.next {
// The new tail is created recursively, as long as there is a next node.
tail = next + rhs
} else {
// If there is not a next node, create a new tail node to append
tail = Node<T>(value: rhs, next: nil)
}
// Return a newly created Node consisting of the lhs list appended with rhs value.
return Node<T>(value: lhs.value, next: tail)
}
If you read a string from an XML file, the line break \n
in this string will not work in UILabel
text. The \n
is not parsed to a line break.
Here is a little trick to solve this issue:
// correct next line \n in string from XML file
NSString *myNewLineStr = @"\n";
myLabelText = [myLabelText stringByReplacingOccurrencesOfString:@"\\n" withString:myNewLineStr];
myLabel.text = myLabelText;
So you have to replace the unparsed \n
part in your string by a parsed \n
in a hardcoded NSString
.
Here are my other label settings:
myLabel.numberOfLines = 0;
myLabel.backgroundColor = [UIColor lightGrayColor];
myLabel.textColor = [UIColor redColor];
myLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:14.0];
myLabel.textAlignment = UITextAlignmentCenter;
Most important is to set numberOfLines
to 0
(= unlimited number of lines in label).
No idea why Apple has chosen to not parse \n
in strings read from XML?
Hope this helps.
public class Node
{
private Object data;
public Node next {get;set;}
public Node(Object data)
{
this.data = data;
}
}
public class Linkedlist
{
Node head;
public void Add(Node n)
{
n.Next = this.Head;
this.Head = n;
}
}
using:
LinkedList sample = new LinkedList();
sample.add(new Node("first"));
sample.Add(new Node("second"))
Java Closures are going to be a part of J2SE 8 and is set to be released by the end of 2012.
Java 8's closures support include the concept of Lambda Expressions, Method Reference, Constructor Reference and the Default Methods.
For more information and working examples for this please visit: http://amitrp.blogspot.in/2012/08/at-first-sight-with-closures-in-java.html
Bulk inserts are possible by using nested array, see the github page
Nested arrays are turned into grouped lists (for bulk inserts), e.g.
[['a', 'b'], ['c', 'd']]
turns into('a', 'b'), ('c', 'd')
You just insert a nested array of elements.
An example is given in here
var mysql = require('mysql');
var conn = mysql.createConnection({
...
});
var sql = "INSERT INTO Test (name, email, n) VALUES ?";
var values = [
['demian', '[email protected]', 1],
['john', '[email protected]', 2],
['mark', '[email protected]', 3],
['pete', '[email protected]', 4]
];
conn.query(sql, [values], function(err) {
if (err) throw err;
conn.end();
});
Note: values
is an array of arrays wrapped in an array
[ [ [...], [...], [...] ] ]
There is also a totally different node-msql package for bulk insertion
The error is telling you that POI couldn't find a core part of the OOXML file, in this case the content types part. Your file isn't a valid OOXML file, let alone a valid .xlsx file. It is a valid zip file though, otherwise you'd have got an earlier error
Can Excel really load this file? I'd expect it wouldn't be able to, as the exception is most commonly triggered by giving POI a regular .zip file! I suspect your file isn't valid, hence the exception
.
Update: In Apache POI 3.15 (from beta 1 onwards), there's a more helpful set of Exception messages for the more common causes of this problem. You'll now get more descriptive exceptions in this case, eg ODFNotOfficeXmlFileException and OLE2NotOfficeXmlFileException. This raw form should only ever show up if POI really has no clue what you've given it but knows it's broken or invalid.
Very simple use this just in one line:
byte[] imgdata = File.ReadAllBytes(@"C:\download.png");
To change the font name use
"font.face": "Liberation Mono"
in this file, in my case with ST3 Default.sublime-theme
var template = $( "<li>", { id: "1234", html:
$( "<div>", { class: "bar", text: "bla" } )
});
$('body').append(template);
What about this?
This will give the correct (custom) filter when the file dialog is showing:
<input type="file" accept=".jpg, .png, .jpeg, .gif, .bmp, .tif, .tiff|image/*">
You could use it to call a superclass's method (such as when you are overriding such a method, super.foo() etc) -- this would allow you to keep that functionality and add on to it with whatever else you have in the overriden method.
If you want to convert back the file formats which have been changed to UNIX Format from PC format.
(1)You need to reinstall tortoise GIT and in the "Line Ending Conversion" Section make sure that you have selected "Check out as is - Check in as is"option.
(2)and keep the remaining configurations as it is.
(3)once installation is done
(4)write all the file extensions which are converted to UNIX format into a text file (extensions.txt).
ex:*.dsp
*.dsw
(5) copy the file into your clone Run the following command in GITBASH
while read -r a;
do
find . -type f -name "$a" -exec dos2unix {} \;
done<extension.txt
All you have to do is go to GitHub settings repositories and you see all the sizes right there in the browser no extra work needed.
For JSON data, it's much easier to POST it as "application/json" content-type. If you use GET, you have to URL-encode the JSON in a parameter and it's kind of messy. Also, there is no size limit when you do POST. GET's size if very limited (4K at most).
Both Jonathan and Charles are right... you've got to stop the service first, then uninstall/reinstall. Combining their two answers makes the perfect batch file or PowerShell script.
I will make mention of a caution learned the hard way -- Windows 2000 Server (possibly the client OS as well) will require a reboot before the reinstall no matter what. There must be a registry key that is not fully cleared until the box is rebooted. Windows Server 2003, Windows XP and later OS versions do not suffer that pain.
My naive assumption was that the size of scroll pane will be determined automatically...
The only solution that actually worked for me was explicitly seeting bounds of JScrollPane:
import javax.swing.*;
public class MyFrame extends JFrame {
public MyFrame()
{
setBounds(100, 100, 491, 310);
getContentPane().setLayout(null);
JTextArea textField = new JTextArea();
textField.setEditable(false);
String str = "";
for (int i = 0; i < 50; ++i)
str += "Some text\n";
textField.setText(str);
JScrollPane scroll = new JScrollPane(textField);
scroll.setBounds(10, 11, 455, 249); // <-- THIS
getContentPane().add(scroll);
setLocationRelativeTo ( null );
}
}
Maybe it will help some future visitors :)
Using this source code you can upload multiple file like google one by one through ajax. Also you can see the uploading progress
HTML
<input type="file" id="multiupload" name="uploadFiledd[]" multiple >
<button type="button" id="upcvr" class="btn btn-primary">Start Upload</button>
<div id="uploadsts"></div>
Javascript
<script>
function uploadajax(ttl,cl){
var fileList = $('#multiupload').prop("files");
$('#prog'+cl).removeClass('loading-prep').addClass('upload-image');
var form_data = "";
form_data = new FormData();
form_data.append("upload_image", fileList[cl]);
var request = $.ajax({
url: "upload.php",
cache: false,
contentType: false,
processData: false,
async: true,
data: form_data,
type: 'POST',
xhr: function() {
var xhr = $.ajaxSettings.xhr();
if(xhr.upload){
xhr.upload.addEventListener('progress', function(event){
var percent = 0;
if (event.lengthComputable) {
percent = Math.ceil(event.loaded / event.total * 100);
}
$('#prog'+cl).text(percent+'%')
}, false);
}
return xhr;
},
success: function (res, status) {
if (status == 'success') {
percent = 0;
$('#prog' + cl).text('');
$('#prog' + cl).text('--Success: ');
if (cl < ttl) {
uploadajax(ttl, cl + 1);
} else {
alert('Done');
}
}
},
fail: function (res) {
alert('Failed');
}
})
}
$('#upcvr').click(function(){
var fileList = $('#multiupload').prop("files");
$('#uploadsts').html('');
var i;
for ( i = 0; i < fileList.length; i++) {
$('#uploadsts').append('<p class="upload-page">'+fileList[i].name+'<span class="loading-prep" id="prog'+i+'"></span></p>');
if(i == fileList.length-1){
uploadajax(fileList.length-1,0);
}
}
});
</script>
PHP
upload.php
move_uploaded_file($_FILES["upload_image"]["tmp_name"],$_FILES["upload_image"]["name"]);
I tried this to fix access issues to an IIS website, which manifested as something like the following in the Event Logs ? Windows ? Application:
Log Name: Application Source: ASP.NET 4.0.30319.0 Date: 1/5/2012 4:12:33 PM Event ID: 1314 Task Category: Web Event Level: Information Keywords: Classic User: N/A Computer: SALTIIS01 Description: Event code: 4008 Event message: File authorization failed for the request. Event time: 1/5/2012 4:12:33 PM Event time (UTC): 1/6/2012 12:12:33 AM Event ID: 349fcb2ec3c24b16a862f6eb9b23dd6c Event sequence: 7 Event occurrence: 3 Event detail code: 0 Application information: Application domain: /LM/W3SVC/2/ROOT/Application/SNCDW-19-129702818025409890 Trust level: Full Application Virtual Path: /Application/SNCDW Application Path: D:\Sites\WCF\Application\SNCDW\ Machine name: SALTIIS01 Process information: Process ID: 1896 Process name: w3wp.exe Account name: iisservice Request information: Request URL: http://webservicestest/Application/SNCDW/PC.svc Request path: /Application/SNCDW/PC.svc User host address: 10.60.16.79 User: js3228 Is authenticated: True Authentication Type: Negotiate Thread account name: iisservice
In the end I had to give the Windows Everyone
group read access to that folder to get it to work properly.
Yes: TIME_CREATED contains a date and a time. Use TRUNC
to strip the time:
SELECT EMP_NAME, DEPT
FROM EMPLOYEE
WHERE TRUNC(TIME_CREATED) = TO_DATE('26/JAN/2011','dd/mon/yyyy')
UPDATE:
As Dave Costa points out in the comment below, this will prevent Oracle from using the index of the column TIME_CREATED
if it exists. An alternative approach without this problem is this:
SELECT EMP_NAME, DEPT
FROM EMPLOYEE
WHERE TIME_CREATED >= TO_DATE('26/JAN/2011','dd/mon/yyyy')
AND TIME_CREATED < TO_DATE('26/JAN/2011','dd/mon/yyyy') + 1
The following approach is correct:
<context:component-scan base-package="x.y.z.service, x.y.z.controller" />
Note that the error complains about x.y.z.dao.daoservice.LoginDAO
, which is not in the packages mentioned above, perhaps you forgot to add it:
<context:component-scan base-package="x.y.z.service, x.y.z.controller, x.y.z.dao" />
I needed to load the settings file synchronously, and this was my solution:
export function InitConfig(config: AppConfig) { return () => config.load(); }
import { Injectable } from '@angular/core';
@Injectable()
export class AppConfig {
Settings: ISettings;
constructor() { }
load() {
return new Promise((resolve) => {
this.Settings = this.httpGet('assets/clientsettings.json');
resolve(true);
});
}
httpGet(theUrl): ISettings {
const xmlHttp = new XMLHttpRequest();
xmlHttp.open( 'GET', theUrl, false ); // false for synchronous request
xmlHttp.send( null );
return JSON.parse(xmlHttp.responseText);
}
}
This is then provided as a app_initializer which is loaded before the rest of the application.
app.module.ts
{
provide: APP_INITIALIZER,
useFactory: InitConfig,
deps: [AppConfig],
multi: true
},
To convert a NSDictionary to a NSString:
NSError * err;
NSData * jsonData = [NSJSONSerialization dataWithJSONObject:myDictionary options:0 error:&err];
NSString * myString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
Considering the following data frame:
>>> df = pd.DataFrame(10*np.random.rand(3, 4), columns=list("ABCD"))
>>> print(df)
... A B C D
... 0 8.362940 0.354027 1.916283 6.226750
... 1 1.988232 9.003545 9.277504 8.522808
... 2 1.141432 4.935593 2.700118 7.739108
Using a list of column names, change the type for multiple columns with applymap()
:
>>> cols = ['A', 'B']
>>> df[cols] = df[cols].applymap(np.int64)
>>> print(df)
... A B C D
... 0 8 0 1.916283 6.226750
... 1 1 9 9.277504 8.522808
... 2 1 4 2.700118 7.739108
Or for a single column with apply()
:
>>> df['C'] = df['C'].apply(np.int64)
>>> print(df)
... A B C D
... 0 8 0 1 6.226750
... 1 1 9 9 8.522808
... 2 1 4 2 7.739108
fun pushNotification(message: String?, clickAtion: String?) {
val ii = Intent(clickAtion)
ii.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
val pendingIntent = PendingIntent.getActivity(this, REQUEST_CODE, ii, PendingIntent.FLAG_ONE_SHOT)
val soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
val largIcon = BitmapFactory.decodeResource(applicationContext.resources,
R.mipmap.ic_launcher)
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val channelId = "default_channel_id"
val channelDescription = "Default Channel"
// Since android Oreo notification channel is needed.
//Check if notification channel exists and if not create one
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
var notificationChannel = notificationManager.getNotificationChannel(channelId)
if (notificationChannel != null) {
val importance = NotificationManager.IMPORTANCE_HIGH //Set the importance level
notificationChannel = NotificationChannel(channelId, channelDescription, importance)
// notificationChannel.lightColor = Color.GREEN //Set if it is necesssary
notificationChannel.enableVibration(true) //Set if it is necesssary
notificationManager.createNotificationChannel(notificationChannel)
val noti_builder = NotificationCompat.Builder(this)
.setContentTitle("MMH")
.setContentText(message)
.setSmallIcon(R.drawable.ic_launcher_background)
.setChannelId(channelId)
.build()
val random = Random()
val id = random.nextInt()
notificationManager.notify(id,noti_builder)
}
}
else
{
val notificationBuilder = NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher).setColor(resources.getColor(R.color.colorPrimary))
.setVibrate(longArrayOf(200, 200, 0, 0, 0))
.setContentTitle(getString(R.string.app_name))
.setLargeIcon(largIcon)
.setContentText(message)
.setAutoCancel(true)
.setStyle(NotificationCompat.BigTextStyle().bigText(message))
.setSound(soundUri)
.setContentIntent(pendingIntent)
val random = Random()
val id = random.nextInt()
notificationManager.notify(id, notificationBuilder.build())
}
}
You do not need to use ORDER BY
in inner query after WHERE
clause because you have already used it in ROW_NUMBER() OVER (ORDER BY VRDATE DESC)
.
SELECT
*
FROM (
SELECT
Stockmain.VRNOA,
item.description as item_description,
party.name as party_name,
stockmain.vrdate,
stockdetail.qty,
stockdetail.rate,
stockdetail.amount,
ROW_NUMBER() OVER (ORDER BY VRDATE DESC) AS RowNum --< ORDER BY
FROM StockMain
INNER JOIN StockDetail
ON StockMain.stid = StockDetail.stid
INNER JOIN party
ON party.party_id = stockmain.party_id
INNER JOIN item
ON item.item_id = stockdetail.item_id
WHERE stockmain.etype='purchase'
) AS MyDerivedTable
WHERE
MyDerivedTable.RowNum BETWEEN 1 and 5
This is an answer to question 8391979, "Does java have a int.tryparse that doesn't throw an exception for bad data? [duplicate]" which is closed and linked to this question.
Edit 2016 08 17: Added ltrimZeroes methods and called them in tryParse(). Without leading zeroes in numberString may give false results (see comments in code). There is now also public static String ltrimZeroes(String numberString) method which works for positive and negative "numbers"(END Edit)
Below you find a rudimentary Wrapper (boxing) class for int with an highly speed optimized tryParse() method (similar as in C#) which parses the string itself and is a little bit faster than Integer.parseInt(String s) from Java:
public class IntBoxSimple {
// IntBoxSimple - Rudimentary class to implement a C#-like tryParse() method for int
// A full blown IntBox class implementation can be found in my Github project
// Copyright (c) 2016, Peter Sulzer, Fürth
// Program is published under the GNU General Public License (GPL) Version 1 or newer
protected int _n; // this "boxes" the int value
// BEGIN The following statements are only executed at the
// first instantiation of an IntBox (i. e. only once) or
// already compiled into the code at compile time:
public static final int MAX_INT_LEN =
String.valueOf(Integer.MAX_VALUE).length();
public static final int MIN_INT_LEN =
String.valueOf(Integer.MIN_VALUE).length();
public static final int MAX_INT_LASTDEC =
Integer.parseInt(String.valueOf(Integer.MAX_VALUE).substring(1));
public static final int MAX_INT_FIRSTDIGIT =
Integer.parseInt(String.valueOf(Integer.MAX_VALUE).substring(0, 1));
public static final int MIN_INT_LASTDEC =
-Integer.parseInt(String.valueOf(Integer.MIN_VALUE).substring(2));
public static final int MIN_INT_FIRSTDIGIT =
Integer.parseInt(String.valueOf(Integer.MIN_VALUE).substring(1,2));
// END The following statements...
// ltrimZeroes() methods added 2016 08 16 (are required by tryParse() methods)
public static String ltrimZeroes(String s) {
if (s.charAt(0) == '-')
return ltrimZeroesNegative(s);
else
return ltrimZeroesPositive(s);
}
protected static String ltrimZeroesNegative(String s) {
int i=1;
for ( ; s.charAt(i) == '0'; i++);
return ("-"+s.substring(i));
}
protected static String ltrimZeroesPositive(String s) {
int i=0;
for ( ; s.charAt(i) == '0'; i++);
return (s.substring(i));
}
public static boolean tryParse(String s,IntBoxSimple intBox) {
if (intBox == null)
// intBoxSimple=new IntBoxSimple(); // This doesn't work, as
// intBoxSimple itself is passed by value and cannot changed
// for the caller. I. e. "out"-arguments of C# cannot be simulated in Java.
return false; // so we simply return false
s=s.trim(); // leading and trailing whitespace is allowed for String s
int len=s.length();
int rslt=0, d, dfirst=0, i, j;
char c=s.charAt(0);
if (c == '-') {
if (len > MIN_INT_LEN) { // corrected (added) 2016 08 17
s = ltrimZeroesNegative(s);
len = s.length();
}
if (len >= MIN_INT_LEN) {
c = s.charAt(1);
if (!Character.isDigit(c))
return false;
dfirst = c-'0';
if (len > MIN_INT_LEN || dfirst > MIN_INT_FIRSTDIGIT)
return false;
}
for (i = len - 1, j = 1; i >= 2; --i, j *= 10) {
c = s.charAt(i);
if (!Character.isDigit(c))
return false;
rslt -= (c-'0')*j;
}
if (len < MIN_INT_LEN) {
c = s.charAt(i);
if (!Character.isDigit(c))
return false;
rslt -= (c-'0')*j;
} else {
if (dfirst >= MIN_INT_FIRSTDIGIT && rslt < MIN_INT_LASTDEC)
return false;
rslt -= dfirst * j;
}
} else {
if (len > MAX_INT_LEN) { // corrected (added) 2016 08 16
s = ltrimZeroesPositive(s);
len=s.length();
}
if (len >= MAX_INT_LEN) {
c = s.charAt(0);
if (!Character.isDigit(c))
return false;
dfirst = c-'0';
if (len > MAX_INT_LEN || dfirst > MAX_INT_FIRSTDIGIT)
return false;
}
for (i = len - 1, j = 1; i >= 1; --i, j *= 10) {
c = s.charAt(i);
if (!Character.isDigit(c))
return false;
rslt += (c-'0')*j;
}
if (len < MAX_INT_LEN) {
c = s.charAt(i);
if (!Character.isDigit(c))
return false;
rslt += (c-'0')*j;
}
if (dfirst >= MAX_INT_FIRSTDIGIT && rslt > MAX_INT_LASTDEC)
return false;
rslt += dfirst*j;
}
intBox._n=rslt;
return true;
}
// Get the value stored in an IntBoxSimple:
public int get_n() {
return _n;
}
public int v() { // alternative shorter version, v for "value"
return _n;
}
// Make objects of IntBoxSimple (needed as constructors are not public):
public static IntBoxSimple makeIntBoxSimple() {
return new IntBoxSimple();
}
public static IntBoxSimple makeIntBoxSimple(int integerNumber) {
return new IntBoxSimple(integerNumber);
}
// constructors are not public(!=:
protected IntBoxSimple() {} {
_n=0; // default value an IntBoxSimple holds
}
protected IntBoxSimple(int integerNumber) {
_n=integerNumber;
}
}
Test/example program for class IntBoxSimple:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class IntBoxSimpleTest {
public static void main (String args[]) {
IntBoxSimple ibs = IntBoxSimple.makeIntBoxSimple();
String in = null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
do {
System.out.printf(
"Enter an integer number in the range %d to %d:%n",
Integer.MIN_VALUE, Integer.MAX_VALUE);
try { in = br.readLine(); } catch (IOException ex) {}
} while(! IntBoxSimple.tryParse(in, ibs));
System.out.printf("The number you have entered was: %d%n", ibs.v());
}
}
Just add a "multidex-config.txt" in you app directory:
The @jfriend00's answer helps me to understand the technique to animate only remove class (not add).
A "base" class should have transition
property (like transition: 2s linear all;
). This enables animations when any other class is added or removed on this element. But to disable animation when other class is added (and only animate class removing) we need to add transition: none;
to the second class.
Example
CSS:
.issue {
background-color: lightblue;
transition: 2s linear all;
}
.recently-updated {
background-color: yellow;
transition: none;
}
HTML:
<div class="issue" onclick="addClass()">click me</div>
JS (only needed to add class):
var timeout = null;
function addClass() {
$('.issue').addClass('recently-updated');
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
timeout = setTimeout(function () {
$('.issue').removeClass('recently-updated');
}, 1000);
}
plunker of this example.
With this code only removing of recently-updated
class will be animated.
I dont think you need regex to achieve this. I would look at the SubString method along with the indexOf method. If you need more help, add a comment showing what you have attempted and I will offer more help.
That is usually all that you need to do...
Are you sure that after 20 minutes, the reason that the session is being lost is from being idle though...
There are many reasons as to why the session might be cleared. You can enable event logging for IIS and can then use the event viewer to see reasons why the session was cleared...you might find that it is for other reasons perhaps?
You can also read the documentation for event messages and the associated table of events.
I took Boann's answer and used it to create a more flexible query string builder that supports lists and arrays, just like php's http_build_query method:
public static byte[] httpBuildQueryString(Map<String, Object> postsData) throws UnsupportedEncodingException {
StringBuilder postData = new StringBuilder();
for (Map.Entry<String,Object> param : postsData.entrySet()) {
if (postData.length() != 0) postData.append('&');
Object value = param.getValue();
String key = param.getKey();
if(value instanceof Object[] || value instanceof List<?>)
{
int size = value instanceof Object[] ? ((Object[])value).length : ((List<?>)value).size();
for(int i = 0; i < size; i++)
{
Object val = value instanceof Object[] ? ((Object[])value)[i] : ((List<?>)value).get(i);
if(i>0) postData.append('&');
postData.append(URLEncoder.encode(key + "[" + i + "]", "UTF-8"));
postData.append('=');
postData.append(URLEncoder.encode(String.valueOf(val), "UTF-8"));
}
}
else
{
postData.append(URLEncoder.encode(key, "UTF-8"));
postData.append('=');
postData.append(URLEncoder.encode(String.valueOf(value), "UTF-8"));
}
}
return postData.toString().getBytes("UTF-8");
}
the $("body").append(r)
statement should be within the test
function, also there was misplaced "
in the test
method
function test() {
var r=$('<input/>').attr({
type: "button",
id: "field",
value: 'new'
});
$("body").append(r);
}
Demo: Fiddle
Update
In that case try a more jQuery-ish solution
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($){
$('#mybutton').one('click', function(){
var r=$('<input/>').attr({
type: "button",
id: "field",
value: 'new'
});
$("body").append(r);
})
})
</script>
</head>
<body>
<button id="mybutton">Insert after</button>
</body>
</html>
Demo: Plunker
Most answers here are from 2008. It looks that things have changed over the time. My latest benchmarks made with JMH shows that on Java 8 +
is around two times faster than concat
.
My benchmark:
@Warmup(iterations = 5, time = 200, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 5, time = 200, timeUnit = TimeUnit.MILLISECONDS)
public class StringConcatenation {
@org.openjdk.jmh.annotations.State(Scope.Thread)
public static class State2 {
public String a = "abc";
public String b = "xyz";
}
@org.openjdk.jmh.annotations.State(Scope.Thread)
public static class State3 {
public String a = "abc";
public String b = "xyz";
public String c = "123";
}
@org.openjdk.jmh.annotations.State(Scope.Thread)
public static class State4 {
public String a = "abc";
public String b = "xyz";
public String c = "123";
public String d = "!@#";
}
@Benchmark
public void plus_2(State2 state, Blackhole blackhole) {
blackhole.consume(state.a+state.b);
}
@Benchmark
public void plus_3(State3 state, Blackhole blackhole) {
blackhole.consume(state.a+state.b+state.c);
}
@Benchmark
public void plus_4(State4 state, Blackhole blackhole) {
blackhole.consume(state.a+state.b+state.c+state.d);
}
@Benchmark
public void stringbuilder_2(State2 state, Blackhole blackhole) {
blackhole.consume(new StringBuilder().append(state.a).append(state.b).toString());
}
@Benchmark
public void stringbuilder_3(State3 state, Blackhole blackhole) {
blackhole.consume(new StringBuilder().append(state.a).append(state.b).append(state.c).toString());
}
@Benchmark
public void stringbuilder_4(State4 state, Blackhole blackhole) {
blackhole.consume(new StringBuilder().append(state.a).append(state.b).append(state.c).append(state.d).toString());
}
@Benchmark
public void concat_2(State2 state, Blackhole blackhole) {
blackhole.consume(state.a.concat(state.b));
}
@Benchmark
public void concat_3(State3 state, Blackhole blackhole) {
blackhole.consume(state.a.concat(state.b.concat(state.c)));
}
@Benchmark
public void concat_4(State4 state, Blackhole blackhole) {
blackhole.consume(state.a.concat(state.b.concat(state.c.concat(state.d))));
}
}
Results:
Benchmark Mode Cnt Score Error Units
StringConcatenation.concat_2 thrpt 50 24908871.258 ± 1011269.986 ops/s
StringConcatenation.concat_3 thrpt 50 14228193.918 ± 466892.616 ops/s
StringConcatenation.concat_4 thrpt 50 9845069.776 ± 350532.591 ops/s
StringConcatenation.plus_2 thrpt 50 38999662.292 ± 8107397.316 ops/s
StringConcatenation.plus_3 thrpt 50 34985722.222 ± 5442660.250 ops/s
StringConcatenation.plus_4 thrpt 50 31910376.337 ± 2861001.162 ops/s
StringConcatenation.stringbuilder_2 thrpt 50 40472888.230 ± 9011210.632 ops/s
StringConcatenation.stringbuilder_3 thrpt 50 33902151.616 ± 5449026.680 ops/s
StringConcatenation.stringbuilder_4 thrpt 50 29220479.267 ± 3435315.681 ops/s
this works for me (Keltex said the same)
.foo {
height: 50px;
...
}
.foo span{
vertical-align: middle;
}
<span class="foo"> <span>middle!</span></span>
<div id='child' style='width: 50px; height: 100px; margin:0 auto;'>Text</div>
This is the closest I could get without adding any custom CSS (this I'd already figured as of the time of asking the question; guess I've to stick with this):
And the markup in use:
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">
<span class="glyphicon glyphicon-search"></span>
</button>
</form>
PS: Of course, that can be fixed by adding a negative margin-left
(-4px) on the button, and removing the border-radius
on the sides input
and button
meet. But the whole point of this question is to get it to work without any custom CSS.
Ion Todirel already mentioned an answer YES using std::reference_wrapper
. Since C++11 we have a mechanism to retrieve object from std::vector
and remove the reference by using std::remove_reference
. Below is given an example compiled using g++
and clang
with option
-std=c++11
and executed successfully.
#include <iostream>
#include <vector>
#include<functional>
class MyClass {
public:
void func() {
std::cout << "I am func \n";
}
MyClass(int y) : x(y) {}
int getval()
{
return x;
}
private:
int x;
};
int main() {
std::vector<std::reference_wrapper<MyClass>> vec;
MyClass obj1(2);
MyClass obj2(3);
MyClass& obj_ref1 = std::ref(obj1);
MyClass& obj_ref2 = obj2;
vec.push_back(obj_ref1);
vec.push_back(obj_ref2);
for (auto obj3 : vec)
{
std::remove_reference<MyClass&>::type(obj3).func();
std::cout << std::remove_reference<MyClass&>::type(obj3).getval() << "\n";
}
}
When working on a project that requires the use of multiple dockerfiles, simply create each dockerfile in a separate directory. For instance,
app/ db/
Each of the above directories will contain their dockerfile. When an application is being built, docker will search all directories and build all dockerfiles.
Sample: Number of requests sent.
The Throughput: is the number of requests per unit of time (seconds, minutes, hours) that are sent to your server during the test.
The Response time: is the elapsed time from the moment when a given request is sent to the server until the moment when the last bit of information has returned to the client.
The throughput is the real load processed by your server during a run but it does not tell you anything about the performance of your server during this same run. This is the reason why you need both measures in order to get a real idea about your server’s performance during a run. The response time tells you how fast your server is handling a given load.
Average: This is the Average (Arithmetic mean µ = 1/n * Si=1…n xi) Response time of your total samples.
Min and Max are the minimum and maximum response time.
An important thing to understand is that the mean value can be very misleading as it does not show you how close (or far) your values are from the average.For this purpose, we need the Deviation value since Average value can be the Same for different response time of the samples!!
Deviation: The standard deviation (s) measures the mean distance of the values to their average (µ).It gives you a good idea of the dispersion or variability of the measures to their mean value.
The following equation show how the standard deviation (s) is calculated:
s = 1/n * v Si=1…n (xi-µ)2
For Details, see here!!
So, if the deviation value is low compared to the mean value, it will indicate you that your measures are not dispersed (or mostly close to the mean value) and that the mean value is significant.
Kb/sec: The throughput measured in Kilobytes per second.
Error % : Percent of requests with errors.
An example is always better to understand!!! I think, this article will help you.
Put into a script I like something like that:
#!/bin/bash
set -o xtrace # remove me after debug
TABLE=some_table_name
DB_NAME=prod_database
BASE_DIR=/var/backups/someDir
LOCATION="${BASE_DIR}/myApp_$(date +%Y%m%d_%H%M%S)"
FNAME="${LOCATION}_${DB_NAME}_${TABLE}.sql"
# Create backups directory if not exists
if [[ ! -e $BASE_DIR ]];then
mkdir $BASE_DIR
chown -R postgres:postgres $BASE_DIR
fi
sudo -H -u postgres pg_dump --column-inserts --data-only --table=$TABLE $DB_NAME > $FNAME
sudo gzip $FNAME
Close iis express and all the browsers (if the url was opened in any of the browser). Also open the visual studio IDE in admin mode. This has resolved my issue.
You can use the "Join" function to create a single string out of the array of labels, like this:
=Join(Parameters!Product.Label, ",")
remember that the use of "live" is for "jQuery 1.3" or higher
in version "jQuery 1.4.3" or higher is used "delegate"
and version "jQuery 1.7 +" or higher is used "on"
$( selector ).live( events, data, handler ); // jQuery 1.3+
$( document ).delegate( selector, events, data, handler ); // jQuery 1.4.3+
$( document ).on( events, selector, data, handler ); // jQuery 1.7+
As of jQuery 1.7, the .live() method is deprecated.
check http://api.jquery.com/live/
Regards, Fernando
sleep infinity
does exactly what it suggests and works without cat abuse.
Here's a trick to easily check if the schema already exists, and then create it, in it's own batch, to avoid the error message of trying to create a schema when it's not the only command in a batch.
IF NOT EXISTS (SELECT schema_name
FROM information_schema.schemata
WHERE schema_name = 'newSchemaName' )
BEGIN
EXEC sp_executesql N'CREATE SCHEMA NewSchemaName;';
END
The proper solution to resolve this issue is by following the steps
. Update Visual studio if you have older version to 15.5.4 (Optional)
Remove all binding redirects from web.config
Add this to the csproj file:
<PropertyGroup> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> </PropertyGroup>
Build.
In the bin folder, there should be a (WebAppName).dll.config
file.
It should have redirects in it. Copy these to the web.config
Remove the above snipped from the csproj file again
It should work
I also wanted an email sent if the service was started this way so added a bit to @Ic code just thought I would post it in case it helped anyone. I used SendMail but there are other command line options How to send a simple email from a Windows batch file?
set service=MyServiceName
for /F "tokens=3 delims=: " %%H in ('sc query %service% ^| findstr " STATE"') do (
if /I "%%H" NEQ "RUNNING" (
net start %service%
for /F "tokens=3 delims=: " %%H in ('sc query %service% ^| findstr " STATE"') do (
if /I "%%H" EQ "RUNNING" (
SendMail /smtpserver localhost /to [email protected] /from [email protected] /subject Service Autostart Notification /body Autostart on service %service% succeded.
) else (
SendMail /smtpserver localhost /to [email protected] /from [email protected] /subject Service Autostart Notification /body Autostart on service %service% failed.
)
)
)
)
$(':text').attr("disabled", "disabled");
sets all textbox to disabled mode.
You can do in another way like giving each textbox id. By doing this code weight will be more and performance issue will be there.
So better have $(':text').attr("disabled", "disabled");
approach.
I found it was impossible to assign a layout to the centralwidget until I had added at least one child beneath it. Then I could highlight the tiny icon with the red 'disabled' mark and then click on a layout in the Designer toolbar at top.
The attribute selectors are often used for inputs. This is the list of attribute selectors:
[title] All elements with the title attribute are selected.
[title=banana] All elements which have the 'banana' value of the title attribute.
[title~=banana] All elements which contain 'banana' in the value of the title attribute.
[title|=banana] All elements which value of the title attribute starts with 'banana'.
[title^=banana] All elements which value of the title attribute begins with 'banana'.
[title$=banana] All elements which value of the title attribute ends with 'banana'.
[title*=banana] All elements which value of the title attribute contains the substring 'banana'.
Reference: https://kolosek.com/css-selectors/
Your logic is saying, "if this item exists already, then add it." It should be the opposite of that.
Change it to...
if (this.items.indexOf(item) == -1) {
this.items.push(item);
}
I'v tried pyenv and it's very handy for switching python versions (global, local in folder or in the virtualenv):
brew install pyenv
then install Python version you want:
pyenv install 3.5.0
and simply create virtualenv with path to needed interpreter version:
virtualenv -p /Users/johnny/.pyenv/versions/3.5.0/bin/python3.5 myenv
That's it, check the version:
. ./myenv/bin/activate && python -V
There are also plugin for pyenv pyenv-virtualenv but it didn't work for me somehow.
It is because there is no package cache in the image, you need to run:
apt-get update
before installing packages, and if your command is in a Dockerfile, you'll then need:
apt-get -y install curl
To suppress the standard output from a command use -qq
. E.g.
apt-get -qq -y install curl
It was solved with:
script-src 'self' http://xxxx 'unsafe-inline' 'unsafe-eval';
You can get all checked checkboxes like this:
var boxes = $(":checkbox:checked");
And all non-checked like this:
var nboxes = $(":checkbox:not(:checked)");
You could merely cycle through either one of these collections, and store those names. If anything is absent, you know it either was or wasn't checked. In PHP, if you had an array of names which were checked, you could simply do an in_array()
request to know whether or not any particular box should be checked at a later date.
jQuery also has a serialize method that will maintain the state of your form controls. For instance, the example provided on jQuery's website follows:
single=Single2&multiple=Multiple&multiple=Multiple3&check=check2&radio=radio2
This will enable you to keep the information for which elements were checked as well.
Lastly:
print_r($_REQUEST);
That covers most incoming items: PHP.net Manual: $_REQUEST
By default git push
updates all the remote branches. But you can configure git to update only the current branch to it's upstream.
git config push.default upstream
It means git will update only the current (checked out) branch when you do git push.
Other valid options are:
nothing
: Do not push anything (error out) unless a refspec is explicitly given. This is primarily meant for people who want to avoid mistakes by always being explicit.matching
: Push all branches having the same name on both ends. (default option prior to Ver 1.7.11) upstream
: Push the current branch to its upstream
branch. This mode only makes sense if you are pushing to the same repository you would normally pull from (i.e. central workflow). No need to have the same name for local and remote branch.tracking
: Deprecated, use upstream
instead.current
: Push the current branch to the remote branch of the same name on the receiving end. Works in both central and non-central workflows.simple
: [available since Ver 1.7.11] in centralized workflow, work like upstream
with an added safety to refuse to push if the upstream branch’s name is different from the local one. When pushing to a remote that is different from the remote you normally pull from, work as current
. This is the safest option and is suited for beginners. This mode has become the default in Git 2.0.Steps:
Create ssh keys on source server
ssh-keygen
Cat and copy id_rsa.pub located under ~./ssh directory
Check if it works by running below command on the source server
git remote show origin
For fetch and push from the source server, if the protocol is 'https' then you have to change it to 'git+ssh' by running below command
git remote set-url origin git+ssh://<bitbucketaccount>@bitbucket.org/<accountname>/repo.git
Check if you can do push to the repo.
Done!
Not possible.
This a little counter-intuitive.
You're encountering the "Apple is-a fruit" but "Every Fruit is not an Apple"
Go for creating a new map and checking with instance of with String
One from a couple of hours that I wasted:
If you've applied all these tips and are only going on 500 errors because you don't have access to the server error log, maybe the problem isn't in the .htaccess but in the files it redirects to.
After I had fixed my .htaccess-problem I spent two more hours trying to fix it some more, even though I simply had forgotten about some permissions.
This answer similar to others, but using preferred stringr::str_detect
and dplyr rownames_to_column
.
library(tidyverse)
mtcars %>%
rownames_to_column("type") %>%
filter(stringr::str_detect(type, 'Toyota|Mazda') )
#> type mpg cyl disp hp drat wt qsec vs am gear carb
#> 1 Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4
#> 2 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4
#> 3 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1
#> 4 Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1
Created on 2018-06-26 by the reprex package (v0.2.0).
Just use abs(x - y)
. This'll return the net difference between the two as a positive value, regardless of which value is larger.
For Mi or Xiaomi Device
1) Setting
2) Additional Setting
3) Developer option
4) Install via USB: Toggle On
It is working fine for me.
Note: Not working then try following options also
1) Sign to MI account (Not applicable to all devices)
2) Also Disable Turn on MIUI optimization: Setting -> Additional Setting -> Developer Option, near bottom we will get this option.
3) Developer option must be enabled and Link for enabling developer option: Description here
Still not working?
-> signed out from Mi Account and then created new account and enable USB Debugging.
Thanks
I'm not using CentOS. Here is what I have in Ubuntu 16.04.2, hadoop-2.7.3, jdk1.8.0_121. Run start-dfs.sh or stop-dfs.sh successfully w/o error:
# JAVA env
#
export JAVA_HOME=/j01/sys/jdk
export JRE_HOME=/j01/sys/jdk/jre
export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:${PATH}:.
# HADOOP env
#
export HADOOP_HOME=/j01/srv/hadoop
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin
Replace /j01/sys/jdk, /j01/srv/hadoop with your installation path
I also did the following for one time setup on Ubuntu, which eliminates the need to enter passwords for multiple times when running start-dfs.sh:
sudo apt install openssh-server openssh-client
ssh-keygen -t rsa
ssh-copy-id user@localhost
Replace user with your username
self.close() does not work, are you sure you closing a window and not a script generated popup ?
you guys might want to look at this : https://bugzilla.mozilla.org/show_bug.cgi?id=183697
An undocumented feature of the formData
field that request
implements is the ability to pass options to the form-data
module it uses:
request({
url: 'http://example.com',
method: 'POST',
formData: {
'regularField': 'someValue',
'regularFile': someFileStream,
'customBufferFile': {
value: fileBufferData,
options: {
filename: 'myfile.bin'
}
}
}
}, handleResponse);
This is useful if you need to avoid calling requestObj.form()
but need to upload a buffer as a file. The form-data
module also accepts contentType
(the MIME type) and knownLength
options.
This change was added in October 2014 (so 2 months after this question was asked), so it should be safe to use now (in 2017+). This equates to version v2.46.0
or above of request
.
You can add a TextView
to your linear layout programmatically like this:
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.mylayout);
TextView txt1 = new TextView(MyClass.this);
linearLayout.setBackgroundColor(Color.TRANSPARENT);
linearLayout.addView(txt1);
For MAC users, the follow steps worked for me.
If you get Error for Brew, Here's the command you need to type first in the terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
$ brew update
$ brew uninstall node
$ brew install node
$ brew postinstall
It can be useful to someone that uses a different system that does not have that library readily available. If that is not declared and you have some functions in your script that are not supported by that system, you should declare #/bin/bash. I've ran into this problem before at work and now I just include it as a practice.
For people having a startTime
(like 12h:30:30) and a duration
(value in minutes like 120), you can guess the endTime
like so:
const startTime = '12:30:00';
const durationInMinutes = '120';
const endTime = moment(startTime, 'HH:mm:ss').add(durationInMinutes, 'minutes').format('HH:mm');
// endTime is equal to "14:30"
From Hadoop page,
start-all.sh
This will startup a Namenode, Datanode, Jobtracker and a Tasktracker on your machine.
start-dfs.sh
This will bring up HDFS with the Namenode running on the machine you ran the command on. On such a machine you would need start-mapred.sh
to separately start the job tracker
start-all.sh/stop-all.sh
has to be run on the master node
You would use start-all.sh
on a single node cluster (i.e. where you would have all the services on the same node.The namenode is also the datanode and is the master node).
In multi-node setup,
You will use start-all.sh
on the master node and would start what is necessary on the slaves as well.
Alternatively,
Use start-dfs.sh
on the node you want the Namenode to run on. This will bring up HDFS with the Namenode running on the machine you ran the command on and Datanodes on the machines listed in the slaves file.
Use start-mapred.sh
on the machine you plan to run the Jobtracker on. This will bring up the Map/Reduce cluster with Jobtracker running on the machine you ran the command on and Tasktrackers running on machines listed in the slaves file.
hadoop-daemon.sh
as stated by Tariq is used on each individual node. The master node will not start the services on the slaves.In a single node setup this will act same as start-all.sh
.In a multi-node setup you will have to access each node (master as well as slaves) and execute on each of them.
Have a look at this start-all.sh
it call config followed by dfs and mapred
Loop through all files ending with: .img
, .bin
, .txt
suffix, and print the file name:
for i in *.img *.bin *.txt;
do
echo "$i"
done
Or in a recursive manner (find also in all subdirectories):
for i in `find . -type f -name "*.img" -o -name "*.bin" -o -name "*.txt"`;
do
echo "$i"
done
This is how I did it. This makes the images in the slideshow take up the full screen if it´s aspect ratio allows it, othervice it scales down.
.carousel {
height: 100vh;
width: 100%;
overflow:hidden;
}
.carousel .carousel-inner {
height:100%;
}
To allways get a full screen slideshow, no matter screen aspect ratio, you can also use object-fit: (doesn´t work in IE or Edge)
.carousel .carousel-inner img {
display:block;
object-fit: cover;
}
I was struggling with this as well. Fortunately, Steve Michelotti documented a solution that worked for me here.
At the end of the day, I enabled all verbs (verb="*") to the ExtensionlessUrlHandler-Integrated-4.0 handler in my web config.
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
Others have pointed out that having WebDAV enabled causes issues. Fortunately, I did not run into that issue as well.
This question has options for when .select() is not working on mobile platforms: Programmatically selecting text in an input field on iOS devices (mobile Safari)
var dataform = new FormData($("#myform")[0]);
//console.log(dataform);
$.ajax({
url: 'url',
type: 'POST',
data: dataform,
async: false,
success: function(res) {
response data;
},
cache: false,
contentType: false,
processData: false
});
To start it right after installation, I generate a batch file with installutil followed by sc start
It's not ideal, but it works....
It's the new feature in C# 6 called Interpolated Strings
.
The easiest way to understand it is: an interpolated string expression creates a string by replacing the contained expressions with the ToString representations of the expressions' results.
For more details about this, please take a look at MSDN.
Now, think a little bit more about it. Why this feature is great?
For example, you have class Point
:
public class Point
{
public int X { get; set; }
public int Y { get; set; }
}
Create 2 instances:
var p1 = new Point { X = 5, Y = 10 };
var p2 = new Point { X = 7, Y = 3 };
Now, you want to output it to the screen. The 2 ways that you usually use:
Console.WriteLine("The area of interest is bounded by (" + p1.X + "," + p1.Y + ") and (" + p2.X + "," + p2.Y + ")");
As you can see, concatenating string like this makes the code hard to read and error-prone. You may use string.Format()
to make it nicer:
Console.WriteLine(string.Format("The area of interest is bounded by({0},{1}) and ({2},{3})", p1.X, p1.Y, p2.X, p2.Y));
This creates a new problem:
For those reasons, we should use new feature:
Console.WriteLine($"The area of interest is bounded by ({p1.X},{p1.Y}) and ({p2.X},{p2.Y})");
The compiler now maintains the placeholders for you so you don’t have to worry about indexing the right argument because you simply place it right there in the string.
For the full post, please read this blog.
PhpMyAdmin has a Import wizard that lets you import a MSSQL file type too.
See http://dev.mysql.com/doc/refman/5.1/en/sql-mode.html for the types of DB scripts it supports.
For Spring Tool Suite
I do:
File -> Open projects from File System
You would use an expression when you want to treat your function as data and not as code. You can do this if you want to manipulate the code (as data). Most of the time if you don't see a need for expressions then you probably don't need to use one.
In this case you are restarting your node.js server often because it's in active development and you are making changes all the time. There is a great hot reload script that will handle this for you by watching all your .js files and restarting your node.js server if any of those files have changed. Just the ticket for rapid development and test.
The script and explanation on how to use it are at here at Draco Blue.
Or, similar to erikkallen's idea, make the background of the A tag black, and make the image semitransparent on mouseover. That way you won't have to create additional divs.
Source for the CSS-based solution:
a.darken {
display: inline-block;
background: black;
padding: 0;
}
a.darken img {
display: block;
-webkit-transition: all 0.5s linear;
-moz-transition: all 0.5s linear;
-ms-transition: all 0.5s linear;
-o-transition: all 0.5s linear;
transition: all 0.5s linear;
}
a.darken:hover img {
opacity: 0.7;
}
And the image:
<a href="http://google.com" class="darken">
<img src="http://www.prelovac.com/vladimir/wp-content/uploads/2008/03/example.jpg" width="200">
</a>
select salary from table order by salary desc limit 1,1
note:this works only for MYSQL
I'm rusty on SQL but I think you could use select as to make your own temporary query columns.
select field1, field2, 'example' as newfield from table1
That would only exist in your query results, of course. You're not actually modifying the table.
Basically speaking, the answer is: it depends. There are many many benchmarks focusing on different kinds of application.
My benchmark on my app is: gcc > icc > clang.
There are rare IO, but many CPU float and data structure operations.
compile flags is -Wall -g -DNDEBUG -O3.
https://github.com/zhangyafeikimi/ml-pack/blob/master/gbdt/profile/benchmark
Check that you spelled the branch name correctly. I was rebasing a story branch (i.e. branch_name
) and forgot the story part. (i.e. story/branch_name
) and then git spit this error at me which didn't make much sense in this context.
This is solved 100%:
Import settings/local_setting.py in app/main.py:
main.py:
import sys
sys.path.insert(0, "../settings")
try:
from local_settings import *
except ImportError:
print('No Import')
If the value on which the selection depends is an integer, you can use the CHOOSE function:
CHOOSE funtion in TSQL documentation
CHOOSE ( index, val_1, val_2 [, val_n ] )
Citing the documentation:
index
Is an integer expression that represents a 1-based index into the list of the items following it.
If the provided index value has a numeric data type other than int, then the value is implicitly converted to an integer. If the index value exceeds the bounds of the array of values, then CHOOSE returns null.
val_1 ... val_n
List of comma separated values of any data type.
In many cases you're better off using CSS transitions for this, and in old browsers the easing will simply be instant. Most animations (like fade in/out) are very trivial to implement and the browser does all the legwork for you. https://developer.mozilla.org/en/docs/Web/CSS/transition
as of Jan 2017, unfortunately @Adi's answer, while it seems like it should work, does not. (Google's API key process is buggy)
you'll need to click "get a key" from this link: https://developers.google.com/maps/documentation/javascript/get-api-key
also I strongly recommend you don't ever choose "secure key" until you are ready to switch to production. I did http referrer restrictions on a key and afterwards was unable to get it working with localhost, even after disabling security for the key. I had to create a new key for it to work again.
The below code worked for me for any type of cell.
InputStream inp =getClass().getResourceAsStream("filename.xls"));
Workbook wb = WorkbookFactory.create(inp);
DataFormatter objDefaultFormat = new DataFormatter();
FormulaEvaluator objFormulaEvaluator = new HSSFFormulaEvaluator((HSSFWorkbook) wb);
Sheet sheet= wb.getSheetAt(0);
Iterator<Row> objIterator = sheet.rowIterator();
while(objIterator.hasNext()){
Row row = objIterator.next();
Cell cellValue = row.getCell(0);
objFormulaEvaluator.evaluate(cellValue); // This will evaluate the cell, And any type of cell will return string value
String cellValueStr = objDefaultFormat.formatCellValue(cellValue,objFormulaEvaluator);
}
WebResourcesDepot wrote a script to load while scrolling that uses jQuery some time ago. You can view their Live Demo Here. The beef of their functionality was this:
$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()){
lastAddedLiveFunc();
}
});
function lastAddedLiveFunc() {
$('div#lastPostsLoader').html('<img src="images/bigLoader.gif">');
$.post("default.asp?action=getLastPosts&lastPostID="+$(".wrdLatest:last").attr("id"),
function(data){
if (data != "") {
$(".wrdLatest:last").after(data);
}
$('div#lastPostsLoader').empty();
});
};
Tried and tested this works !
mkdir <directory name> ; //Same directory name as the one you want to pull
cd <directory name>;
git remote add origin <GIT_URL>;
git checkout -b '<branch name>';
git config core.sparsecheckout true;
echo <directory name>/ >> .git/info/sparse-checkout;
git pull origin <pull branch name>
Hope this was helpful!
On codeplex was released new XNA Extension for Visual Studio 2012/2013. You can download it from: https://msxna.codeplex.com/releases
To uninstall Anaconda, you can do a simple remove of the program. This will leave a few files behind, which for most users is just fine. See Option A.
If you also want to remove all traces of the configuration files and directories from Anaconda and its programs, you can download and use the Anaconda-Clean program first, then do a simple remove. See Option B.
Use simple remove to uninstall Anaconda:
macOS–Open the Terminal.app or iTerm2 terminal application, and then remove your entire Anaconda directory, which has a name such as anaconda2 or anaconda3, by entering rm -rf ~/anaconda3
.
Full uninstall using Anaconda-Clean and simple remove.
NOTE: Anaconda-Clean must be run before simple remove.
Install the Anaconda-Clean package from Anaconda Prompt or a terminal window:
conda install anaconda-clean
In the same window, run one of these commands:
Remove all Anaconda-related files and directories with a confirmation prompt before deleting each one:
anaconda-clean
Or, remove all Anaconda-related files and directories without being prompted to delete each one:
anaconda-clean --yes
Anaconda-Clean creates a backup of all files and directories that might be removed, such as .bash_profile
, in a folder named .anaconda_backup
in your home directory. Also note that Anaconda-Clean leaves your data files in the AnacondaProjects directory untouched.
After using Anaconda-Clean, follow the instructions above in Option A to uninstall Anaconda.
Removing Anaconda path from .bash_profile
If you use Linux or macOS, you may also wish to check the .bash_profile
file in your home directory for a line such as:
export PATH="/Users/jsmith/anaconda3/bin:$PATH"
NOTE: Replace /Users/jsmith/anaconda3/
with your actual path.
This line adds the Anaconda path to the PATH environment variable. It may refer to either Anaconda or Miniconda. After uninstalling Anaconda, you may delete this line and save the file.
Try to pass value a and compare using the equals method like this:
public static void main(String str[]) {
boolean b = str[0].equals("a");
System.out.println(b);
}
Follow this link to know more about Command line argument in Java
Assuming self
is a UIViewController
:
func displayAlert() {
let alert = UIAlertController(title: "Test",
message: "I am a modal alert",
preferredStyle: .alert)
let defaultButton = UIAlertAction(title: "OK",
style: .default) {(_) in
// your defaultButton action goes here
}
alert.addAction(defaultButton)
present(alert, animated: true) {
// completion goes here
}
}
You can do this go to Settings > Storage, clicking on the setting menu icon in the top right hand corner and selecting "USB computer connection". I then changed the storage mode to "Camera (PTP)". Done try re installing the driver from device manager.
What the heck, I'll throw in a quickly-cobbled-together answer as well...it looks a bit like some other implementations here, but I'll add it anywho:
(barely tested, hopefully I'm not embarassing myself)
Let's state some goals first (my assumptions):
1) Must sort ObservableCollection<T>
in place, to maintain notifications, etc.
2) Must not be horribly inefficient (i.e., something close to standard "good" sorting efficiency)
public static class Ext
{
public static void Sort<T>(this ObservableCollection<T> src)
where T : IComparable<T>
{
// Some preliminary safety checks
if(src == null) throw new ArgumentNullException("src");
if(!src.Any()) return;
// N for the select,
// + ~ N log N, assuming "smart" sort implementation on the OrderBy
// Total: N log N + N (est)
var indexedPairs = src
.Select((item,i) => Tuple.Create(i, item))
.OrderBy(tup => tup.Item2);
// N for another select
var postIndexedPairs = indexedPairs
.Select((item,i) => Tuple.Create(i, item.Item1, item.Item2));
// N for a loop over every element
var pairEnum = postIndexedPairs.GetEnumerator();
pairEnum.MoveNext();
for(int idx = 0; idx < src.Count; idx++, pairEnum.MoveNext())
{
src.RemoveAt(pairEnum.Current.Item1);
src.Insert(idx, pairEnum.Current.Item3);
}
// (very roughly) Estimated Complexity:
// N log N + N + N + N
// == N log N + 3N
}
}
If I understand well, you want to Join ScheduleRequest
with User
and apply the in
clause to the userName
property of the entity User
.
I'd need to work a bit on this schema. But you can try with this trick, that is much more readable than the code you posted, and avoids the Join
part (because it handles the Join
logic outside the Criteria Query).
List<String> myList = new ArrayList<String> ();
for (User u : usersList) {
myList.add(u.getUsername());
}
Expression<String> exp = scheduleRequest.get("createdBy");
Predicate predicate = exp.in(myList);
criteria.where(predicate);
In order to write more type-safe code you could also use Metamodel by replacing this line:
Expression<String> exp = scheduleRequest.get("createdBy");
with this:
Expression<String> exp = scheduleRequest.get(ScheduleRequest_.createdBy);
If it works, then you may try to add the Join
logic into the Criteria Query
. But right now I can't test it, so I prefer to see if somebody else wants to try.
Not a perfect answer though may be code snippets might help.
public <T> List<T> findListWhereInCondition(Class<T> clazz,
String conditionColumnName, Serializable... conditionColumnValues) {
QueryBuilder<T> queryBuilder = new QueryBuilder<T>(clazz);
addWhereInClause(queryBuilder, conditionColumnName,
conditionColumnValues);
queryBuilder.select();
return queryBuilder.getResultList();
}
private <T> void addWhereInClause(QueryBuilder<T> queryBuilder,
String conditionColumnName, Serializable... conditionColumnValues) {
Path<Object> path = queryBuilder.root.get(conditionColumnName);
In<Object> in = queryBuilder.criteriaBuilder.in(path);
for (Serializable conditionColumnValue : conditionColumnValues) {
in.value(conditionColumnValue);
}
queryBuilder.criteriaQuery.where(in);
}
port 50070 changed to 9870 in 3.0.0-alpha1
In fact, lots of others ports changed too. Look:
Namenode ports: 50470 --> 9871, 50070 --> 9870, 8020 --> 9820
Secondary NN ports: 50091 --> 9869, 50090 --> 9868
Datanode ports: 50020 --> 9867, 50010 --> 9866, 50475 --> 9865, 50075 --> 9864
You're missing the multiplication operator. Also, you want to do 4/3
in floating point, not integer math.
volume = (4.0 / 3) * Math.PI * Math.pow(radius, 3);
^^ ^
This is a new answer to an old question about a common misconception about contains()
in XPath...
Summary: contains()
means contains a substring, not contains a node.
This XPath is often misinterpreted:
//ul[contains(li, 'Model')]
Wrong interpretation:
Select those ul
elements that contain an li
element with Model
in it.
This is wrong because
contains(x,y)
expects x
to be a string, andthe XPath rule for converting multiple elements to a string is this:
A node-set is converted to a string by returning the string-value of the node in the node-set that is first in document order. If the node-set is empty, an empty string is returned.
Right interpretation: Select those ul
elements whose first li
child has a string-value that contains a Model
substring.
XML
<r>
<ul id="one">
<li>Model A</li>
<li>Foo</li>
</ul>
<ul id="two">
<li>Foo</li>
<li>Model A</li>
</ul>
</r>
XPaths
//ul[contains(li, 'Model')]
selects the one
ul
element.
Note: The two
ul
element is not selected because the string-value of the first li
child
of the two
ul
is Foo
, which does not contain the Model
substring.
//ul[li[contains(.,'Model')]]
selects the one
and two
ul
elements.
Note: Both ul
elements are selected because contains()
is applied to each li
individually. (Thus, the tricky multiple-element-to-string conversion rule is avoided.) Both ul
elements do have an li
child whose string value contains the Model
substring -- position of the li
element no longer matters.
I had a similar problem with dynamically adding datepicker classes. The solution I found was to comment out line 46 of datepicker.js
// this.element.on('click', $.proxy(this.show, this));
finalName is created as:
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>
One of the solutions is to add own property:
<properties>
<finalName>${project.artifactId}-${project.version}</finalName>
</properties>
<build>
<finalName>${finalName}</finalName>
</build>
And now try:
mvn -DfinalName=build clean package
If you do not have the ability to modify your php.ini file, use cURL: PHP Curl And Cookies
Here is an example function I created:
function get_web_page( $url, $cookiesIn = '' ){
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => true, //return headers in addition to content
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle all encodings
CURLOPT_AUTOREFERER => true, // set referer on redirect
CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
CURLOPT_TIMEOUT => 120, // timeout on response
CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
CURLINFO_HEADER_OUT => true,
CURLOPT_SSL_VERIFYPEER => true, // Validate SSL Cert
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_COOKIE => $cookiesIn
);
$ch = curl_init( $url );
curl_setopt_array( $ch, $options );
$rough_content = curl_exec( $ch );
$err = curl_errno( $ch );
$errmsg = curl_error( $ch );
$header = curl_getinfo( $ch );
curl_close( $ch );
$header_content = substr($rough_content, 0, $header['header_size']);
$body_content = trim(str_replace($header_content, '', $rough_content));
$pattern = "#Set-Cookie:\\s+(?<cookie>[^=]+=[^;]+)#m";
preg_match_all($pattern, $header_content, $matches);
$cookiesOut = implode("; ", $matches['cookie']);
$header['errno'] = $err;
$header['errmsg'] = $errmsg;
$header['headers'] = $header_content;
$header['content'] = $body_content;
$header['cookies'] = $cookiesOut;
return $header;
}
NOTE: In revisiting this function I noticed that I had disabled SSL checks in this code. That is generally a BAD thing even though in my particular case the site I was using it on was local and was safe. As a result I've modified this code to have SSL checks on by default. If for some reason you need to change that, you can simply update the value for CURLOPT_SSL_VERIFYPEER, but I wanted the code to be secure by default if someone uses this.
My problem was the same, but the solution had to do with changing a firewall setting. It turned out that node was set to block incoming traffic. I knew something was up because I used to be able to get to my localhost server from my phone.
Go to System Preferences -> Security & Privacy -> Firewall -> Firewall Options, and then scroll down until you find node and make sure node's setting is set to Allow incoming connections.
After changing the setting, I could reach the localhost server (port 3000) running on my Mac by going to http://192.168.1.11:3000
At a place where you want javadoc, type in /**
<NEWLINE> and it will create the template.
I found the answer... or at least, the easiest answer (if there are multiple). When I installed the printer, I renamed it to "ICS Label Printer". Here's how to change the options to allow pass-through ZPL commands:
In my code, I just have to add "${" to the beginning of my ZPL and "}$" to the end and print it as plain text. This is with the "Windows driver for ZDesigner LP 2844-Z printer Version 2.6.42 (Build 2382)". Works like a charm!
.ico
, or is it just named ".ico"?The absolutely easiest way to have a favicon is to place an icon called "favicon.ico" in the root folder. That just works everywhere, no code needed at all.
If you must have it in a subdirectory, use:
<link rel="shortcut icon" href="/img/favicon.ico" />
Note the /
before img
to ensure it is anchored to the root folder.
I don't know what browser you're using, but according to w3schools.com, nth-child and nth-last-child do now work on MSIE 8. I don't know about 9. http://www.w3schools.com/cssref/pr_border-style.asp will give you more info.
One more solution is
Rails.application.routes.routes
http://hackingoff.com/blog/generate-rails-sitemap-from-routes/
Python 3.5 adds the math.isclose
and cmath.isclose
functions as described in PEP 485.
If you're using an earlier version of Python, the equivalent function is given in the documentation.
def isclose(a, b, rel_tol=1e-09, abs_tol=0.0):
return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)
rel_tol
is a relative tolerance, it is multiplied by the greater of the magnitudes of the two arguments; as the values get larger, so does the allowed difference between them while still considering them equal.
abs_tol
is an absolute tolerance that is applied as-is in all cases. If the difference is less than either of those tolerances, the values are considered equal.
You can combine the two functions; coerce to characters thence to numerics:
> fac <- factor(c("1","2","1","2"))
> as.numeric(as.character(fac))
[1] 1 2 1 2
HTML:
<tr>
<th>Language</th>
<th>Skill Level</th>
<th> </th>
</tr>
CSS:
tr, th {
padding: 10px;
text-align: center;
}
jQuery recently started using source maps.
For example, let's look at the minified jQuery 2.0.3 file's first few lines.
/*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/
Excerpt from Introduction to JavaScript Source Maps:
Have you ever found yourself wishing you could keep your client-side code readable and more importantly debuggable even after you've combined and minified it, without impacting performance? Well now you can through the magic of source maps.
Basically it's a way to map a combined/minified file back to an unbuilt state. When you build for production, along with minifying and combining your JavaScript files, you generate a source map which holds information about your original files. When you query a certain line and column number in your generated JavaScript you can do a lookup in the source map which returns the original location. Developer tools (currently WebKit nightly builds, Google Chrome, or Firefox 23+) can parse the source map automatically and make it appear as though you're running unminified and uncombined files.
emphasis mine
It's incredibly useful, and will only download if the user opens dev tools.
Remove the source mapping line, or do nothing. It isn't really a problem.
Side note: your server should return 404, not 500. It could point to a security problem if this happens in production.
const list = [
{ qty: 10, size: 'XXL' },
{ qty: 2, size: 'XL' },
{ qty: 8, size: 'M' }
]
list.sort((a, b) => (a.qty > b.qty) ? 1 : -1)
console.log(list)
_x000D_
Out Put :
[
{
"qty": 2,
"size": "XL"
},
{
"qty": 8,
"size": "M"
},
{
"qty": 10,
"size": "XXL"
}
]
Another way to use .ui in your code is:
from PyQt4 import QtCore, QtGui, uic
class MyWidget(QtGui.QWidget)
...
#somewhere in constructor:
uic.loadUi('MyWidget.ui', self)
both approaches are good. Do not forget, that if you use Qt resource files (extremely useful) for icons and so on, you must compile it too:
pyrcc4.exe -o ui/images_rc.py ui/images/images.qrc
Note, when uic
compiles interface, it adds 'import images_rc' at the end of .py file, so you must compile resources into the file with this name, or rename it in generated code.
You have to know that:
Assignment operators syntax is: variable = expression;
For this reason 1 += 2
-> 1 = 1 + 2
is not a valid syntax as the left operand isn't a variable. The error in this case is ReferenceError: invalid assignment left-hand side
.
x += y
is the short form for x = x + y
, where x
is the variable and x + y
the expression.
The result of the sum is 15.
sum = 0; sum = sum + 1; // 1 sum = sum + 2; // 3 sum = sum + 3; // 6 sum = sum + 4; // 10 sum = sum + 5; // 15
Other assignment operator shortcuts works the same way (relatively to the standard operations they refer to). .
Approach for docker
via psql command
docker exec -i %containerid% psql -U %user% -c '\dt' > tables.txt
or query from sql file
docker exec -i %containerid% psql -U %user% < file.sql > data.txt
If you only need to show time value in a datagrid or label similar, best way is convert directly time in datetime datatype.
SELECT CONVERT(datetime,myTimeField) as myTimeField FROM Table1
The simple solution is:
1.keep the image file and HTML file in the same folder.
2.code: <img src="Desert.png">
// your image name.
3.keep the folder in D drive.
Keeping the folder on the desktop(which is c drive) you can face the issue of permission.
Technically, no. But what you can do is use a font size that is as tall as you would like the stretched font to be, and then condense it horizontally with font-stretch
.
Here:
df = df.reset_index()
df.columns[0] = 'New_ID'
df['New_ID'] = df.index + 880
Put your form inside an asp.net panel control and set its defaultButton attribute with your button Id. See the code below:
<asp:Panel ID="Panel1" runat="server" DefaultButton="Button1">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Send" />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
Hope this will help you...
I just encountered this same issue. Turned out the Project URL on the Web property sheet was malformed.
I had just removed a port number, forgot to delete the preceding colon and tried running with: http://localhost:/XYZ
Seems like lots of different issues result in this error message.
Try Runscope. A free tool sampling their service is provided at https://www.hurl.it/ . You can set the method, authentication, headers, parameters, and body. Response shows status code, headers, and body. The response body can be formatted from JSON with a collapsable heirarchy. Paid accounts can automate test API calls and use return data to build new test calls. COI disclosure: I have no relationship to Runscope.
Easy:
SELECT SUBSTR(OrderNo, 1, 2) FROM shipment;
Of course, you can't fully rely on the client-side (javascript) validation, but that's not a reason to avoid it completely. With or without it, you have to do the server-side validation anyway (since the client can disable javascript). And that's just what you're left with, due to your non-javascript solution constraint.
So, after a submit, if the field value doesn't pass the server-side validation, the client should end up on the very same page, with additional error message specifying the requested value format. You also should provide the value format information beforehands, e.g. as a tool-tip hint (title
attribute).
There's most certainly no passive client-side validation mechanism existing in HTML 4 / XHTML.
On the other hand, in HTML 5 you have two options:
input of type number
:
<input type="number" min="xxx" max="yyy" title="Format: 3 digits" />
– only validates the range – if user enters a non-number, an empty value is submitted
– the field visual is enhanced with increment / decrement controls (browser dependent)
the pattern
attribute:
<input type="text" pattern="[0-9]{3}" title="Format: 3 digits" />
<input type="text" pattern="\d{3}" title="Format: 3 digits" />
– this gives you a full contorl over the format (anything you can specify by regular expression)
– no visual difference / enhancement
But here you still rely on browser capabilities, so do a server-side validation in either case.
Since Java 1.5, simple one line concatenation with "+" and StringBuilder.append() generate exactly the same bytecode.
So for the sake of code readability, use "+".
2 exceptions :
transparent is the default for background-color
getDimensions(id) {
var obj = questions.filter(function(node) {
return node.id==id;
});
return obj;
}
Bootstrap >= v4.0 dropped glyphicon support
Dropped the Glyphicons icon font. If you need icons, some options are:
the upstream version of Glyphicons
Source: https://v4-alpha.getbootstrap.com/migration/#components
If you are using Bootstrap >= v4.0 or newer, you can use existing style classes of bootstrap such as text-success
,text-warning
etc.
For example, if you are using fontawesome:
<i class="fa fa-tag text-danger" aria-hidden="true"></i>
To find the home directory for user FOO on a UNIX-ish system, use ~FOO
. For the current user, use ~
.
The double curly brackets are processed via Blade -- not just plain PHP. This syntax basically echos the calculated value.
{{ Request::segment(1) }}
Using CentOS7, logs are available using the command journalctl -u docker
. Answering distinctly, because @sabin's answer might be accurate for older versions of CentOS but was not true for me.
systemd has its own logging system called the journal. The logs for the docker daemon can be viewed using journalctl -u docker
This implementation:
do=true
while $do || conditions; do
do=false
# your code ...
done
It works with a read loop, too, skipping the first read:
do=true
while $do || read foo; do
do=false
# your code ...
echo $foo
done
You can do this by adding a div i.e. centerBlock. And give this property in CSS to center the image or any content. Here is the code:
<div class="container">
<div class="row">
<div class="col-sm-4 col-md-4 col-lg-4">
<div class="centerBlock">
<img class="img-responsive" src="img/some-image.png" title="This image needs to be centered">
</div>
</div>
<div class="col-sm-8 col-md-8 col-lg-8">
Some content not important at this moment
</div>
</div>
</div>
// CSS
.centerBlock {
display: table;
margin: auto;
}
CURL request by default is GET, you don't have to set any options to make a GET CURL request.
Structs can have functions just like classes. The only difference is that they are public by default:
struct A {
void f() {}
};
Additionally, structs can also have constructors and destructors.
struct A {
A() : x(5) {}
~A() {}
private: int x;
};
Cloning an input stream might not be a good idea, because this requires deep knowledge about the details of the input stream being cloned. A workaround for this is to create a new input stream that reads from the same source again.
So using some Java 8 features this would look like this:
public class Foo {
private Supplier<InputStream> inputStreamSupplier;
public void bar() {
procesDataThisWay(inputStreamSupplier.get());
procesDataTheOtherWay(inputStreamSupplier.get());
}
private void procesDataThisWay(InputStream) {
// ...
}
private void procesDataTheOtherWay(InputStream) {
// ...
}
}
This method has the positive effect that it will reuse code that is already in place - the creation of the input stream encapsulated in inputStreamSupplier
. And there is no need to maintain a second code path for the cloning of the stream.
On the other hand, if reading from the stream is expensive (because a it's done over a low bandwith connection), then this method will double the costs. This could be circumvented by using a specific supplier that will store the stream content locally first and provide an InputStream
for that now local resource.
Try line-height
like I've done here:
http://jsfiddle.net/BqTUS/5/
If you just deleted the branch, you will see something like this in your terminal:
Deleted branch branch_name(was e562d13)
- where e562d13 is a unique ID (a.k.a. the "SHA" or "hash"), with this you can restore the deleted branch.
To restore the branch, use:
git checkout -b <branch_name> <sha>
for example:
git checkout -b branch_name e562d13
To attempt command line arguments directly is not possible.
One alternative might be environment variables (https://superuser.com/questions/728951/systemd-giving-my-service-multiple-arguments).
This is where I found the answer: http://www.freedesktop.org/software/systemd/man/systemctl.html
so sudo systemctl restart myprog -v
-- systemctl will think you're trying to set one of its flags, not myprog's flag.
sudo systemctl restart myprog someotheroption
-- systemctl will restart myprog and the someotheroption service, if it exists.
In MAC OS Catalina, this are the steps that worked for me, all the above solutions did help but didn't solve my problem.
Please make use of the code below to display images inline:
<img style='vertical-align:middle;' src='somefolder/icon.gif'>
<div style='vertical-align:middle; display:inline;'>
Your text here
</div>
Yet another catch I ran into: ensure your Installer derived class (typically ProjectInstaller
) is at the top of the namespace hierarchy, I tried to use a public class within another public class, but this results in the same old error:
No public installers with the RunInstallerAttribute.Yes attribute could be found
What you need is look around assertion like .+? (?=abc)
.
See: Lookahead and Lookbehind Zero-Length Assertions
Be aware that [abc]
isn't the same as abc
. Inside brackets it's not a string - each character is just one of the possibilities. Outside the brackets it becomes the string.
Java Developers decide Strings are immutable due to the following aspect design, efficiency, and security.
Design Strings are created in a special memory area in java heap known as "String Intern pool". While you creating new String (Not in the case of using String() constructor or any other String functions which internally use the String() constructor for creating a new String object; String() constructor always create new string constant in the pool unless we call the method intern()) variable it searches the pool to check whether is it already exist. If it is exist, then return reference of the existing String object. If the String is not immutable, changing the String with one reference will lead to the wrong value for the other references.
According to this article on DZone:
Security String is widely used as parameter for many java classes, e.g. network connection, opening files, etc. Were String not immutable, a connection or file would be changed and lead to serious security threat. Mutable strings could cause security problem in Reflection too, as the parameters are strings.
Efficiency The hashcode of string is frequently used in Java. For example, in a HashMap. Being immutable guarantees that hashcode will always the same, so that it can be cached without worrying the changes.That means, there is no need to calculate hashcode every time it is used.
This question is a bit old, but in case someone wants to close a dialog that is NOT modal when user clicks somewhere, you can use this that I took from the JQuery UI Multiselect plugin. The main advantage is that the click is not "lost" (if user wants to click on a link or a button, the action is done).
$myselector.dialog({
title: "Dialog that closes when user clicks outside",
modal:false,
close: function(){
$(document).off('mousedown.mydialog');
},
open: function(event, ui) {
var $dialog = $(this).dialog('widget');
$(document).on('mousedown.mydialog', function(e) {
// Close when user clicks elsewhere
if($dialog.dialog('isOpen') && !$.contains($myselector.dialog('widget')[0], e.target)){
$myselector.dialog('close');
}
});
}
});
The fetch mode only says that the association must be fetched. If you want to add restrictions on an associated entity, you must create an alias, or a subcriteria. I generally prefer using aliases, but YMMV:
Criteria c = session.createCriteria(Dokument.class, "dokument");
c.createAlias("dokument.role", "role"); // inner join by default
c.createAlias("role.contact", "contact");
c.add(Restrictions.eq("contact.lastName", "Test"));
return c.list();
This is of course well explained in the Hibernate reference manual, and the javadoc for Criteria even has examples. Read the documentation: it has plenty of useful information.
Try this...
styles.xml
<resources>
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
AndroidManifest.xml
<activity
android:name="com.example.Home"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
They are likely still referenced by the project file. Make sure they are deleted using the Solution Explorer in Visual Studio - it should show them as being missing (with an exclamation mark).
Parsing is just process of analyse the string of character and find the tokens from that string and parser is a component of interpreter and compiler.It uses lexical analysis and then syntactic analysis.It parse it and then compile this code after this whole process of compilation.
Set the id
attribute of the input
to txtJob
. Your browser is acting quirky when you call getElementById
.
I was trying to do something similar to this but instead remove the column from an embedded document. It took me a while to find a solution and this was the first post I came across so I thought I would post this here for anyone else trying to do the same.
So lets say instead your data looks like this:
{
name: 'book',
tags: [
{
words: ['abc','123'],
lat: 33,
long: 22
}, {
words: ['def','456'],
lat: 44,
long: 33
}
]
}
To remove the column words
from the embedded document, do this:
db.example.update(
{'tags': {'$exists': true}},
{ $unset: {'tags.$[].words': 1}},
{multi: true}
)
or using the updateMany
db.example.updateMany(
{'tags': {'$exists': true}},
{ $unset: {'tags.$[].words': 1}}
)
The $unset
will only edit it if the value exists but it will not do a safe navigation (it wont check if tags
exists first) so the exists is needed on the embedded document.
This uses the all positional operator ($[]
) which was introduced in version 3.6
It is also worth mentioning that if you're using HtmlAgilityPack like I was, you should use HtmlAgilityPack.HtmlEntity.DeEntitize()
. It takes a string
and returns a string
.
Just do a standard custom validator and verify first if the form itself is defined, otherwise it will throw an error that says the form is undefined, because at first it will try to run the validator before the form is constructed.
// form builder
private buildForm(): void {
this.changePasswordForm = this.fb.group({
currentPass: ['', Validators.required],
newPass: ['', Validators.required],
confirmPass: ['', [Validators.required, this.passwordMatcher.bind(this)]],
});
}
// confirm new password validator
private passwordMatcher(control: FormControl): { [s: string]: boolean } {
if (
this.changePasswordForm &&
(control.value !== this.changePasswordForm.controls.newPass.value)
) {
return { passwordNotMatch: true };
}
return null;
}
It just checks that the new password field has the same value that the confirm password field. Is a validator specific for the confirm password field instead of the whole form.
You just have to verify that this.changePasswordForm
is defined because otherwise it will throw an undefined error when the form is built.
It works just fine, without creating directives or error state matchers.
Simply parsing the JSON and comparing the two objects is not enough because it wouldn't be the exact same object references (but might be the same values).
You need to do a deep equals.
From http://threebit.net/mail-archive/rails-spinoffs/msg06156.html - which seems the use jQuery.
Object.extend(Object, {
deepEquals: function(o1, o2) {
var k1 = Object.keys(o1).sort();
var k2 = Object.keys(o2).sort();
if (k1.length != k2.length) return false;
return k1.zip(k2, function(keyPair) {
if(typeof o1[keyPair[0]] == typeof o2[keyPair[1]] == "object"){
return deepEquals(o1[keyPair[0]], o2[keyPair[1]])
} else {
return o1[keyPair[0]] == o2[keyPair[1]];
}
}).all();
}
});
Usage:
var anObj = JSON.parse(jsonString1);
var anotherObj= JSON.parse(jsonString2);
if (Object.deepEquals(anObj, anotherObj))
...
It is possible to have 2 groovy-xxx-all.jar files by excample in lib directory. which makes that an app is not running
Well, you can use xpath utility. I guess perl's XML::Xpath contains it.
You can use VLOOKUP, but this requires a wrapper function to return True
or False
. Not to mention it is (relatively) slow. Use COUNTIF or MATCH instead.
Fill down this formula in column K next to the existing values in column I (from I1
to I2691
):
=COUNTIF(<entire column E range>,<single column I value>)>0
=COUNTIF($E$1:$E$99504,$I1)>0
You can also use MATCH:
=NOT(ISNA(MATCH(<single column I value>,<entire column E range>)))
=NOT(ISNA(MATCH($I1,$E$1:$E$99504,0)))
Now the <b>
element is deprecated. <strong>
renders as <b>
, and <em>
renders as <i>
.
tv.setText(Html.fromHtml("<strong>bold</strong> and <em>italic</em> "));
I might be late to the party, but as per my understanding , you're looking for something like this :
for(String params : Collections.list(httpServletRequest.getParameterNames())) {
// Whatever you want to do with your map
// Key : params
// Value : httpServletRequest.getParameter(params)
}
First you should learn about loops, in this case most suitable is for
loop. For instance let's initialize whole table with increasing values starting with 0:
final int SIZE = 10;
int[] array = new int[SIZE];
for (int i = 0; i < SIZE; i++) {
array[i] = i;
}
Now you can modify it to initialize your table with values as per your assignment.
But what happen if you replace condition i < SIZE
with i < 11
? Well, you will get IndexOutOfBoundException
, as you try to access (at some point) an object under index 10, but the highest index in 10-element array is 9. So you are trying, in other words, to find friend's home with number 11, but there are only 10 houses in the street.
In case of the code you presented, well, there must be more of it, as you can not get this error (exception) from that code.
There are various ways to handle this more elegantly now. Please see some other answers on this thread. Tech moves fast so answers can often become out of date fairly quickly. My answer will still work but it's worth looking at alternatives as well.
Using your code, the issue is that you haven't waited for a socket to be assigned to the request before attempting to set stuff on the socket object. It's all async so:
var options = { ... }
var req = http.request(options, function(res) {
// Usual stuff: on(data), on(end), chunks, etc...
});
req.on('socket', function (socket) {
socket.setTimeout(myTimeout);
socket.on('timeout', function() {
req.abort();
});
});
req.on('error', function(err) {
if (err.code === "ECONNRESET") {
console.log("Timeout occurs");
//specific error treatment
}
//other error treatment
});
req.write('something');
req.end();
The 'socket' event is fired when the request is assigned a socket object.
Just wanted to add my 2 cents, since I googled this question b/c I found myself in a similar situation...
BE AWARE that while changing from varchar(xxx)
to varchar(yyy)
is a meta-data change indeed, but changing to varchar(max)
is not. Because varchar(max)
values (aka BLOB values - image/text etc) are stored differently on the disk, not within a table row, but "out of row". So the server will go nuts on a big table and become unresponsive for minutes (hours).
--no downtime
ALTER TABLE MyTable ALTER COLUMN [MyColumn] VARCHAR(1200)
--huge downtime
ALTER TABLE MyTable ALTER COLUMN [MyColumn] VARCHAR(max)
PS. same applies to nvarchar
or course.
Try jCounter, it has a customRange setting where you can specify the start and end number, it can count up as well including the fallback you want at the end.