Android doesn't come with SOAP library. However, you can download 3rd party library here:
https://github.com/simpligility/ksoap2-android
If you need help using it, you might find this thread helpful:
How to call a .NET Webservice from Android using KSOAP2?
This error can appear on the client if there is a problem on the server side. For example, if the SOAP server is a PHP script with a parse error, the client will fail with this message.
If you are in control of the server, tail your Apache error_log on the machine that hosts the SOAP server. On CentOS you will find this in /var/log/httpd/error_log, so the command is:
tail -f /var/log/httpd/error_log
Now refresh the client and watch for the error message. Any PHP errors with the server script will be shown.
Hope that helps someone.
I often used Bacon Bits great answer as I just can not memorize the syntax.
But I usually add a CTE as an addition to make the DELETE part more useful because very often you will want to apply the merge only to a part of the target table.
WITH target as (
SELECT * FROM dbo.energydate WHERE DateTime > GETDATE()
)
MERGE INTO target WITH (HOLDLOCK)
USING dbo.temp_energydata AS source
ON target.webmeterID = source.webmeterID
AND target.DateTime = source.DateTime
WHEN MATCHED THEN
UPDATE SET target.kWh = source.kWh
WHEN NOT MATCHED BY TARGET THEN
INSERT (webmeterID, DateTime, kWh)
VALUES (source.webmeterID, source.DateTime, source.kWh)
WHEN NOT MATCHED BY SOURCE THEN
DELETE
This type of error also takes place because the resize is unable to get the image in simple the directory of the image may be wrong.In my case I left the forward slash during providing the location of file and this error took place after I put the slash problem was solved.
Just for completeness and because I did not see anyone else suggest it:
Before implementing any of the complicated suggestions above consider if SQL injection is indeed a problem in your scenario.
In many cases the value provided to IN (...) is a list of ids that have been generated in a way that you can be sure that no injection is possible... (e.g. the results of a previous select some_id from some_table where some_condition.)
If that is the case you might just concatenate this value and not use the services or the prepared statement for it or use them for other parameters of this query.
query="select f1,f2 from t1 where f3=? and f2 in (" + sListOfIds + ");";
To enforce non-www and https in a single request, you can use the following Rule in your htaccess :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\. [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$
RewriteRule ^ https://%1%{REQUEST_URI} [NE,L,R]
This redirects http://www.example.com/ or https://www.example.com/ to ssl non-www https://example.com/ .
I am using R Temp Redirect flag for testing purpose and to avoid browser caching. If you want to make the redirect permanent , just change the R flag to R=301 .
I had the exact same issue. If you are using a relative path os.path.dirname(path) will only return the relative path. os.path.realpath does the trick:
>>> import os
>>> f = open('file.txt')
>>> os.path.realpath(f.name)
You do not exactly define what the dictionaries should look like, but most likely you are referring to QuerySet.values()
. From the official django documentation:
Returns a
ValuesQuerySet
— aQuerySet
subclass that returns dictionaries when used as an iterable, rather than model-instance objects.Each of those dictionaries represents an object, with the keys corresponding to the attribute names of model objects.
You need to use an SSH key to login to your instance.
The GCE documentation explains the process here.
Using <meta http-equiv="X-UA-Compatible" content="IE=9">
, IE9+ does support addEventListener
by removing the "on" in the event name, like this:
var btn1 = document.getElementById('btn1');
btn1.addEventListener('mousedown', function() {
console.log('mousedown');
});
TextView does not support setMargins. Android docs say:
Even though a view can define a padding, it does not provide any support for margins. However, view groups provide such a support. Refer to ViewGroup and ViewGroup.MarginLayoutParams for further information.
Use getChildCount()
and getChildAt(int index)
.
Example:
LinearLayout ll = …
final int childCount = ll.getChildCount();
for (int i = 0; i < childCount; i++) {
View v = ll.getChildAt(i);
// Do something with v.
// …
}
Mixaz's above answer worked for me. However I had issues installing the package because of PGP check failures. Installing it by skipping the signature worked, you could try this :
yaourt --m-arg "--skipchecksums --skippgpcheck" -Sb <your-package>
If you frequently need to access the Nth element of a sequence, std::list
, which is implemented as a doubly linked list, is probably not the right choice. std::vector
or std::deque
would likely be better.
That said, you can get an iterator to the Nth element using std::advance
:
std::list<Object> l;
// add elements to list 'l'...
unsigned N = /* index of the element you want to retrieve */;
if (l.size() > N)
{
std::list<Object>::iterator it = l.begin();
std::advance(it, N);
// 'it' points to the element at index 'N'
}
For a container that doesn't provide random access, like std::list
, std::advance
calls operator++
on the iterator N
times. Alternatively, if your Standard Library implementation provides it, you may call std::next
:
if (l.size() > N)
{
std::list<Object>::iterator it = std::next(l.begin(), N);
}
std::next
is effectively wraps a call to std::advance
, making it easier to advance an iterator N
times with fewer lines of code and fewer mutable variables. std::next
was added in C++11.
Use a semaphore with a count that is equal to the number of readers. Let each reader take one count of the semaphore in order to read, that way they can all read at the same time. Then let the writer take ALL the semaphore counts prior to writing. This causes the writer to wait for all reads to finish and then block out reads while writing.
border-color: transparent; border: 1px solid red;
In case the solution did not help to just suspend resharper (STRG+R, STRG+R did still not work for example) I decided to disable the plugin and restart visual studio.
VisualStudio > Extras > Extensions > Resharper > Disable
https://docs.microsoft.com/en-us/visualstudio/extensibility/how-to-diagnose-extension-performance
short read:
Flattening a tensor means to remove all of the dimensions except for one. This is exactly what the Flatten layer do.
long read:
If we take the original model (with the Flatten layer) created in consideration we can get the following model summary:
Layer (type) Output Shape Param #
=================================================================
D16 (Dense) (None, 3, 16) 48
_________________________________________________________________
A (Activation) (None, 3, 16) 0
_________________________________________________________________
F (Flatten) (None, 48) 0
_________________________________________________________________
D4 (Dense) (None, 4) 196
=================================================================
Total params: 244
Trainable params: 244
Non-trainable params: 0
For this summary the next image will hopefully provide little more sense on the input and output sizes for each layer.
The output shape for the Flatten layer as you can read is (None, 48)
. Here is the tip. You should read it (1, 48)
or (2, 48)
or ... or (16, 48)
... or (32, 48)
, ...
In fact, None
on that position means any batch size. For the inputs to recall, the first dimension means the batch size and the second means the number of input features.
The role of the Flatten layer in Keras is super simple:
A flatten operation on a tensor reshapes the tensor to have the shape that is equal to the number of elements contained in tensor non including the batch dimension.
Note: I used the model.summary()
method to provide the output shape and parameter details.
the easiest way to to make the browser to scroll the page to a given anchor is to type in your style.css *{scroll-behavior: smooth;} and in your html navigation use #NameOfTheSection
*{scroll-behavior: smooth;}
_x000D_
<a href="#scroll-to">Home<a/>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<p>other sections</p>
<section id="scroll-to">
<p>it will scroll down to this section</p>
</section>
_x000D_
I resolved in This Way (it's a little bit laboriouse, but it's surely the faster in runtime).
In VB (sorry, but I think it's not hard translate it in C#), I make this substitution with RE:
(?<Attr><(.*ComponentModel\.)Bindable\(True\)>)( |\r\n)*(?<Def>(Public|Private|Friend|Protected) .*Property )(?<Name>[^ ]*) As (?<Type>.*?)[ |\r\n](?![ |\r\n]*Get)
with:
Private _${Name} As ${Type}\r\n${Attr}\r\n${Def}${Name} As ${Type}\r\nGet\r\nReturn _${Name}\r\nEnd Get\r\nSet (Value As ${Type})\r\nIf _${Name} <> Value Then \r\n_${Name} = Value\r\nRaiseEvent PropertyChanged(Me, New ComponentModel.PropertyChangedEventArgs("${Name}"))\r\nEnd If\r\nEnd Set\r\nEnd Property\r\n
This transofrm all code like this:
<Bindable(True)>
Protected Friend Property StartDate As DateTime?
In
Private _StartDate As DateTime?
<Bindable(True)>
Protected Friend Property StartDate As DateTime?
Get
Return _StartDate
End Get
Set(Value As DateTime?)
If _StartDate <> Value Then
_StartDate = Value
RaiseEvent PropertyChange(Me, New ComponentModel.PropertyChangedEventArgs("StartDate"))
End If
End Set
End Property
And If I want to have a more readable code, I can be the opposite just making the following substitution:
Private _(?<Name>.*) As (?<Type>.*)[\r\n ]*(?<Attr><(.*ComponentModel\.)Bindable\(True\)>)[\r\n ]*(?<Def>(Public|Private|Friend|Protected) .*Property )\k<Name> As \k<Type>[\r\n ]*Get[\r\n ]*Return _\k<Name>[\r\n ]*End Get[\r\n ]*Set\(Value As \k<Type>\)[\r\n ]*If _\k<Name> <> Value Then[\r\n ]*_\k<Name> = Value[\r\n ]*RaiseEvent PropertyChanged\(Me, New (.*ComponentModel\.)PropertyChangedEventArgs\("\k<Name>"\)\)[\r\n ]*End If[\r\n ]*End Set[\r\n ]*End Property
With
${Attr} ${Def} ${Name} As ${Type}
I throw to replace the IL code of the set method, but I can't write a lot of compiled code in IL... If a day I write it, I'll say you!
Local variables are automatically freed when the function ends, you don't need to free them by yourself. You only free dynamically allocated memory (e.g using malloc
) as it's allocated on the heap:
char *arr = malloc(3 * sizeof(char));
strcpy(arr, "bo");
// ...
free(arr);
More about dynamic memory allocation: http://en.wikipedia.org/wiki/C_dynamic_memory_allocation
I'm posting this for people searching for an answer when using MySQL and Java Spring Boot JPA, like @immanuelRocha says, only have too @CreationTimeStamp to the @Column in Spring, and in MySQL set the default value to "CURRENT_TIMESTAMP".
In Spring add just the line :
@Column(name = "insert_date")_x000D_
@CreationTimestamp_x000D_
private Timestamp insert_date;
_x000D_
This works well for me:
from matplotlib import pyplot as plt
F = plt.gcf()
Size = F.get_size_inches()
F.set_size_inches(Size[0]*2, Size[1]*2, forward=True) # Set forward to True to resize window along with plot in figure.
plt.show() # or plt.imshow(z_array) if using an animation, where z_array is a matrix or numpy array
This might also help: http://matplotlib.1069221.n5.nabble.com/Resizing-figure-windows-td11424.html
Sorry not sure what was going on this worked in the end:
<VirtualHost *>
ServerName example.com
DocumentRoot /var/www/html/mjp
Alias /ncn "/var/www/html/ncn"
<Directory "/var/www/html/ncn">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
i use jspdf and html2canvas for css rendering and i export content of specific div as this is my code
$(document).ready(function () {
let btn=$('#c-oreder-preview');
btn.text('download');
btn.on('click',()=> {
$('#c-invoice').modal('show');
setTimeout(function () {
html2canvas(document.querySelector("#c-print")).then(canvas => {
//$("#previewBeforeDownload").html(canvas);
var imgData = canvas.toDataURL("image/jpeg",1);
var pdf = new jsPDF("p", "mm", "a4");
var pageWidth = pdf.internal.pageSize.getWidth();
var pageHeight = pdf.internal.pageSize.getHeight();
var imageWidth = canvas.width;
var imageHeight = canvas.height;
var ratio = imageWidth/imageHeight >= pageWidth/pageHeight ? pageWidth/imageWidth : pageHeight/imageHeight;
//pdf = new jsPDF(this.state.orientation, undefined, format);
pdf.addImage(imgData, 'JPEG', 0, 0, imageWidth * ratio, imageHeight * ratio);
pdf.save("invoice.pdf");
//$("#previewBeforeDownload").hide();
$('#c-invoice').modal('hide');
});
},500);
});
});
Use this annotation
@RequestMapping(value = "/url", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON})
I tried following the above tutorial. Thing is tensorflow changes a lot and so do the NVIDIA versions needed for running on a GPU. The next issue is that your driver version determines your toolkit version etc. As of today this information about the software requirements should shed some light on how they interplay:
NVIDIA® GPU drivers —CUDA 9.0 requires 384.x or higher.
CUDA® Toolkit —TensorFlow supports CUDA 9.0.
CUPTI ships with the CUDA Toolkit.
cuDNN SDK (>= 7.2) Note: Make sure your GPU has compute compatibility >3.0
(Optional) NCCL 2.2 for multiple GPU support.
(Optional) TensorRT 4.0 to improve latency and throughput for inference on some models.
And here you'll find the up-to-date requirements stated by tensorflow (which will hopefully be updated by them on a regular basis).
Since JSF 2.3 all the bean scopes defined in package javax.faces.bean
package have been deprecated to align the scopes with CDI. Moreover they're only applicable if your bean is using @ManagedBean
annotation. If you are using JSF versions below 2.3 refer to the legacy answer at the end.
From JSF 2.3 here are scopes that can be used on JSF Backing Beans:
1. @javax.enterprise.context.ApplicationScoped
: The application scope persists for the entire duration of the web application. That scope is shared among all requests and all sessions. This is useful when you have data for whole application.
2. @javax.enterprise.context.SessionScoped
: The session scope persists from the time that a session is established until session termination. The session context is shared between all requests that occur in the same HTTP session. This is useful when you wont to save data for a specific client for a particular session.
3. @javax.enterprise.context.ConversationScoped
: The conversation scope persists as log as the bean lives. The scope provides 2 methods: Conversation.begin()
and Conversation.end()
. These methods should called explicitly, either to start or end the life of a bean.
4. @javax.enterprise.context.RequestScoped
: The request scope is short-lived. It starts when an HTTP request is submitted and ends after the response is sent back to the client. If you place a managed bean into request scope, a new instance is created with each request. It is worth considering request scope if you are concerned about the cost of session scope storage.
5. @javax.faces.flow.FlowScoped
: The Flow scope persists as long as the Flow lives. A flow may be defined as a contained set of pages (or views) that define a unit of work. Flow scoped been is active as long as user navigates with in the Flow.
6. @javax.faces.view.ViewScoped
: A bean in view scope persists while the same JSF page is redisplayed. As soon as the user navigates to a different page, the bean goes out of scope.
The following legacy answer applies JSF version before 2.3
As of JSF 2.x there are 4 Bean Scopes:
- @SessionScoped
- @RequestScoped
- @ApplicationScoped
- @ViewScoped
Session Scope: The session scope persists from the time that a session is established until session termination. A session terminates if the web application invokes the invalidate method on the HttpSession object, or if it times out.
RequestScope: The request scope is short-lived. It starts when an HTTP request is submitted and ends after the response is sent back to the client. If you place a managed bean into request scope, a new instance is created with each request. It is worth considering request scope if you are concerned about the cost of session scope storage.
ApplicationScope: The application scope persists for the entire duration of the web application. That scope is shared among all requests and all sessions. You place managed beans into the application scope if a single bean should be shared among all instances of a web application. The bean is constructed when it is first requested by any user of the application, and it stays alive until the web application is removed from the application server.
ViewScope: View scope was added in JSF 2.0. A bean in view scope persists while the same JSF page is redisplayed. (The JSF specification uses the term view for a JSF page.) As soon as the user navigates to a different page, the bean goes out of scope.
Choose the scope you based on your requirement.
Source: Core Java Server Faces 3rd Edition by David Geary & Cay Horstmann [Page no. 51 - 54]
I know this is old but if you do a split then join it will remove all occurrences of a particular character ie:
var str = theText.split('A').join('')
will remove all occurrences of 'A' from the string, obviously it's not case sensitive
Actually the best way to accomplish this is to write the javascript in a .php and use jquery in a separate file to use the Jquery get script file or jquery load use php include function in the doc where the javascript will live. Essentially this is how it will look.
Dynamic Javascript File in a .php file extension - Contains a mixture of php variables pre processed by the server and the javascript that needs these variables in scripts.
Static Js File - Using http://api.jquery.com/jquery.getscript/ or http://api.jquery.com/load/
In the main html page call the static file as a regular js file. Calling the static js file will force load the dynamic data from the server.
some file.php 1:
<?php
$somevar = "Some Dynamic Data";
?>
$('input').val(<?php echo $somevar?>);
or simply echo the script such as
echo "$('input').val(".$somevar.");";
File 2:somejsfile.js:
$("#result").load( "file.php" );
File 3 myhtml.html:
<script src="somejsfile.js"></script>
I believe this answer the question for many people looking to mix php and javascript. It would be nice to have that data process in the background then have the user have delays waiting for data. You could also bypass the second file and simply use php's include on the main html page, you would just have your javascript exposed on the main page. For performance that is up to you and how you want to handle all of that.
NSString* expectedString = nil;
if([givenString hasPrefix:@"*"])
{
expectedString = [givenString substringFromIndex:1];
}
Time Zone Handling
I just want to clarify, even though this has been commented so future people don't miss this very important distinction.
DateTime.strptime("1318996912",'%s') # => Wed, 19 Oct 2011 04:01:52 +0000
displays a return value in UTC and requires the seconds to be a String and outputs a UTC Time object, whereas
Time.at(1318996912) # => 2011-10-19 00:01:52 -0400
displays a return value in the LOCAL time zone, normally requires a FixNum argument, but the Time object itself is still in UTC even though the display is not.
So even though I passed the same integer to both methods, I seemingly two different results because of how the class' #to_s
method works. However, as @Eero had to remind me twice of:
Time.at(1318996912) == DateTime.strptime("1318996912",'%s') # => true
An equality comparison between the two return values still returns true. Again, this is because the values are basically the same (although different classes, the #==
method takes care of this for you), but the #to_s
method prints drastically different strings. Although, if we look at the strings, we can see they are indeed the same time, just printed in different time zones.
Method Argument Clarification
The docs also say "If a numeric argument is given, the result is in local time." which makes sense, but was a little confusing to me because they don't give any examples of non-integer arguments in the docs. So, for some non-integer argument examples:
Time.at("1318996912")
TypeError: can't convert String into an exact number
you can't use a String argument, but you can use a Time argument into Time.at
and it will return the result in the time zone of the argument:
Time.at(Time.new(2007,11,1,15,25,0, "+09:00"))
=> 2007-11-01 15:25:00 +0900
Benchmarks
After a discussion with @AdamEberlin on his answer, I decided to publish slightly changed benchmarks to make everything as equal as possible. Also, I never want to have to build these again so this is as good a place as any to save them.
Time.at(int).to_datetime ~ 2.8x faster
09:10:58-watsw018:~$ ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
09:11:00-watsw018:~$ irb
irb(main):001:0> require 'benchmark'
=> true
irb(main):002:0> require 'date'
=> true
irb(main):003:0>
irb(main):004:0* format = '%s'
=> "%s"
irb(main):005:0> times = ['1318996912', '1318496913']
=> ["1318996912", "1318496913"]
irb(main):006:0> int_times = times.map(&:to_i)
=> [1318996912, 1318496913]
irb(main):007:0>
irb(main):008:0* datetime_from_strptime = DateTime.strptime(times.first, format)
=> #<DateTime: 2011-10-19T04:01:52+00:00 ((2455854j,14512s,0n),+0s,2299161j)>
irb(main):009:0> datetime_from_time = Time.at(int_times.first).to_datetime
=> #<DateTime: 2011-10-19T00:01:52-04:00 ((2455854j,14512s,0n),-14400s,2299161j)>
irb(main):010:0>
irb(main):011:0* datetime_from_strptime === datetime_from_time
=> true
irb(main):012:0>
irb(main):013:0* Benchmark.measure do
irb(main):014:1* 100_000.times {
irb(main):015:2* times.each do |i|
irb(main):016:3* DateTime.strptime(i, format)
irb(main):017:3> end
irb(main):018:2> }
irb(main):019:1> end
=> #<Benchmark::Tms:0x00007fbdc18f0d28 @label="", @real=0.8680500000045868, @cstime=0.0, @cutime=0.0, @stime=0.009999999999999998, @utime=0.86, @total=0.87>
irb(main):020:0>
irb(main):021:0* Benchmark.measure do
irb(main):022:1* 100_000.times {
irb(main):023:2* int_times.each do |i|
irb(main):024:3* Time.at(i).to_datetime
irb(main):025:3> end
irb(main):026:2> }
irb(main):027:1> end
=> #<Benchmark::Tms:0x00007fbdc3108be0 @label="", @real=0.33059399999910966, @cstime=0.0, @cutime=0.0, @stime=0.0, @utime=0.32000000000000006, @total=0.32000000000000006>
****edited to not be completely and totally incorrect in every way****
****added benchmarks****
You need to put "here" into a <div>
or <span>
with style="float: right"
.
You can KILL the processid.
mysql> show full processlist;
+---------+------------+-------------------+------+---------+-------+-------+-----------------------+
| Id | User | Host | db | Command | Time | State | Info |
+---------+------------+-------------------+------+---------+-------+-------+-----------------------+
| 1193777 | TestUser12 | 192.168.1.11:3775 | www | Sleep | 25946 | | NULL |
+---------+------------+-------------------+------+---------+-------+-------+-----------------------+
mysql> kill 1193777;
But:
Or you configure your mysql-server by setting a shorter timeout on wait_timeout
and interactive_timeout
mysql> show variables like "%timeout%";
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| connect_timeout | 5 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 50 |
| interactive_timeout | 28800 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| slave_net_timeout | 3600 |
| table_lock_wait_timeout | 50 |
| wait_timeout | 28800 |
+--------------------------+-------+
9 rows in set (0.00 sec)
Set with:
set global wait_timeout=3;
set global interactive_timeout=3;
(and also set in your configuration file, for when your server restarts)
But you're treating the symptoms instead of the underlying cause - why are the connections open? If the PHP script finished, shouldn't they close? Make sure your webserver is not using connection pooling...
In some cases, Reflection doesn't work properly.
You could use dictionaries, if all item types are the same. For instance, if your items are strings :
Dictionary<string, string> response = JsonConvert.DeserializeObject<Dictionary<string, string>>(item);
Or ints:
Dictionary<string, int> response = JsonConvert.DeserializeObject<Dictionary<string, int>>(item);
You have your arguments to the remote add
command reversed:
git remote add <NAME> <PATH>
So:
git remote add bak /home/sas/dev/apps/smx/repo/bak/ontologybackend/.git
See git remote --help
for more information.
As an update to the state of the Ruby ecosystem, Date
, DateTime
and Time
now have methods to convert between the various classes. Using Ruby 1.9.2+:
pry
[1] pry(main)> ts = 'Jan 1, 2000 12:01:01'
=> "Jan 1, 2000 12:01:01"
[2] pry(main)> require 'time'
=> true
[3] pry(main)> require 'date'
=> true
[4] pry(main)> ds = Date.parse(ts)
=> #<Date: 2000-01-01 (4903089/2,0,2299161)>
[5] pry(main)> ds.to_date
=> #<Date: 2000-01-01 (4903089/2,0,2299161)>
[6] pry(main)> ds.to_datetime
=> #<DateTime: 2000-01-01T00:00:00+00:00 (4903089/2,0,2299161)>
[7] pry(main)> ds.to_time
=> 2000-01-01 00:00:00 -0700
[8] pry(main)> ds.to_time.class
=> Time
[9] pry(main)> ds.to_datetime.class
=> DateTime
[10] pry(main)> ts = Time.parse(ts)
=> 2000-01-01 12:01:01 -0700
[11] pry(main)> ts.class
=> Time
[12] pry(main)> ts.to_date
=> #<Date: 2000-01-01 (4903089/2,0,2299161)>
[13] pry(main)> ts.to_date.class
=> Date
[14] pry(main)> ts.to_datetime
=> #<DateTime: 2000-01-01T12:01:01-07:00 (211813513261/86400,-7/24,2299161)>
[15] pry(main)> ts.to_datetime.class
=> DateTime
Not really answering your question but if you want the benefits of Distributed Revision Control - it sounds like you do - and you're using Windows I think you'd be better off using Mercurial rather that Git as Mercurial has much better Windows support. Mercurial does have a Mac port too.
Probably your item.photo
is undefined
if you don't have a photo attribute on item in the first place and thus undefined != ''
. But if you'd put some code to show how you provide values to item
, it would help.
PS: Sorry to post this as an answer (I rather think it's more of a comment), but I don't have enough reputation yet.
I also had a similar case after copying a project on a production server. The public folder was accessed by Apache via a symbolic link.
For Apache or the PHP service, the path to the project has not changed, thus they used cached file paths that lead to the old project repository.
Restarting Apache and PHP service resolved the issue.
You don't need to set "fixed"
- all you need is setting overflow:hidden
since the column width is set.
Adapted this to take an input list of servers, specify a hostname and give some helpful output
$name = "<ServiceName>"
$servers = Get-content servers.txt
function Confirm-WindowsServiceExists($name)
{
if (Get-Service -Name $name -Computername $server -ErrorAction Continue)
{
Write-Host "$name Exists on $server"
return $true
}
Write-Host "$name does not exist on $server"
return $false
}
function Remove-WindowsServiceIfItExists($name)
{
$exists = Confirm-WindowsServiceExists $name
if ($exists)
{
Write-host "Removing Service $name from $server"
sc.exe \\$server delete $name
}
}
ForEach ($server in $servers) {Remove-WindowsServiceIfItExists($name)}
You can try usage:
# echo "/usr/lib/oracle/12.2/client64/lib" > /etc/ld.so.conf.d/oracle.conf
# ldconfig
This problem are because oracleinstant client not configure shared library.
First of all, a disclaimer. I don't really advocate for the solution I present below. The only browser specific CSS I write is for IE (especially IE6), although I wish it wasn't the case.
Now, the solution. You asked it to be elegant so I don't know how elegant is it but it's sure going to target Gecko platforms only.
The trick is only working when JavaScript is enabled and makes use of Mozilla bindings (XBL), which are heavily used internally in Firefox and all other Gecko-based products. For a comparison, this is like the behavior CSS property in IE, but much more powerful.
Three files are involved in my solution:
ff.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
-moz-binding: url(ff.xml#load-mozilla-css);
}
</style>
</head>
<body>
<h1>This should be red in FF</h1>
</body>
</html>
ff.xml
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="load-mozilla-css">
<implementation>
<constructor>
<![CDATA[
var link = document.createElement("link");
link.setAttribute("rel", "stylesheet");
link.setAttribute("type", "text/css");
link.setAttribute("href", "ff.css");
document.getElementsByTagName("head")[0]
.appendChild(link);
]]>
</constructor>
</implementation>
</binding>
</bindings>
ff.css
h1 {
color: red;
}
Update: The above solution is not that good. It would be better if instead of appending a new LINK element it will add that "firefox" class on the BODY element. And it's possible, just by replacing the above JS with the following:
this.className += " firefox";
The solution is inspired by Dean Edwards' moz-behaviors.
Most python people prefer underscores, but even I am using python since more than 5 years right now, I still do not like them. They just look ugly to me, but maybe that's all the Java in my head.
I simply like CamelCase better since it fits better with the way classes are named, It feels more logical to have SomeClass.doSomething()
than SomeClass.do_something()
. If you look around in the global module index in python, you will find both, which is due to the fact that it's a collection of libraries from various sources that grew overtime and not something that was developed by one company like Sun with strict coding rules. I would say the bottom line is: Use whatever you like better, it's just a question of personal taste.
datetime.date
has a isocalendar()
method, which returns a tuple containing the calendar week:
>>> import datetime
>>> datetime.date(2010, 6, 16).isocalendar()[1]
24
datetime.date.isocalendar() is an instance-method returning a tuple containing year, weeknumber and weekday in respective order for the given date instance.
You cannot scroll images continuously using the HTML marquee tag - it must have JavaScript added for the continuous scrolling functionality.
There is a JavaScript plugin called crawler.js available on the dynamic drive forum for achieving this functionality. This plugin was created by John Davenport Scheuer and has been modified over time to suit new browsers.
I have also implemented this plugin into my blog to document all the steps to use this plugin. Here is the sample code:
<head>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="assets/js/crawler.js" type="text/javascript" ></script>
</head>
<div id="mycrawler2" style="margin-top: -3px; " class="productswesupport">
<img src="assets/images/products/ie.png" />
<img src="assets/images/products/browser.png" />
<img src="assets/images/products/chrome.png" />
<img src="assets/images/products/safari.png" />
</div>
Here is the plugin configration:
marqueeInit({
uniqueid: 'mycrawler2',
style: {
},
inc: 5, //speed - pixel increment for each iteration of this marquee's movement
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
moveatleast: 2,
neutral: 150,
savedirection: true,
random: true
});
You get undefined for the various scenarios:
You declare a variable with var but never set it.
var foo;
alert(foo); //undefined.
You attempt to access a property on an object you've never set.
var foo = {};
alert(foo.bar); //undefined
You attempt to access an argument that was never provided.
function myFunction (foo) {
alert(foo); //undefined.
}
As cwolves pointed out in a comment on another answer, functions that don't return a value.
function myFunction () {
}
alert(myFunction());//undefined
A null usually has to be intentionally set on a variable or property (see comments for a case in which it can appear without having been set). In addition a null is of type object
and undefined is of type undefined
.
I should also note that null is valid in JSON but undefined is not:
JSON.parse(undefined); //syntax error
JSON.parse(null); //null
I got it working using the Raw data option in postman, as you can see in the screen shot
This is an update to @Tom's answer using Swift 2.0 Note - This is the whole CallComposer class I am using.
class CallComposer: NSObject {
var editedPhoneNumber = ""
func call(phoneNumber: String) -> Bool {
if phoneNumber != "" {
for i in number.characters {
switch (i){
case "0","1","2","3","4","5","6","7","8","9" : editedPhoneNumber = editedPhoneNumber + String(i)
default : print("Removed invalid character.")
}
}
let phone = "tel://" + editedPhoneNumber
let url = NSURL(string: phone)
if let url = url {
UIApplication.sharedApplication().openURL(url)
} else {
print("There was an error")
}
} else {
return false
}
return true
}
}
Use sh, it'll make things a lot easier:
import sh
print sh.swfdump("/tmp/filename.swf", "-d")
**HTML Character Entity Reference Chart at W3.org**
https://dev.w3.org/html5/html-author/charref
	


!
!
"
" "
#
#
$
$
%
%
&
& &
'
'
(
(
)
)
*
* *
+
+
,
,
.
.
/
/
:
:
;
;
<
< <
=
=
>
> >
?
?
@
@
[
[ [
\
\
]
] ]
^
^
_
_
`
` `
{
{ {
|
| | |
}
} }
 
¡
¡
¢
¢
£
£
¤
¤
¥
¥
¦
¦
§
§
¨
¨ ¨ ¨ ¨
©
© ©
ª
ª
«
«
¬
¬
­
®
® ® ®
¯
¯ ‾ ¯
°
°
±
± ± ±
²
²
³
³
´
´ ´
µ
µ
¶
¶
·
· · ·
¸
¸ ¸
¹
¹
º
º
»
»
¼
¼
½
½ ½
¾
¾
¿
¿
À
À
Á
Á
Â
Â
Ã
Ã
Ä
Ä
Å
Å
Æ
Æ
Ç
Ç
È
È
É
É
Ê
Ê
Ë
Ë
Ì
Ì
Í
Í
Î
Î
Ï
Ï
Ð
Ð
Ñ
Ñ
Ò
Ò
Ó
Ó
Ô
Ô
Õ
Õ
Ö
Ö
×
×
Ø
Ø
Ù
Ù
Ú
Ú
Û
Û
Ü
Ü
Ý
Ý
Þ
Þ
ß
ß
à
à
á
á
â
â
ã
ã
ä
ä
å
å
æ
æ
ç
ç
è
è
é
é
ê
ê
ë
ë
ì
ì
í
í
î
î
ï
ï
ð
ð
ñ
ñ
ò
ò
ó
ó
ô
ô
õ
õ
ö
ö
÷
÷ ÷
ø
ø
ù
ù
ú
ú
û
û
ü
ü
ý
ý
þ
þ
ÿ
ÿ
A
Ā
a
ā
A
Ă
a
ă
A
Ą
a
ą
C
Ć
c
ć
C
Ĉ
c
ĉ
C
Ċ
c
ċ
C
Č
c
č
D
Ď
d
ď
Ð
Đ
d
đ
E
Ē
e
ē
E
Ė
e
ė
E
Ę
e
ę
E
Ě
e
ě
G
Ĝ
g
ĝ
G
Ğ
g
ğ
G
Ġ
g
ġ
G
Ģ
H
Ĥ
h
ĥ
H
Ħ
h
ħ
I
Ĩ
i
ĩ
I
Ī
i
ī
I
Į
i
į
I
İ
i
ı ı
?
IJ
?
ij
J
Ĵ
j
ĵ
K
Ķ
k
ķ
?
ĸ
L
Ĺ
l
ĺ
L
Ļ
l
ļ
L
Ľ
l
ľ
?
Ŀ
?
ŀ
L
Ł
l
ł
N
Ń
n
ń
N
Ņ
n
ņ
N
Ň
n
ň
?
ʼn
?
Ŋ
?
ŋ
O
Ō
o
ō
O
Ő
o
ő
Œ
Œ
œ
œ
R
Ŕ
r
ŕ
R
Ŗ
r
ŗ
R
Ř
r
ř
S
Ś
s
ś
S
Ŝ
s
ŝ
S
Ş
s
ş
Š
Š
š
š
T
Ţ
t
ţ
T
Ť
t
ť
T
Ŧ
t
ŧ
U
Ũ
u
ũ
U
Ū
u
ū
U
Ŭ
u
ŭ
U
Ů
u
ů
U
Ű
u
ű
U
Ų
u
ų
W
Ŵ
w
ŵ
Y
Ŷ
y
ŷ
Ÿ
Ÿ
Z
Ź
z
ź
Z
Ż
z
ż
Ž
Ž
ž
ž
ƒ
ƒ
?
Ƶ
?
ǵ
?
ȷ
ˆ
ˆ
?
ˇ ˇ
?
˘ ˘
?
˙ ˙
°
˚
?
˛
˜
˜ ˜
?
˝ ˝
?
̑
_
_
?
Α
?
Β
G
Γ
?
Δ
?
Ε
?
Ζ
?
Η
T
Θ
?
Ι
?
Κ
?
Λ
?
Μ
?
Ν
?
Ξ
?
Ο
?
Π
?
Ρ
S
Σ
?
Τ
?
Υ
F
Φ
?
Χ
?
Ψ
O
Ω
a
α
ß
β
?
γ
d
δ
e
ϵ ϵ ε
?
ζ
?
η
?
θ
?
ι
?
κ
?
λ
µ
μ
?
ν
?
ξ
?
ο
p
π
?
ρ
?
ς ς ς
s
σ
t
τ
?
υ υ
f
φ ϕ ϕ
?
χ
?
ψ
?
ω
?
ϑ ϑ ϑ
?
ϒ ϒ
?
ϕ
?
ϖ ϖ
?
Ϝ
?
ϝ ϝ
?
ϰ ϰ
?
ϱ ϱ
?
ε ϵ
?
϶ ϶
?
Ё
?
Ђ
?
Ѓ
?
Є
?
Ѕ
?
І
?
Ї
?
Ј
?
Љ
?
Њ
?
Ћ
?
Ќ
?
Ў
?
Џ
?
А
?
Б
?
В
?
Г
?
Д
?
Е
?
Ж
?
З
?
И
?
Й
?
К
?
Л
?
М
?
Н
?
О
?
П
?
Р
?
С
?
Т
?
У
?
Ф
?
Х
?
Ц
?
Ч
?
Ш
?
Щ
?
Ъ
?
Ы
?
Ь
?
Э
?
Ю
?
Я
?
а
?
б
?
в
?
г
?
д
?
е
?
ж
?
з
?
и
?
й
?
к
?
л
?
м
?
н
?
о
?
п
?
р
?
с
?
т
?
у
?
ф
?
х
?
ц
?
ч
?
ш
?
щ
?
ъ
?
ы
?
ь
?
э
?
ю
?
я
?
ё
?
ђ
?
ѓ
?
є
?
ѕ
?
і
?
ї
?
ј
?
љ
?
њ
?
ћ
?
ќ
?
ў
?
џ
 
 
 
 
 
 
   
   
?
​ ​ ​ ​ ​
?
‌
?
‍
?
‎
?
‏
-
‐ ‐
–
–
—
—
-
―
?
‖ ‖
‘
‘ ‘
’
’ ’ ’
‚
‚ ‚
“
“ “
”
” ” ”
„
„ „
†
†
‡
‡ ‡
•
• •
?
‥
…
… …
‰
‰
?
‱
'
′
"
″
?
‴
`
‵ ‵
‹
‹
›
›
?
‾
?
⁁
?
⁃
/
⁄
?
⁏
?
⁗
?
 
?
⁠
?
⁡ ⁡
?
⁢ ⁢
?
⁣ ⁣
€
€
?
⃛ ⃛
?
⃜
C
ℂ ℂ
?
℅
g
ℊ
H
ℋ ℋ ℋ
H
ℌ ℌ
H
ℍ ℍ
h
ℎ
?
ℏ ℏ ℏ ℏ
I
ℐ ℐ
I
ℑ ℑ ℑ ℑ
L
ℒ ℒ ℒ
l
ℓ
N
ℕ ℕ
?
№
?
℗
P
℘ ℘
P
ℙ ℙ
Q
ℚ ℚ
R
ℛ ℛ
R
ℜ ℜ ℜ ℜ
R
ℝ ℝ
?
℞
™
™ ™
Z
ℤ ℤ
?
Ω
?
℧
Z
ℨ ℨ
?
℩
Å
Å
B
ℬ ℬ ℬ
C
ℭ ℭ
e
ℯ
E
ℰ ℰ
F
ℱ ℱ
M
ℳ ℳ ℳ
o
ℴ ℴ ℴ
?
ℵ ℵ
?
ℶ
?
ℷ
?
ℸ
?
ⅅ ⅅ
?
ⅆ ⅆ
?
ⅇ ⅇ ⅇ
?
ⅈ ⅈ
?
⅓
?
⅔
?
⅕
?
⅖
?
⅗
?
⅘
?
⅙
?
⅚
?
⅛
?
⅜
?
⅝
?
⅞
?
← ← ← ← ←
?
↑ ↑ ↑ ↑
?
→ → → → →
?
↓ ↓ ↓ ↓
?
↔ ↔ ↔
?
↕ ↕ ↕
?
↖ ↖ ↖
?
↗ ↗ ↗
?
↘ ↘ ↘
?
↙ ↙ ↙
?
↚ ↚
?
↛ ↛
?
↝ ↝
?
↞ ↞
?
↟
?
↠ ↠
?
↡
?
↢ ↢
?
↣ ↣
?
↤ ↤
?
↥ ↥
?
↦ ↦ ↦
?
↧ ↧
?
↩ ↩
?
↪ ↪
?
↫ ↫
?
↬ ↬
?
↭ ↭
?
↮ ↮
?
↰ ↰
?
↱ ↱
?
↲
?
↳
?
↵
?
↶ ↶
?
↷ ↷
?
↺ ↺
?
↻ ↻
?
↼ ↼ ↼
?
↽ ↽ ↽
?
↾ ↾ ↾
?
↿ ↿ ↿
?
⇀ ⇀ ⇀
?
⇁ ⇁ ⇁
?
⇂ ⇂ ⇂
?
⇃ ⇃ ⇃
?
⇄ ⇄ ⇄
?
⇅ ⇅
?
⇆ ⇆ ⇆
?
⇇ ⇇
?
⇈ ⇈
?
⇉ ⇉
?
⇊ ⇊
?
⇋ ⇋ ⇋
?
⇌ ⇌ ⇌
?
⇍ ⇍
?
⇎ ⇎
?
⇏ ⇏
?
⇐ ⇐ ⇐
?
⇑ ⇑ ⇑
?
⇒ ⇒ ⇒ ⇒
?
⇓ ⇓ ⇓
?
⇔ ⇔ ⇔ ⇔
?
⇕ ⇕ ⇕
?
⇖
?
⇗
?
⇘
?
⇙
?
⇚ ⇚
?
⇛ ⇛
?
⇝
?
⇤ ⇤
?
⇥ ⇥
?
⇵ ⇵
?
⇽
?
⇾
?
⇿
?
∀ ∀
?
∁ ∁
?
∂ ∂
?
∃ ∃
?
∄ ∄ ∄
Ø
∅ ∅ ∅ ∅
?
∇ ∇
?
∈ ∈ ∈ ∈
?
∉ ∉ ∉
?
∋ ∋ ∋ ∋
?
∌ ∌ ∌
?
∏ ∏
?
∐ ∐
?
∑ ∑
-
−
±
∓ ∓ ∓
?
∔ ∔
\
∖ ∖ ∖ ∖ ∖
*
∗
°
∘ ∘
v
√ √
?
∝ ∝ ∝ ∝ ∝
8
∞
?
∟
?
∠ ∠
?
∡ ∡
?
∢
|
∣ ∣ ∣ ∣
?
∤ ∤ ∤ ∤
?
∥ ∥ ∥ ∥ ∥
?
∦ ∦ ∦ ∦ ∦
?
∧ ∧
?
∨ ∨
n
∩
?
∪
?
∫ ∫
?
∬
?
∭ ∭
?
∮ ∮ ∮
?
∯ ∯
?
∰
?
∱
?
∲ ∲
?
∳ ∳
?
∴ ∴ ∴
?
∵ ∵ ∵
:
∶
?
∷ ∷
?
∸ ∸
?
∺
?
∻
~
∼ ∼ ∼ ∼
?
∽ ∽
?
∾ ∾
?
∿
?
≀ ≀ ≀
?
≁ ≁
?
≂ ≂ ≂
?
≃ ≃ ≃
?
≄ ≄ ≄
?
≅ ≅
?
≆
?
≇ ≇
˜
≈ ≈ ≈ ≈ ≈ ≈
?
≉ ≉ ≉
?
≊ ≊
?
≋
?
≌ ≌
?
≍ ≍
?
≎ ≎ ≎
?
≏ ≏ ≏
?
≐ ≐ ≐
?
≑ ≑
?
≒ ≒
?
≓ ≓
?
≔ ≔ ≔
?
≕ ≕
?
≖ ≖
?
≗ ≗
?
≙
?
≚
?
≜ ≜
?
≟ ≟
?
≠ ≠
=
≡ ≡
?
≢ ≢
=
≤ ≤
=
≥ ≥ ≥
?
≦ ≦ ≦
?
≧ ≧ ≧
?
≨ ≨
?
≩ ≩
«
≪ ≪ ≪
»
≫ ≫ ≫
?
≬ ≬
?
≭
?
≮ ≮ ≮
?
≯ ≯ ≯
?
≰ ≰ ≰
?
≱ ≱ ≱
?
≲ ≲ ≲
?
≳ ≳ ≳
?
≴ ≴
?
≵ ≵
?
≶ ≶ ≶
?
≷ ≷ ≷
?
≸ ≸
?
≹ ≹
?
≺ ≺ ≺
?
≻ ≻ ≻
?
≼ ≼ ≼
?
≽ ≽ ≽
?
≾ ≾ ≾
?
≿ ≿ ≿
?
⊀ ⊀ ⊀
?
⊁ ⊁ ⊁
?
⊂ ⊂
?
⊃ ⊃ ⊃
?
⊄
?
⊅
?
⊆ ⊆ ⊆
?
⊇ ⊇ ⊇
?
⊈ ⊈ ⊈
?
⊉ ⊉ ⊉
?
⊊ ⊊
?
⊋ ⊋
?
⊍
?
⊎ ⊎
?
⊏ ⊏ ⊏
?
⊐ ⊐ ⊐
?
⊑ ⊑ ⊑
?
⊒ ⊒ ⊒
?
⊓ ⊓
?
⊔ ⊔
?
⊕ ⊕
?
⊖ ⊖
?
⊗ ⊗
?
⊘
?
⊙ ⊙
?
⊚ ⊚
?
⊛ ⊛
?
⊝ ⊝
?
⊞ ⊞
?
⊟ ⊟
?
⊠ ⊠
?
⊡ ⊡
?
⊢ ⊢
?
⊣ ⊣
?
⊤ ⊤
?
⊥ ⊥ ⊥ ⊥
?
⊧
?
⊨ ⊨
?
⊩
?
⊪
?
⊫
?
⊬
?
⊭
?
⊮
?
⊯
?
⊰
?
⊲ ⊲ ⊲
?
⊳ ⊳ ⊳
?
⊴ ⊴ ⊴
?
⊵ ⊵ ⊵
?
⊶
?
⊷
?
⊸ ⊸
?
⊹
?
⊺ ⊺
?
⊻
?
⊽
?
⊾
?
⊿
?
⋀ ⋀ ⋀
?
⋁ ⋁ ⋁
?
⋂ ⋂ ⋂
?
⋃ ⋃ ⋃
?
⋄ ⋄ ⋄
·
⋅
?
⋆ ⋆
?
⋇ ⋇
?
⋈
?
⋉
?
⋊
?
⋋ ⋋
?
⋌ ⋌
?
⋍ ⋍
?
⋎ ⋎
?
⋏ ⋏
?
⋐ ⋐
?
⋑ ⋑
?
⋒
?
⋓
?
⋔ ⋔
?
⋕
?
⋖ ⋖
?
⋗ ⋗
?
⋘
?
⋙ ⋙
?
⋚ ⋚ ⋚
?
⋛ ⋛ ⋛
?
⋞ ⋞
?
⋟ ⋟
?
⋠ ⋠
?
⋡ ⋡
?
⋢ ⋢
?
⋣ ⋣
?
⋦
?
⋧
?
⋨ ⋨
?
⋩ ⋩
?
⋪ ⋪ ⋪
?
⋫ ⋫ ⋫
?
⋬ ⋬ ⋬
?
⋭ ⋭ ⋭
?
⋮
?
⋯
?
⋰
?
⋱
?
⋲
?
⋳
?
⋴
?
⋵
?
⋶
?
⋷
?
⋹
?
⋺
?
⋻
?
⋼
?
⋽
?
⋾
?
⌅ ⌅
?
⌆ ⌆
?
⌈ ⌈
?
⌉ ⌉
?
⌊ ⌊
?
⌋ ⌋
?
⌌
?
⌍
?
⌎
?
⌏
¬
⌐
?
⌒
?
⌓
?
⌕
?
⌖
?
⌜ ⌜
?
⌝ ⌝
?
⌞ ⌞
?
⌟ ⌟
?
⌢ ⌢
?
⌣ ⌣
?
⌭
?
⌮
?
⌶
?
⌽
?
⌿
?
⍼
?
⎰ ⎰
?
⎱ ⎱
?
⎴ ⎴
?
⎵ ⎵
?
⎶
?
⏜
?
⏝
?
⏞
?
⏟
?
⏢
?
⏧
?
␣
?
Ⓢ Ⓢ
-
─ ─
¦
│
+
┌
+
┐
+
└
+
┘
+
├
¦
┤
-
┬
-
┴
+
┼
-
═
¦
║
+
╒
+
╓
+
╔
+
╕
+
╖
+
╗
+
╘
+
╙
+
╚
+
╛
+
╜
+
╝
¦
╞
¦
╟
¦
╠
¦
╡
¦
╢
¦
╣
-
╤
-
╥
-
╦
-
╧
-
╨
-
╩
+
╪
+
╫
+
╬
¯
▀
_
▄
¦
█
¦
░
¦
▒
¦
▓
?
□ □ □
?
▪ ▪ ▪ ▪
?
▫
?
▭
?
▮
?
▱
?
△ △
?
▴ ▴
?
▵ ▵
?
▸ ▸
?
▹ ▹
?
▽ ▽
?
▾ ▾
?
▿ ▿
?
◂ ◂
?
◃ ◃
?
◊ ◊
?
○
?
◬
?
◯ ◯
?
◸
?
◹
?
◺
?
◻
?
◼
?
★ ★
?
☆
?
☎
?
♀
?
♂
?
♠ ♠
?
♣ ♣
?
♥ ♥
?
♦ ♦
?
♪
?
♭
?
♮ ♮
?
♯
?
✓ ✓
?
✗
?
✠ ✠
?
✶
|
❘
?
❲
?
❳
?
⟦ ⟦
?
⟧ ⟧
?
⟨ ⟨ ⟨
?
⟩ ⟩ ⟩
?
⟪
?
⟫
?
⟬
?
⟭
?
⟵ ⟵ ⟵
?
⟶ ⟶ ⟶
?
⟷ ⟷ ⟷
?
⟸ ⟸ ⟸
?
⟹ ⟹ ⟹
?
⟺ ⟺ ⟺
?
⟼ ⟼
?
⟿
?
⤂
?
⤃
?
⤄
?
⤅
?
⤌
?
⤍ ⤍
?
⤎
?
⤏ ⤏
?
⤐ ⤐
?
⤑
?
⤒
?
⤓
?
⤖
?
⤙
?
⤚
?
⤛
?
⤜
?
⤝
?
⤞
?
⤟
?
⤠
?
⤣
?
⤤
?
⤥ ⤥
?
⤦ ⤦
?
⤧
?
⤨ ⤨
?
⤩ ⤩
?
⤪
?
⤳
?
⤵
?
⤶
?
⤷
?
⤸
?
⤹
?
⤼
?
⤽
?
⥅
?
⥈
?
⥉
?
⥊
?
⥋
?
⥎
?
⥏
?
⥐
?
⥑
?
⥒
?
⥓
?
⥔
?
⥕
?
⥖
?
⥗
?
⥘
?
⥙
?
⥚
?
⥛
?
⥜
?
⥝
?
⥞
?
⥟
?
⥠
?
⥡
?
⥢
?
⥣
?
⥤
?
⥥
?
⥦
?
⥧
?
⥨
?
⥩
?
⥪
?
⥫
?
⥬
?
⥭
?
⥮ ⥮
?
⥯ ⥯
?
⥰
?
⥱
?
⥲
?
⥳
?
⥴
?
⥵
?
⥶
?
⥸
?
⥹
?
⥻
?
⥼
?
⥽
?
⥾
?
⥿
?
⦅
?
⦆
?
⦋
?
⦌
?
⦍
?
⦎
?
⦏
?
⦐
?
⦑
?
Not fully, pls track the link for fully document.
It seems that, according to the HTML5 spec, the value property of the textarea element should return '\r\n' for a newline:
The element's value is defined to be the element's raw value with the following transformation applied:
Replace every occurrence of a "CR" (U+000D) character not followed by a "LF" (U+000A) character, and every occurrence of a "LF" (U+000A) character not preceded by a "CR" (U+000D) character, by a two-character string consisting of a U+000D CARRIAGE RETURN "CRLF" (U+000A) character pair.
Following the link to 'value' makes it clear that it refers to the value property accessed in javascript:
Form controls have a value and a checkedness. (The latter is only used by input elements.) These are used to describe how the user interacts with the control.
However, in all five major browsers (using Windows, 11/27/2015), if '\r\n' is written to a textarea, the '\r' is stripped. (To test: var e=document.createElement('textarea'); e.value='\r\n'; alert(e.value=='\n');) This is true of IE since v9. Before that, IE was returning '\r\n' and converting both '\r' and '\n' to '\r\n' (which is the HTML5 spec). So... I'm confused.
To be safe, it's usually enough to use '\r?\n' in regular expressions instead of just '\n', but if the newline sequence must be known, a test like the above can be performed in the app.
Usually a back-reference is either $1
or \1
(backslash one) for the first capture group (the first match of a pattern in parentheses), and indeed Sublime supports both syntaxes. So try:
my name used to be \1
or
my name used to be $1
Also note that your original capture pattern:
my name is (\w)+
is incorrect and will only capture the final letter of the name rather than the whole name. You should use the following pattern to capture all of the letters of the name:
my name is (\w+)
Make sure the folder with the standard header files is in the projects path.
I don't know where this is in Turbo C, but I would think there's a way of doing this.
Here is one possiblity for you if you are using Bootstrap 3
live view: http://fiddle.jshell.net/panchroma/vPH8N/10/show/
edit view: http://jsfiddle.net/panchroma/vPH8N/
I'm using the resposive table code from http://getbootstrap.com/css/#tables-responsive
ie:
<div class="table-responsive">
<table class="table">
...
</table>
</div>
This answer is an update, circa November 2019. None of the popular pip installs will give you a working setup on MacOS 10.13 (and likely other versions as well). Here is a simple way that I got things working:
brew install mysql
pip install mysqlclient
If you need help installing brew, see this site: https://brew.sh/
You can do it using group by:
c_maxes = df.groupby(['A', 'B']).C.transform(max)
df = df.loc[df.C == c_maxes]
c_maxes
is a Series
of the maximum values of C
in each group but which is of the same length and with the same index as df
. If you haven't used .transform
then printing c_maxes
might be a good idea to see how it works.
Another approach using drop_duplicates
would be
df.sort('C').drop_duplicates(subset=['A', 'B'], take_last=True)
Not sure which is more efficient but I guess the first approach as it doesn't involve sorting.
EDIT:
From pandas 0.18
up the second solution would be
df.sort_values('C').drop_duplicates(subset=['A', 'B'], keep='last')
or, alternatively,
df.sort_values('C', ascending=False).drop_duplicates(subset=['A', 'B'])
In any case, the groupby
solution seems to be significantly more performing:
%timeit -n 10 df.loc[df.groupby(['A', 'B']).C.max == df.C]
10 loops, best of 3: 25.7 ms per loop
%timeit -n 10 df.sort_values('C').drop_duplicates(subset=['A', 'B'], keep='last')
10 loops, best of 3: 101 ms per loop
JPA doesn't offer any support for derived property so you'll have to use a provider specific extension. As you mentioned, @Formula
is perfect for this when using Hibernate. You can use an SQL fragment:
@Formula("PRICE*1.155")
private float finalPrice;
Or even complex queries on other tables:
@Formula("(select min(o.creation_date) from Orders o where o.customer_id = id)")
private Date firstOrderDate;
Where id
is the id
of the current entity.
The following blog post is worth the read: Hibernate Derived Properties - Performance and Portability.
Without more details, I can't give a more precise answer but the above link should be helpful.
string str = "47-61-74-65-77-61-79-53-65-72-76-65-72";
string[] parts = str.Split('-');
foreach (string val in parts)
{
int x;
if (int.TryParse(val, out x))
{
Console.Write(string.Format("{0:x2} ", x);
}
}
Console.WriteLine();
You can split the string at the -
Convert the text to ints (int.TryParse)
Output the int as a hex string {0:x2}
Using MacPorts you can install the client with:
sudo port install mysql57
You also need to select the installed version as your mysql
sudo port select mysql mysql57
The server is only installed if you append -server
to the package name (e.g. mysql57-server
)
You could do it like this:
iterations = 10
variables = 2
output <- matrix(ncol=variables, nrow=iterations)
for(i in 1:iterations){
output[i,] <- runif(2)
}
output
and then turn it into a data.frame
output <- data.frame(output)
class(output)
what this does:
Funny you mention that, I did a blog post on this very subject.
See Oracle vs MySQL vs SQL Server: Aggregation vs Joins
Short answer: you have to test it and individual databases vary a lot.
For Sequelize 4
Query
SELECT * FROM Student WHERE LastName='Doe'
AND (FirstName = "John" or FirstName = "Jane") AND Age BETWEEN 18 AND 24
Syntax with Operators
const Op = require('Sequelize').Op;
var r = await to (Student.findAll(
{
where: {
LastName: "Doe",
FirstName: {
[Op.or]: ["John", "Jane"]
},
Age: {
// [Op.gt]: 18
[Op.between]: [18, 24]
}
}
}
));
Notes
$
(e.g $and
, $or
...){freezeTableName: true}
set in the table model then Sequelize will query against the plural form of its name ( Student -> Students )I know that this question is old but I think my answer would help those who haven't found solution in other answers. So, my problem was that I couldn't display croatian characters in my PDF. Firstly, I used FPDF but, I think, it does not support Unicode. Finally, what solved my problem is tFPDF which is the version of FPDF that supports Unicode. This is the example that worked for me:
require('tFPDF/tfpdf.php');
$pdf = new tFPDF();
$pdf->AddPage();
$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true);
$pdf->AddFont('DejaVu', 'B', 'DejaVuSansCondensed-Bold.ttf', true);
$pdf->SetFont('DejaVu','',14);
$txt = 'ccžšdCCŽŠÐ';
$pdf->Write(8,$txt);
$pdf->Output();
Definitely a network/proxy thing. I connect via wifi and a corporate gateway. Deleted workspace, reinstalled GGTS - still hangs. Turn off the network - launches fine.
If you are restrained from having the files in your directory, you can run this code in a script file from the Host machine.
#!/bin/sh
OPTIONS=`vagrant ssh-config | awk -v ORS=' ' '{print "-o " $1 "=" $2}'`
scp ${OPTIONS} /File/To/Copy vagrant@YourServer:/Where/To/Put/File
In this setup, you only need to change /File/To/Copy
to the file or files you want to copy and then /Where/To/Put/File
is the location on the VM you wish to have the files copied to.
If you create this file and call it copyToServer.sh
you can then run the sh
command to push those files.
sh ./copyToServer.sh
As a final note, you cannot run this code as a provisioner
because that runs on the Guest server, while this code runs from the Host.
I too had the same problem.
I was running node v 6.2 alongside using purgecss within my gulpfile. Problem only occurred when I created a new Laravel project; up until that point, I never had an issue with purgecss.
Following @Quentin's statement - how node versions prior to 7.6 do not support async functions - I decided to update my node version to 9.11.2
This worked for me:
1-
$ npm install -g n
$ n 9.11.2
2-
delete 'node_modules' from the route directory
3-
$ npm install
Still not sure how node/purgecss worked prior to updating.. but this did the trick.
If you want to check for false and alert if not, then no there isn't.
If you use if(val)
, then anything that evaluates to 'truthy', like a non-empty string, will also pass. So it depends on how stringent your criterion is. Using ===
and !==
is generally considered good practice, to avoid accidentally matching truthy or falsy conditions via JavaScript's implicit boolean tests.
Simply type the table name and select it and press ATL + F1
Say your table name is Customer
then open a new query window, type and select the table name and press ALT + F1
It will show the complete definition of table.
Given that we are in a php code context and the variable $url
contains the link the user wants to share, you can try this to use a custom image :
<a class="facebook-share-button" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($url); ?>" target="_blank"><img src="/img/facebook-share-button.png" /></a>
or this for just plain text :
<a class="facebook-share-button" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($url); ?>" target="_blank">share</a>
You can also style the link purely with css.
The html code :
<a class="facebook-share-button" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($url); ?>" target="_blank"></a>
The css code :
.facebook-share-button {
background-image: url("/img/facebook-share-button.png");
display: inline-block;
height: 32px;
width: 32px;
}
.facebook-share-button:active,
.facebook-share-button:focus,
.facebook-share-button:hover {
background-image: url("/img/facebook-share-button-hover.png");
}
Due to this article is a good SEO site, so I suggest to use build-in function "mb_convert_variables" to solve this problem. It works with simple syntax.
mb_convert_variables('utf-8', 'original encode', array/object)
You failed to load the slick.js
file. Add this script file https://kenwheeler.github.io/slick/slick/slick.js
.
I updated your JSFiddle by adding an external file on left sidebar External Resources
. Then it doesn't report the error: $(...).slick is not a function
.
Just type
gcc --version
in any terminal near you.. ;-)
Here's a new look on an age-old issue using a more functional style. If you keep the TaskXM class in all of your projects you only have one line of code to never worry about cross-thread updates again.
public class Example
{
/// <summary>
/// No more delegates, background workers, etc. Just one line of code as shown below.
/// Note it is dependent on the Task Extension method shown next.
/// </summary>
public async void Method1()
{
// Still on the GUI thread here if the method was called from the GUI thread
// This code below calls the extension method which spins up a new task and calls back.
await TaskXM.RunCodeAsync(() =>
{
// Running an asynchronous task here
// Cannot update the GUI thread here, but can do lots of work
});
// Can update GUI on this line
}
}
/// <summary>
/// A class containing extension methods for the Task class
/// </summary>
public static class TaskXM
{
/// <summary>
/// RunCodeAsyc is an extension method that encapsulates the Task.run using a callback
/// </summary>
/// <param name="Code">The caller is called back on the new Task (on a different thread)</param>
/// <returns></returns>
public async static Task RunCodeAsync(Action Code)
{
await Task.Run(() =>
{
Code();
});
return;
}
}
import subprocess, optparse, os, sys, re, datetime, threading, time, glob, shutil, xml.dom.minidom, traceback
class OutputManager:
def __init__(self, filename, mode, console, logonly):
self.con = console
self.logtoconsole = True
self.logtofile = False
if filename:
try:
self.f = open(filename, mode)
self.logtofile = True
if logonly == True:
self.logtoconsole = False
except IOError:
print (sys.exc_value)
print ("Switching to console only output...\n")
self.logtofile = False
self.logtoconsole = True
def write(self, data):
if self.logtoconsole == True:
self.con.write(data)
if self.logtofile == True:
self.f.write(data)
sys.stdout.flush()
def getTimeString():
return time.strftime("%Y-%m-%d", time.gmtime())
def runCommand(command):
'''
Execute a command in new thread and return the
stdout and stderr content of it.
'''
try:
Output = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True).communicate()[0]
except Exception as e:
print ("runCommand failed :%s" % (command))
print (str(e))
sys.stdout.flush()
return None
return Output
def GetOs():
Os = ""
if sys.platform.startswith('win32'):
Os = "win"
elif sys.platform.startswith('linux'):
Os = "linux"
elif sys.platform.startswith('darwin'):
Os = "mac"
return Os
def check_output(*popenargs, **kwargs):
try:
if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it will be overridden.')
# Get start time.
startTime = datetime.datetime.now()
timeoutValue=3600
cmd = popenargs[0]
if sys.platform.startswith('win32'):
process = subprocess.Popen( cmd, stdout=subprocess.PIPE, shell=True)
elif sys.platform.startswith('linux'):
process = subprocess.Popen( cmd , stdout=subprocess.PIPE, shell=True )
elif sys.platform.startswith('darwin'):
process = subprocess.Popen( cmd , stdout=subprocess.PIPE, shell=True )
stdoutdata, stderrdata = process.communicate( timeout = timeoutValue )
retcode = process.poll()
####################################
# Catch crash error and log it.
####################################
OutputHandle = None
try:
if retcode >= 1:
OutputHandle = OutputManager( 'CrashJob_' + getTimeString() + '.txt', 'a+', sys.stdout, False)
OutputHandle.write( cmd )
print (stdoutdata)
print (stderrdata)
sys.stdout.flush()
except Exception as e:
print (str(e))
except subprocess.TimeoutExpired:
####################################
# Catch time out error and log it.
####################################
Os = GetOs()
if Os == 'win':
killCmd = "taskkill /FI \"IMAGENAME eq {0}\" /T /F"
elif Os == 'linux':
killCmd = "pkill {0)"
elif Os == 'mac':
# Linux, Mac OS
killCmd = "killall -KILL {0}"
runCommand(killCmd.format("java"))
runCommand(killCmd.format("YouApp"))
OutputHandle = None
try:
OutputHandle = OutputManager( 'KillJob_' + getTimeString() + '.txt', 'a+', sys.stdout, False)
OutputHandle.write( cmd )
except Exception as e:
print (str(e))
except Exception as e:
for frame in traceback.extract_tb(sys.exc_info()[2]):
fname,lineno,fn,text = frame
print "Error in %s on line %d" % (fname, lineno)
You have two references to the :lot_priprc binding variable -- while it should require you to only set the variable's value once and bind it in both places, I've had problems where this didn't work and had to treat each copy as a different variable. A pain, but it worked.
Beside of the inbuilt 'reindent' function, you can also install other plugins, such as SublimeAStyleFormatter and CodeFormatter. These plugins are better for their specify language.
Remark: not too easy way, but workable and it has its own unique pros.
If one want to clone only HEAD
revision of a repository and only HEAD
s of all the its submodules (i.e. to checkout "trunk"), then one can use following Lua script. Sometimes simple command git submodule update --init --recursive --remote --no-fetch --depth=1
can result in an unrecoverable git
error. In this case one need to clean up subdirectory of .git/modules
directory and clone submodule manually using git clone --separate-git-dir
command. The only complexity is to find out URL, path of .git
directory of submodule and path of submodule in superproject tree.
Remark: the script is only tested against https://github.com/boostorg/boost.git
repository. Its peculiarities: all the submodules hosted on the same host and .gitmodules
contains only relative URLs.
-- mkdir boost ; cd boost ; lua ../git-submodules-clone-HEAD.lua https://github.com/boostorg/boost.git .
local module_url = arg[1] or 'https://github.com/boostorg/boost.git'
local module = arg[2] or module_url:match('.+/([_%d%a]+)%.git')
local branch = arg[3] or 'master'
function execute(command)
print('# ' .. command)
return os.execute(command)
end
-- execute('rm -rf ' .. module)
if not execute('git clone --single-branch --branch master --depth=1 ' .. module_url .. ' ' .. module) then
io.stderr:write('can\'t clone repository from ' .. module_url .. ' to ' .. module .. '\n')
return 1
end
-- cd $module ; git submodule update --init --recursive --remote --no-fetch --depth=1
execute('mkdir -p ' .. module .. '/.git/modules')
assert(io.input(module .. '/.gitmodules'))
local lines = {}
for line in io.lines() do
table.insert(lines, line)
end
local submodule
local path
local submodule_url
for _, line in ipairs(lines) do
local submodule_ = line:match('^%[submodule %"([_%d%a]-)%"%]$')
if submodule_ then
submodule = submodule_
path = nil
submodule_url = nil
else
local path_ = line:match('^%s*path = (.+)$')
if path_ then
path = path_
else
submodule_url = line:match('^%s*url = (.+)$')
end
if submodule and path and submodule_url then
-- execute('rm -rf ' .. path)
local git_dir = module .. '/.git/modules/' .. path:match('^.-/(.+)$')
-- execute('rm -rf ' .. git_dir)
execute('mkdir -p $(dirname "' .. git_dir .. '")')
if not execute('git clone --depth=1 --single-branch --branch=' .. branch .. ' --separate-git-dir ' .. git_dir .. ' ' .. module_url .. '/' .. submodule_url .. ' ' .. module .. '/' .. path) then
io.stderr:write('can\'t clone submodule ' .. submodule .. '\n')
return 1
end
path = nil
submodule_url = nil
end
end
end
Why don't you try to grep the return of your command ? Something like :
adb devices -l | grep 123abc12
It should return only the line you want to.
Powershell Solution:
If you're running windows, you can use PowerShell to remove multiple branches at once...
git branch -D ((git branch | Select-String -Pattern '^\s*3\.2\..*') | foreach{$_.ToString().Trim()})
//this will remove all branches starting with 3.2.
git branch -D ((git branch | Select-String -Pattern 'feature-*') | foreach{$_.ToString().Trim()})
// this will delete all branches that contains the word "feature-" as a substring.
You can also fine tune how the pattern matching should work using Powershell's Select-String command. Take a look at powershell docs.
Well, you'll need to loop over them one way or the other. I prefer defining a method like this:
public IEnumerable<DateTime> EachDay(DateTime from, DateTime thru)
{
for(var day = from.Date; day.Date <= thru.Date; day = day.AddDays(1))
yield return day;
}
Then you can use it like this:
foreach (DateTime day in EachDay(StartDate, EndDate))
// print it or whatever
In this manner you could hit every other day, every third day, only weekdays, etc. For example, to return every third day starting with the "start" date, you could just call AddDays(3)
in the loop instead of AddDays(1)
.
I expect xxcopy has an option for that.
Bingo:
http://www.xxcopy.com/xxcopy27.htm#tag_231
2.3 By comparison with the file in destination
The switches in this group select files based on the
comparison between the files in the source and those in
the destination. They are often used for periodic backup
and directory synchronization purposes. These switches
were originally created as variations of directory backup.
They are also convenient for selecting files for deletion.
2.3.1 by Presence/Absence
The /BB and /U switches are the two switches which select
files by the pure presence or absence as the criteria.
Other switches in the this group (Group 2.3) are also
affected by the file in the destination, but for a
particular characteristics for comparison's sake.
/BB Selects files that are present in source but not in destination.
/U Selects files that are present in both source and destination.
-Adam
Use overflow-y:auto
for displaying scroll automatically when the content exceeds the divs set height.
Here's another way to think about it. Suppose there were a name()
function that returned the name of its argument. Given the following code:
def f(a):
return a
b = "x"
c = b
d = f(c)
e = [f(b), f(c), f(d)]
What should name(e[2])
return, and why?
Summarising @Rasmi Ranjan Nayak and @nogard answers and adding another option:
You should use the flag --gtest_filter
, like
--gtest_filter=Test_Cases1*
(You can also do this in Properties|Configuration Properties|Debugging|Command Arguments)
You should set the variable GTEST_FILTER
like
export GTEST_FILTER = "Test_Cases1*"
You should set a flag filter
, like
::testing::GTEST_FLAG(filter) = "Test_Cases1*";
such that your main function becomes something like
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
::testing::GTEST_FLAG(filter) = "Test_Cases1*";
return RUN_ALL_TESTS();
}
See section Running a Subset of the Tests for more info on the syntax of the string you can use.
Declare it as a decimal
which uses the int
variable and divide this by 100
int number = 700
decimal correctNumber = (decimal)number / 100;
Edit: Bala was faster with his reaction
Edit: New article by Dave Abrahams on cpp-next:
Pass by value for structs where the copying is cheap has the additional advantage that the compiler may assume that the objects don't alias (are not the same objects). Using pass-by-reference the compiler cannot assume that always. Simple example:
foo * f;
void bar(foo g) {
g.i = 10;
f->i = 2;
g.i += 5;
}
the compiler can optimize it into
g.i = 15;
f->i = 2;
since it knows that f and g doesn't share the same location. if g was a reference (foo &), the compiler couldn't have assumed that. since g.i could then be aliased by f->i and have to have a value of 7. so the compiler would have to re-fetch the new value of g.i from memory.
For more pratical rules, here is a good set of rules found in Move Constructors article (highly recommended reading).
"Primitive" above means basically small data types that are a few bytes long and aren't polymorphic (iterators, function objects, etc...) or expensive to copy. In that paper, there is one other rule. The idea is that sometimes one wants to make a copy (in case the argument can't be modified), and sometimes one doesn't want (in case one wants to use the argument itself in the function if the argument was a temporary anyway, for example). The paper explains in detail how that can be done. In C++1x that technique can be used natively with language support. Until then, i would go with the above rules.
Examples: To make a string uppercase and return the uppercase version, one should always pass by value: One has to take a copy of it anyway (one couldn't change the const reference directly) - so better make it as transparent as possible to the caller and make that copy early so that the caller can optimize as much as possible - as detailed in that paper:
my::string uppercase(my::string s) { /* change s and return it */ }
However, if you don't need to change the parameter anyway, take it by reference to const:
bool all_uppercase(my::string const& s) {
/* check to see whether any character is uppercase */
}
However, if you the purpose of the parameter is to write something into the argument, then pass it by non-const reference
bool try_parse(T text, my::string &out) {
/* try to parse, write result into out */
}
Do aman 2 sendfile
. You only need to open the source file on the client and destination file on the server, then call sendfile and the kernel will chop and move the data.
/*$mpdf = new mPDF('', // mode - default ''
'', // format - A4, for example, default ''
0, // font size - default 0
'', // default font family
15, // margin_left
15, // margin right
16, // margin top
16, // margin bottom
9, // margin header
9, // margin footer
'L'); // L - landscape, P - portrait*/
I found this code on Microsoft forum. This is so far one of easiest way, easy to understand and use. This has saved me hours , I have customized it as extension method without any change to actual method. Below is the code. it doesn't require much explanation.
You can use two function signature with same implementation
1) public static DataSet ToDataSetFromObject(this object dsCollection)
2) public static DataSet ToDataSetFromArrayOfObject( this object[] arrCollection) . I 'll be using this one for example.
// <summary>
// Serialize Object to XML and then read it into a DataSet:
// </summary>
// <param name="arrCollection">Array of object</param>
// <returns>dataset</returns>
public static DataSet ToDataSetFromArrayOfObject( this object[] arrCollection)
{
DataSet ds = new DataSet();
try {
XmlSerializer serializer = new XmlSerializer(arrCollection.GetType);
System.IO.StringWriter sw = new System.IO.StringWriter();
serializer.Serialize(sw, dsCollection);
System.IO.StringReader reader = new System.IO.StringReader(sw.ToString());
ds.ReadXml(reader);
} catch (Exception ex) {
throw (new Exception("Error While Converting Array of Object to Dataset."));
}
return ds;
}
To use this extension in code
Country[] objArrayCountry = null;
objArrayCountry = ....;// populate your array
if ((objArrayCountry != null)) {
dataset = objArrayCountry.ToDataSetFromArrayOfObject();
}
You could just use another non-regex based method. Someone gave the suggestion of using Substring, but you could also use Split:
string testString = "my-string";
string[] splitString = testString.Split("-");
string resultingString = splitString[0]; //my
See http://msdn.microsoft.com/en-US/library/ms228388%28v=VS.80%29.aspx for another good example.
best answer written by Dmitri Korotkevitch:
Speaking of the installation, SQL Server 2008 allows you to set authentication mode (Windows or SQL Server) during the installation process. You will be forced to choose the strong password for sa user in the case if you choose sql server authentication mode during setup.
If you install SQL Server with Windows Authentication mode and want to change it, you need to do 2 different things:
Go to SQL Server Properties/Security tab and change the mode to SQL Server authentication mode
Go to security/logins, open SA login properties
a. Uncheck "Enforce password policy" and "Enforce password expiration" check box there if you decide to use weak password
b. Assign password to SA user
c. Open "Status" tab and enable login.
I don't need to mention that every action from above would violate security best practices that recommend to use windows authentication mode, have sa login disabled and use strong passwords especially for sa login.
You are not returning a response object from your view my_form_post
. The function ends with implicit return None
, which Flask does not like.
Make the function my_form_post
return an explicit response, for example
return 'OK'
at the end of the function.
example of string subtraction on date
and time
to get file named "YYYY-MM-DD HH:MM:SS.txt"
echo test > "%date:~0,4%-%date:~5,2%-%date:~8,2% %time:~0,2%_%time:~3,2%_%time:~6,2%.txt"
I use color
to indicate if my script end up successfully, failed, or need some input by changing color of text and background. It really helps when you have some machine in reach of your view but quite far away
color XY
where X and Y is hex value from 0
to F
, where X - background, Y - text, when X = Y color will not change.
color Z
changes text color to 'Z' and sets black background, 'color 0' won't work
for names of colors call
color ?
Bitmap bmp = new Bitmap("filename.bmp");
RectangleF rectf = new RectangleF(70, 90, 90, 50);
Graphics g = Graphics.FromImage(bmp);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.DrawString("yourText", new Font("Tahoma",8), Brushes.Black, rectf);
g.Flush();
image.Image=bmp;
Source link: http://www.codeblocq.com/2016/01/Untrack-files-already-added-to-git-repository-based-on-gitignore/
Let’s say you have already added/committed some files to your git repository and you then add them to your .gitignore; these files will still be present in your repository index. This article we will see how to get rid of them.
Before proceeding, make sure all your changes are committed, including your .gitignore file.
To clear your repo, use:
git rm -r --cached .
The rm
command can be unforgiving. If you wish to try what it does beforehand, add the -n
or --dry-run
flag to test things out.
git add .
git commit -m ".gitignore fix"
Your repository is clean :)
Push the changes to your remote to see the changes effective there as well.
extension Date {
func isBetween(_ date1: Date, and date2: Date) -> Bool {
return (min(date1, date2) ... max(date1, date2)).contains(self)
}
}
let resultArray = dateArray.filter { $0.dateObj!.isBetween(startDate, and: endDate) }
No code? For shame!
Here is a simple JavaScript address parser. It's pretty awful for every single reason that Matt gives in his dissertation above (which I almost 100% agree with: addresses are complex types, and humans make mistakes; better to outsource and automate this - when you can afford to).
But rather than cry, I decided to try:
This code works OK for parsing most Esri results for findAddressCandidate
and also with some other (reverse)geocoders that return single-line address where street/city/state are delimited by commas. You can extend if you want or write country-specific parsers. Or just use this as case study of how challenging this exercise can be or at how lousy I am at JavaScript. I admit I only spent about thirty mins on this (future iterations could add caches, zip validation, and state lookups as well as user location context), but it worked for my use case: End user sees form that parses geocode search response into 4 textboxes. If address parsing comes out wrong (which is rare unless source data was poor) it's no big deal - the user gets to verify and fix it! (But for automated solutions could either discard/ignore or flag as error so dev can either support the new format or fix source data.)
/* _x000D_
address assumptions:_x000D_
- US addresses only (probably want separate parser for different countries)_x000D_
- No country code expected._x000D_
- if last token is a number it is probably a postal code_x000D_
-- 5 digit number means more likely_x000D_
- if last token is a hyphenated string it might be a postal code_x000D_
-- if both sides are numeric, and in form #####-#### it is more likely_x000D_
- if city is supplied, state will also be supplied (city names not unique)_x000D_
- zip/postal code may be omitted even if has city & state_x000D_
- state may be two-char code or may be full state name._x000D_
- commas: _x000D_
-- last comma is usually city/state separator_x000D_
-- second-to-last comma is possibly street/city separator_x000D_
-- other commas are building-specific stuff that I don't care about right now._x000D_
- token count:_x000D_
-- because units, street names, and city names may contain spaces token count highly variable._x000D_
-- simplest address has at least two tokens: 714 OAK_x000D_
-- common simple address has at least four tokens: 714 S OAK ST_x000D_
-- common full (mailing) address has at least 5-7:_x000D_
--- 714 OAK, RUMTOWN, VA 59201_x000D_
--- 714 S OAK ST, RUMTOWN, VA 59201_x000D_
-- complex address may have a dozen or more:_x000D_
--- MAGICICIAN SUPPLY, LLC, UNIT 213A, MAGIC TOWN MALL, 13 MAGIC CIRCLE DRIVE, LAND OF MAGIC, MA 73122-3412_x000D_
*/_x000D_
_x000D_
var rawtext = $("textarea").val();_x000D_
var rawlist = rawtext.split("\n");_x000D_
_x000D_
function ParseAddressEsri(singleLineaddressString) {_x000D_
var address = {_x000D_
street: "",_x000D_
city: "",_x000D_
state: "",_x000D_
postalCode: ""_x000D_
};_x000D_
_x000D_
// tokenize by space (retain commas in tokens)_x000D_
var tokens = singleLineaddressString.split(/[\s]+/);_x000D_
var tokenCount = tokens.length;_x000D_
var lastToken = tokens.pop();_x000D_
if (_x000D_
// if numeric assume postal code (ignore length, for now)_x000D_
!isNaN(lastToken) ||_x000D_
// if hyphenated assume long zip code, ignore whether numeric, for now_x000D_
lastToken.split("-").length - 1 === 1) {_x000D_
address.postalCode = lastToken;_x000D_
lastToken = tokens.pop();_x000D_
}_x000D_
_x000D_
if (lastToken && isNaN(lastToken)) {_x000D_
if (address.postalCode.length && lastToken.length === 2) {_x000D_
// assume state/province code ONLY if had postal code_x000D_
// otherwise it could be a simple address like "714 S OAK ST"_x000D_
// where "ST" for "street" looks like two-letter state code_x000D_
// possibly this could be resolved with registry of known state codes, but meh. (and may collide anyway)_x000D_
address.state = lastToken;_x000D_
lastToken = tokens.pop();_x000D_
}_x000D_
if (address.state.length === 0) {_x000D_
// check for special case: might have State name instead of State Code._x000D_
var stateNameParts = [lastToken.endsWith(",") ? lastToken.substring(0, lastToken.length - 1) : lastToken];_x000D_
_x000D_
// check remaining tokens from right-to-left for the first comma_x000D_
while (2 + 2 != 5) {_x000D_
lastToken = tokens.pop();_x000D_
if (!lastToken) break;_x000D_
else if (lastToken.endsWith(",")) {_x000D_
// found separator, ignore stuff on left side_x000D_
tokens.push(lastToken); // put it back_x000D_
break;_x000D_
} else {_x000D_
stateNameParts.unshift(lastToken);_x000D_
}_x000D_
}_x000D_
address.state = stateNameParts.join(' ');_x000D_
lastToken = tokens.pop();_x000D_
}_x000D_
}_x000D_
_x000D_
if (lastToken) {_x000D_
// here is where it gets trickier:_x000D_
if (address.state.length) {_x000D_
// if there is a state, then assume there is also a city and street._x000D_
// PROBLEM: city may be multiple words (spaces)_x000D_
// but we can pretty safely assume next-from-last token is at least PART of the city name_x000D_
// most cities are single-name. It would be very helpful if we knew more context, like_x000D_
// the name of the city user is in. But ignore that for now._x000D_
// ideally would have zip code service or lookup to give city name for the zip code._x000D_
var cityNameParts = [lastToken.endsWith(",") ? lastToken.substring(0, lastToken.length - 1) : lastToken];_x000D_
_x000D_
// assumption / RULE: street and city must have comma delimiter_x000D_
// addresses that do not follow this rule will be wrong only if city has space_x000D_
// but don't care because Esri formats put comma before City_x000D_
var streetNameParts = [];_x000D_
_x000D_
// check remaining tokens from right-to-left for the first comma_x000D_
while (2 + 2 != 5) {_x000D_
lastToken = tokens.pop();_x000D_
if (!lastToken) break;_x000D_
else if (lastToken.endsWith(",")) {_x000D_
// found end of street address (may include building, etc. - don't care right now)_x000D_
// add token back to end, but remove trailing comma (it did its job)_x000D_
tokens.push(lastToken.endsWith(",") ? lastToken.substring(0, lastToken.length - 1) : lastToken);_x000D_
streetNameParts = tokens;_x000D_
break;_x000D_
} else {_x000D_
cityNameParts.unshift(lastToken);_x000D_
}_x000D_
}_x000D_
address.city = cityNameParts.join(' ');_x000D_
address.street = streetNameParts.join(' ');_x000D_
} else {_x000D_
// if there is NO state, then assume there is NO city also, just street! (easy)_x000D_
// reasoning: city names are not very original (Portland, OR and Portland, ME) so if user wants city they need to store state also (but if you are only ever in Portlan, OR, you don't care about city/state)_x000D_
// put last token back in list, then rejoin on space_x000D_
tokens.push(lastToken);_x000D_
address.street = tokens.join(' ');_x000D_
}_x000D_
}_x000D_
// when parsing right-to-left hard to know if street only vs street + city/state_x000D_
// hack fix for now is to shift stuff around._x000D_
// assumption/requirement: will always have at least street part; you will never just get "city, state" _x000D_
// could possibly tweak this with options or more intelligent parsing&sniffing_x000D_
if (!address.city && address.state) {_x000D_
address.city = address.state;_x000D_
address.state = '';_x000D_
}_x000D_
if (!address.street) {_x000D_
address.street = address.city;_x000D_
address.city = '';_x000D_
}_x000D_
_x000D_
return address;_x000D_
}_x000D_
_x000D_
// get list of objects with discrete address properties_x000D_
var addresses = rawlist_x000D_
.filter(function(o) {_x000D_
return o.length > 0_x000D_
})_x000D_
.map(ParseAddressEsri);_x000D_
$("#output").text(JSON.stringify(addresses));_x000D_
console.log(addresses);
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
<textarea>_x000D_
27488 Stanford Ave, Bowden, North Dakota_x000D_
380 New York St, Redlands, CA 92373_x000D_
13212 E SPRAGUE AVE, FAIR VALLEY, MD 99201_x000D_
1005 N Gravenstein Highway, Sebastopol CA 95472_x000D_
A. P. Croll & Son 2299 Lewes-Georgetown Hwy, Georgetown, DE 19947_x000D_
11522 Shawnee Road, Greenwood, DE 19950_x000D_
144 Kings Highway, S.W. Dover, DE 19901_x000D_
Intergrated Const. Services 2 Penns Way Suite 405, New Castle, DE 19720_x000D_
Humes Realty 33 Bridle Ridge Court, Lewes, DE 19958_x000D_
Nichols Excavation 2742 Pulaski Hwy, Newark, DE 19711_x000D_
2284 Bryn Zion Road, Smyrna, DE 19904_x000D_
VEI Dover Crossroads, LLC 1500 Serpentine Road, Suite 100 Baltimore MD 21_x000D_
580 North Dupont Highway, Dover, DE 19901_x000D_
P.O. Box 778, Dover, DE 19903_x000D_
714 S OAK ST_x000D_
714 S OAK ST, RUM TOWN, VA, 99201_x000D_
3142 E SPRAGUE AVE, WHISKEY VALLEY, WA 99281_x000D_
27488 Stanford Ave, Bowden, North Dakota_x000D_
380 New York St, Redlands, CA 92373_x000D_
</textarea>_x000D_
<div id="output">_x000D_
</div>
_x000D_
Just few more details:
`image` blob
$image = addslashes(file_get_contents($_FILES['image']['tmp_name']));
$sql = "INSERT INTO `product_images` (`id`, `image`) VALUES ('1', '{$image}')";
<img src="data:image/png;base64,'.base64_encode($row['image']).'">
If you dont define name in the path field, usually the error will come.
e.g.: path('crud/',ABC.as_view(),name="crud")
I came across the same problem, and found that easier way is to undock the developer tool's video to a separate window! (Using the right hand top corner toolbar button of developer tools window) and in the new window , simply say select all and copy and paste to excel!!
I know that i am late but i would like to post a solution here:
Check the full source code here.
This is the code i used when changing theme using preferences..
SharedPreferences pref = PreferenceManager
.getDefaultSharedPreferences(this);
String themeName = pref.getString("prefSyncFrequency3", "Theme1");
if (themeName.equals("Africa")) {
setTheme(R.style.AppTheme);
} else if (themeName.equals("Colorful Beach")) {
//Toast.makeText(this, "set theme", Toast.LENGTH_SHORT).show();
setTheme(R.style.beach);
} else if (themeName.equals("Abstract")) {
//Toast.makeText(this, "set theme", Toast.LENGTH_SHORT).show();
setTheme(R.style.abstract2);
} else if (themeName.equals("Default")) {
setTheme(R.style.defaulttheme);
}
Please note that you have to put the code before setcontentview..
HAPPY CODING!
Multiple attributes can be connected with an and
:
GroupMember.find_or_create_by_member_id_and_group_id(4, 7)
(use find_or_initialize_by
if you don't want to save the record right away)
Edit: The above method is deprecated in Rails 4. The new way to do it will be:
GroupMember.where(:member_id => 4, :group_id => 7).first_or_create
and
GroupMember.where(:member_id => 4, :group_id => 7).first_or_initialize
Edit 2: Not all of these were factored out of rails just the attribute specific ones.
https://github.com/rails/rails/blob/4-2-stable/guides/source/active_record_querying.md
Example
GroupMember.find_or_create_by_member_id_and_group_id(4, 7)
became
GroupMember.find_or_create_by(member_id: 4, group_id: 7)
JSON.stringify
takes more optional arguments.
Try:
JSON.stringify({a:1,b:2,c:{d:1,e:[1,2]}}, null, 4); // Indented 4 spaces
JSON.stringify({a:1,b:2,c:{d:1,e:[1,2]}}, null, "\t"); // Indented with tab
From:
How can I beautify JSON programmatically?
Should work in modern browsers, and it is included in json2.js if you need a fallback for browsers that don't support the JSON helper functions. For display purposes, put the output in a <pre>
tag to get newlines to show.
eventcreate2 allows you to create custom logs, where eventcreate does not.
Short answer
pip install -r /path/to/requirements.txt
or in another form:
python -m pip install -r /path/to/requirements.txt
Explanation
Here, -r
is short form of --requirement
and it asks the pip
to install from the given requirements
file.
pip
will start installation only after checking the availability of all listed items in the requirements
file and it won't start installation even if one requirement
is unavailable.
One workaround to install the available packages is installing listed packages one by one. Use the following command for that. A red color warning will be shown to notify you about the unavailable packages.
cat requirements.txt | xargs -n 1 pip install
To ignore comments (lines starting with a #
) and blank lines, use:
cat requirements.txt | cut -f1 -d"#" | sed '/^\s*$/d' | xargs -n 1 pip install
If you mean File.separator
and File.pathSeparator
then:
File.pathSeparator
is used to separate individual file paths in a list of file paths. Consider on windows, the PATH environment variable. You use a ;
to separate the file paths so on Windows File.pathSeparator
would be ;
.
File.separator
is either /
or \
that is used to split up the path to a specific file. For example on Windows it is \
or C:\Documents\Test
you can suppress this error in eclipse: Window -> Preferences -> Maven -> Error/Warnings
Web container also known as a Servlet container is the component of a web server that interacts with Java servlets. A web container is responsible for managing the lifecycle of servlets, mapping a URL to a particular servlet and ensuring that the URL requester has the correct access rights.
Taking up @ZF007's answer, this is not answering your question as a whole, but can be the solution for the same error. I post it here since I have not found a direct solution as an answer to this error message elsewhere on Stack Overflow.
The error appears when you check whether an array was empty or not.
if np.array([1,2]): print(1)
--> ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
.
if np.array([1,2])[0]: print(1)
--> no ValueError, but: if np.array([])[0]: print(1)
--> IndexError: index 0 is out of bounds for axis 0 with size 0
.
if np.array([1]): print(1)
--> no ValueError, but again will not help at an array with many elements.
if np.array([]): print(1)
--> DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use 'array.size > 0' to check that an array is not empty.
Doing so:
if np.array([]).size: print(1)
solved the error.To prevent form submit when pressing enter in a textarea
or input
field, check the submit event to find what type of element sent the event.
<button type="submit" form="my-form">Submit</button>
<form id="my-form">
...
</form>
$(document).on('submit', 'form', function(e) {
if (e.delegateTarget.activeElement.type!=="submit") {
e.preventDefault();
}
});
A better solution is if you don't have a submit button and you fire the event with a normal button. It is better because in the first examlple 2 submit events are fired, but in the second example only 1 submit event is fired.
<button type="button" onclick="$('#my-form').submit();">Submit</button>
<form id="my-form">
...
</form>
$(document).on('submit', 'form', function(e) {
if (e.delegateTarget.activeElement.localName!=="button") {
e.preventDefault();
}
});
public static List<SelectListItem> States = new List<SelectListItem>()
{
new SelectListItem() {Text="Alabama", Value="AL"},
new SelectListItem() { Text="Alaska", Value="AK"},
new SelectListItem() { Text="Arizona", Value="AZ"},
new SelectListItem() { Text="Arkansas", Value="AR"},
new SelectListItem() { Text="California", Value="CA"},
new SelectListItem() { Text="Colorado", Value="CO"},
new SelectListItem() { Text="Connecticut", Value="CT"},
new SelectListItem() { Text="District of Columbia", Value="DC"},
new SelectListItem() { Text="Delaware", Value="DE"},
new SelectListItem() { Text="Florida", Value="FL"},
new SelectListItem() { Text="Georgia", Value="GA"},
new SelectListItem() { Text="Hawaii", Value="HI"},
new SelectListItem() { Text="Idaho", Value="ID"},
new SelectListItem() { Text="Illinois", Value="IL"},
new SelectListItem() { Text="Indiana", Value="IN"},
new SelectListItem() { Text="Iowa", Value="IA"},
new SelectListItem() { Text="Kansas", Value="KS"},
new SelectListItem() { Text="Kentucky", Value="KY"},
new SelectListItem() { Text="Louisiana", Value="LA"},
new SelectListItem() { Text="Maine", Value="ME"},
new SelectListItem() { Text="Maryland", Value="MD"},
new SelectListItem() { Text="Massachusetts", Value="MA"},
new SelectListItem() { Text="Michigan", Value="MI"},
new SelectListItem() { Text="Minnesota", Value="MN"},
new SelectListItem() { Text="Mississippi", Value="MS"},
new SelectListItem() { Text="Missouri", Value="MO"},
new SelectListItem() { Text="Montana", Value="MT"},
new SelectListItem() { Text="Nebraska", Value="NE"},
new SelectListItem() { Text="Nevada", Value="NV"},
new SelectListItem() { Text="New Hampshire", Value="NH"},
new SelectListItem() { Text="New Jersey", Value="NJ"},
new SelectListItem() { Text="New Mexico", Value="NM"},
new SelectListItem() { Text="New York", Value="NY"},
new SelectListItem() { Text="North Carolina", Value="NC"},
new SelectListItem() { Text="North Dakota", Value="ND"},
new SelectListItem() { Text="Ohio", Value="OH"},
new SelectListItem() { Text="Oklahoma", Value="OK"},
new SelectListItem() { Text="Oregon", Value="OR"},
new SelectListItem() { Text="Pennsylvania", Value="PA"},
new SelectListItem() { Text="Rhode Island", Value="RI"},
new SelectListItem() { Text="South Carolina", Value="SC"},
new SelectListItem() { Text="South Dakota", Value="SD"},
new SelectListItem() { Text="Tennessee", Value="TN"},
new SelectListItem() { Text="Texas", Value="TX"},
new SelectListItem() { Text="Utah", Value="UT"},
new SelectListItem() { Text="Vermont", Value="VT"},
new SelectListItem() { Text="Virginia", Value="VA"},
new SelectListItem() { Text="Washington", Value="WA"},
new SelectListItem() { Text="West Virginia", Value="WV"},
new SelectListItem() { Text="Wisconsin", Value="WI"},
new SelectListItem() { Text="Wyoming", Value="WY"}
};
How we do it is put this method into a class and then call the class from the view
@Html.DropDownListFor(x => x.State, Class.States)
On a first hand, a web server serves web content (HTML and static content) over the HTTP protocol. On the other hand, an application server is a container upon which you can build and expose business logic and processes to client applications through various protocols including HTTP in a n-tier architecture.
An application server thus offers much more services than an web server which typically include:
AFAIK, ATG Dynamo was one of the very first application server in late 90's (according to the definition above). In early 2000, it was the reign of some proprietary application servers like ColdFusion (CFML AS), BroadVision (Server-side JavaScript AS), etc. But none really survived the Java application server era.
% mysql --user=root mysql
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' WITH GRANT OPTION;
CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%' WITH GRANT OPTION;
CREATE USER 'admin'@'localhost';
GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
CREATE USER 'dummy'@'localhost';
FLUSH PRIVILEGES;
Maybe this answer is not quite what you're looking for, but it will fomat any language with the same keyboard shortcut. The solution are language specific keyboard shortcuts.
For every language you want to format, you must find and download a plugin for that, for example a html formatter and a C# formatter. And then you map the command for every plugin to the same key, but with a differnt context (see the link).
Greets
If you are using sublime then this code may work if you add it in build as code for building system. You can use this link for more information.
{
"shell_cmd": "g++ \"${file}\" -std=c++1y -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "g++ \"${file}\" -std=c++1y -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
]
}
In Java as other suggest
listitem.setClickable(false);
Or in xml:
android:clickable="false"
It works very fine
There is also this way of specifying the viewmodel:
using Wpf = System.Windows;
public partial class App : Wpf.Application //your skeleton app already has this.
{
protected override void OnStartup( Wpf.StartupEventArgs e ) //you need to add this.
{
base.OnStartup( e );
MainWindow = new MainView();
MainWindow.DataContext = new MainViewModel( e.Args );
MainWindow.Show();
}
}
<Rant>
All of the solutions previously proposed require that MainViewModel
must have a parameterless constructor.
Microsoft is under the impression that systems can be built using parameterless constructors. If you are also under that impression, go ahead and use some of the other solutions.
For those that know that constructors must have parameters, and therefore the instantiation of objects cannot be left in the hands of magic frameworks, the proper way of specifying the viewmodel is the one I showed above.
</Rant>
In my case, update the pip versión after create the venv, this update pip from 9.0.1 to 20.3.1
python3 -m venv env/python
source env/python/bin/activate
pip3 install pip --upgrade
But, the message was...
Using legacy 'setup.py install' for django-avatar, since package 'wheel' is not installed.
Then, I install wheel package after update pip
python3 -m venv env/python
source env/python/bin/activate
pip3 install --upgrade pip
pip3 install wheel
And the message was...
Building wheel for django-avatar (setup.py): started
default: Building wheel for django-avatar (setup.py): finished with status 'done'
The particular format for strptime
:
datetime.datetime.strptime(string_date, "%Y-%m-%d %H:%M:%S.%f")
#>>> datetime.datetime(2013, 9, 28, 20, 30, 55, 782000)
You can define multiple routes with and without parameter:
@RouteConfig([
{ path: '/user/:id', component: User, name: 'User' },
{ path: '/user', component: User, name: 'Usernew' }
])
and handle the optional parameter in your component:
constructor(params: RouteParams) {
var paramId = params.get("id");
if (paramId) {
...
}
}
See also the related github issue: https://github.com/angular/angular/issues/3525
As stated above, the checked state of the object should be included within object properties. In some cases you may need also to change the object selection state by clicking on the object itself and let the CheckBox inform about the actual state (either selected or unselected). The checkbox will then use the state of the object at the actual position of the given adapter which is (by default/in most cases) the position of the element in the list.
Check the snippet below, it may be useful.
import android.content.Context;_x000D_
import android.graphics.Bitmap;_x000D_
import android.net.Uri;_x000D_
import android.provider.MediaStore;_x000D_
import android.support.v7.widget.RecyclerView;_x000D_
import android.view.LayoutInflater;_x000D_
import android.view.View;_x000D_
import android.view.ViewGroup;_x000D_
import android.widget.CheckBox;_x000D_
import android.widget.CompoundButton;_x000D_
import android.widget.ImageView;_x000D_
_x000D_
import java.io.File;_x000D_
import java.io.IOException;_x000D_
import java.util.List;_x000D_
_x000D_
public class TakePicImageAdapter extends RecyclerView.Adapter<TakePicImageAdapter.ViewHolder>{_x000D_
private Context context;_x000D_
private List<Image> imageList;_x000D_
_x000D_
public TakePicImageAdapter(Context context, List<Image> imageList) {_x000D_
this.context = context;_x000D_
this.imageList = imageList;_x000D_
}_x000D_
_x000D_
@Override_x000D_
public TakePicImageAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {_x000D_
View view= LayoutInflater.from(context).inflate(R.layout.image_item,parent,false);_x000D_
return new ViewHolder(view);_x000D_
}_x000D_
_x000D_
@Override_x000D_
public void onBindViewHolder(final TakePicImageAdapter.ViewHolder holder, final int position) {_x000D_
File file=new File(imageList.get(position).getPath());_x000D_
try {_x000D_
Bitmap bitmap= MediaStore.Images.Media.getBitmap(context.getContentResolver(), Uri.fromFile(file));_x000D_
holder.image.setImageBitmap(bitmap_x000D_
);_x000D_
} catch (IOException e) {_x000D_
e.printStackTrace();_x000D_
}_x000D_
holder.selectImage.setOnCheckedChangeListener(null);_x000D_
holder.selectImage.setChecked(imageList.get(position).isSelected());_x000D_
holder.selectImage.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {_x000D_
@Override_x000D_
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {_x000D_
holder.selectImage.setChecked(isChecked);_x000D_
imageList.get(position).setSelected(isChecked);_x000D_
}_x000D_
});_x000D_
holder.image.setOnClickListener(new View.OnClickListener() {_x000D_
@Override_x000D_
public void onClick(View v) {_x000D_
if (imageList.get(position).isSelected())_x000D_
{_x000D_
imageList.get(position).setSelected(false);_x000D_
holder.selectImage.setChecked(false);_x000D_
}else_x000D_
{_x000D_
imageList.get(position).setSelected(true);_x000D_
holder.selectImage.setChecked(true);_x000D_
}_x000D_
}_x000D_
});_x000D_
_x000D_
}_x000D_
_x000D_
@Override_x000D_
public int getItemCount() {_x000D_
return imageList.size();_x000D_
}_x000D_
_x000D_
public class ViewHolder extends RecyclerView.ViewHolder {_x000D_
public ImageView image;public CheckBox selectImage;_x000D_
public ViewHolder(View itemView) {_x000D_
super(itemView);_x000D_
image=(ImageView)itemView.findViewById(R.id.image);_x000D_
selectImage=(CheckBox) itemView.findViewById(R.id.ch);_x000D_
_x000D_
}_x000D_
}_x000D_
}
_x000D_
ng-class
is a Directive of core AngularJs. In which you can use "String Syntax", "Array Syntax", "Evaluated Expression", " Ternary Operator" and many more options described below:
This is the simplest way to use ngClass. You can just add an Angular variable to ng-class and that is the class that will be used for that element.
<!-- whatever is typed into this input will be used as the class for the div below -->
<input type="text" ng-model="textType">
<!-- the class will be whatever is typed into the input box above -->
<div ng-class="textType">Look! I'm Words!
Demo Example of ngClass Using String Syntax
This is similar to the string syntax method except you are able to apply multiple classes.
<!-- both input boxes below will be classes for the div -->
<input type="text" ng-model="styleOne">
<input type="text" ng-model="styleTwo">
<!-- this div will take on both classes from above -->
<div ng-class="[styleOne, styleTwo]">Look! I'm Words!
A more advanced method of using ngClass (and one that you will probably use the most) is to evaluate an expression. The way this works is that if a variable or expression evaluates to true
, you can apply a certain class. If not, then the class won't be applied.
<!-- input box to toggle a variable to true or false -->
<input type="checkbox" ng-model="awesome"> Are You Awesome?
<input type="checkbox" ng-model="giant"> Are You a Giant?
<!-- add the class 'text-success' if the variable 'awesome' is true -->
<div ng-class="{ 'text-success': awesome, 'text-large': giant }">
Example of ngClass Using Evaluated Expression
This is similar to the evaluated expression method except you just able to compares multiple values with the only variable.
<div ng-class="{value1:'class1', value2:'class2'}[condition]"></div>
The ternary operator allows us to use shorthand to specify two different classes, one if an expression is true and one for false. Here is the basic syntax for the ternary operator:
ng-class="$variableToEvaluate ? 'class-if-true' : 'class-if-false'">
If you are using the ngRepeat
directive and you want to apply classes to the first
, last
, or a specific number in the list, you can use special properties of ngRepeat
. These include $first
, $last
, $even
, $odd
, and a few others. Here's an example of how to use these.
<!-- add a class to the first item -->
<ul>
<li ng-class="{ 'text-success': $first }" ng-repeat="item in items">{{ item.name }}</li>
</ul>
<!-- add a class to the last item -->
<ul>
<li ng-class="{ 'text-danger': $last }" ng-repeat="item in items">{{ item.name }}</li>
</ul>
<!-- add a class to the even items and a different class to the odd items -->
<ul>
<li ng-class="{ 'text-info': $even, 'text-danger': $odd }" ng-repeat="item in items">{{ item.name }}</li>
</ul>
When I use Junit4, import junit.framework.Assert; import junit.framework.TestCase; the warning info is :The type of Assert is deprecated
when import like this: import org.junit.Assert; import org.junit.Test; the warning has disappeared
possible duplicate of differences between 2 JUnit Assert classes
SELECT *
FROM table1, table2
This will join every row in table1 with table2 (the Cartesian product) returning all columns.
try this one out resizeable button
<button type="submit me" style="height: 25px; width: 100px">submit me</button>
Assuming you do as David Zaslavsky suggests, so that the first argument simply is the program to run (no option-parsing required), you're dealing with the question of how to pass arguments 2 and on to your external program. Here's a convenient way:
#!/bin/bash
ext_program="$1"
shift
"$ext_program" "$@"
The shift
will remove the first argument, renaming the rest ($2
becomes $1, and so on).
$@` refers to the arguments, as an array of words (it must be quoted!).
If you must have your --file
syntax (for example, if there's a default program to run, so the user doesn't necessarily have to supply one), just replace ext_program="$1"
with whatever parsing of $1
you need to do, perhaps using getopt or getopts.
If you want to roll your own, for just the one specific case, you could do something like this:
if [ "$#" -gt 0 -a "${1:0:6}" == "--file" ]; then
ext_program="${1:7}"
else
ext_program="default program"
fi
try this one :
$('html').keyup(function(e){if(e.keyCode == 8)alert('backspace trapped')})
I used a combination of the answers from rohancragg, Mukul Goel, and NullSoulException from above. However I had an additional error:
ORA-01157: cannot identify/lock data file string - see DBWR trace file
To which I found the answer here: http://nimishgarg.blogspot.com/2014/01/ora-01157-cannot-identifylock-data-file.html
Incase the above post gets deleted I am including the commands here as well.
C:\>sqlplus sys/sys as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 30 19:07:16 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 778387456 bytes
Fixed Size 1384856 bytes
Variable Size 520097384 bytes
Database Buffers 251658240 bytes
Redo Buffers 5246976 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 11 – see DBWR trace file
ORA-01110: data file 16: 'E:\oracle\app\nimish.garg\oradata\orcl\test_ts.dbf'
SQL> select NAME from v$datafile where file#=16;
NAME
--------------------------------------------------------------------------------
E:\ORACLE\APP\NIMISH.GARG\ORADATA\ORCL\TEST_TS.DBF
SQL> alter database datafile 16 OFFLINE DROP;
Database altered.
SQL> alter database open;
Database altered.
Thanks everyone you saved my day!
Fissh
Your file has syntax error, so your file was not interpreted, so settings was not changed and you have blank page.
You can separate your file to two.
index.php
<?php
ini_set("display_errors", "1");
error_reporting(E_ALL);
include 'error.php';
error.php
<?
echo('catch this -> ' ;. $thisdoesnotexist);
ctrl+shift+p
then type Flutter:launch emulator
or
run this command in your VS code terminal flutter emulators
then see the result if you have installed any emulator it will show you , then to run one of them use flutter emulators --launch your_emulator_id
in my case flutter emulators --launch Nexus 6 API 28
but if you havent installed any emulator you can install one with flutter emulators --create [--name xyz]
then run your project flutter run
inside the root directory of the project
As a complement of the answers above, here is a sum up about Redirections:
EDIT: This graphic is not entirely correct.
The first example does not use stdin at all, it's passing "hello" as an argument to the echo command.
The graphic also says 2>&1 has the same effect as &> however
ls Documents ABC > dirlist 2>&1
#does not give the same output as
ls Documents ABC > dirlist &>
This is because &> requires a file to redirect to, and 2>&1 is simply sending stderr into stdout
you can include @ in a 'scriptBlock' like this:
@(
echo don't echoed
hostname
)
echo echoed
and especially do not do that :)
for %%a in ("@") do %%~aecho %%~a
Same problem, different solution.
One line in the PHP file was printing out XML headers (which use the same begin/end tags as PHP). Looks like the code within these tags set the encoding, and was executed within PHP which resulted in the strange characters. Either way here's the solution:
# Original
$xml_string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
# fixed
$xml_string = "<" . "?xml version=\"1.0\" encoding=\"UTF-8\"?" . ">";
#!/bin/sh
sed '1,2d' "$0"|$(which groovy) /dev/stdin; exit;
println("hello");
I had the same problem
I fixed that by using two options
contentType: false
processData: false
Actually I Added these two command to my $.ajax({}) function
You want to do the check for undefined
first. If you do it the other way round, it will generate an error if the array is undefined.
if (array === undefined || array.length == 0) {
// array empty or does not exist
}
This answer is getting a fair amount of attention, so I'd like to point out that my original answer, more than anything else, addressed the wrong order of the conditions being evaluated in the question. In this sense, it fails to address several scenarios, such as null
values, other types of objects with a length
property, etc. It is also not very idiomatic JavaScript.
The foolproof approach
Taking some inspiration from the comments, below is what I currently consider to be the foolproof way to check whether an array is empty or does not exist. It also takes into account that the variable might not refer to an array, but to some other type of object with a length
property.
if (!Array.isArray(array) || !array.length) {
// array does not exist, is not an array, or is empty
// ? do not attempt to process array
}
To break it down:
Array.isArray()
, unsurprisingly, checks whether its argument is an array. This weeds out values like null
, undefined
and anything else that is not an array.
Note that this will also eliminate array-like objects, such as the arguments
object and DOM NodeList
objects. Depending on your situation, this might not be the behavior you're after.
The array.length
condition checks whether the variable's length
property evaluates to a truthy value. Because the previous condition already established that we are indeed dealing with an array, more strict comparisons like array.length != 0
or array.length !== 0
are not required here.
The pragmatic approach
In a lot of cases, the above might seem like overkill. Maybe you're using a higher order language like TypeScript that does most of the type-checking for you at compile-time, or you really don't care whether the object is actually an array, or just array-like.
In those cases, I tend to go for the following, more idiomatic JavaScript:
if (!array || !array.length) {
// array or array.length are falsy
// ? do not attempt to process array
}
Or, more frequently, its inverse:
if (array && array.length) {
// array and array.length are truthy
// ? probably OK to process array
}
With the introduction of the optional chaining operator (Elvis operator) in ECMAScript 2020, this can be shortened even further:
if (!array?.length) {
// array or array.length are falsy
// ? do not attempt to process array
}
Or the opposite:
if (array?.length) {
// array and array.length are truthy
// ? probably OK to process array
}
select distinct 'GRANT '||privilege||' ON '||OWNER||'.'||TABLE_NAME||' TO '||RP.GRANTEE
from DBA_ROLE_PRIVS RP join ROLE_TAB_PRIVS RTP
on (RP.GRANTED_ROLE = RTP.role)
where (OWNER in ('YOUR USER') --Change User Name
OR RP.GRANTEE in ('YOUR USER')) --Change User Name
and RP.GRANTEE not in ('SYS', 'SYSTEM')
;
cp dir1/* dir2
Or if you have directories inside dir1 that you'd want to copy as well
cp -r dir1/* dir2
Here you can do like this -
val data = df.groupBy("Hour").agg(first("Hour").as("_1"),first("Category").as("Category"),first("TotalValue").as("TotalValue")).drop("Hour")
data.withColumnRenamed("_1","Hour").show
the qplot() function in the ggplot2 package is very simple to use and provides an elegant solution that includes confidence bands. For instance,
qplot(x,y, geom='smooth', span =0.5)
produces
html
<input id="something" onkeyup="key_up(this)" type="text">
script
function key_up(e){
var enterKey = 13; //Key Code for Enter Key
if (e.which == enterKey){
//Do you work here
}
}
Next time, Please try providing some code.
Make sure, that all of your class methods (updateVelocity
, updatePosition
, ...) take at least one positional argument, which is canonically named self
and refers to the current instance of the class.
When you call particle.updateVelocity()
, the called method implicitly gets an argument: the instance, here particle
as first parameter.
This produces the error description and nice clean, indented stacktrace:
begin
# Some exception throwing code
rescue => e
puts "Error during processing: #{$!}"
puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
end
You could use
Material Design Library made for pretty alert dialogs, buttons, and other things like snack bars. Currently it's heavily developed.
Guide, code, example - https://github.com/navasmdc/MaterialDesignLibrary
Guide how to add library to Android Studio 1.0 - How do I import material design library to Android Studio?
.
Happy coding ;)
For those struggling through this using macOS, first install all the tools:
brew install tree findutils rename
Then when needed to rename, make an alias for GNU find (gfind) as find. Then run the code of @Michel Krelin:
alias find=gfind
find . -depth -name '* *' \
| while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done
My recommendation? Don't use jQuery at all. I had the same problem as you. I found that $('#my_input').val()
always return some weird result.
Try to use document.getElementById('my_input').valueAsNumber
instead of $("#my_input").val();
and then, use Number(your_value_retrieved)
to try to create a Number. If the value is NaN, you know certainly that that's not a number.
One thing to add is when you write a number on the input, the input will actually accept almost any character (I can write the euro sign, a dollar, and all of other special characters), so it is best to retrieve the value using .valueAsNumber
instead of using jQuery.
Oh, and BTW, that allows your users to add internationalization (i.e.: support commas instead of dots to create decimal numbers). Just let the Number()
object to create something for you and it will be decimal-safe, so to speak.
To achieve following result :
1, 2, 3, 4, NULL, NULL, NULL.
USE syntax, place -(minus sign)
before field name and use inverse order_type(Like: If you want order by ASC order then use DESC or if you want DESC order then use ASC)
SELECT * FROM tablename WHERE visible=1 ORDER BY -position DESC
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.
REST
RESTs sweet spot is when you are exposing a public API over the internet to handle CRUD operations on data. REST is focused on accessing named resources through a single consistent interface.
SOAP
SOAP brings it’s own protocol and focuses on exposing pieces of application logic (not data) as services. SOAP exposes operations. SOAP is focused on accessing named operations, each implement some business logic through different interfaces.
Though SOAP is commonly referred to as “web services” this is a misnomer. SOAP has very little if anything to do with the Web. REST provides true “Web services” based on URIs and HTTP.
Reference: http://spf13.com/post/soap-vs-rest
And finally: What they could be referring to is REST vs. RPC See this: http://encosia.com/rest-vs-rpc-in-asp-net-web-api-who-cares-it-does-both/
One is a function that prints to stdout. The other is an object that provides several member functions and overloads of operator<<
that print to stdout. There are many more differences that I could enumerate, but I'm not sure what you are after.
You should be using a Property:
Private _myValue As String
Public Property MyValue As String
Get
Return _myValue
End Get
Set(value As String)
_myValue = value
End Set
End Property
Then use it like so:
MyValue = "Hello"
Console.write(MyValue)
OutOfMemoryException (on 32-bit machines) is just as often about Fragmentation as actual hard limits on memory - you'll find lots about this, but here's my first google hit briefly discussing it: http://blogs.msdn.com/b/joshwil/archive/2005/08/10/450202.aspx. (@Anthony Pegram is referring to the same problem in his comment above).
That said, there is one other possibility that comes to mind for your code above: As you're using the "IEnumerable" constructor to the List, you may not giving the object any hints as to the size of the collection you're passing to the List constructor. If the object you are passing is is not a collection (does not implement the ICollection
interface), then behind-the-scenes the List implementation is going to need to grow several (or many) times, each time leaving behind a too-small array that needs to be garbage collected. The garbage collector probably won't get to those discarded arrays fast enough, and you'll get your error.
The simplest fix for this would be to use the List(int capacity)
constructor to tell the framework what backing array size to allocate (even if you're estimating and just guessing "50000" for example), and then use the AddRange(IEnumerable collection)
method to actually populate your list.
So, simplest "Fix" if I'm right: replace
List<Vehicle> vList = new List<Vehicle>(selectedVehicles);
with
List<Vehicle> vList = new List<Vehicle>(50000);
vList.AddRange(selectedVehicles);
All the other comments and answers still apply in terms of overall design decisions - but this might be a quick fix.
Note (as @Alex commented below), this is only an issue if selectedVehicles
is not an ICollection.
For same table,
UPDATE PHA_BILL_SEGMENT AS PHA,
(SELECT BILL_ID, COUNT(REGISTRATION_NUMBER) AS REG
FROM PHA_BILL_SEGMENT
GROUP BY REGISTRATION_NUMBER, BILL_DATE, BILL_AMOUNT
HAVING REG > 1) T
SET PHA.BILL_DATE = PHA.BILL_DATE + 2
WHERE PHA.BILL_ID = T.BILL_ID;
If the lines are all of a fixed length you can use the Seek method of a stream to move to the correct starting positiion.
If the lines are of a variable length your options are more limited.
If this is a file you will be only using once and then discarding, then you are best off reading it in and working with it in memeory.
If this is a file you will keeping and will be reading from more than writing to, you can create a custom index file that contains the starting positions of each line. Then use that index to get your Seek position. The process of creating the index file is resource intensive. Everytime you add a new line to the file you will need to update the index, so maintenance becomes a non-trivial issue.
For those wanting a more secure way to create a random byte array, yes the most secure way is:
byte[] bytes = new byte[20];
SecureRandom.getInstanceStrong().nextBytes(bytes);
BUT your threads might block if there is not enough randomness available on the machine, depending on your OS. The following solution will not block:
SecureRandom random = new SecureRandom();
byte[] bytes = new byte[20];
random.nextBytes(bytes);
This is because the first example uses /dev/random
and will block while waiting for more randomness (generated by a mouse/keyboard and other sources). The second example uses /dev/urandom
which will not block.
Beautiful solution using Reflection
.
<?php
class Grandpa
{
public function __construct()
{
echo "Grandpa's constructor called\n";
}
}
class Papa extends Grandpa
{
public function __construct()
{
echo "Papa's constructor called\n";
// call Grandpa's constructor
parent::__construct();
}
}
class Kiddo extends Papa
{
public function __construct()
{
echo "Kiddo's constructor called\n";
$reflectionMethod = new ReflectionMethod(get_parent_class(get_parent_class($this)), '__construct');
$reflectionMethod->invoke($this);
}
}
$kiddo = new Kiddo();
$papa = new Papa();
I can't tell if you've found some special case code which requires you to test against private fields. But in my experience you never have to test something private - always public. Maybe you could give an example of some code where you need to test private?
Here's my hack... =D
# Make sure no one can connect to this database except you!
sudo -u postgres /usr/pgsql-9.4/bin/psql -c "UPDATE pg_database SET datallowconn=false WHERE datname='<DATABASE_NAME>';"
# Drop all existing connections except for yours!
sudo -u postgres /usr/pgsql-9.4/bin/psql -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '<DATABASE_NAME>' AND pid <> pg_backend_pid();"
# Drop database! =D
sudo -u postgres /usr/pgsql-9.4/bin/psql -c "DROP DATABASE <DATABASE_NAME>;"
I put this answer because include a command (above) to block new connections and because any attempt with the command...
REVOKE CONNECT ON DATABASE <DATABASE_NAME> FROM PUBLIC, <USERS_ETC>;
... do not works to block new connections!
Thanks to @araqnid @GoatWalker ! =D
No, there isn't.
I'm pretty sure there is no way to intercept a click on the refresh button from JS, and even if there was, JS can be turned off.
You should probably step back from your X (preventing refreshing) and find a different solution to Y (whatever that might be).
A function can be in-lined into a SQL statement, e.g.
select foo
,fn_bar (foo)
from foobar
Which cannot be done with a stored procedure. The architecture of the query optimiser limits what can be done with functions in this context, requiring that they are pure (i.e. the same inputs always produce the same output). This restricts what can be done in the function, but allows it to be used in-line in the query if it is defined to be "pure".
Otherwise, a function (not necessarily deterministic) can return a variable or a result set. In the case of a function returning a result set, you can join it against some other selection in a query. However, you cannot use a non-deterministic function like this in a correlated subquery as the optimiser cannot predict what sort of result set will be returned (this is computationally intractable, like the halting problem).
Here is an example of how to do the same thing in ASP.NET using C#. Feel free to use a different error catch image :)
public string GetVimeoPreviewImage(string vimeoURL)
{
try
{
string vimeoUrl = System.Web.HttpContext.Current.Server.HtmlEncode(vimeoURL);
int pos = vimeoUrl.LastIndexOf(".com");
string videoID = vimeoUrl.Substring(pos + 4, 8);
XmlDocument doc = new XmlDocument();
doc.Load("http://vimeo.com/api/v2/video/" + videoID + ".xml");
XmlElement root = doc.DocumentElement;
string vimeoThumb = root.FirstChild.SelectSingleNode("thumbnail_medium").ChildNodes[0].Value;
string imageURL = vimeoThumb;
return imageURL;
}
catch
{
//cat with cheese on it's face fail
return "http://bestofepicfail.com/wp-content/uploads/2008/08/cheese_fail.jpg";
}
}
NOTE: Your API request should like this when requested: http://vimeo.com/api/v2/video/32660708.xml
You can use the HTML5 pattern attribute or use JavaScript.
The pattern could look for example like this:
<input id="groupidtext" type="text" pattern="(.){6,6}" style="width: 100px;" maxlength="6" />
But the pattern attribute will only work with HTML5 browsers. For old browsers you'll need JavaScript.
As suggested in the comments to add, this will only work as soon as a form is about to be submitted. If this input is not in a form and you need validation as a user types, use JavaScript.
See section Attributes from documentation on directives.
observing interpolated attributes: Use $observe to observe the value changes of attributes that contain interpolation (e.g. src="{{bar}}"). Not only is this very efficient but it's also the only way to easily get the actual value because during the linking phase the interpolation hasn't been evaluated yet and so the value is at this time set to undefined.
using System;
using System.Linq;
class Program
{
static void Main(string[] args)
{
int[] numbers = { 3, 9, 5 };
int biggestNumber = numbers.Max();
Console.WriteLine(biggestNumber);
Console.ReadLine();
}
}
select COUNT(*)
from Monitor as m
inner join Monitor_Request as mr on mr.Company_ID=m.Company_id
group by m.Company_id
having COUNT(m.Monitor_id)>=5
This works too ..
var image = new Image();
image.src = 'image url';
image.onload = function(e){
// functionalities on load
}
$("#img-container").append(image);
In my case I was getting the grey background and it turned out to be inclusion of a zoom value in the map options. Yup, makes no sense.
It doesn't when you start a long operation behind, because everything STOPS since you'Re in the same thread.
You can use an OrderedDictionary.
Represents a collection of key/value pairs that are accessible by the key or index.
SELECT CONVERT_TZ() will work for that.but its not working for me.
Why, what error do you get?
SELECT CONVERT_TZ(displaytime,'GMT','MET');
should work if your column type is timestamp, or date
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_convert-tz
Test how this works:
SELECT CONVERT_TZ(a_ad_display.displaytime,'+00:00','+04:00');
Check your timezone-table
SELECT * FROM mysql.time_zone;
SELECT * FROM mysql.time_zone_name;
http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html
If those tables are empty, you have not initialized your timezone tables. According to link above you can use mysql_tzinfo_to_sql
program to load the Time Zone Tables. Please try this
shell> mysql_tzinfo_to_sql /usr/share/zoneinfo
or if not working read more: http://dev.mysql.com/doc/refman/5.5/en/mysql-tzinfo-to-sql.html
Change key in Project > Build Setting "typecheck calls to printf/scanf : NO"
Explanation : [How it works]
Check calls to printf and scanf, etc., to make sure that the arguments supplied have types appropriate to the format string specified, and that the conversions specified in the format string make sense.
Hope it work
Other warning
objective c implicit conversion loses integer precision 'NSUInteger' (aka 'unsigned long') to 'int
Change key "implicit conversion to 32Bits Type > Debug > *64 architecture : No"
[caution: It may void other warning of 64 Bits architecture conversion].
func paramsFromJSON(json: String) -> [String : AnyObject]?
{
let objectData: NSData = (json.dataUsingEncoding(NSUTF8StringEncoding))!
var jsonDict: [ String : AnyObject]!
do {
jsonDict = try NSJSONSerialization.JSONObjectWithData(objectData, options: .MutableContainers) as! [ String : AnyObject]
return jsonDict
} catch {
print("JSON serialization failed: \(error)")
return nil
}
}
let json = Mapper().toJSONString(loginJSON, prettyPrint: false)
Alamofire.request(.POST, url + "/login", parameters: paramsFromJSON(json!), encoding: .JSON)
I didn't use regex since it is difficult to deal with nested code. So this snippet should be able to allow you to grab sections of code with balanced brackets:
def extract_code(data):
""" returns an array of code snippets from a string (data)"""
start_pos = None
end_pos = None
count_open = 0
count_close = 0
code_snippets = []
for i,v in enumerate(data):
if v =='{':
count_open+=1
if not start_pos:
start_pos= i
if v=='}':
count_close +=1
if count_open == count_close and not end_pos:
end_pos = i+1
if start_pos and end_pos:
code_snippets.append((start_pos,end_pos))
start_pos = None
end_pos = None
return code_snippets
I used this to extract code snippets from a text file.
string.IsNullOrEmpty(str) - if you'd like to check string value has been provided
string.IsNullOrWhiteSpace(str) - basically this is already a sort of business logic implementation (i.e. why " " is bad, but something like "~~" is good).
My advice - do not mix business logic with technical checks. So, for example, string.IsNullOrEmpty is the best to use at the beginning of methods to check their input parameters.
The following example is coding in typescript with Hooks.
import React, { useState, useEffect } from "react";
........
const App = () => {
const [showScrollView, setShowScrollView] = useState(false);
......
const onPress = () => {
// toggle true or false
setShowScrollView(!showScrollView);
}
......
</MapboxGL.ShapeSource>
<View>{showScrollView ? (<DetailsScrollView />) : null}</View>
</MapboxGL.MapView>
......
}
The quickest method would be using binary tree. Its worst case is also only O(logn).
if ($("#btn").data('events') != undefined && $("#btn").data('events').click != undefined) {
//do nothing as the click event is already there
} else {
$("#btn").click(function (e) {
alert('test');
});
}
Using
$("a").attr("href", "http://www.google.com/")
will modify the href of all hyperlinks to point to Google. You probably want a somewhat more refined selector though. For instance, if you have a mix of link source (hyperlink) and link target (a.k.a. "anchor") anchor tags:
<a name="MyLinks"></a>
<a href="http://www.codeproject.com/">The CodeProject</a>
...Then you probably don't want to accidentally add href
attributes to them. For safety then, we can specify that our selector will only match <a>
tags with an existing href
attribute:
$("a[href]") //...
Of course, you'll probably have something more interesting in mind. If you want to match an anchor with a specific existing href
, you might use something like this:
$("a[href='http://www.google.com/']").attr('href', 'http://www.live.com/')
This will find links where the href
exactly matches the string http://www.google.com/
. A more involved task might be matching, then updating only part of the href
:
$("a[href^='http://stackoverflow.com']")
.each(function()
{
this.href = this.href.replace(/^http:\/\/beta\.stackoverflow\.com/,
"http://stackoverflow.com");
});
The first part selects only links where the href starts with http://stackoverflow.com
. Then, a function is defined that uses a simple regular expression to replace this part of the URL with a new one. Note the flexibility this gives you - any sort of modification to the link could be done here.
How about:
DELETE guide_category
WHERE id_guide_category IN (
SELECT id_guide_category
FROM guide_category AS gc
LEFT JOIN guide AS g
ON g.id_guide = gc.id_guide
WHERE g.title IS NULL
)
Broadcast receivers receive events of a certain type. I don't think you can invoke them by class name.
First, your IntentFilter must contain an event.
static final String SOME_ACTION = "com.yourcompany.yourapp.SOME_ACTION";
IntentFilter intentFilter = new IntentFilter(SOME_ACTION);
Second, when you send a broadcast, use this same action:
Intent i = new Intent(SOME_ACTION);
sendBroadcast(i);
Third, do you really need MyIntentService to be inline? Static? [EDIT] I discovered that MyIntentSerivce MUST be static if it is inline.
Fourth, is your service declared in the AndroidManifest.xml?
Follow this steps:
-Build
-Generate Signed Apk
-Create new
Then fill up "New Key Store" form. If you wand to change .jnk file destination then chick on destination and give a name to get Ok button. After finishing it you will get "Key store password", "Key alias", "Key password" Press next and change your the destination folder. Then press finish, thats all. :)
See any reference manual, such as the man page:
f,F
The double argument is rounded and converted to decimal notation in the style [-]ddd.ddd, where the number of digits after the decimal-point character is equal to the precision specification. If the precision is missing, it is taken as 6; if the precision is explicitly zero, no decimal-point character appears. If a decimal point appears, at least one digit appears before it. (The SUSv2 does not know about F and says that character string representations for infinity and NaN may be made available. The C99 standard specifies '[-]inf' or '[-]infinity' for infinity, and a string starting with 'nan' for NaN, in the case of f conversion, and '[-]INF' or '[-]INFINITY' or 'NAN*' in the case of F conversion.)
g,G
The double argument is converted in style f or e (or F or E for G conversions). The precision specifies the number of significant digits. If the precision is missing, 6 digits are given; if the precision is zero, it is treated as 1. Style e is used if the exponent from its conversion is less than -4 or greater than or equal to the precision. Trailing zeros are removed from the fractional part of the result; a decimal point appears only if it is followed by at least one digit.
I think the easiest way to do this would be to set the columns to the top level:
df.columns = df.columns.get_level_values(0)
Note: if the to level has a name you can also access it by this, rather than 0.
.
If you want to combine/join
your MultiIndex into one Index (assuming you have just string entries in your columns) you could:
df.columns = [' '.join(col).strip() for col in df.columns.values]
Note: we must strip
the whitespace for when there is no second index.
In [11]: [' '.join(col).strip() for col in df.columns.values]
Out[11]:
['USAF',
'WBAN',
'day',
'month',
's_CD sum',
's_CL sum',
's_CNT sum',
's_PC sum',
'tempf amax',
'tempf amin',
'year']
In https://www.php.net/manual/es/function.usleep.php
<?php
// Wait 2 seconds
usleep(2000000);
// if you need 5 seconds
usleep(5000000);
?>
You should always use the resource manager and not read files directly to ensure globalization is taken into account.
using System.Collections;
using System.Globalization;
using System.Resources;
...
/* Reference to your resources class -- may be named differently in your case */
ResourceManager MyResourceClass =
new ResourceManager(typeof(Resources));
ResourceSet resourceSet =
MyResourceClass.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
foreach (DictionaryEntry entry in resourceSet)
{
string resourceKey = entry.Key.ToString();
object resource = entry.Value;
}
After reading the accepted answer's comments, I tried the robocopy command, which worked for me (using the standard command prompt from Windows 7 64 bits SP 1):
robocopy source_dir dest_dir /s /e
Just adding so you don't have to click-through:
curl --user name:password http://www.example.com
or if you're trying to do send authentication for OAuth 2:
curl -H "Authorization: OAuth <ACCESS_TOKEN>" http://www.example.com
A little more compressed than the above accepted example. Grabs the target from the data-target of the current clicked anything with data-toggle=modal on. This makes it so you don't have to know what the id of the target modal is, just reuse the same one! less code = win! You could also modify this to load title, labels and buttons for your modal should you want to.
$("[data-toggle=modal]").click(function(ev) {
ev.preventDefault();
// load the url and show modal on success
$( $(this).attr('data-target') + " .modal-body").load($(this).attr("href"), function() {
$($(this).attr('data-target')).modal("show");
});
});
Example Links:
<a data-toggle="modal" href="/page/api?package=herp" data-target="#modal">click me</a>
<a data-toggle="modal" href="/page/api?package=derp" data-target="#modal">click me2</a>
<a data-toggle="modal" href="/page/api?package=merp" data-target="#modal">click me3</a>
You have to replace the Flutter icon files with images of your own. This site will help you turn your png into launcher icons of various sizes:
https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html
A slight modification to solution provided by lebreeze:
function daysInMonth(iMonth, iYear)
{
return new Date(iYear, iMonth, 0).getDate();
}
This may also work:
SELECT
COUNT(DISTINCT T.tag) as DistinctTag,
COUNT(DISTINCT T2.tag) as DistinctPositiveTag
FROM Table T
LEFT JOIN Table T2 ON T.tag = T2.tag AND T.entryID = T2.entryID AND T2.entryID > 0
You need the entryID condition in the left join rather than in a where clause in order to make sure that any items that only have a entryID of 0 get properly counted in the first DISTINCT.
My favourite rule in regards to authentication systems: use passphrases, not passwords. Easy to remember, hard to crack. More info: Coding Horror: Passwords vs. Pass Phrases
If you have two or more selects and use Steve McLenithan's answer, try to replace the first line with:
$('#CHOSENINPUTFIELDID_chosen > div > div input').autocomplete({
not remove suffix: _chosen
For complete M B
answer, if you want to access to an specific attribute of this object already filtered from the array in your HTML, you will have to do it in this way:
{{ (myArray | filter : {'id':73})[0].name }}
So, in this case, it will print john
in the HTML.
Regards!
I think inline scripts are hard to stop instead you can try with this:
<div id="test">
<div>Click Me</div>
</div>
and script:
$(function () {
$('#test').children().click(function(){
alert('hello');
});
$('#test').children().off('click');
});
I had the same problem. Even after updating the password using sudo passwd it was not working. I had to give "multiple" roles for my user through IAM & Admin Refer Screen Shot on IAM & Admin screen of google cloud
After that i restarted the VM. Then again changed the password and then it worked.
user1@sap-hanaexpress-public-1-vm:~> sudo passwd
New password:
Retype new password:
passwd: password updated successfully
user1@sap-hanaexpress-public-1-vm:~> su
Password:
sap-hanaexpress-public-1-vm:/home/user1 # whoami
root
sap-hanaexpress-public-1-vm:/home/user1 #
The first response is the best solution:
Add an onsubmit handler to the form (either via plain js or jquery $().submit(fn)), and return false unless your specific conditions are met.
More specific with jquery:
$('#your-form-id').submit(function(){return false;});
Unless you don't want the form to submit, ever - in which case, why not just leave out the 'action' attribute on the form element?
Writing Chrome extensions is an example of where you might have a form for user input, but you don't want it to submit. If you use action="javascript:void(0);", the code will probably work but you will end up with this problem where you get an error about running inline Javascript.
If you leave out the action completely, the form will reload which is also undesired in some cases when writing a Chrome extension. Or if you had a webpage with some sort of an embedded calculator, where the user would provide some input and click "Calculate" or something like that.
To open in a new windows with dimensions and everything, you will need to call a JavaScript function, as target="_blank" won't let you adjust sizes. An example would be:
<a href="http://www.facebook.com/sharer" onclick="window.open(this.href, 'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" >Share this</a>
Hope this helps you.