String string;
for (Datapoint d : dataPointList) {
Field[] fields = d.getFields();
for (Field f : fields) {
String value = (String) g.get(d);
if (value.equals(string)) {
//Do your stuff
}
}
}
The answer is on the MSDN site:
The Save (Not Permitted) dialog box warns you that saving changes is not permitted because the changes you have made require the listed tables to be dropped and re-created.
The following actions might require a table to be re-created:
- Adding a new column to the middle of the table
- Dropping a column
- Changing column nullability
- Changing the order of the columns
- Changing the data type of a column
EDIT 1:
Additional useful informations from here:
To change the Prevent saving changes that require the table re-creation option, follow these steps:
- Open SQL Server Management Studio (SSMS).
- On the Tools menu, click Options.
- In the navigation pane of the Options window, click Designers.
- Select or clear the Prevent saving changes that require the table re-creation check box, and then click OK.
Note If you disable this option, you are not warned when you save the table that the changes that you made have changed the metadata structure of the table. In this case, data loss may occur when you save the table.
Risk of turning off the "Prevent saving changes that require table re-creation" option
Although turning off this option can help you avoid re-creating a table, it can also lead to changes being lost. For example, suppose that you enable the Change Tracking feature in SQL Server 2008 to track changes to the table. When you perform an operation that causes the table to be re-created, you receive the error message that is mentioned in the "Symptoms" section. However, if you turn off this option, the existing change tracking information is deleted when the table is re-created. Therefore, we recommend that you do not work around this problem by turning off the option.
The name
attribute is used when sending data in a form submission. Different controls respond differently. For example, you may have several radio buttons with different id
attributes, but the same name
. When submitted, there is just the one value in the response - the radio button you selected.
Of course, there's more to it than that, but it will definitely get you thinking in the right direction.
maybe you can try this way
SELECT *
FROM Product P
WHERE (CASE
WHEN @Status = 'published' THEN
(CASE
WHEN P.Status IN (1, 3) THEN
'TRUE'
ELSE
FALSE
END)
WHEN @Status = 'standby' THEN
(CASE
WHEN P.Status IN (2, 5, 9, 6) THEN
'TRUE'
ELSE
'FALSE'
END)
WHEN @Status = 'deleted' THEN
(CASE
WHEN P.Status IN (4, 5, 8, 10) THEN
'TRUE'
ELSE
'FALSE'
END)
ELSE
(CASE
WHEN P.Status IN (1, 3) THEN
'TRUE'
ELSE
'FALSE'
END)
END) = 'TRUE'
In this way if @Status = 'published', the query will check if P.Status is among 1 or 3, it will return TRUE else 'FALSE'. This will be matched with TRUE at the end
Hope it helps.
I think that in order to get the request data, bound and validated by the form object, you must use this command :
$form->getViewData();
$form->getClientData(); // Deprecated since version 2.1, to be removed in 2.3.
The error means that you're navigating to a view whose model is declared as typeof Foo
(by using @model Foo
), but you actually passed it a model which is typeof Bar
(note the term dictionary is used because a model is passed to the view via a ViewDataDictionary
).
The error can be caused by
Passing the wrong model from a controller method to a view (or partial view)
Common examples include using a query that creates an anonymous object (or collection of anonymous objects) and passing it to the view
var model = db.Foos.Select(x => new
{
ID = x.ID,
Name = x.Name
};
return View(model); // passes an anonymous object to a view declared with @model Foo
or passing a collection of objects to a view that expect a single object
var model = db.Foos.Where(x => x.ID == id);
return View(model); // passes IEnumerable<Foo> to a view declared with @model Foo
The error can be easily identified at compile time by explicitly declaring the model type in the controller to match the model in the view rather than using var
.
Passing the wrong model from a view to a partial view
Given the following model
public class Foo
{
public Bar MyBar { get; set; }
}
and a main view declared with @model Foo
and a partial view declared with @model Bar
, then
Foo model = db.Foos.Where(x => x.ID == id).Include(x => x.Bar).FirstOrDefault();
return View(model);
will return the correct model to the main view. However the exception will be thrown if the view includes
@Html.Partial("_Bar") // or @{ Html.RenderPartial("_Bar"); }
By default, the model passed to the partial view is the model declared in the main view and you need to use
@Html.Partial("_Bar", Model.MyBar) // or @{ Html.RenderPartial("_Bar", Model.MyBar); }
to pass the instance of Bar
to the partial view. Note also that if the value of MyBar
is null
(has not been initialized), then by default Foo
will be passed to the partial, in which case, it needs to be
@Html.Partial("_Bar", new Bar())
Declaring a model in a layout
If a layout file includes a model declaration, then all views that use that layout must declare the same model, or a model that derives from that model.
If you want to include the html for a separate model in a Layout, then in the Layout, use @Html.Action(...)
to call a [ChildActionOnly]
method initializes that model and returns a partial view for it.
select t2.*
from t1 join t2 on t2.url='site.com/path/%' + cast(t1.id as varchar) + '%/more'
where t1.id > 9000
Using concat like suggested is even better though
I did not get it. I had a similar problem but in my nav bar.
What I was doing is I kept my navBar code in this way: nav>div.navlinks>ul>li*3>a
In order to put hover effects on a I positioned a to relative and designed a::before
and a::after
then i put a gray background on before and after elements and kept hover effects in such way that as one hovers on <a>
they will pop from outside a to fill <a>
.
The problem is that the overflow hidden is not working on <a>
.
What i discovered is if i removed <li>
and simply put <a>
without <ul>
and <li>
then it worked.
What may be the problem?
On Vista, this worked:
DOS: del c:\user\dad\.android\debug.keystore
ECLIPSE: In Project, Clean the project. Close Eclipse. Re-open Eclipse.
ECLIPSE: Start the Emulator. Remove the Application from the emulator.
You are good to go.
I was pretty worried when I say that error, but I fixed it from reading here and playing around for 10 minutes.
It is enough to close just Statement
and Connection
. There is no need to explicitly close the ResultSet
object.
Java documentation says about java.sql.ResultSet
:
A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results.
Thanks BalusC for comments: "I wouldn't rely on that. Some JDBC drivers fail on that."
If useful, try this:
BufferedImage imgBuffer = ImageIO.read(new File("c:\\image.bmp"));
byte[] pixels = (byte[])imgBuffer.getRaster().getDataElements(0, 0, imgBuffer.getWidth(), imgBuffer.getHeight(), null);
You need to run this command in the top-level directory of a Selenium SVN repository checkout.
You might have had Power Tool installed.
In this case you can turn it off from 'Tools > Options > Productivity Power Tools > PowerCommands > General'
With PostgreSQL there are a number of date/time functions available, see here.
In your example, you could use:
SELECT * FROM myTable WHERE date_trunc('day', dt) = 'YYYY-MM-DD';
If you are running this query regularly, it is possible to create an index using the date_trunc
function as well:
CREATE INDEX date_trunc_dt_idx ON myTable ( date_trunc('day', dt) );
One advantage of this is there is some more flexibility with timezones if required, for example:
CREATE INDEX date_trunc_dt_idx ON myTable ( date_trunc('day', dt at time zone 'Australia/Sydney') );
SELECT * FROM myTable WHERE date_trunc('day', dt at time zone 'Australia/Sydney') = 'YYYY-MM-DD';
how to club the 4 query's as a single query
show below query
nsc = nature of case
report is taken on 06th of every month
( monthly report will be counted from 05th previous month to 05th present of present month)
Setting links on the page woud require a combination of @Ravi and @ncksllvn's answers:
// Find link in $(".product-item") and set "target" attribute to "_blank".
$(this).find("a").attr("target", "_blank");
For opening the page in another window, see this question: jQuery click _blank And see this reference for window.open
options for customization.
Update:
You would need something along:
$(document).ready(function() {
$(".product-item").click(function() {
var productLink = $(this).find("a");
productLink.attr("target", "_blank");
window.open(productLink.attr("href"));
return false;
});
});
Note the usage of .attr()
:
$element.attr("attribute_name") // Get value of attribute.
$element.attr("attribute_name", attribute_value) // Set value of attribute.
See Converting unix timestamp to excel date-time forum thread.
The sum function only gets the total of a column. In order to sum two values from different columns, convert the values to int and add them up using the +-Operator
Select (convert(int, col1)+convert(int, col2)) as summed from tbl1
Hope that helps.
As mentioned in have debugger run application as different user (linked above), another extremely simple way to do this which doesn't require any more tools:
Click "Run as different user"
Enter credentials of the other user in the next pop-up window
Now when you debug the solution it will be with the other user's permissions.
Hint: if you are going to run multiple instances of Visual Studio, change the theme of it (like to "dark") so you can keep track of which one is which easily).
You can use jasper report.
iReport is a very effective tool to develop jasper reports.
It supports almost all the facilities provided by crystal report like formatting, grouping, creation of charts etc.
Refer the link for tutorial:
Assign the values of nested json
to struct until you know the underlying type of json keys:-
package main
import (
"encoding/json"
"fmt"
)
// Object
type Object struct {
Foo map[string]map[string]string `json:"foo"`
More string `json:"more"`
}
func main(){
someJSONString := []byte(`{"foo":{ "bar": "1", "baz": "2" }, "more": "text"}`)
var obj Object
err := json.Unmarshal(someJSONString, &obj)
if err != nil{
fmt.Println(err)
}
fmt.Println("jsonObj", obj)
}
I simply want to add to what jasonbar says, when querying like:
SHOW columns FROM table
If you get the result out as an array it will look like this:
array([0],[Field],[1],[Type],[2],[Null],[3],[Key],[4],[Default],[5],[Extra])
Where [n] and [text] give the same value.
Not really told in any documentation I have found. Simply good to know what else is there.
You can use a datetime
field and set it's default value to GetDate()
.
CREATE TABLE [dbo].[Test](
[TimeStamp] [datetime] NOT NULL CONSTRAINT [DF_Test_TimeStamp] DEFAULT (GetDate()),
[Foo] [varchar](50) NOT NULL
) ON [PRIMARY]
You 'can' have a static class in C++, as mentioned before, a static class is one that does not have any objects of it instantiated it. In C++, this can be obtained by declaring the constructor/destructor as private. End result is the same.
If copy assignment operator of foo and bar is cheap (eg. int, char, pointer etc), you can do the following:
foo f; bar b;
BOOST_FOREACH(boost::tie(f,b),testing)
{
cout << "Foo is " << f << " Bar is " << b;
}
string GetString(RichTextBox rtb)
{
var textRange = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
return textRange.Text;
}
On Linux when write()ing into a socket which the other side, unknown to you, closed will provoke a SIGPIPE signal/exception however you want to call it. However if you don't want to be caught out by the SIGPIPE you can use send() with the flag MSG_NOSIGNAL. The send() call will return with -1 and in this case you can check errno which will tell you that you tried to write a broken pipe (in this case a socket) with the value EPIPE which according to errno.h is equivalent to 32. As a reaction to the EPIPE you could double back and try to reopen the socket and try to send your information again.
Most of the answers given so far go in the wrong direction, suggesting to load additional libraries and use the code instead of markup. In Ipython/Jupyter Notebooks it is very simple. Make sure the cell is indeed in markup and to display a image use:
![alt text](imagename.png "Title")
Further advantage compared to the other methods proposed is that you can display all common file formats including jpg, png, and gif (animations).
You can use the ImageGrab module. ImageGrab works on Windows and macOS, and you need PIL (Pillow) to use it. Here is a little example:
from PIL import ImageGrab
snapshot = ImageGrab.grab()
save_path = "C:\\Users\\YourUser\\Desktop\\MySnapshot.jpg"
snapshot.save(save_path)
Because you rebased feature
on top of the new master
, your local feature
is not a fast-forward of origin/feature
anymore. So, I think, it's perfectly fine in this case to override the fast-forward check by doing git push origin +feature
. You can also specify this in your config
git config remote.origin.push +refs/heads/feature:refs/heads/feature
If other people work on top of origin/feature
, they will be disturbed by this forced update. You can avoid that by merging in the new master
into feature
instead of rebasing. The result will indeed be a fast-forward.
The PHP refresh after 5 seconds didn't work for me when opening a Save As dialogue to save a file: (header('Content-type: text/plain'); header("Content-Disposition: attachment; filename=$filename>");)
After the Save As link was clicked, and file was saved, the timed refresh stopped on the calling page.
However, thank you very much, ibu's javascript solution just kept on ticking and refreshing my webpage, which is what I needed for my specific application. So thank you ibu for posting javascript solution to php problem here.
You can use javascript to redirect after some time
setTimeout(function () {
window.location.href = 'http://www.google.com';
},5000); // 5 seconds
If it is a list, you can also use AddRange method.
var listB = new List<int>{3, 4, 5};
var listA = new List<int>{1, 2, 3, 4, 5};
listA.AddRange(listB); // listA now has elements of listB also.
If you need new list (and exclude the duplicate), you can use Union
var listB = new List<int>{3, 4, 5};
var listA = new List<int>{1, 2, 3, 4, 5};
var listFinal = listA.Union(listB);
If you need new list (and include the duplicate), you can use Concat
var listB = new List<int>{3, 4, 5};
var listA = new List<int>{1, 2, 3, 4, 5};
var listFinal = listA.Concat(listB);
If you need common items, you can use Intersect.
var listB = new List<int>{3, 4, 5};
var listA = new List<int>{1, 2, 3, 4};
var listFinal = listA.Intersect(listB); //3,4
This particular error implies that one of the variables being used in the arithmetic on the line has a shape incompatible with another on the same line (i.e., both different and non-scalar). Since n
and the output of np.add.reduce()
are both scalars, this implies that the problem lies with xm
and ym
, the two of which are simply your x
and y
inputs minus their respective means.
Based on this, my guess is that your x
and y
inputs have different shapes from one another, making them incompatible for element-wise multiplication.
** Technically, it's not that variables on the same line have incompatible shapes. The only problem is when two variables being added, multiplied, etc., have incompatible shapes, whether the variables are temporary (e.g., function output) or not. Two variables with different shapes on the same line are fine as long as something else corrects the issue before the mathematical expression is evaluated.
You need to concatenate your string.
document.getElementById(tabName).style.backgroundImage = 'url(buttons/' + imagePrefix + '.png)';
The way you had it, it's just making 1 long string and not actually interpreting imagePrefix.
I would even suggest creating the string separate:
function ChangeBackgroungImageOfTab(tabName, imagePrefix)
{
var urlString = 'url(buttons/' + imagePrefix + '.png)';
document.getElementById(tabName).style.backgroundImage = urlString;
}
As mentioned by David Thomas below, you can ditch the double quotes in your string. Here is a little article to get a better idea of how strings and quotes/double quotes are related: http://www.quirksmode.org/js/strings.html
You can directly run the second query if you know the owner name.
--First you can select what all OWNERS there exist:
SELECT DISTINCT(owner) from SYS.ALL_TABLES;
--Then you can see the tables under by that owner:
SELECT table_name, owner from all_tables where owner like ('%XYZ%');
Since this answer still gets voted up, I want to point out that you should almost never need to look in the header files. If you want to write reliable code, you're much better served by looking in the standard. A better question than "how is off_t
defined on my machine" is "how is off_t
defined by the standard?". Following the standard means that your code will work today and tomorrow, on any machine.
In this case, off_t
isn't defined by the C standard. It's part of the POSIX standard, which you can browse here.
Unfortunately, off_t
isn't very rigorously defined. All I could find to define it is on the page on sys/types.h
:
blkcnt_t
andoff_t
shall be signed integer types.
This means that you can't be sure how big it is. If you're using GNU C, you can use the instructions in the answer below to ensure that it's 64 bits. Or better, you can convert to a standards defined size before putting it on the wire. This is how projects like Google's Protocol Buffers work (although that is a C++ project).
So, I think "where do I find the definition in my header files" isn't the best question. But, for completeness here's the answer:
On my machine (and most machines using glibc) you'll find the definition in bits/types.h
(as a comment says at the top, never directly include this file), but it's obscured a bit in a bunch of macros. An alternative to trying to unravel them is to look at the preprocessor output:
#include <stdio.h>
#include <sys/types.h>
int main(void) {
off_t blah;
return 0;
}
And then:
$ gcc -E sizes.c | grep __off_t
typedef long int __off_t;
....
However, if you want to know the size of something, you can always use the sizeof()
operator.
Edit: Just saw the part of your question about the __
. This answer has a good discussion. The key point is that names starting with __
are reserved for the implementation (so you shouldn't start your own definitions with __
).
You cannot directly access the table with the name 'customer'. Either it should be 'user1.customer' or create a synonym 'customer' for user2 pointing to 'user1.customer'. hope this helps..
For copy directory use following command
cp -r source Destination
For example
cp -r /home/hasan /opt
For copy file use command without -r
cp /home/file /home/hasan/
This should do what you want:
<div class="comeBack_up" *ngIf="(previous_info | json) != ({} | json)">
or shorter
<div class="comeBack_up" *ngIf="(previous_info | json) != '{}'">
Each {}
creates a new instance and ====
comparison of different objects instances always results in false
. When they are convert to strings ===
results to true
As a complementary, for those who might meet the same issue as mine, I'm using $.ajax
to post form data to server and I also got the 400
error at first.
Assume I have a javascript variable,
var formData = {
"name":"Gearon",
"hobby":"Be different"
};
Do not use variable formData
directly as the value of key data
like below:
$.ajax({
type: "post",
dataType: "json",
url: "http://localhost/user/add",
contentType: "application/json",
data: formData,
success: function(data, textStatus){
alert("Data: " + data + "\nStatus: " + status);
}
});
Instead, use JSON.stringify to encapsulate the formData
as below:
$.ajax({
type: "post",
dataType: "json",
url: "http://localhost/user/add",
contentType: "application/json",
data: JSON.stringify(formData),
success: function(data, textStatus){
alert("Data: " + data + "\nStatus: " + status);
}
});
Anyway, as others have illustrated, the error is because the server could not recognize the request cause malformed syntax, I'm just raising a instance at practice. Hope it would be helpful to someone.
You can use LINQ:
using System.Linq;
IList<Foo> list = new List<Foo>();
IEnumerable<Foo> sortedEnum = list.OrderBy(f=>f.Bar);
IList<Foo> sortedList = sortedEnum.ToList();
Try:
DataTable.Rows[RowNo].ItemArray[columnIndex].ToString()
(This is C# code. Change this to VB equivalent)
On the replacement side, you must use $1, not \1.
And you can only do what you want by making replace an evalable expression that gives the result you want and telling s/// to eval it with the /ee modifier like so:
$find="start (.*) end";
$replace='"foo $1 bar"';
$var = "start middle end";
$var =~ s/$find/$replace/ee;
print "var: $var\n";
To see why the "" and double /e are needed, see the effect of the double eval here:
$ perl
$foo = "middle";
$replace='"foo $foo bar"';
print eval('$replace'), "\n";
print eval(eval('$replace')), "\n";
__END__
"foo $foo bar"
foo middle bar
(Though as ikegami notes, a single /e or the first /e of a double e isn't really an eval()
; rather, it tells the compiler that the substitution is code to compile, not a string. Nonetheless, eval(eval(...))
still demonstrates why you need to do what you need to do to get /ee to work as desired.)
I couldn't get the SDK to install properly (some of the files seemed unsigned, something like that). I found another solution here and that seems to work okay for me. It doesn't require installation of new files at all. Basically, what you do is:
Edit the .csproj file in a text editor, and add:
<Reference Include="System.Management.Automation" />
to the relevant section.
Hope this helps.
To answer your question, yes it does: your synchronized
method cannot be executed by more than one thread at a time.
You should only use extern template
to force the compiler to not instantiate a template when you know that it will be instantiated somewhere else. It is used to reduce compile time and object file size.
For example:
// header.h
template<typename T>
void ReallyBigFunction()
{
// Body
}
// source1.cpp
#include "header.h"
void something1()
{
ReallyBigFunction<int>();
}
// source2.cpp
#include "header.h"
void something2()
{
ReallyBigFunction<int>();
}
This will result in the following object files:
source1.o
void something1()
void ReallyBigFunction<int>() // Compiled first time
source2.o
void something2()
void ReallyBigFunction<int>() // Compiled second time
If both files are linked together, one void ReallyBigFunction<int>()
will be discarded, resulting in wasted compile time and object file size.
To not waste compile time and object file size, there is an extern
keyword which makes the compiler not compile a template function. You should use this if and only if you know it is used in the same binary somewhere else.
Changing source2.cpp
to:
// source2.cpp
#include "header.h"
extern template void ReallyBigFunction<int>();
void something2()
{
ReallyBigFunction<int>();
}
Will result in the following object files:
source1.o
void something1()
void ReallyBigFunction<int>() // compiled just one time
source2.o
void something2()
// No ReallyBigFunction<int> here because of the extern
When both of these will be linked together, the second object file will just use the symbol from the first object file. No need for discard and no wasted compile time and object file size.
This should only be used within a project, like in times when you use a template like vector<int>
multiple times, you should use extern
in all but one source file.
This also applies to classes and function as one, and even template member functions.
Try INC_DIR=../ ../StdCUtil
.
Then, set CCFLAGS=-c -Wall $(addprefix -I,$(INC_DIR))
EDIT: Also, modify your #include
to be #include <StdCUtil/split.h>
so that the compiler knows to use -I rather than local path of the .cpp using the #include
.
For linux systems officially Google offers solution in Manage Chrome Browser updates (Linux)
and also I wrote a script below to make it for me:
#!/bin/sh
# stop chrome update from repository file
sudo -s<<END
touch /etc/default/google-chrome
echo "repo_add_once=false" > /etc/default/google-chrome
END
Also Disable Chromium Auto Update in Linux page states the same procedure.
Returns the absolute path to the directory on the filesystem where files created with openFileOutput(String, int) are stored.
Environment.getDataDirectory()
Return the user data directory.
Text files in Windows don't have a format. There's an unofficial convention that if the file starts with the BOM codepoint in UTF-8 format that it's UTF-8, but that convention isn't universally supported. That would be the 3 byte sequence "\xef\xbf\xbe"
, i.e. ￾
in the Latin-1 character set.
Just as there are printer drivers that do not connect to a printer at all but rather write to a PDF file, analogously there are virtual audio drivers available that do not connect to a physical microphone at all but can pipe input from other sources such as files or other programs.
I hope I'm not breaking any rules by recommending free/donation software, but VB-Audio Virtual Cable should let you create a pair of virtual input and output audio devices. Then you could play an MP3 into the virtual output device and then set the virtual input device as your "microphone". In theory I think that should work.
If all else fails, you could always roll your own virtual audio driver. Microsoft provides some sample code but unfortunately it is not applicable to the older Windows XP audio model. There is probably sample code available for XP too.
If you are using Xcode 8.0 to 8.3.3 and swift 2.2 to 3.0
In my case need to change in URL http:// to https:// (if not working then try)
Add an App Transport Security Setting: Dictionary.
Add a NSAppTransportSecurity: Dictionary.
Add a NSExceptionDomains: Dictionary.
Add a yourdomain.com: Dictionary. (Ex: stackoverflow.com)
Add Subkey named " NSIncludesSubdomains" as Boolean: YES
Add Subkey named " NSExceptionAllowsInsecureHTTPLoads" as Boolean: YES
This is an old question but you can also use express-validator package to check request params
express-validator version 4 (latest):
validator = require('express-validator/check');
app.get('/show/:id', [
validator.param('id').isMongoId().trim()
], function(req, res) {
// validation result
var errors = validator.validationResult(req);
// check if there are errors
if ( !errors.isEmpty() ) {
return res.send('404');
}
// else
model.findById(req.params.id, function(err, doc) {
return res.send(doc);
});
});
express-validator version 3:
var expressValidator = require('express-validator');
app.use(expressValidator(middlewareOptions));
app.get('/show/:id', function(req, res, next) {
req.checkParams('id').isMongoId();
// validation result
req.getValidationResult().then(function(result) {
// check if there are errors
if ( !result.isEmpty() ) {
return res.send('404');
}
// else
model.findById(req.params.id, function(err, doc) {
return res.send(doc);
});
});
});
I had a similar problem and after going over a lot on stack overflow and spending time on the jar dependencies, I figured out that in my case, I had two sets of asm.jar. I removed one of them and it worked fine...
They are binary large objects, you can use them to store binary data such as images or serialized objects among other things.
Seeing how you draw your canvas with
$("canvas").drawImage();
it seems that you use jQuery Canvas (jCanvas) by Caleb Evans.
I actually use that plugin and it has a simple way to retrieve canvas base64 image string with $('canvas').getCanvasImage();
Here's a working Fiddle for you: http://jsfiddle.net/e6nqzxpn/
Use HashMap
most of the times but use TreeMap
when you need the key to be sorted (when you need to iterate the keys).
SELECT date_part ('year', f) * 12
+ date_part ('month', f)
FROM age ('2015-06-12'::DATE, '2014-12-01'::DATE) f
Result: 6
.Click() - Perform only click operation as like mouse click.
.Submit() - Perform Enter operation as like keyboard Enter event.
For Example. Consider a login page where it contains username and password and submit button.
On filling password if we want to login without clicking login button. we need to user .submit button on password where .click() operation does not work.[to login into application]
Brif.
driver.get("https:// anyURL");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.findElement(By.id("txtUserId")).sendKeys("[email protected]");
WebElement text = driver.findElement(By.id("txtPassword")); text.sendKeys("password");
Thread.sleep(1000);
text.click(); //This will not work - it will on perform click operation not submit operation
text.submit(); //This will perform submit operation has enter key
without disabling the selected value on submitting..
$('#selectID option:not(:selected)').prop('disabled', true);
If you use Jquery version lesser than 1.7
$('#selectID option:not(:selected)').attr('disabled', true);
It works for me..
SerialPort (RS-232 Serial COM Port) in C# .NET
This article explains how to use the SerialPort
class in .NET to read and write data, determine what serial ports are available on your machine, and how to send files. It even covers the pin assignments on the port itself.
Example Code:
using System;
using System.IO.Ports;
using System.Windows.Forms;
namespace SerialPortExample
{
class SerialPortProgram
{
// Create the serial port with basic settings
private SerialPort port = new SerialPort("COM1",
9600, Parity.None, 8, StopBits.One);
[STAThread]
static void Main(string[] args)
{
// Instatiate this class
new SerialPortProgram();
}
private SerialPortProgram()
{
Console.WriteLine("Incoming Data:");
// Attach a method to be called when there
// is data waiting in the port's buffer
port.DataReceived += new
SerialDataReceivedEventHandler(port_DataReceived);
// Begin communications
port.Open();
// Enter an application loop to keep this thread alive
Application.Run();
}
private void port_DataReceived(object sender,
SerialDataReceivedEventArgs e)
{
// Show all the incoming data in the port's buffer
Console.WriteLine(port.ReadExisting());
}
}
}
it seems when target sdk is pie (api level 28.0) and windowIsTranslucent is true
<item name="android:windowIsTranslucent">true</item>
and you try to access orientation. problem comes with android oreo 8.0 (api level 26) there are two ways to solve this
if you are setting orientation in manifest like this
android:screenOrientation="portrait"
or in activity class like this
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
remove form both places.
and observed when u set windowIsTranslucent to true, it takes orientation from parent activity.
I ran into this issue over the past couple days. Like Omri Aharon said in their answer above, it is important to add definitions for your prop types similar to:
SomeClass.propTypes = {
someProp: PropTypes.number,
onTap: PropTypes.func,
};
Don't forget to add the prop definitions outside of your class. I would place it right below/above my class. If you are not sure what your variable type or suffix is for your PropType (ex: PropTypes.number), refer to this npm reference. To Use PropTypes, you must import the package:
import PropTypes from 'prop-types';
If you get the linting error:someProp is not required, but has no corresponding defaultProps declaration
all you have to do is either add .isRequired
to the end of your prop definition like so:
SomeClass.propTypes = {
someProp: PropTypes.number.isRequired,
onTap: PropTypes.func.isRequired,
};
OR add default prop values like so:
SomeClass.defaultProps = {
someProp: 1
};
If you are anything like me, unexperienced or unfamiliar with reactjs, you may also get this error: Must use destructuring props assignment
. To fix this error, define your props before they are used. For example:
const { someProp } = this.props;
That code transforms any bootstrap table row that has data-href
attribute set into a clickable element
Note: data-href
attribute is a valid tr
attribute (HTML5), href
attributes on tr element are not.
$(function(){
$('.table tr[data-href]').each(function(){
$(this).css('cursor','pointer').hover(
function(){
$(this).addClass('active');
},
function(){
$(this).removeClass('active');
}).click( function(){
document.location = $(this).attr('data-href');
}
);
});
});
For 1D array, numpy.correlate
is faster than scipy.signal.correlate
, under different sizes, I see a consistent 5x peformance gain using numpy.correlate
. When two arrays are of similar size (the bright line connecting the diagonal), the performance difference is even more outstanding (50x +).
# a simple benchmark
res = []
for x in range(1, 1000):
list_x = []
for y in range(1, 1000):
# generate different sizes of series to compare
l1 = np.random.choice(range(1, 100), size=x)
l2 = np.random.choice(range(1, 100), size=y)
time_start = datetime.now()
np.correlate(a=l1, v=l2)
t_np = datetime.now() - time_start
time_start = datetime.now()
scipy.signal.correlate(in1=l1, in2=l2)
t_scipy = datetime.now() - time_start
list_x.append(t_scipy / t_np)
res.append(list_x)
plt.imshow(np.matrix(res))
As default, scipy.signal.correlate calculates a few extra numbers by padding and that might explained the performance difference.
>> l1 = [1,2,3,2,1,2,3]
>> l2 = [1,2,3]
>> print(numpy.correlate(a=l1, v=l2))
>> print(scipy.signal.correlate(in1=l1, in2=l2))
[14 14 10 10 14]
[ 3 8 14 14 10 10 14 8 3] # the first 3 is [0,0,1]dot[1,2,3]
Element, Pseudo Element: d = 1 – (0,0,0,1)
Class, Pseudo class, Attribute: c = 1 – (0,0,1,0)
Id: b = 1 – (0,1,0,0)
Inline Style: a = 1 – (1,0,0,0)
Inline css ( html style attribute ) overrides css rules in style tag and css file
A more specific selector takes precedence over a less specific one.
Rules that appear later in the code override earlier rules if both have the same specificity.
I apologize for resurrecting this question but I stumbled upon this thread and found a small issue. For anyone wanting a character limit that will remove words that would go above your given limit, the above answers work great. In my specific case, I like to display a word if the limit falls in the middle of said word. I decided to share my solution in case anyone else is looking for this functionality and needs to include words instead of trimming them out.
function str_limit($str, $len = 100, $end = '...')
{
if(strlen($str) < $len)
{
return $str;
}
$str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
if(strlen($str) <= $len)
{
return $str;
}
$out = '';
foreach(explode(' ', trim($str)) as $val)
{
$out .= $val . ' ';
if(strlen($out) >= $len)
{
$out = trim($out);
return (strlen($out) == strlen($str)) ? $out : $out . $end;
}
}
}
Examples:
echo str_limit('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 100, '...');
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore...
echo str_limit('Lorem ipsum', 100, '...');
Lorem ipsum
echo str_limit('Lorem ipsum', 1, '...');
Lorem...
To expand on the "use JAXB" comments above,
In Windows
"%java_home%\bin\xjc" -p [your namespace] [xsd_file].xsd
e.g.,
"%java_home%\bin\xjc" -p com.mycompany.quickbooks.obj quickbooks.xsd
Wait a bit, and if you had a well-formed XSD file, you will get some well-formed Java classes
@media (min-width: @screen-sm-min) {
div.equal-height-sm {
display: table;
> div[class^='col-'] {
display: table-cell;
float: none;
vertical-align: top;
}
}
}
<div class="equal-height-sm">
<div class="col-xs-12 col-sm-7">Test<br/>Test<br/>Test</div>
<div class="col-xs-12 col-sm-5">Test</div>
</div>
Example:
https://jsfiddle.net/b9chris/njcnex83/embedded/result/
Adapted from several answers here. The flexbox-based answers are the right way once IE8 and 9 are dead, and once Android 2.x is dead, but that is not true in 2015, and likely won't be in 2016. IE8 and 9 still make up 4-6% of usage depending on how you measure, and for many corporate users it's much worse. http://caniuse.com/#feat=flexbox
The display: table
, display: table-cell
trick is more backwards-compatible - and one great thing is the only serious compatibility issue is a Safari issue where it forces box-sizing: border-box
, something already applied to your Bootstrap tags. http://caniuse.com/#feat=css-table
You can obviously add more classes that do similar things, like .equal-height-md
. I tied these to divs for the small performance benefit in my constrained usage, but you could remove the tag to make it more generalized like the rest of Bootstrap.
Note that the jsfiddle here uses CSS, and so, things Less would otherwise provide are hard-coded in the linked example. For example @screen-sm-min has been replaced with what Less would insert - 768px.
I made a convenient underscore mixin for this.
_.isIE(); // Any version of IE?
_.isIE(9); // IE 9?
_.isIE([7,8,9]); // IE 7, 8 or 9?
_.mixin({_x000D_
isIE: function(mixed) {_x000D_
if (_.isUndefined(mixed)) {_x000D_
mixed = [7, 8, 9, 10, 11];_x000D_
} else if (_.isNumber(mixed)) {_x000D_
mixed = [mixed];_x000D_
}_x000D_
for (var j = 0; j < mixed.length; j++) {_x000D_
var re;_x000D_
switch (mixed[j]) {_x000D_
case 11:_x000D_
re = /Trident.*rv\:11\./g;_x000D_
break;_x000D_
case 10:_x000D_
re = /MSIE\s10\./g;_x000D_
break;_x000D_
case 9:_x000D_
re = /MSIE\s9\./g;_x000D_
break;_x000D_
case 8:_x000D_
re = /MSIE\s8\./g;_x000D_
break;_x000D_
case 7:_x000D_
re = /MSIE\s7\./g;_x000D_
break;_x000D_
}_x000D_
_x000D_
if (!!window.navigator.userAgent.match(re)) {_x000D_
return true;_x000D_
}_x000D_
}_x000D_
_x000D_
return false;_x000D_
}_x000D_
});_x000D_
_x000D_
console.log(_.isIE());_x000D_
console.log(_.isIE([7, 8, 9]));_x000D_
console.log(_.isIE(11));
_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
_x000D_
Thanks to this site by Mkyong, the only solution that actually worked for us to pass a parameter was this
<h:commandLink action="#{user.editAction}">
<f:param name="myId" value="#{param.id}" />
</h:commandLink>
with
public String editAction() {
Map<String,String> params =
FacesContext.getExternalContext().getRequestParameterMap();
String idString = params.get("myId");
long id = Long.parseLong(idString);
...
}
Technically, that you cannot pass to the method itself directly, but to the JSF request parameter map
.
If you can construct the vector after you've gotten the array and array size, you can just say:
std::vector<ValueType> vec(a, a + n);
...assuming a
is your array and n
is the number of elements it contains. Otherwise, std::copy()
w/resize()
will do the trick.
I'd stay away from memcpy()
unless you can be sure that the values are plain-old data (POD) types.
Also, worth noting that none of these really avoids the for loop--it's just a question of whether you have to see it in your code or not. O(n) runtime performance is unavoidable for copying the values.
Finally, note that C-style arrays are perfectly valid containers for most STL algorithms--the raw pointer is equivalent to begin()
, and (ptr + n
) is equivalent to end()
.
find ./ -type f -exec dos2unix {} \;
to recursively convert all line-endings within current folderIf you wish to use "like" as a parameter your link needs to be:
<a href="/topic.php?like=like">Like</a>
More likely though is that you want:
<a href="/topic.php?id=14&like=like">Like</a>
This indicates you are trying to put something too big into a column. For example, you have a VARCHAR2(10) column and you are putting in 11 characters. Same thing with number.
This is happening at line 176 of package UMAIN. You would need to go and have a look at that to see what it is up to. Hopefully you can look it up in your source control (or from user_source). Later versions of Oracle report this error better, telling you which column and what value.
I have made a small batch script that can determine PowerShell version:
@echo off
for /f "tokens=2 delims=:" %%a in ('powershell -Command Get-Host ^| findstr /c:Version') do (echo %%a)
This simply extracts the version of PowerShell using Get-Host
and searches the string Version
When the line with the version is found, it uses the for
command to extract the version. In this case we are saying that the delimiter is a colon and search next the first colon, resulting in my case 5.1.18362.752
.
The Simplest solution is here: If you are using Visual Studio, from the Solution Explorer
, right click on your project file. Choose Properties
. Select Icon and manifest
then Browse your .ico
file.
SQL Server :
SELECT [activity_dt], count(*)
FROM table1
GROUP BY DATEPART(day, [activity_dt]), DATEPART(hour, [activity_dt]);
Oracle :
SELECT [activity_dt], count(*)
FROM table1
GROUP BY TO_CHAR(activity_dt, 'DD'), TO_CHAR(activity_dt, 'hh');
MySQL :
SELECT [activity_dt], count(*)
FROM table1
GROUP BY hour( activity_dt ) , day( activity_dt )
If you use the new querySelectorAll you can call forEach directly.
document.querySelectorAll('.edit').forEach(function(button) {
// Now do something with my button
});
Per the comment below. nodeLists do not have a forEach function.
If using this with babel you can add Array.from
and it will convert non node lists to a forEach array. Array.from
does not work natively in browsers below and including IE 11.
Array.from(document.querySelectorAll('.edit')).forEach(function(button) {
// Now do something with my button
});
At our meetup last night I discovered another way to handle node lists not having forEach
[...document.querySelectorAll('.edit')].forEach(function(button) {
// Now do something with my button
});
Showing as Node List
Showing as Array
I do not know what I am doing but that worked for me :
OTHER_BRIDGE=br-xxxxx # this is the other random docker bridge (`ip addr` to find)
service docker stop
ip link set dev $OTHER_BRIDGE down
ip link set dev docker0 down
ip link delete $OTHER_BRIDGE type bridge
ip link delete docker0 type bridge
service docker start && service docker stop
iptables -t nat -A POSTROUTING ! -o docker0 -s 172.17.0.0/16 -j MASQUERADE
iptables -t nat -A POSTROUTING ! -o docker0 -s 172.18.0.0/16 -j MASQUERADE
service docker start
JavaScript:
document.getElementsByTagName('head')[0].appendChild( ... );
Make DOM element like so:
link=document.createElement('link');
link.href='href';
link.rel='rel';
document.getElementsByTagName('head')[0].appendChild(link);
in function
def handleUpload():
if 'photo' in request.files:
photo = request.files['photo']
if photo.filename != '':
image = request.files['photo']
image_string = base64.b64encode(image.read())
image_string = image_string.decode('utf-8')
#use this to remove b'...' to get raw string
return render_template('handleUpload.html',filestring = image_string)
return render_template('upload.html')
in html file
<html>
<head>
<title>Simple file upload using Python Flask</title>
</head>
<body>
{% if filestring %}
<h1>Raw image:</h1>
<h1>{{filestring}}</h1>
<img src="data:image/png;base64, {{filestring}}" alt="alternate" />.
{% else %}
<h1></h1>
{% endif %}
</body>
What happens after login (to which url the user is redirected) is handled by the AuthenticationSuccessHandler
.
This interface (a concrete class implementing it is SavedRequestAwareAuthenticationSuccessHandler
) is invoked by the AbstractAuthenticationProcessingFilter
or one of its subclasses like (UsernamePasswordAuthenticationFilter
) in the method successfulAuthentication
.
So in order to have an other redirect in case 3 you have to subclass SavedRequestAwareAuthenticationSuccessHandler
and make it to do what you want.
Sometimes (depending on your exact usecase) it is enough to enable the useReferer
flag of AbstractAuthenticationTargetUrlRequestHandler
which is invoked by SimpleUrlAuthenticationSuccessHandler
(super class of SavedRequestAwareAuthenticationSuccessHandler
).
<bean id="authenticationFilter"
class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
<property name="filterProcessesUrl" value="/login/j_spring_security_check" />
<property name="authenticationManager" ref="authenticationManager" />
<property name="authenticationSuccessHandler">
<bean class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler">
<property name="useReferer" value="true"/>
</bean>
</property>
<property name="authenticationFailureHandler">
<bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
<property name="defaultFailureUrl" value="/login?login_error=t" />
</bean>
</property>
</bean>
I will make it simple,
Major difference is in require, entire JS file is called or imported. Even if you don't need some part of it.
var myObject = require('./otherFile.js'); //This JS file will be imported fully.
Whereas in import you can extract only objects/functions/variables which are required.
import { getDate }from './utils.js';
//Here I am only pulling getDate method from the file instead of importing full file
Another major difference is you can use require
anywhere in the program where as import
should always be at the top of file
INSERT INTO Test([col1],[col2]) (
SELECT
a.Name AS [col1],
b.sub AS [col2]
FROM IdTable b
INNER JOIN Nametable a ON b.no = a.no
)
Well, I guess that Flex' implementation of the SOAP Encoder seems to serialize null values incorrectly. Serializing them as a String Null doesn't seem to be a good solution. The formally correct version seems to be to pass a null value as:
<childtag2 xsi:nil="true" />
So the value of "Null" would be nothing else than a valid string, which is exactly what you are looking for.
I guess getting this fixed in Apache Flex shouldn't be that hard to get done. I would recommend opening a Jira issue or to contact the guys of the apache-flex mailinglist. However this would only fix the client side. I can't say if ColdFusion will be able to work with null values encoded this way.
See also Radu Cotescu's blog post How to send null values in soapUI requests.
I converted @syockit's answer as well as the step-down approach into a reusable Angular service for anyone who's interested: https://gist.github.com/fisch0920/37bac5e741eaec60e983
I included both solutions because they both have their own pros / cons. The lanczos convolution approach is higher quality at the cost of being slower, whereas the step-wise downscaling approach produces reasonably antialiased results and is significantly faster.
Example usage:
angular.module('demo').controller('ExampleCtrl', function (imageService) {
// EXAMPLE USAGE
// NOTE: it's bad practice to access the DOM inside a controller,
// but this is just to show the example usage.
// resize by lanczos-sinc filter
imageService.resize($('#myimg')[0], 256, 256)
.then(function (resizedImage) {
// do something with resized image
})
// resize by stepping down image size in increments of 2x
imageService.resizeStep($('#myimg')[0], 256, 256)
.then(function (resizedImage) {
// do something with resized image
})
})
Try to avoid what I have now decided to call Newbiecategoryaholism. When newcomers to Objective-C discover categories they often go hog wild, adding useful little categories to every class in existence ("What? i can add a method to convert a number to roman numerals to NSNumber rock on!").
Don't do this.
Your code will be more portable and easier to understand with out dozens of little category methods sprinkled on top of two dozen foundation classes.
Most of the time when you really think you need a category method to help streamline some code you'll find you never end up reusing the method.
There are other dangers too, unless you're namespacing your category methods (and who besides the utterly insane ddribin is?) there is a chance that Apple, or a plugin, or something else running in your address space will also define the same category method with the same name with a slightly different side effect....
OK. Now that you've been warned, ignore the "don't do this part". But exercise extreme restraint.
Use the 'And' keyword for a logical and. Like this:
If Not ((filename = testFileName) And (fileName <> "")) Then
now you have imported android.R
instead of your own R... Try to take a look on your "problems" view if you have errors in one of your xml files... get rid of the import android.R
and comment out all usages of R.*
Cleaning should help when your project has no other errors, so check your xml files or file naming in your res folders
For the allowed characters you can use
^[a-zA-Z0-9~@#$^*()_+=[\]{}|\\,.?: -]*$
to validate a complete string that should consist of only allowed characters. Note that -
is at the end (because otherwise it'd be a range) and a few characters are escaped.
For the invalid characters you can use
[<>'"/;`%]
to check for them.
To combine both into a single regex you can use
^(?=[a-zA-Z0-9~@#$^*()_+=[\]{}|\\,.?: -]*$)(?!.*[<>'"/;`%])
but you'd need a regex engine that allows lookahead.
obj={};
$.each(obj, function (key, value) {
console.log(key+ ' : ' + value); //push the object value
});
for (var i in obj) {
nameList += "" + obj[i] + "";//display the object value
}
$("id/class").html($(nameList).length);//display the length of object.
A helpful blog post on the subject, linked to from within the Modernizr source for detecting touch events. Conclusion: it's not possible to reliably detect touchscreen devices from Javascript.
Better late than never.
I had difficulties reading files line by line in some circumstances. The method below is the best I found, so far, and I recommend it.
Usage: String yourData = LoadData("YourDataFile.txt");
Where YourDataFile.txt is assumed to reside in assets/
public String LoadData(String inFile) {
String tContents = "";
try {
InputStream stream = getAssets().open(inFile);
int size = stream.available();
byte[] buffer = new byte[size];
stream.read(buffer);
stream.close();
tContents = new String(buffer);
} catch (IOException e) {
// Handle exceptions here
}
return tContents;
}
I don't know why, but for some reason, the "/bin/bash" version didn't work for me. Instead, the simpler version worked, following the example given here at Oracle Docs.
String[] args = new String[] {"ping", "www.google.com"};
Process proc = new ProcessBuilder(args).start();
you could do this, if you want to use the old syntax (or don't want to rewrite every template)
@for $i from 1 through $grid-columns {
@include media-breakpoint-up(xs) {
.col-xs-#{$i} {
@include make-col-ready();
@include make-col($i);
}
}
}
For those who may stumble across this post, you need to set
font-family: FontAwesome;
as a property in your CSS selector and then unicode will work fine in CSS
I think it's easiest:
First set any Label as you like (Italic, Bold, Size etc.) And:
yourDataGridView.Font = anyLabel.Font;
Here is a pretty simple socket program. This is about as simple as sockets get.
for the client program(CPU 1)
import socket
s = socket.socket()
host = '111.111.0.11' # needs to be in quote
port = 1247
s.connect((host, port))
print s.recv(1024)
inpt = raw_input('type anything and click enter... ')
s.send(inpt)
print "the message has been sent"
You have to replace the 111.111.0.11 in line 4 with the IP number found in the second computers network settings.
For the server program(CPU 2)
import socket
s = socket.socket()
host = socket.gethostname()
port = 1247
s.bind((host,port))
s.listen(5)
while True:
c, addr = s.accept()
print("Connection accepted from " + repr(addr[1]))
c.send("Server approved connection\n")
print repr(addr[1]) + ": " + c.recv(1026)
c.close()
Run the server program and then the client one.
java android
in my case
I want to change from
~/propic/........png
anything after /propic/ doesn't matter what before it
........png
finally, I found the code in Class StringUtils
this is the code
public static String substringAfter(final String str, final String separator) {
if (isEmpty(str)) {
return str;
}
if (separator == null) {
return "";
}
final int pos = str.indexOf(separator);
if (pos == 0) {
return str;
}
return str.substring(pos + separator.length());
}
The key is in the quotes around the colon and &, i.e. rows(variable & ":" & variable).select
Adapt this:
Rows(x & ":" & y).select
where x and y are your variables.
Some other examples that may help you understand
Rows(x & ":" & x).select
Or
Rows((x+1) & ":" (x*3)).select
Or
Rows((x+2) & ":" & (y-3)).select
Hopefully you get the idea.
As @Raheel Answered it will fine but if you are working with Laravel 7/6
Then Eloquent whereIn
Query.
Example1:
$users = User::wherein('id',[1,2,3])->get();
Example2:
$users = DB::table('users')->whereIn('id', [1, 2, 3])->get();
Example3:
$ids = [1,2,3];
$users = User::wherein('id',$ids)->get();
This depends on what you mean by "get the range of selection". If you mean getting the range address (like "A1:B1") then use the Address property of Selection object - as Michael stated Selection object is much like a Range object, so most properties and methods works on it.
Sub test()
Dim myString As String
myString = Selection.Address
End Sub
Try this:
UPDATE test
SET
field = 1
WHERE id = 123 and condition
For me, I couldn't get this to return a hash.
results = ActiveRecord::Base.connection.execute(sql)
But using the exec_query method worked.
results = ActiveRecord::Base.connection.exec_query(sql)
In case of getting "Could not locate device support files" after your device iOS version has been updated and your Xcode is still old version, just copy old SDK under new name and restart Xcode. Open your terminal and do following:
$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
$ cp -rpv 10.3.1\ \(14E8301\)/ 11.2.1
Restart Xcode and it will most probably work.
I guess your app crashes because of NullPointerException
.
Change this
ListView lv = (ListView)getActivity().findViewById(R.id.lv_contact);
to
ListView lv = (ListView)rootView.findViewById(R.id.lv_contact);
assuming listview belongs to the fragment layout.
The rest of the code looks alright
Edit:
Well since you said it is not working i tried it myself
Checkout intent properties like no history , clear back stack etc ... Intent.setFlags
Intent mStartActivity = new Intent(HomeActivity.this, SplashScreen.class);
int mPendingIntentId = 123456;
PendingIntent mPendingIntent = PendingIntent.getActivity(HomeActivity.this, mPendingIntentId, mStartActivity,
PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager) HomeActivity.this.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);
System.exit(0);
Without having Visual Studio, you can grab Nuget from: http://nuget.org/nuget.exe
For command-line executions using this, check out: http://docs.nuget.org/docs/reference/command-line-reference
With respect to Powershell, just copy the nuget.exe to the machine. No installation required, just execute it using commands from the above documentation.
You can use a mail web service such as Postmark, Sendgrid etc.
Sendgrid vs Postmark vs Amazon SES and other email/SMTP API providers?
Edit: I just use the Google Gmail API now. I had trouble sending reminder email to my employer's organization due to strict filters. But Gmail works as long as you don't spam people.
You are debugging two or more times. so the application may run more at a time. Then only this issue will occur. You should close all debugging applications using task-manager, Then debug again.
From ?read.table
: The number of data columns is determined by looking at the first five lines of input (or the whole file if it has less than five lines), or from the length of col.names if it is specified and is longer. This could conceivably be wrong if fill or blank.lines.skip are true, so specify col.names if necessary.
So, perhaps your data file isn't clean. Being more specific will help the data import:
d = read.table("foobar.txt",
sep="\t",
col.names=c("id", "name"),
fill=FALSE,
strip.white=TRUE)
will specify exact columns and fill=FALSE
will force a two column data frame.
You need to make both your method - printMenu()
and getUserChoice()
static
, as you are directly invoking them from your static main
method, without creating an instance of the class, those methods are defined in. And you cannot invoke a non-static
method without any reference to an instance of the class they are defined in.
Alternatively you can change the method invocation part to:
BookStoreApp2 bookStoreApp = new BookStoreApp2();
bookStoreApp.printMenu();
bookStoreApp.getUserChoice();
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
}
const tifOptions = [];
for (const [key, value] of Object.entries(tifs)) {
tifOptions.push(<option value={key} key={key}>{value}</option>);
}
return (
<select id="tif" name="tif" onChange={this.handleChange}>
{ tifOptions }
</select>
)
in my case this is the solution to fix it. When you create a project select MinGW GCC from the Toolchains panel.
Once the project is created, select project file, press ctrl + b to build the project. Then hit run and the the output should be printed on the console.
You should be able to put them in your ~/matlab on unix.
I'm not sure which directory matlab looks in for windows, but you should be able to figure it out by executing userpath
from the matlab command line.
The below code worked fine:
Run Keyword if '${value1}' \ \ == \ \ '${cost1}' \ and \ \ '${value2}' \ \ == \ \ 'cost2' LOG HELLO
If you're looking for a 1 liner, this does well.
new Point(Mouse.GetPosition(mWindow).X + mWindow.Left, Mouse.GetPosition(mWindow).Y + mWindow.Top)
The + mWindow.Left
and + mWindow.Top
makes sure the position is in the right place even when the user drags the window around.
A note of personal experience in addition to both Stefan Gehrig's answer and Dave None's answer (and mmmshuddup's reply):
I was having validation problems using both \n and PHP_EOL when I used the ICS validator at http://severinghaus.org/projects/icv/
I learned I had to use \r\n in order to get it to validate properly, so this was my solution:
function dateToCal($timestamp) {
return date('Ymd\Tgis\Z', $timestamp);
}
function escapeString($string) {
return preg_replace('/([\,;])/','\\\$1', $string);
}
$eol = "\r\n";
$load = "BEGIN:VCALENDAR" . $eol .
"VERSION:2.0" . $eol .
"PRODID:-//project/author//NONSGML v1.0//EN" . $eol .
"CALSCALE:GREGORIAN" . $eol .
"BEGIN:VEVENT" . $eol .
"DTEND:" . dateToCal($end) . $eol .
"UID:" . $id . $eol .
"DTSTAMP:" . dateToCal(time()) . $eol .
"DESCRIPTION:" . htmlspecialchars($title) . $eol .
"URL;VALUE=URI:" . htmlspecialchars($url) . $eol .
"SUMMARY:" . htmlspecialchars($description) . $eol .
"DTSTART:" . dateToCal($start) . $eol .
"END:VEVENT" . $eol .
"END:VCALENDAR";
$filename="Event-".$id;
// Set the headers
header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename=' . $filename);
// Dump load
echo $load;
That stopped my parse errors and made my ICS files validate properly.
I don't know what things were like in the alpha, but I'm using beta 12 right now and this works fine. If you have an array of objects, create a select like this:
<select [(ngModel)]="simpleValue"> // value is a string or number
<option *ngFor="let obj of objArray" [value]="obj.value">{{obj.name}}</option>
</select>
If you want to match on the actual object, I'd do it like this:
<select [(ngModel)]="objValue"> // value is an object
<option *ngFor="let obj of objArray" [ngValue]="obj">{{obj.name}}</option>
</select>
I feel like there should be a no javascript solution, but how is this?
$(window).resize(function() {
$('#content').height($(window).height() - 46);
});
$(window).trigger('resize');
File.WriteAllText(path, String.Empty);
Alternatively,
File.Create(path).Close();
Header fields are not copied to subsequent requests. You should use either cookie for this (addCookie method) or store "REMOTE_USER" in session (which you can obtain with getSession method).
An easy way is to convert the dates into milliseconds after January 1, 1970 (use Date.getTime()) and then compare these values.
If you want something more similar to your example try _itot_s. On Microsoft compilers _itot_s points to _itoa_s or _itow_s depending on your Unicode setting:
CString str;
_itot_s( 15, str.GetBufferSetLength( 40 ), 40, 10 );
str.ReleaseBuffer();
it should be slightly faster since it doesn't need to parse an input format.
If you want to manipulate the actual CSS class instead of modifying the DOM elements or using modifier CSS classes, see https://stackoverflow.com/a/50036923/482916.
If you need to set the user header string in the curl request, you can use the -H
option to set user agent like:
curl -H "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36" http://stackoverflow.com/questions/28760694/how-to-use-curl-to-get-a-get-request-exactly-same-as-using-chrome
Updated user-agent form newest Chrome at 02-22-2021
Using a proxy tool like Charles Proxy really helps make short work of something like what you are asking. Here is what I do, using this SO page as an example (as of July 2015 using Charles version 3.10):
You now have a cURL request you can run in a terminal that will mirror the request your browser made. Here is what my request to this page looked like (with the cookie header removed):
curl -H "Host: stackoverflow.com" -H "Cache-Control: max-age=0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36" -H "HTTPS: 1" -H "DNT: 1" -H "Referer: https://www.google.com/" -H "Accept-Language: en-US,en;q=0.8,en-GB;q=0.6,es;q=0.4" -H "If-Modified-Since: Thu, 23 Jul 2015 20:31:28 GMT" --compressed http://stackoverflow.com/questions/28760694/how-to-use-curl-to-get-a-get-request-exactly-same-as-using-chrome
In my application i have component and all data is coming from API which i am calling in Component's constructor. There is button by which i am updating my page data. on button click i have save data in back end and refresh data. So to reload/refresh the component - as per my requirement - is only to refresh the data. if this is also your requirement then use the same code written in constructor of component.
A version I do not believe that has been posted yet. I tested with python 2.7 on Ubuntu 12.04.
Found this solution at : http://code.activestate.com/recipes/439094-get-the-ip-address-associated-with-a-network-inter/
import socket
import fcntl
import struct
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915, # SIOCGIFADDR
struct.pack('256s', ifname[:15])
)[20:24])
Example Result:
>>> get_ip_address('eth0')
'38.113.228.130'
I saw some answers at this post and it's possible to be considered completed base knowledge, because have a several approaches in C# Programming to resolve the same problem. Only one thing that is necessary to be considered is about a difference between Pure UTF-8 and UTF-8 with B.O.M..
In last week, at my job, I need to develop one functionality that outputs CSV files with B.O.M. and other CSVs with pure UTF-8 (without B.O.M.), each CSV file Encoding type will be consumed by different non-standardized APIs, that one API read UTF-8 with B.O.M. and the other API read without B.O.M.. I need to research the references about this concept, reading "What's the difference between UTF-8 and UTF-8 without B.O.M.?" Stack Overflow discussion and this Wikipedia link "Byte order mark" to build my approach.
Finally, my C# Programming for the both UTF-8 encoding types (with B.O.M. and pure) needed to be similar like this example bellow:
//for UTF-8 with B.O.M., equals shared by Zanoni (at top)
string result = System.Text.Encoding.UTF8.GetString(byteArray);
//for Pure UTF-8 (without B.O.M.)
string result = (new UTF8Encoding(false)).GetString(byteArray);
Aliases are meant for aliasing command names. Anything beyond that should be done with functions.
alias ll='ls -l' # The ll command is an alias for ls -l
Aliases are names that are still associated with the original name. ll
is just a slightly specific kind of ls
.
d() {
if exists colordiff; then
colordiff -ur "$@"
elif exists diff; then
diff -ur "$@"
elif exists comm; then
comm -3 "$1" "$2"
fi | less
}
A function is a new command that has internal logic. It isn't simply a rename of another command. It does internal operations.
Technically, aliases in the Bash shell language are so limited in capabilities that they are extremely ill suited for anything that involves more than a single command. Use them for making a small mutation of a single command, nothing more.
Since the intention is to create a new command that performs an operation which internally will resolve in other commands, the only correct answer is to use a function here:
lock() {
gnome-screensaver
gnome-screensaver-command --lock
}
Usage of aliases in a scenario like this runs into a lot of issues. Contrary to functions, which are executed as commands, aliases are expanded into the current command, which will lead to very unexpected issues when combining this alias "command" with other commands. They also don't work in scripts.
For Query parameters like domain.com/test?format=json&type=mini
format, then you can easily receive it via - req.query.
app.get('/test', function(req, res){
var format = req.query.format,
type = req.query.type;
});
The solution is to compare Input::old()
with the $key
variable.
@if (Input::old('title') == $key)
<option value="{{ $key }}" selected>{{ $val }}</option>
@else
<option value="{{ $key }}">{{ $val }}</option>
@endif
I'm playing with this too. It seems strange that you can just declare an empty dictionary and then add a key/value pair to it like so :
var emptyDictionary = Dictionary<String, Float>()
var flexDictionary = [:]
emptyDictionary["brian"] = 4.5
flexDictionary["key"] = "value" // ERROR : cannot assign to the result of this expression
But you can create a Dictionary that accepts different value types by using the "Any" type like so :
var emptyDictionary = Dictionary<String, Any>()
emptyDictionary["brian"] = 4.5
emptyDictionary["mike"] = "hello"
JQuery UI makes light work out of creating toggle buttons. Just put this
<label for="myToggleButton">my toggle button caption</label>
<input type="checkbox" id="myToggleButton" />
on your page and then in your body onLoad
or your $.ready()
(or some object literals init()
function if your building an ajax site..) drop some JQuery like so:
$("#myToggleButton").button()
thats it. (don't forget the < label for=...>
because JQueryUI uses that for the body of the toggle button..)
From there you just work with it like any other input="checkbox
" because that is what the underlying control still is but JQuery UI just skins it to look like a pretty toggle button on screen.
You can't set the field having data-type "text". Only because of that thing you are getting this error. Try to change the data-type with int
Do you have Enable Autogrowth and Unrestricted File Growth both enabled for the log file? You can edit these via SSMS in "Database Properties > Files"
Here is how you can create a rounded rectangle with SVG Path:
<path d="M100,100 h200 a20,20 0 0 1 20,20 v200 a20,20 0 0 1 -20,20 h-200 a20,20 0 0 1 -20,-20 v-200 a20,20 0 0 1 20,-20 z" />
Explanation
m100,100: move to point(100,100)
h200: draw a 200px horizontal line from where we are
a20,20 0 0 1 20,20: draw an arc with 20px X radius, 20px Y radius, clockwise, to a point with 20px difference in X and Y axis
v200: draw a 200px vertical line from where we are
a20,20 0 0 1 -20,20: draw an arc with 20px X and Y radius, clockwise, to a point with -20px difference in X and 20px difference in Y axis
h-200: draw a -200px horizontal line from where we are
a20,20 0 0 1 -20,-20: draw an arc with 20px X and Y radius, clockwise, to a point with -20px difference in X and -20px difference in Y axis
v-200: draw a -200px vertical line from where we are
a20,20 0 0 1 20,-20: draw an arc with 20px X and Y radius, clockwise, to a point with 20px difference in X and -20px difference in Y axis
z: close the path
<svg width="440" height="440">_x000D_
<path d="M100,100 h200 a20,20 0 0 1 20,20 v200 a20,20 0 0 1 -20,20 h-200 a20,20 0 0 1 -20,-20 v-200 a20,20 0 0 1 20,-20 z" fill="none" stroke="black" stroke-width="3" />_x000D_
</svg>
_x000D_
What I do with my TestNG, (sorry, JUnit doesn't support this) test cases is I can assign a group to the test I want to run
@Test(groups="broken")
And then simply run 'mvn -Dgroups=broken'.
You can create .war file back from your existing folder.
Using this command
cd /to/your/folder/location
jar -cvf my_web_app.war *
I was having this same issue while my JAVA_HOME system variable was pointing to C:\Program Files\Java\jdk1.8.0_171\bin and my PATH entry consisted of just %JAVA_HOME%.
I changed my JAVA_HOME variable to exclude the bin folder (C:\Program Files\Java\jdk1.8.0_171), and added the bin folder to the system PATH variable: %JAVA_HOME%\bin,
Just add
style="white-space:nowrap;"
Example:
<table class="blueTable" style="white-space:nowrap;">
<tr>
<td>My name is good</td>
</tr>
</table>
length is constant which is used to find out the array storing capacity not the number of elements in the array
Example:
int[] a = new int[5]
a.length
always returns 5, which is called the capacity of an array. But
number of elements in the array is called size
Example:
int[] a = new int[5]
a[0] = 10
Here the size would be 1, but a.length
is still 5. Mind that there is no actual property or method called size
on an array so you can't just call a.size
or a.size()
to get the value 1.
The size()
method is available for collections, length
works with arrays in Java.
I will recommend to use an alternative method using seaborn
which more powerful tool for data plotting. You can use seaborn scatterplot
and define colum 3 as hue
and size
.
Working code:
import pandas as pd
import seaborn as sns
import numpy as np
#creating sample data
sample_data={'col_name_1':np.random.rand(20),
'col_name_2': np.random.rand(20),'col_name_3': np.arange(20)*100}
df= pd.DataFrame(sample_data)
sns.scatterplot(x="col_name_1", y="col_name_2", data=df, hue="col_name_3",size="col_name_3")
$('tableName').find('tr').length
Just download and install "Samsung Kies" from this link. and everything would work as required.
Before installing, uninstall the drivers you have installed for your device.
Update:
Two possible solutions:
You need to keep an array of the google.maps.Marker
objects to hide (or remove or run other operations on them).
In the global scope:
var gmarkers = [];
Then push the markers on that array as you create them:
var marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i].latitude, locations[i].longitude),
title: locations[i].title,
icon: icon,
map:map
});
// Push your newly created marker into the array:
gmarkers.push(marker);
Then to remove them:
function removeMarkers(){
for(i=0; i<gmarkers.length; i++){
gmarkers[i].setMap(null);
}
}
working example (toggles the markers)
code snippet:
var gmarkers = [];_x000D_
var RoseHulman = new google.maps.LatLng(39.483558, -87.324593);_x000D_
var styles = [{_x000D_
stylers: [{_x000D_
hue: "black"_x000D_
}, {_x000D_
saturation: -90_x000D_
}]_x000D_
}, {_x000D_
featureType: "road",_x000D_
elementType: "geometry",_x000D_
stylers: [{_x000D_
lightness: 100_x000D_
}, {_x000D_
visibility: "simplified"_x000D_
}]_x000D_
}, {_x000D_
featureType: "road",_x000D_
elementType: "labels",_x000D_
stylers: [{_x000D_
visibility: "on"_x000D_
}]_x000D_
}];_x000D_
_x000D_
var styledMap = new google.maps.StyledMapType(styles, {_x000D_
name: "Campus"_x000D_
});_x000D_
var mapOptions = {_x000D_
center: RoseHulman,_x000D_
zoom: 15,_x000D_
mapTypeControl: true,_x000D_
zoomControl: true,_x000D_
zoomControlOptions: {_x000D_
style: google.maps.ZoomControlStyle.SMALL_x000D_
},_x000D_
mapTypeControlOptions: {_x000D_
mapTypeIds: ['map_style', google.maps.MapTypeId.HYBRID],_x000D_
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU_x000D_
},_x000D_
scrollwheel: false,_x000D_
streetViewControl: true,_x000D_
_x000D_
};_x000D_
_x000D_
var map = new google.maps.Map(document.getElementById('map'), mapOptions);_x000D_
map.mapTypes.set('map_style', styledMap);_x000D_
map.setMapTypeId('map_style');_x000D_
_x000D_
var infowindow = new google.maps.InfoWindow({_x000D_
maxWidth: 300,_x000D_
infoBoxClearance: new google.maps.Size(1, 1),_x000D_
disableAutoPan: false_x000D_
});_x000D_
_x000D_
var marker, i, icon, image;_x000D_
_x000D_
var locations = [{_x000D_
"id": "1",_x000D_
"category": "6",_x000D_
"campus_location": "F2",_x000D_
"title": "Alpha Tau Omega Fraternity",_x000D_
"description": "<p>Alpha Tau Omega house</p>",_x000D_
"longitude": "-87.321133",_x000D_
"latitude": "39.484092"_x000D_
}, {_x000D_
"id": "2",_x000D_
"category": "6",_x000D_
"campus_location": "B2",_x000D_
"title": "Apartment Commons",_x000D_
"description": "<p>The commons area of the apartment-style residential complex</p>",_x000D_
"longitude": "-87.329282",_x000D_
"latitude": "39.483599"_x000D_
}, {_x000D_
"id": "3",_x000D_
"category": "6",_x000D_
"campus_location": "B2",_x000D_
"title": "Apartment East",_x000D_
"description": "<p>Apartment East</p>",_x000D_
"longitude": "-87.328809",_x000D_
"latitude": "39.483748"_x000D_
}, {_x000D_
"id": "4",_x000D_
"category": "6",_x000D_
"campus_location": "B2",_x000D_
"title": "Apartment West",_x000D_
"description": "<p>Apartment West</p>",_x000D_
"longitude": "-87.329732",_x000D_
"latitude": "39.483429"_x000D_
}, {_x000D_
"id": "5",_x000D_
"category": "6",_x000D_
"campus_location": "C2",_x000D_
"title": "Baur-Sames-Bogart (BSB) Hall",_x000D_
"description": "<p>Baur-Sames-Bogart Hall</p>",_x000D_
"longitude": "-87.325714",_x000D_
"latitude": "39.482382"_x000D_
}, {_x000D_
"id": "6",_x000D_
"category": "6",_x000D_
"campus_location": "D3",_x000D_
"title": "Blumberg Hall",_x000D_
"description": "<p>Blumberg Hall</p>",_x000D_
"longitude": "-87.328321",_x000D_
"latitude": "39.483388"_x000D_
}, {_x000D_
"id": "7",_x000D_
"category": "1",_x000D_
"campus_location": "E1",_x000D_
"title": "The Branam Innovation Center",_x000D_
"description": "<p>The Branam Innovation Center</p>",_x000D_
"longitude": "-87.322614",_x000D_
"latitude": "39.48494"_x000D_
}, {_x000D_
"id": "8",_x000D_
"category": "6",_x000D_
"campus_location": "G3",_x000D_
"title": "Chi Omega Sorority",_x000D_
"description": "<p>Chi Omega house</p>",_x000D_
"longitude": "-87.319905",_x000D_
"latitude": "39.482071"_x000D_
}, {_x000D_
"id": "9",_x000D_
"category": "3",_x000D_
"campus_location": "D1",_x000D_
"title": "Cook Stadium/Phil Brown Field",_x000D_
"description": "<p>Cook Stadium at Phil Brown Field</p>",_x000D_
"longitude": "-87.325258",_x000D_
"latitude": "39.485007"_x000D_
}, {_x000D_
"id": "10",_x000D_
"category": "1",_x000D_
"campus_location": "D2",_x000D_
"title": "Crapo Hall",_x000D_
"description": "<p>Crapo Hall</p>",_x000D_
"longitude": "-87.324368",_x000D_
"latitude": "39.483709"_x000D_
}, {_x000D_
"id": "11",_x000D_
"category": "6",_x000D_
"campus_location": "G3",_x000D_
"title": "Delta Delta Delta Sorority",_x000D_
"description": "<p>Delta Delta Delta</p>",_x000D_
"longitude": "-87.317477",_x000D_
"latitude": "39.482951"_x000D_
}, {_x000D_
"id": "12",_x000D_
"category": "6",_x000D_
"campus_location": "D2",_x000D_
"title": "Deming Hall",_x000D_
"description": "<p>Deming Hall</p>",_x000D_
"longitude": "-87.325822",_x000D_
"latitude": "39.483421"_x000D_
}, {_x000D_
"id": "13",_x000D_
"category": "5",_x000D_
"campus_location": "F1",_x000D_
"title": "Facilities Operations",_x000D_
"description": "<p>Facilities Operations</p>",_x000D_
"longitude": "-87.321782",_x000D_
"latitude": "39.484916"_x000D_
}, {_x000D_
"id": "14",_x000D_
"category": "2",_x000D_
"campus_location": "E3",_x000D_
"title": "Flame of the Millennium",_x000D_
"description": "<p>Flame of Millennium sculpture</p>",_x000D_
"longitude": "-87.323306",_x000D_
"latitude": "39.481978"_x000D_
}, {_x000D_
"id": "15",_x000D_
"category": "5",_x000D_
"campus_location": "E2",_x000D_
"title": "Hadley Hall",_x000D_
"description": "<p>Hadley Hall</p>",_x000D_
"longitude": "-87.324046",_x000D_
"latitude": "39.482887"_x000D_
}, {_x000D_
"id": "16",_x000D_
"category": "2",_x000D_
"campus_location": "F2",_x000D_
"title": "Hatfield Hall",_x000D_
"description": "<p>Hatfield Hall</p>",_x000D_
"longitude": "-87.322340",_x000D_
"latitude": "39.482146"_x000D_
}, {_x000D_
"id": "17",_x000D_
"category": "6",_x000D_
"campus_location": "C2",_x000D_
"title": "Hulman Memorial Union",_x000D_
"description": "<p>Hulman Memorial Union</p>",_x000D_
"longitude": "-87.32698",_x000D_
"latitude": "39.483574"_x000D_
}, {_x000D_
"id": "18",_x000D_
"category": "1",_x000D_
"campus_location": "E2",_x000D_
"title": "John T. Myers Center for Technological Research with Industry",_x000D_
"description": "<p>John T. Myers Center for Technological Research With Industry</p>",_x000D_
"longitude": "-87.322984",_x000D_
"latitude": "39.484063"_x000D_
}, {_x000D_
"id": "19",_x000D_
"category": "6",_x000D_
"campus_location": "A2",_x000D_
"title": "Lakeside Hall",_x000D_
"description": "<p></p>",_x000D_
"longitude": "-87.330612",_x000D_
"latitude": "39.482804"_x000D_
}, {_x000D_
"id": "20",_x000D_
"category": "6",_x000D_
"campus_location": "F2",_x000D_
"title": "Lambda Chi Alpha Fraternity",_x000D_
"description": "<p>Lambda Chi Alpha</p>",_x000D_
"longitude": "-87.320999",_x000D_
"latitude": "39.48305"_x000D_
}, {_x000D_
"id": "21",_x000D_
"category": "1",_x000D_
"campus_location": "D2",_x000D_
"title": "Logan Library",_x000D_
"description": "<p>Logan Library</p>",_x000D_
"longitude": "-87.324851",_x000D_
"latitude": "39.483408"_x000D_
}, {_x000D_
"id": "22",_x000D_
"category": "6",_x000D_
"campus_location": "C2",_x000D_
"title": "Mees Hall",_x000D_
"description": "<p>Mees Hall</p>",_x000D_
"longitude": "-87.32778",_x000D_
"latitude": "39.483533"_x000D_
}, {_x000D_
"id": "23",_x000D_
"category": "1",_x000D_
"campus_location": "E2",_x000D_
"title": "Moench Hall",_x000D_
"description": "<p>Moench Hall</p>",_x000D_
"longitude": "-87.323695",_x000D_
"latitude": "39.483471"_x000D_
}, {_x000D_
"id": "24",_x000D_
"category": "1",_x000D_
"campus_location": "G4",_x000D_
"title": "Oakley Observatory",_x000D_
"description": "<p>Oakley Observatory</p>",_x000D_
"longitude": "-87.31616",_x000D_
"latitude": "39.483789"_x000D_
}, {_x000D_
"id": "25",_x000D_
"category": "1",_x000D_
"campus_location": "D2",_x000D_
"title": "Olin Hall and Olin Advanced Learning Center",_x000D_
"description": "<p>Olin Hall</p>",_x000D_
"longitude": "-87.324550",_x000D_
"latitude": "39.482796"_x000D_
}, {_x000D_
"id": "26",_x000D_
"category": "6",_x000D_
"campus_location": "C3",_x000D_
"title": "Percopo Hall",_x000D_
"description": "<p>Percopo Hall</p>",_x000D_
"longitude": "-87.328182",_x000D_
"latitude": "39.482121"_x000D_
}, {_x000D_
"id": "27",_x000D_
"category": "6",_x000D_
"campus_location": "G3",_x000D_
"title": "Public Safety Office",_x000D_
"description": "<p>The Office of Public Safety</p>",_x000D_
"longitude": "-87.320377",_x000D_
"latitude": "39.48191"_x000D_
}, {_x000D_
"id": "28",_x000D_
"category": "1",_x000D_
"campus_location": "E2",_x000D_
"title": "Rotz Mechanical Engineering Lab",_x000D_
"description": "<p>Rotz Lab</p>",_x000D_
"longitude": "-87.323247",_x000D_
"latitude": "39.483711"_x000D_
}, {_x000D_
"id": "28",_x000D_
"category": "6",_x000D_
"campus_location": "C2",_x000D_
"title": "Scharpenberg Hall",_x000D_
"description": "<p>Scharpenberg Hall</p>",_x000D_
"longitude": "-87.328139",_x000D_
"latitude": "39.483582"_x000D_
}, {_x000D_
"id": "29",_x000D_
"category": "6",_x000D_
"campus_location": "G2",_x000D_
"title": "Sigma Nu Fraternity",_x000D_
"description": "<p>The Sigma Nu house</p>",_x000D_
"longitude": "-87.31999",_x000D_
"latitude": "39.48374"_x000D_
}, {_x000D_
"id": "30",_x000D_
"category": "6",_x000D_
"campus_location": "E4",_x000D_
"title": "South Campus / Rose-Hulman Ventures",_x000D_
"description": "<p></p>",_x000D_
"longitude": "-87.330623",_x000D_
"latitude": "39.417646"_x000D_
}, {_x000D_
"id": "31",_x000D_
"category": "6",_x000D_
"campus_location": "C3",_x000D_
"title": "Speed Hall",_x000D_
"description": "<p>Speed Hall</p>",_x000D_
"longitude": "-87.326632",_x000D_
"latitude": "39.482121"_x000D_
}, {_x000D_
"id": "32",_x000D_
"category": "3",_x000D_
"campus_location": "C1",_x000D_
"title": "Sports and Recreation Center",_x000D_
"description": "<p></p>",_x000D_
"longitude": "-87.3272",_x000D_
"latitude": "39.484874"_x000D_
}, {_x000D_
"id": "33",_x000D_
"category": "6",_x000D_
"campus_location": "F2",_x000D_
"title": "Triangle Fraternity",_x000D_
"description": "<p>Triangle fraternity</p>",_x000D_
"longitude": "-87.32113",_x000D_
"latitude": "39.483659"_x000D_
}, {_x000D_
"id": "34",_x000D_
"category": "6",_x000D_
"campus_location": "B3",_x000D_
"title": "White Chapel",_x000D_
"description": "<p>The White Chapel</p>",_x000D_
"longitude": "-87.329367",_x000D_
"latitude": "39.482481"_x000D_
}, {_x000D_
"id": "35",_x000D_
"category": "6",_x000D_
"campus_location": "F2",_x000D_
"title": "Women's Fraternity Housing",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.320753",_x000D_
"latitude": "39.482401"_x000D_
}, {_x000D_
"id": "36",_x000D_
"category": "3",_x000D_
"campus_location": "E1",_x000D_
"title": "Intramural Fields",_x000D_
"description": "<p></p>",_x000D_
"longitude": "-87.321267",_x000D_
"latitude": "39.485934"_x000D_
}, {_x000D_
"id": "37",_x000D_
"category": "3",_x000D_
"campus_location": "A3",_x000D_
"title": "James Rendel Soccer Field",_x000D_
"description": "<p></p>",_x000D_
"longitude": "-87.332135",_x000D_
"latitude": "39.480933"_x000D_
}, {_x000D_
"id": "38",_x000D_
"category": "3",_x000D_
"campus_location": "B2",_x000D_
"title": "Art Nehf Field",_x000D_
"description": "<p>Art Nehf Field</p>",_x000D_
"longitude": "-87.330923",_x000D_
"latitude": "39.48022"_x000D_
}, {_x000D_
"id": "39",_x000D_
"category": "3",_x000D_
"campus_location": "B2",_x000D_
"title": "Women's Softball Field",_x000D_
"description": "<p></p>",_x000D_
"longitude": "-87.329904",_x000D_
"latitude": "39.480278"_x000D_
}, {_x000D_
"id": "40",_x000D_
"category": "3",_x000D_
"campus_location": "D1",_x000D_
"title": "Joy Hulbert Tennis Courts",_x000D_
"description": "<p>The Joy Hulbert Outdoor Tennis Courts</p>",_x000D_
"longitude": "-87.323767",_x000D_
"latitude": "39.485595"_x000D_
}, {_x000D_
"id": "41",_x000D_
"category": "6",_x000D_
"campus_location": "B2",_x000D_
"title": "Speed Lake",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.328134",_x000D_
"latitude": "39.482779"_x000D_
}, {_x000D_
"id": "42",_x000D_
"category": "5",_x000D_
"campus_location": "F1",_x000D_
"title": "Recycling Center",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.320098",_x000D_
"latitude": "39.484593"_x000D_
}, {_x000D_
"id": "43",_x000D_
"category": "1",_x000D_
"campus_location": "F3",_x000D_
"title": "Army ROTC",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.321342",_x000D_
"latitude": "39.481992"_x000D_
}, {_x000D_
"id": "44",_x000D_
"category": "2",_x000D_
"campus_location": " ",_x000D_
"title": "Self Made Man",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.326272",_x000D_
"latitude": "39.484481"_x000D_
}, {_x000D_
"id": "P1",_x000D_
"category": "4",_x000D_
"title": "Percopo Parking",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.328756",_x000D_
"latitude": "39.481587"_x000D_
}, {_x000D_
"id": "P2",_x000D_
"category": "4",_x000D_
"title": "Speed Parking",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.327361",_x000D_
"latitude": "39.481694"_x000D_
}, {_x000D_
"id": "P3",_x000D_
"category": "4",_x000D_
"title": "Main Parking",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.326245",_x000D_
"latitude": "39.481446"_x000D_
}, {_x000D_
"id": "P4",_x000D_
"category": "4",_x000D_
"title": "Lakeside Parking",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.330848",_x000D_
"latitude": "39.483284"_x000D_
}, {_x000D_
"id": "P5",_x000D_
"category": "4",_x000D_
"title": "Hatfield Hall Parking",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.321417",_x000D_
"latitude": "39.482398"_x000D_
}, {_x000D_
"id": "P6",_x000D_
"category": "4",_x000D_
"title": "Women's Fraternity Parking",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.320977",_x000D_
"latitude": "39.482315"_x000D_
}, {_x000D_
"id": "P7",_x000D_
"category": "4",_x000D_
"title": "Myers and Facilities Parking",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.322243",_x000D_
"latitude": "39.48417"_x000D_
}, {_x000D_
"id": "P8",_x000D_
"category": "4",_x000D_
"title": "",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.323241",_x000D_
"latitude": "39.484758"_x000D_
}, {_x000D_
"id": "P9",_x000D_
"category": "4",_x000D_
"title": "",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.323617",_x000D_
"latitude": "39.484311"_x000D_
}, {_x000D_
"id": "P10",_x000D_
"category": "4",_x000D_
"title": "",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.325714",_x000D_
"latitude": "39.484584"_x000D_
}, {_x000D_
"id": "P11",_x000D_
"category": "4",_x000D_
"title": "",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.32778",_x000D_
"latitude": "39.484145"_x000D_
}, {_x000D_
"id": "P12",_x000D_
"category": "4",_x000D_
"title": "",_x000D_
"description": "",_x000D_
"image": "",_x000D_
"longitude": "-87.329035",_x000D_
"latitude": "39.4848"_x000D_
}];_x000D_
_x000D_
for (i = 0; i < locations.length; i++) {_x000D_
_x000D_
var marker = new google.maps.Marker({_x000D_
position: new google.maps.LatLng(locations[i].latitude, locations[i].longitude),_x000D_
title: locations[i].title,_x000D_
map: map_x000D_
});_x000D_
gmarkers.push(marker);_x000D_
google.maps.event.addListener(marker, 'click', (function(marker, i) {_x000D_
return function() {_x000D_
if (locations[i].description !== "" || locations[i].title !== "") {_x000D_
infowindow.setContent('<div class="content" id="content-' + locations[i].id +_x000D_
'" style="max-height:300px; font-size:12px;"><h3>' + locations[i].title + '</h3>' +_x000D_
'<hr class="grey" />' +_x000D_
hasImage(locations[i]) +_x000D_
locations[i].description) + '</div>';_x000D_
infowindow.open(map, marker);_x000D_
}_x000D_
}_x000D_
})(marker, i));_x000D_
}_x000D_
_x000D_
function toggleMarkers() {_x000D_
for (i = 0; i < gmarkers.length; i++) {_x000D_
if (gmarkers[i].getMap() != null) gmarkers[i].setMap(null);_x000D_
else gmarkers[i].setMap(map);_x000D_
}_x000D_
}_x000D_
_x000D_
function hasImage(location) {_x000D_
return '';_x000D_
}
_x000D_
html,_x000D_
body,_x000D_
#map {_x000D_
height: 100%;_x000D_
width: 100%;_x000D_
}
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk"></script>_x000D_
<div id="controls">_x000D_
<input type="button" value="Toggle All Markers" onClick="toggleMarkers()" />_x000D_
</div>_x000D_
<div id="map"></div>
_x000D_
You can have the program create an .ics (iCal) version of the calendar and then you can import this .ics into whichever calendar program you'd like: Google, Outlook, etc.
I know this post is quite old, so I won't bother inputting any code. But please comment on this if you'd like me to provide an outline of how to do this.
When you read()
the file, you may get a newline character '\n'
in your string. Try either
if UserInput.strip() == 'List contents':
or
if 'List contents' in UserInput:
Also note that your second file open
could also use with
:
with open('/Users/.../USER_INPUT.txt', 'w+') as UserInputFile: if UserInput.strip() == 'List contents': # or if s in f: UserInputFile.write("ls") else: print "Didn't work"
There are lots of sophisticated regex testing and development tools, but if you just want a simple test harness in Java, here's one for you to play with:
String[] tests = {
"AAA123",
"ABCDEFGH123",
"XXXX123",
"XYZ123ABC",
"123123",
"X123",
"123",
};
for (String test : tests) {
System.out.println(test + " " +test.matches(".+123"));
}
Now you can easily add new testcases and try new patterns. Have fun exploring regex.
The behaviour is not defined, so you must explicit set a commit or a rollback:
http://docs.oracle.com/cd/B10500_01/java.920/a96654/basic.htm#1003303
"If auto-commit mode is disabled and you close the connection without explicitly committing or rolling back your last changes, then an implicit COMMIT operation is executed."
Hsqldb makes a rollback
con.setAutoCommit(false);
stmt.executeUpdate("insert into USER values ('" + insertedUserId + "','Anton','Alaf')");
con.close();
result is
2011-11-14 14:20:22,519 main INFO [SqlAutoCommitExample:55] [AutoCommit enabled = false] 2011-11-14 14:20:22,546 main INFO [SqlAutoCommitExample:65] [Found 0# users in database]
First you need to turn on virtualization on your machine. To do that, restart your machine. Press F2. Goto BIOS. Make Virtualization Enabled. Press F10. Start windows. Now, goto Extras folder of Android installation folder and find intel-haxm-android.exe. Run it. Start Android Studio. Now, it should allow you to run your program using emulator.
Actually, the HTML 4.01 spec says that these attributes do not require values. I haven't personally encountered a situation where providing a value rendered these controls as unselected.
Here are the respective links to the spec document for selected and checked.
Edit: Firebug renders the checkbox as checked regardless of any values I put in quotes for the checked attribute (including just typing "checked" with no values whatsoever), and IE 8's Developer Tools forces checked="checked". I'm not sure if any similar tools exist for other browsers that might alter the rendered state of a checkbox, however.
All the other response are very miss-leading for somebody coming from google and looking for "timestamp in go"! YYYYMMDDhhmmss is not a "timestamp".
To get the "timestamp" of a date in go (number of seconds from january 1970), the correct function is .Unix(), and it really return an integer
You could also use a LEFT JOIN and IS NULL condition:
SELECT
mac,
creation_date
FROM
logs
LEFT JOIN consols ON logs.mac = consols.mac
WHERE
logs_type_id=11
AND
consols.mac IS NULL;
An index on the "mac" columns might improve performance.
I need to decrypt a password. The password is crypted with password_hash function.
$password = 'examplepassword'; $crypted = password_hash($password, PASSWORD_DEFAULT);
Its not clear to me if you need password_verify
, or you are trying to gain unauthorized access to the application or database. Other have talked about password_verify
, so here's how you could gain unauthorized access. Its what bad guys often do when they try to gain access to a system.
First, create a list of plain text passwords. A plain text list can be found in a number of places due to the massive data breaches from companies like Adobe. Sort the list and then take the top 10,000 or 100,000 or so.
Second, create a list of digested passwords. Simply encrypt or hash the password. Based on your code above, it does not look like a salt is being used (or its a fixed salt). This makes the attack very easy.
Third, for each digested password in the list, perform a select in an attempt to find a user who is using the password:
$sql_script = 'select * from USERS where password="'.$digested_password.'"'
Fourth, profit.
So, rather than picking a user and trying to reverse their password, the bad guy picks a common password and tries to find a user who is using it. Odds are on the bad guy's side...
Because the bad guy does these things, it would behove you to not let users choose common passwords. In this case, take a look at ProCheck, EnFilter or Hyppocrates (et al). They are filtering libraries that reject bad passwords. ProCheck achieves very high compression, and can digest multi-million word password lists into a 30KB data file.
As always in python, there are of course several ways to do it, but there is one obvious way to do it.
tmpdict["ONE"]["TWO"]["THREE"]
is the obvious way to do it.
When that does not fit well with your algorithm, that may be a hint that your structure is not the best for the problem.
If you just want to just save you repetative typing, you can of course alias a subset of the dict:
>>> two_dict = tmpdict['ONE']['TWO'] # now you can just write two_dict for tmpdict['ONE']['TWO']
>>> two_dict["spam"] = 23
>>> tmpdict
{'ONE': {'TWO': {'THREE': 10, 'spam': 23}}}
Just create a small delete function which can help you to achieve this task, I have tested this code and it runs perfectly well.
This function deletes files older than 90 days as well as a file with extension .zip to be deleted from a folder.
Private Sub DeleteZip()
Dim eachFileInMydirectory As New DirectoryInfo("D:\Test\")
Dim fileName As IO.FileInfo
Try
For Each fileName In eachFileInMydirectory.GetFiles
If fileName.Extension.Equals("*.zip") AndAlso (Now - fileName.CreationTime).Days > 90 Then
fileName.Delete()
End If
Next
Catch ex As Exception
WriteToLogFile("No Files older than 90 days exists be deleted " & ex.Message)
End Try
End Sub
Yep.
// FakeChart.cs
// ------------------------------------------------------------------
//
// A Winforms app that produces a contrived chart using
// DataVisualization (MSChart). Requires .net 4.0.
//
// Author: Dino
//
// ------------------------------------------------------------------
//
// compile: \net4.0\csc.exe /t:winexe /debug+ /R:\net4.0\System.Windows.Forms.DataVisualization.dll FakeChart.cs
//
using System;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace Dino.Tools.WebMonitor
{
public class FakeChartForm1 : Form
{
private System.ComponentModel.IContainer components = null;
System.Windows.Forms.DataVisualization.Charting.Chart chart1;
public FakeChartForm1 ()
{
InitializeComponent();
}
private double f(int i)
{
var f1 = 59894 - (8128 * i) + (262 * i * i) - (1.6 * i * i * i);
return f1;
}
private void Form1_Load(object sender, EventArgs e)
{
chart1.Series.Clear();
var series1 = new System.Windows.Forms.DataVisualization.Charting.Series
{
Name = "Series1",
Color = System.Drawing.Color.Green,
IsVisibleInLegend = false,
IsXValueIndexed = true,
ChartType = SeriesChartType.Line
};
this.chart1.Series.Add(series1);
for (int i=0; i < 100; i++)
{
series1.Points.AddXY(i, f(i));
}
chart1.Invalidate();
}
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
this.SuspendLayout();
//
// chart1
//
chartArea1.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea1);
this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
legend1.Name = "Legend1";
this.chart1.Legends.Add(legend1);
this.chart1.Location = new System.Drawing.Point(0, 50);
this.chart1.Name = "chart1";
// this.chart1.Size = new System.Drawing.Size(284, 212);
this.chart1.TabIndex = 0;
this.chart1.Text = "chart1";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Controls.Add(this.chart1);
this.Name = "Form1";
this.Text = "FakeChart";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
this.ResumeLayout(false);
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FakeChartForm1());
}
}
}
UI:
import java.util.ArrayList;
import java.util.Iterator;
public class javaClass {
public static void main(String args[]) {
ArrayList<String> alstr = new ArrayList<>();
alstr.add("irfan");
alstr.add("yogesh");
alstr.add("kapil");
alstr.add("rajoria");
for(String str : alstr) {
System.out.println(str);
}
// update value here
alstr.set(3, "Ramveer");
System.out.println("with Iterator");
Iterator<String> itr = alstr.iterator();
while (itr.hasNext()) {
Object obj = itr.next();
System.out.println(obj);
}
}}
$ F = "text file.test.txt"
$ echo ${F/*./}
txt
This caters for multiple dots and spaces in a filename, however if there is no extension it returns the filename itself. Easy to check for though; just test for the filename and extension being the same.
Naturally this method doesn't work for .tar.gz files. However that could be handled in a two step process. If the extension is gz then check again to see if there is also a tar extension.
Simply parsing the JSON and comparing the two objects is not enough because it wouldn't be the exact same object references (but might be the same values).
You need to do a deep equals.
From http://threebit.net/mail-archive/rails-spinoffs/msg06156.html - which seems the use jQuery.
Object.extend(Object, {
deepEquals: function(o1, o2) {
var k1 = Object.keys(o1).sort();
var k2 = Object.keys(o2).sort();
if (k1.length != k2.length) return false;
return k1.zip(k2, function(keyPair) {
if(typeof o1[keyPair[0]] == typeof o2[keyPair[1]] == "object"){
return deepEquals(o1[keyPair[0]], o2[keyPair[1]])
} else {
return o1[keyPair[0]] == o2[keyPair[1]];
}
}).all();
}
});
Usage:
var anObj = JSON.parse(jsonString1);
var anotherObj= JSON.parse(jsonString2);
if (Object.deepEquals(anObj, anotherObj))
...
Keep in mind the second parameter to @Html.HiddenFor will only be used to set the value when it can't find route or model data matching the field. Darin is correct, use view model.
This concept is not that easy as it looks. We can access static members without inheritance, which is HasA-relation. We can access static members by extending the parent class also. That doesn't imply that it is an ISA-relation (Inheritance). Actually static members belong to the class, and static is not an access modifier. As long as the access modifiers permit to access the static members we can use them in other classes. Like if it is public then it will be accessible inside the same package and also outside the package. For private we can't use it anywhere. For default, we can use it only within the package. But for protected we have to extend the super class. So getting the static method to other class does not depend on being Static. It depends on Access modifiers. So, in my opinion, Static members can access if the access modifiers permit. Otherwise, we can use them like we use by Hasa-relation. And has a relation is not inheritance. Again we can not override the static method. If we can use other method but cant override it, then it is HasA-relation. If we can't override them it won't be inheritance.So the writer was 100% correct.
I like to use:
(strlen(string) + 1 ) * sizeof(char)
This will give you the buffer size in bytes. You can use this with snprintf() may help:
const char* message = "%s, World!";
char* string = (char*)malloc((strlen(message)+1))*sizeof(char));
snprintf(string, (strlen(message)+1))*sizeof(char), message, "Hello");
Cheers! Function: size_t strlen (const char *s)
Running queries on hot-standby server is somewhat tricky — it can fail, because during querying some needed rows might be updated or deleted on primary. As a primary does not know that a query is started on secondary it thinks it can clean up (vacuum) old versions of its rows. Then secondary has to replay this cleanup, and has to forcibly cancel all queries which can use these rows.
Longer queries will be canceled more often.
You can work around this by starting a repeatable read transaction on primary which does a dummy query and then sits idle while a real query is run on secondary. Its presence will prevent vacuuming of old row versions on primary.
More on this subject and other workarounds are explained in Hot Standby — Handling Query Conflicts section in documentation.
It could be because of couple of Browser settings. Try with these options checked..
Tools > Internet Options > Advanced > Enable Integrated Windows Authentication (works with Integrated Windows Authentication set on IIS)
Tools > Internet Options> Security > Local Intranet > Custom Level > Automatic Logon
Worst case, try adding localhost to the Trusted sites.
If you are in a network, you can also try debugging by getting a network trace. Could be because of some proxy trying to authenticate.
class Program
{
static void Main(string[] args)
{
Type type = typeof(MyReflectionClass);
MethodInfo method = type.GetMethod("MyMethod");
MyReflectionClass c = new MyReflectionClass();
string result = (string)method.Invoke(c, null);
Console.WriteLine(result);
}
}
public class MyReflectionClass
{
public string MyMethod()
{
return DateTime.Now.ToString();
}
}
To stop the service we must use the method stopService()
:
Intent myService = new Intent(MainActivity.this, BackgroundSoundService.class);
//startService(myService);
stopService(myService);
then the method onDestroy()
in the service is called:
@Override
public void onDestroy() {
Log.i(TAG, "onCreate() , service stopped...");
}
Here is a complete example including how to stop the service.
From the DOCS
Formats a number as text. Group sizing and separator and other locale-specific configurations are based on the active locale.
SYNTAX:
number_expression | number[:digitInfo[:locale]]
where expression
is a number:
digitInfo
is a string which has a following format:
{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}
Please see Daniel Kocherga's answer, as it'll work for you in most cases.
In addition to that method to get the attribute's value, you may sometimes want to get the label of a select
or multiselect
. In that case, I have created this method which I store in a helper class:
/**
* @param int $entityId
* @param int|string|array $attribute atrribute's ids or codes
* @param null|int|Mage_Core_Model_Store $store
*
* @return bool|null|string
* @throws Mage_Core_Exception
*/
public function getAttributeRawLabel($entityId, $attribute, $store=null) {
if (!$store) {
$store = Mage::app()->getStore();
}
$value = (string)Mage::getResourceModel('catalog/product')->getAttributeRawValue($entityId, $attribute, $store);
if (!empty($value)) {
return Mage::getModel('catalog/product')->getResource()->getAttribute($attribute)->getSource()->getOptionText($value);
}
return null;
}
You are not specified your project as right way.
XAMPP control panel
then start the apache
and MySQL
localhost:80\
press enter now your php basic Config page is visible.xampp\htdocs\YourFloderName
Then
create php file then save it and go to browser then type it localhost\YourFolderName
now it listed the files click the file and it runs.You can use izip
to combine your lists, and then iterate them
for val in itertools.izip(l1,l2,l3,l4,l5):
writer.writerow(val)
To change database owner:
ALTER AUTHORIZATION ON DATABASE::YourDatabaseName TO sa
As of SQL Server 2014 you can still use sp_changedbowner
as well, even though Microsoft promised to remove it in the "future" version after SQL Server 2012. They removed it from SQL Server 2014 BOL though.
we can you use .length property to set or returns number of elements in an array. return value is a number
> set the length: let count = myArray.length;
> return lengthof an array : myArray.length
we can you .size in case we need to filter duplicate values and get the count of elements in a set.
const set = new set([1,1,2,1]); console.log(set.size) ;`
You can't according to the PHP manual:
Once the cookies have been set, they can be accessed on the next page load with the $_COOKIE or $HTTP_COOKIE_VARS arrays.
This is because cookies are sent in response headers to the browser and the browser must then send them back with the next request. This is why they are only available on the second page load.
But you can work around it by also setting $_COOKIE
when you call setcookie()
:
if(!isset($_COOKIE['lg'])) {
setcookie('lg', 'ro');
$_COOKIE['lg'] = 'ro';
}
echo $_COOKIE['lg'];
You need to disable the button in the onsubmit
event of the <form>
:
<form action='/' method='POST' onsubmit='disableButton()'>
<input name='txt' type='text' required />
<button id='btn' type='submit'>Post</button>
</form>
<script>
function disableButton() {
var btn = document.getElementById('btn');
btn.disabled = true;
btn.innerText = 'Posting...'
}
</script>
Note: this way if you have a form element which has the required
attribute will work.
This is the way it worked for me:
$.post("/Controller/Action", $("#form").serialize(), function(json) {
// handle response
}, "json");
[HttpPost]
public ActionResult TV(MyModel id)
{
return Json(new { success = true });
}
I have searched the best and the simplest answer to make 9-patch image. Now to make the 9 patch image is the easiest task.
From https://romannurik.github.io/AndroidAssetStudio/index.html you can make a 9-patch image for all the resolutions - XHDPI,HDPI,MDPI,LDPI in just one click.
There are predefined macros that are used by most compilers, you can find the list here. GCC compiler predefined macros can be found here. Here is an example for gcc:
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
//define something for Windows (32-bit and 64-bit, this part is common)
#ifdef _WIN64
//define something for Windows (64-bit only)
#else
//define something for Windows (32-bit only)
#endif
#elif __APPLE__
#include <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR
// iOS Simulator
#elif TARGET_OS_IPHONE
// iOS device
#elif TARGET_OS_MAC
// Other kinds of Mac OS
#else
# error "Unknown Apple platform"
#endif
#elif __linux__
// linux
#elif __unix__ // all unices not caught above
// Unix
#elif defined(_POSIX_VERSION)
// POSIX
#else
# error "Unknown compiler"
#endif
The defined macros depend on the compiler that you are going to use.
The _WIN64
#ifdef
can be nested into the _WIN32
#ifdef
because _WIN32
is even defined when targeting the Windows x64 version. This prevents code duplication if some header includes are common to both
(also WIN32
without underscore allows IDE to highlight the right partition of code).
why making life hard-
PreparedStatement pstmt = conn.prepareStatement("select * from employee where id in ("+ StringUtils.join(arraylistParameter.iterator(),",") +)");
print "bla: ", $myvar =~ tr{a}{b},"\n";
I honestly thought that the casting method would work fine. Since it doesn't you can try stringstream. An example is below:
#include <sstream>
#include <string>
std::stringstream ss;
std::string target;
char mychar = 'a';
ss << mychar;
ss >> target;
Think that JavaScriptDevelopmentTools might do it. Although, I have eclipse indigo, and I'm pretty sure it does that kind of thing automatically.
For optimal Insertion performance disable the index if that's an option for you. Other than that, better hardware (disk, memory) is also helpful
Thought I would add that we also ran into this issue with multiple machines in our domain. I created a list of offending machines and added them all to a text file from which to run the script. I ran this from the CMD prompt using elevated privileges.
psexec @firewallFix.txt -d netsh advfirewall firewall
set rule name="Windows Management Instrumentation (WMI-In)"
profile=domain new enable=yes profile=domain
What seems to be needed is to actually define the button as a button widget.
I had the same problem (in beta 1)
I did
$("#submitButton").button();
in my window ready handler, after that it worked to do as it is said in the docs, i.e.:
$("#submitButton").button('disable');
I guess this has to do with that jqm is converting the markup, but isnt actually instatiating a real button widget for buttons and link buttons.
HttpClient is a new API that came with 4.3, it has updated API's with support for progress events, json deserialization by default, Interceptors and many other great features. See more here https://angular.io/guide/http
Http is the older API and will eventually be deprecated.
Since their usage is very similar for basic tasks I would advise using HttpClient since it is the more modern and easy to use alternative.
The (un)safe way to do this - if you are ok with not using option explicit - is...
Not TypeName(myObj) = "Empty"
This also handles the case if the object has not been declared. This is useful if you want to just comment out a declaration to switch off some behaviour...
Dim myObj as Object
Not TypeName(myObj) = "Empty" '/ true, the object exists - TypeName is Object
'Dim myObj as Object
Not TypeName(myObj) = "Empty" '/ false, the object has not been declared
This works because VBA will auto-instantiate an undeclared variable as an Empty Variant type. It eliminates the need for an auxiliary Boolean to manage the behaviour.
Does anybody have any experience to share?
There are 2^122
possible values for a type-4 UUID. (The spec says that you lose 2 bits for the type, and a further 4 bits for a version number.)
Assuming that you were to generate 1 million random UUIDs a second, the chances of a duplicate occurring in your lifetime would be vanishingly small. And to detect the duplicate, you'd have to solve the problem of comparing 1 million new UUIDs per second against all of the UUIDs you have previously generated1!
The chances that anyone has experienced (i.e. actually noticed) a duplicate in real life are even smaller than vanishingly small ... because of the practical difficulty of looking for collisions.
Now of course, you will typically be using a pseudo-random number generator, not a source of truly random numbers. But I think we can be confident that if you are using a creditable provider for your cryptographic strength random numbers, then it will be cryptographic strength, and the probability of repeats will be the same as for an ideal (non-biased) random number generator.
However, if you were to use a JVM with a "broken" crypto- random number generator, all bets are off. (And that might include some of the workarounds for "shortage of entropy" problems on some systems. Or the possibility that someone has tinkered with your JRE, either on your system or upstream.)
1 - Assuming that you used "some kind of binary btree" as proposed by an anonymous commenter, each UUID is going to need O(NlogN)
bits of RAM memory to represent N
distinct UUIDs assuming low density and random distribution of the bits. Now multiply that by 1,000,000 and the number of seconds that you are going to run the experiment for. I don't think that is practical for the length of time needed to test for collisions of a high quality RNG. Not even with (hypothetical) clever representations.
You might want to look at the uniq
and sort
applications.
./yourscript.ksh | sort | uniq
(FYI, yes, the sort is necessary in this command line, uniq
only strips duplicate lines that are immediately after each other)
EDIT:
Contrary to what has been posted by Aaron Digulla in relation to uniq
's commandline options:
Given the following input:
class jar jar jar bin bin java
uniq
will output all lines exactly once:
class jar bin java
uniq -d
will output all lines that appear more than once, and it will print them once:
jar bin
uniq -u
will output all lines that appear exactly once, and it will print them once:
class java
var datatable_jquery_script = document.createElement("script");
datatable_jquery_script.src = "vendor/datatables/jquery.dataTables.min.js";
document.body.appendChild(datatable_jquery_script);
setTimeout(function(){
var datatable_bootstrap_script = document.createElement("script");
datatable_bootstrap_script.src = "vendor/datatables/dataTables.bootstrap4.min.js";
document.body.appendChild(datatable_bootstrap_script);
},100);
I used setTimeOut to make sure datatables.min.js loads first. I inspected the waterfall loading of each, bootstrap4.min.js always loads first.
"exec nohup setsid your_command"
the nohup allows your_command to continue even though the process that launched may terminate first. If it does, the the SIGNUP signal will be sent to your_command causing it to terminate (unless it catches that signal and ignores it).
If you have more than 1 image on the page that you like to enlarge, name the id's for instance "content1", "content2", "content3", etc. Then extend the script with this, like so:
$(document).ready(function() {
$("[id^=content]").hover(function() {
$(this).addClass('transition');
}, function() {
$(this).removeClass('transition');
});
});
Edit: Change the "#content" CSS to: img[id^=content] to remain having the transition effects.
Here's a quick and easy method:
CREATE TABLE database1.employees
AS
SELECT * FROM database2.employees;
Sharing working and relevant code from our project:
//documentsArray is the list of sampleCollection objects
sampleCollection.insertMany(documentsArray)
.then((res) => {
console.log("insert sampleCollection result ", res);
})
.catch(err => {
console.log("bulk insert sampleCollection error ", err);
});
I landed here when I was trying to do a similar thing. For a application/x-www-form-urlencoded content type, you could try to use this for the body:
var body = 'username' =myusername & 'password'=mypassword;
with what you tried doing the value assigned to body will be a string.
There is too much data to be displayed on the screen, therefore a summary is displayed instead.
If you want to output the data anyway (it won't probably fit on a screen and does not look very well):
print paramdata.values
converts the dataframe to its numpy-array matrix representation.
paramdata.columns
stores the respective column names and
paramdata.index
stores the respective index (row names).