I've used a DOS command line to do this. Two lines, actually. The first one to make the "current directory" the folder where the file is - or the root folder of a group of folders where the file can be. The second line does the search.
CD C:\TheFolder
C:\TheFolder>FINDSTR /L /S /I /N /C:"TheString" *.PRG
You can find details about the parameters at this link.
Hope it helps!
.h files, or header files, are used to list the publicly accessible instance variables and and methods in the class declaration. .cpp files, or implementation files, are used to actually implement those methods and use those instance variables.
The reason they are separate is because .h files aren't compiled into binary code while .cpp files are. Take a library, for example. Say you are the author and you don't want it to be open source. So you distribute the compiled binary library and the header files to your customers. That allows them to easily see all the information about your library's classes they can use without being able to see how you implemented those methods. They are more for the people using your code rather than the compiler. As was said before: it's the convention.
I had need of some symbolic constants in pyparsing to represent left and right associativity of binary operators. I used class constants like this:
# an internal class, not intended to be seen by client code
class _Constants(object):
pass
# an enumeration of constants for operator associativity
opAssoc = _Constants()
opAssoc.LEFT = object()
opAssoc.RIGHT = object()
Now when client code wants to use these constants, they can import the entire enum using:
import opAssoc from pyparsing
The enumerations are unique, they can be tested with 'is' instead of '==', they don't take up a big footprint in my code for a minor concept, and they are easily imported into the client code. They don't support any fancy str() behavior, but so far that is in the YAGNI category.
If you want to be able to think it as a 2D array rather than being forced to think in term of a list of lists (much more natural in my opinion), you can do the following:
import numpy
Nx=3; Ny=4
my2Dlist= numpy.zeros((Nx,Ny)).tolist()
The result is a list (not a NumPy array), and you can overwrite the individual positions with numbers, strings, whatever.
I found a solution using DEBUG at http://www.scribd.com/doc/445750/Create-a-Huge-File, but I don't know an easy way to script it and it doesn't seem to be able to create files larger than 1 GB.
public static void Serialize(object value, Stream s)
{
using (StreamWriter writer = new StreamWriter(s))
using (JsonTextWriter jsonWriter = new JsonTextWriter(writer))
{
JsonSerializer ser = new JsonSerializer();
ser.Serialize(jsonWriter, value);
jsonWriter.Flush();
}
}
public static T Deserialize<T>(Stream s)
{
using (StreamReader reader = new StreamReader(s))
using (JsonTextReader jsonReader = new JsonTextReader(reader))
{
JsonSerializer ser = new JsonSerializer();
return ser.Deserialize<T>(jsonReader);
}
}
use line-height: 0px;
The CSS Code:
div{line-height:0;}
This will affect generically to all your Div's. If you want your existing parent div only to have no spacing, you can apply the same into it.
i would suggest the following way:
@PropertySource(ignoreResourceNotFound = true, value = "classpath:otherprops.properties")
@Controller
public class ClassA {
@Value("${myName}")
private String name;
@RequestMapping(value = "/xyz")
@ResponseBody
public void getName(){
System.out.println(name);
}
}
Here your new properties file name is "otherprops.properties" and the property name is "myName". This is the simplest implementation to access properties file in spring boot version 1.5.8.
The underlying problem is Ctrl+Alt+Left and Right are used by window managers to switch workspace and/or OEM utilities to change the screen orientation.
You can change the assignments using
File / Settings / Keymap
then Main Menu / Navigate
find Back
and Forward
and right click to Add Keyboard Shortcut
to set an alternative key chord.
Alt Graph+Left and Alt Graph+Right works well for me (IDEA 13.1.4 on Ubuntu under IceWM).
Use a JSON parser, like JSON.NET
string json = "{ \"Atlantic/Canary\": \"GMT Standard Time\", \"Europe/Lisbon\": \"GMT Standard Time\", \"Antarctica/Mawson\": \"West Asia Standard Time\", \"Etc/GMT+3\": \"SA Eastern Standard Time\", \"Etc/GMT+2\": \"UTC-02\", \"Etc/GMT+1\": \"Cape Verde Standard Time\", \"Etc/GMT+7\": \"US Mountain Standard Time\", \"Etc/GMT+6\": \"Central America Standard Time\", \"Etc/GMT+5\": \"SA Pacific Standard Time\", \"Etc/GMT+4\": \"SA Western Standard Time\", \"Pacific/Wallis\": \"UTC+12\", \"Europe/Skopje\": \"Central European Standard Time\", \"America/Coral_Harbour\": \"SA Pacific Standard Time\", \"Asia/Dhaka\": \"Bangladesh Standard Time\", \"America/St_Lucia\": \"SA Western Standard Time\", \"Asia/Kashgar\": \"China Standard Time\", \"America/Phoenix\": \"US Mountain Standard Time\", \"Asia/Kuwait\": \"Arab Standard Time\" }";
var data = (JObject)JsonConvert.DeserializeObject(json);
string timeZone = data["Atlantic/Canary"].Value<string>();
Try to use .card-listing:hover::after
hover
and after
using ::
it wil work
You need to create a C API for exposing the functionality of your C++ code. Basically, you will need to write C++ code that is declared extern "C" and that has a pure C API (not using classes, for example) that wraps the C++ library. Then you use the pure C wrapper library that you've created.
Your C API can optionally follow an object-oriented style, even though C is not object-oriented. Ex:
// *.h file
// ...
#ifdef __cplusplus
#define EXTERNC extern "C"
#else
#define EXTERNC
#endif
typedef void* mylibrary_mytype_t;
EXTERNC mylibrary_mytype_t mylibrary_mytype_init();
EXTERNC void mylibrary_mytype_destroy(mylibrary_mytype_t mytype);
EXTERNC void mylibrary_mytype_doit(mylibrary_mytype_t self, int param);
#undef EXTERNC
// ...
// *.cpp file
mylibrary_mytype_t mylibrary_mytype_init() {
return new MyType;
}
void mylibrary_mytype_destroy(mylibrary_mytype_t untyped_ptr) {
MyType* typed_ptr = static_cast<MyType*>(untyped_ptr);
delete typed_ptr;
}
void mylibrary_mytype_doit(mylibrary_mytype_t untyped_self, int param) {
MyType* typed_self = static_cast<MyType*>(untyped_self);
typed_self->doIt(param);
}
thanks @iuryxavier
from multiprocessing import Pool
from multiprocessing import cpu_count
def add_1(x):
return x + 1
if __name__ == "__main__":
pool = Pool(cpu_count())
results = pool.map(add_1, range(10**12))
pool.close() # 'TERM'
pool.join() # 'KILL'
I had this error because I registered the wrong class in this line of code:
JAXBContext context = JAXBContext.newInstance(MyRootXmlClass.class);
I have a similar problem. I try to run an example in tensorflow/models/objective_detection and met the same message. Try to change Python3 to Python2
A large project I worked on used StyleCop and FXCop in the automated build with rules to prevent people checking in code with uncommented fields, methods, properties etc., etc.
Someone got so pissed off with having to add comments like "Gets or sets the full name." to self-documenting properties like FullName, that they went to the effort of writing a macro to get around the rules.
The macro inserted XML summary tags for methods, properties etc. with a single non-displaying Unicode character as the tag content which would fool the build rules whilst simultaneously striking his minor blow against mindless insistence on commenting stuff for the sake of it...
...at least until they introduced another rule to check for Unicode characters in comments.
strace sqlplus -L scott/tiger@orcl
helps to find .tnsnames.ora
file on /home/oracle
to find the file it takes instead of $ORACLE_HOME/network/admin/tnsnames.ora
file. Thanks for the posting.
Ummm... an inner class IS a nested class... do you mean anonymous class and inner class?
Edit: If you actually meant inner vs anonymous... an inner class is just a class defined within a class such as:
public class A {
public class B {
}
}
Whereas an anonymous class is an extension of a class defined anonymously, so no actual "class is defined, as in:
public class A {
}
A anon = new A() { /* you could change behavior of A here */ };
Further Edit:
Wikipedia claims there is a difference in Java, but I've been working with Java for 8 years, and it's the first I heard such a distinction... not to mention there are no references there to back up the claim... bottom line, an inner class is a class defined within a class (static or not), and nested is just another term to mean the same thing.
There is a subtle difference between static and non-static nested class... basically non-static inner classes have implicit access to instance fields and methods of the enclosing class (thus they cannot be constructed in a static context, it will be a compiler error). Static nested classes, on the other hand, don't have implicit access to instance fields and methods, and CAN be constructed in a static context.
You could capture the (2001)
part and replace the rest with nothing.
public static string extractYearString(string input) {
return input.replaceAll(".*\(([0-9]{4})\).*", "$1");
}
var subject = "(2001) (asdf) (dasd1123_asd 21.01.2011 zqge)(dzqge) name (20019)";
var result = extractYearString(subject);
System.out.println(result); // <-- "2001"
.*\(([0-9]{4})\).*
means
.*
match anything\(
match a (
character(
begin capture[0-9]{4}
any single digit four times)
end capture\)
match a )
character.*
anything (rest of string)The following shows an example of a shared class library shared.[h,cpp] and a main.cpp module using the library. It's a very simple example and the makefile could be made much better. But it works and may help you:
shared.h defines the class:
class myclass {
int myx;
public:
myclass() { myx=0; }
void setx(int newx);
int getx();
};
shared.cpp defines the getx/setx functions:
#include "shared.h"
void myclass::setx(int newx) { myx = newx; }
int myclass::getx() { return myx; }
main.cpp uses the class,
#include <iostream>
#include "shared.h"
using namespace std;
int main(int argc, char *argv[])
{
myclass m;
cout << m.getx() << endl;
m.setx(10);
cout << m.getx() << endl;
}
and the makefile that generates libshared.so and links main with the shared library:
main: libshared.so main.o
$(CXX) -o main main.o -L. -lshared
libshared.so: shared.cpp
$(CXX) -fPIC -c shared.cpp -o shared.o
$(CXX) -shared -Wl,-soname,libshared.so -o libshared.so shared.o
clean:
$rm *.o *.so
To actual run 'main' and link with libshared.so you will probably need to specify the load path (or put it in /usr/local/lib or similar).
The following specifies the current directory as the search path for libraries and runs main (bash syntax):
export LD_LIBRARY_PATH=.
./main
To see that the program is linked with libshared.so you can try ldd:
LD_LIBRARY_PATH=. ldd main
Prints on my machine:
~/prj/test/shared$ LD_LIBRARY_PATH=. ldd main
linux-gate.so.1 => (0xb7f88000)
libshared.so => ./libshared.so (0xb7f85000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7e74000)
libm.so.6 => /lib/libm.so.6 (0xb7e4e000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb7e41000)
libc.so.6 => /lib/libc.so.6 (0xb7cfa000)
/lib/ld-linux.so.2 (0xb7f89000)
This happened to me when I was checking out a project from an svn repository in eclipse. There were jar files in my .m2 folder that eclipse wasn't looking at. To fix the issue I did:
right click project folder Configure > Convert to Maven Project
and that solved the issue.
Believe it or not, you can actually use java.awt.Robot
to "create an image containing pixels read from the screen." You can then write that image to a file on disk.
I just tried it, and the whole thing ends up like:
Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
BufferedImage capture = new Robot().createScreenCapture(screenRect);
ImageIO.write(capture, "bmp", new File(args[0]));
NOTE: This will only capture the primary monitor. See GraphicsConfiguration for multi-monitor support.
For powershell in Windows, you can add relative path + filename to --output
flag:
curl -L http://github.com/GorvGoyl/Notion-Boost-browser-extension/archive/master.zip --output build_firefox/master-repo.zip
here build_firefox is relative folder.
You might be able to resize the image with canvas
and export it using dataURI. Not sure about compression, though.
Take a look at this: Resizing an image in an HTML5 canvas
The curl examples above all failed for me when I ran them from a cygwin terminal. There were errors like this when i ran the script example.
curl http://192.168.2.20:7773/solr/CORE1/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">1</int></lst>
</response>
<!--
It looks like it deleted stuff, but it did not go away
maybe because the committing call failed like so
-->
curl http://192.168.1.2:7773/solr/CORE1/update --data-binary '' -H 'Content-type:text/xml; charset=utf-8'
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">400</int><int name="QTime">2</int></lst><lst name="error"><str name="msg">Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]</str><int name="code">400</int></lst>
</response>
I needed to use the delete in a loop on core names to wipe them all out in a project.
This query below worked for me in the Cygwin terminal script.
curl http://192.168.1.2:7773/hpi/CORE1/update?stream.body=<delete><query>*:*</query></delete>&commit=true
<?xml version="1.0" encoding="UTF-8"?>
<response>
<lst name="responseHeader"><int name="status">0</int><int name="QTime">1</int></lst>
</response>
This one line made the data go away and the change persisted.
It's actually very easy in jQuery:
$("#ddl_1").clone().attr("id",newId).appendTo("body");
Change .appendTo() of course...
This is the ASCII format.
Please consider that:
Some data (like URLs) can be sent over the Internet using the ASCII character-set. Since data often contain characters outside the ASCII set, so it has to be converted into a valid ASCII format.
To find it yourself, you can visit https://en.wikipedia.org/wiki/ASCII, there you can find big tables of characters. The one you are looking is in Control Characters
table.
Digging to table you can find
Oct Dec Hex Name
012 10 0A Line Feed
In the html file you can use Dec and Hex representation of charters
The Dec
is represented with
The Hex
is represented with 

(or you can omit the leading zero 

)
There is a good converter at https://r12a.github.io/apps/conversion/ .
There is no such thing as "SOAP protocol". SOAP is an XML schema.
It usually runs over HTTP (port 80), however.
You're so close!
Change
plot "print_1012720" using 1:2 title "Flow 1", \
plot "print_1058167" using 1:2 title "Flow 2", \
plot "print_193548" using 1:2 title "Flow 3", \
plot "print_401125" using 1:2 title "Flow 4", \
plot "print_401275" using 1:2 title "Flow 5", \
plot "print_401276" using 1:2 title "Flow 6"
to
plot "print_1012720" using 1:2 title "Flow 1", \
"print_1058167" using 1:2 title "Flow 2", \
"print_193548" using 1:2 title "Flow 3", \
"print_401125" using 1:2 title "Flow 4", \
"print_401275" using 1:2 title "Flow 5", \
"print_401276" using 1:2 title "Flow 6"
The error arises because gnuplot is trying to interpret the word "plot" as the filename to plot, but you haven't assigned any strings to a variable named "plot" (which is good – that would be super confusing).
We can add the following to a particular tag in CSS:
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
In case of half rotation change 90
to 45
.
If youR data was in A1:C100
then:
Excel - all versions
=SUMPRODUCT(--(A1:A100="M"),--(C1:C100="Yes"))
Excel - 2007 onwards
=COUNTIFS(A1:A100,"M",C1:C100,"Yes")
First option is definitely the best option.
SELECT * FROM TABLE WHERE ID IN (id1, id2, ..., idn)
However considering that the list of ids is very huge, say millions, you should consider chunk sizes like below:
Why should you divide into chunks?
You will never get memory overflow exception which is very common in scenarios like yours. You will have optimized number of database calls resulting in better performance.
It has always worked like charm for me. Hope it would work for my fellow developers as well :)
We can get the details and status of session from below query as:
select ' Sid, Serial#, Aud sid : '|| s.sid||' , '||s.serial#||' , '||
s.audsid||chr(10)|| ' DB User / OS User : '||s.username||
' / '||s.osuser||chr(10)|| ' Machine - Terminal : '||
s.machine||' - '|| s.terminal||chr(10)||
' OS Process Ids : '||
s.process||' (Client) '||p.spid||' (Server)'|| chr(10)||
' Client Program Name : '||s.program "Session Info"
from v$process p,v$session s
where p.addr = s.paddr
and s.sid = nvl('&SID',s.sid)
and nvl(s.terminal,' ') = nvl('&Terminal',nvl(s.terminal,' '))
and s.process = nvl('&Process',s.process)
and p.spid = nvl('&spid',p.spid)
and s.username = nvl('&username',s.username)
and nvl(s.osuser,' ') = nvl('&OSUser',nvl(s.osuser,' '))
and nvl(s.machine,' ') = nvl('&machine',nvl(s.machine,' '))
and nvl('&SID',nvl('&TERMINAL',nvl('&PROCESS',nvl('&SPID',nvl('&USERNAME',
nvl('&OSUSER',nvl('&MACHINE','NO VALUES'))))))) <> 'NO VALUES'
/
For more details: https://ora-data.blogspot.in/2016/11/query-session-details.html
Thanks,
It seems like you installed a zip version of sbt, which is fine. But I suggest you install the native debian package if you are on Ubuntu. That is how I managed to install it on my Ubuntu 12.04. Check it out here: http://www.scala-sbt.org/release/docs/Installing-sbt-on-Linux.html Or simply directly download it from here.
nginx
, like all well-behaved programs, can be configured not to self-daemonize.
Use the daemon off
configuration directive described in http://wiki.nginx.org/CoreModule.
In more recent versions of @angular/common/http
(5.0 and up, by the looks of it), you can use the fromObject
key of HttpParamsOptions
to pass the object straight in:
let httpParams = new HttpParams({ fromObject: { aaa: 111, bbb: 222 } });
This just runs a forEach
loop under the hood, though:
this.map = new Map<string, string[]>();
Object.keys(options.fromObject).forEach(key => {
const value = (options.fromObject as any)[key];
this.map !.set(key, Array.isArray(value) ? value : [value]);
});
I exactly agree with @deceze but I want to develop this "I get an error from the service" part of the question,
We getting this kind of errors as http 415
Http 415 Unsupported Media type error
The HTTP 415 Unsupported Media Type client error response code indicates that the server refuses to accept the request because the payload format is in an unsupported format.
The format problem might be due to the request's indicated Content-Type or Content-Encoding, or as a result of inspecting the data directly.
In other words, such is seen in this example.
Content-Type: application/json
and Accept: application/json
. Otherwise, it will assume the defaultI'm using this code, hope this helps!
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim destination_wb As Workbook
Set destination_wb = Workbooks.Open(DESTINATION_WORKBOOK_NAME)
worksheet_to_copy.Copy Before:=destination_wb.Worksheets(1)
destination_wb.Worksheets(1).Name = worksheet_to_copy.Name
'Add the sheets count to the name to avoid repeated worksheet names error
'& destination_wb.Worksheets.Count
'optional
destination_wb.Worksheets(1).UsedRange.Columns.AutoFit
'I use this to avoid macro errors in destination_wb
Call DeleteAllVBACode(destination_wb)
'Delete source worksheet
Application.DisplayAlerts = False
worksheet_to_copy.Delete
Application.DisplayAlerts = True
destination_wb.Save
destination_wb.Close
Application.EnableEvents = True
Application.ScreenUpdating = True
' From http://www.cpearson.com/Excel/vbe.aspx
Public Sub DeleteAllVBACode(libro As Workbook)
Dim VBProj As VBProject
Dim VBComp As VBComponent
Dim CodeMod As CodeModule
Set VBProj = libro.VBProject
For Each VBComp In VBProj.VBComponents
If VBComp.Type = vbext_ct_Document Then
Set CodeMod = VBComp.CodeModule
With CodeMod
.DeleteLines 1, .CountOfLines
End With
Else
VBProj.VBComponents.Remove VBComp
End If
Next VBComp
End Sub
I don't think converting to a tuple is the right answer. You need go and look at where you are calling the function and make sure that c
is a list of list of strings, or whatever you designed this function to work with
For example you might get this error if you passed [c]
to the function instead of c
Based on reference "Peter O".. Here is the java version
private static final float angleBetweenPoints(PointF a, PointF b) {
float deltaY = b.y - a.y;
float deltaX = b.x - a.x;
return (float) (Math.atan2(deltaY, deltaX)); }
DO Not Use EventEmitter for your service communication.
You should use one of the Observable types. I personally like BehaviorSubject.
Simple example:
You can pass initial state, here I passing null
let subject = new BehaviorSubject(null);
When you want to update the subject
subject.next(myObject)
Observe from any service or component and act when it gets new updates.
subject.subscribe(this.YOURMETHOD);
You can iterate through JavaScript objects this way:
for(var attributename in myobject){
console.log(attributename+": "+myobject[attributename]);
}
myobject could be your json.data
A comprehansive comparison between diffreent formats made by me in this post- https://maxondev.com/serialization-performance-comparison-c-net-formats-frameworks-xmldatacontractserializer-xmlserializer-binaryformatter-json-newtonsoft-servicestack-text/
Just one sample from the post-
$("#show").click(function() {
var count_checked = $("[name='chk[]']:checked").length; // count the checked rows
if(count_checked == 0)
{
alert("Please select any record to delete.");
return false;
}
if(count_checked == 1) {
alert("Record Selected:"+count_checked);
} else {
alert("Record Selected:"+count_checked);
}
});
Working solution October 2018, for videos including audio channel
$(document).ready(function() {
$('video').prop('muted',true).play()
});
Have a look at another of mine, more in-depth answer: https://stackoverflow.com/a/57723549/3049675
Try this:
I use this everywhere where there is a $_POST request.
$username=isset($_POST['username']) ? $_POST['username'] : "";
This is just a short hand boolean, if isset it will set it to $_POST['username'], if not then it will set it to an empty string.
Usage example:
if($username===""){ echo "Field is blank" } else { echo "Success" };
To assign multiple classes to an html element, include both class names within the quotations of the class attribute and have them separated by a space:
<article class="column wrapper">
In the above example, column
and wrapper
are two separate css classes, and both of their properties will be applied to the article
element.
I had a similar problem and solved it using list...not sure if this will help or not
classes = list(unique_labels(y_true, y_pred))
For anyone want to replace your script.
update dbo.[TABLE_NAME] set COLUMN_NAME= replace(COLUMN_NAME, 'old_value', 'new_value') where COLUMN_NAME like %CONDITION%
This is a reply to user672009 and addition to sdqali's post (his code will crash on building debug version by IDE's "Run" button):
You can use the following code:
final Console console = System.console();
if (console != null) {
// Building from console
signingConfigs {
release {
storeFile file(console.readLine("Enter keystore path: "))
storePassword console.readLine("Enter keystore password: ")
keyAlias console.readLine("Enter alias key: ")
keyPassword console.readLine("Enter key password: ")
}
}
} else {
// Building from IDE's "Run" button
signingConfigs {
release {
}
}
}
In a very general way and to support SQL server here is
SELECT TOP(N) *
FROM tbl_name
ORDER BY tbl_id DESC
and for the performance, it is not bad (less than one second for more than 10,000 records On Server machine)
If you want to redirect the output to a log file to look for errors or something. You can do something like this.
sqlplus -s <<EOF>> LOG_FILE_NAME user/passwd@host/db
#Your SQL code
EOF
When you do this,
while((inputLine = buff_read.readLine())!= null){
System.out.println(inputLine);
}
You consume everything in instream, so instream is empty. Now when try to do this,
Document doc = builder.parse(instream);
The parsing will fail, because you have passed it an empty stream.
Yes, gzip
will let you do this. If you simply run gzip > foo.gz
, it will compress STDIN to the file foo.gz. You can also pipe data into it, like some_command | gzip > foo.gz
.
You could simply use
return
which does exactly the same as
return None
Your function will also return None
if execution reaches the end of the function body without hitting a return
statement. Returning nothing is the same as returning None
in Python.
You are not using the function in_array (http://php.net/manual/en/function.in-array.php) correctly:
bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )
The $needle has to have a value in the array, so you first need to extract the url from the string (with a regular expression for example). Something like this:
$url = extrctUrl('my domain name is website3.com');
//$url will be 'website3.com'
in_array($url, $owned_urls)
Every time setColor
gets hit, you are setting count = 1. You would need to define count
outside of the scope of the function. Example:
var count=1;
function setColor(btn, color){
var property = document.getElementById(btn);
if (count == 0){
property.style.backgroundColor = "#FFFFFF"
count=1;
}
else{
property.style.backgroundColor = "#7FFF00"
count=0;
}
}
Using JQuery, try this:
$("#id_description_iframe").contents().find("body").html()
If you're just starting out learning javascript & don't want to spend time creating an entire webpage just for embedding test scripts, just open Dev Tools in a new tab in Chrome Browser, and click on Console
.
Then type out some test scripts: eg.
console.log('Aha!')
Then press Enter after every line (to submit for execution by Chrome)
or load your own "external script file":
document.createElement('script').src = 'http://example.com/file.js';
Then call your functions:
console.log(file.function('?????'))
Tested in Google Chrome 85.0.4183.121
In my case I had a project with lots of entries in "Build Settings > Other Linker Flags"
I needed to reduce it down to just
$(inherited)
-ObjC
Old settings:
Updated settings:
Generally you can do
select * from your_table
order by case when name = 'core' then 1 else 2 end,
priority
Especially in MySQL you can also do
select * from your_table
order by name <> 'core',
priority
Since the result of a comparision in MySQL is either 0
or 1
and you can sort by that result.
Just set the height and width where you are adding that logo. I tried and its working fine
Just put that line in the bat file...
Alternatively you can even make a shortcut for svcutil.exe, then add the arguments in the 'target' window.
Excel export script works on IE7+, Firefox and Chrome.
function fnExcelReport()
{
var tab_text="<table border='2px'><tr bgcolor='#87AFC6'>";
var textRange; var j=0;
tab = document.getElementById('headerTable'); // id of table
for(j = 0 ; j < tab.rows.length ; j++)
{
tab_text=tab_text+tab.rows[j].innerHTML+"</tr>";
//tab_text=tab_text+"</tr>";
}
tab_text=tab_text+"</table>";
tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, "");//remove if u want links in your table
tab_text= tab_text.replace(/<img[^>]*>/gi,""); // remove if u want images in your table
tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); // reomves input params
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer
{
txtArea1.document.open("txt/html","replace");
txtArea1.document.write(tab_text);
txtArea1.document.close();
txtArea1.focus();
sa=txtArea1.document.execCommand("SaveAs",true,"Say Thanks to Sumit.xls");
}
else //other browser not tested on IE 11
sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));
return (sa);
}
Just create a blank iframe:
<iframe id="txtArea1" style="display:none"></iframe>
Call this function on:
<button id="btnExport" onclick="fnExcelReport();"> EXPORT </button>
EDIT2- Yea auto fills the DOM SOZ!
#img_box{
width:90%;
height:90%;
min-width: 400px;
min-height: 400px;
}
check out this fiddle
http://jsfiddle.net/ppumkin/4qjXv/2/
http://jsfiddle.net/ppumkin/4qjXv/3/
and this page
http://www.webmasterworld.com/css/3828593.htm
Removed original answer because it was wrong.
The width is ok- but the height resets to 0
so
min-height: 400px;
to leave the file in the repo but ignore future changes to it:
git update-index --assume-unchanged <file>
and to undo this:
git update-index --no-assume-unchanged <file>
to find out which files have been set this way:
git ls-files -v|grep '^h'
credit for the original answer to http://blog.pagebakers.nl/2009/01/29/git-ignoring-changes-in-tracked-files/
It means display width
Whether you use tinyint(1) or tinyint(2), it does not make any difference.
I always use tinyint(1) and int(11), I used several mysql clients (navicat, sequel pro).
It does not mean anything AT ALL! I ran a test, all above clients or even the command-line client seems to ignore this.
But, display width is most important if you are using ZEROFILL
option, for example your table has following 2 columns:
A tinyint(2) zerofill
B tinyint(4) zerofill
both columns has the value of 1, output for column A would be 01
and 0001
for B, as seen in screenshot below :)
if the error is
Line 26:
Line 27: @foreach (Customers customer in Model)
Line 28: {
Line 29:
give the full name space
like
@foreach (Start.Models.customer customer in Model)
You may find that using the `group' aes will help you get the result you want. For example:
tu <- expand.grid(Land = gl(2, 1, labels = c("DE", "BB")),
Altersgr = gl(5, 1, labels = letters[1:5]),
Geschlecht = gl(2, 1, labels = c('m', 'w')),
Jahr = 2000:2009)
set.seed(42)
tu$Wert <- unclass(tu$Altersgr) * 200 + rnorm(200, 0, 10)
ggplot(tu, aes(x = Jahr, y = Wert, color = Altersgr, group = Altersgr)) +
geom_point() + geom_line() +
facet_grid(Geschlecht ~ Land)
Which produces the plot found here:
I know it's been a while, but I'll this here in case it helps someone out.
The right answer by far is (and the selected one) the one from CommonsWare. I was having the same problem as posted, the following
MyFragmentClass fragmentList =
(MyFragmentClass) getSupportFragmentManager().findFragmentById(R.id.fragementID);
kept on returning null. My mistake was really silly, in my xml file:
<fragment
android:tag="@+id/fragementID"
android:name="com.sf.lidgit_android.content.MyFragmentClass"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
The mistake was that I had android:tag INSTEAD OF android:id.
please try adding this meta-tag and style
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
<style>
body{
touch-action: manipulation;
}
</style>
How are you generating the radio button list? If you're just using HTML:
<input type="radio" onclick="alert('hello');"/>
If you're generating these via something like ASP.NET, you can add that as an attribute to each element in the list. You can run this after you populate your list, or inline it if you build up your list one-by-one:
foreach(ListItem RadioButton in RadioButtons){
RadioButton.Attributes.Add("onclick", "alert('hello');");
}
git push origin
will push all changes on the local branches that have matching remote branches at origin
As for git push
Works like
git push <remote>
, where<remote>
is the current branch's remote (or origin, if no remote is configured for the current branch).
From the Examples section of the git-push
man page
Try:
#your_div_id {
width: 855px;
margin:0 auto;
text-align: center;
}
The ISO 8601 time format does not store a time zone name, only the corresponding UTC offset is preserved.
To convert a file ctime to an ISO 8601 time string while preserving the UTC offset in Python 3:
>>> import os
>>> from datetime import datetime, timezone
>>> ts = os.path.getctime(some_file)
>>> dt = datetime.fromtimestamp(ts, timezone.utc)
>>> dt.astimezone().isoformat()
'2015-11-27T00:29:06.839600-05:00'
The code assumes that your local timezone is Eastern Time Zone (ET) and that your system provides a correct UTC offset for the given POSIX timestamp (ts
), i.e., Python has access to a historical timezone database on your system or the time zone had the same rules at a given date.
If you need a portable solution; use the pytz
module that provides access to the tz database:
>>> import os
>>> from datetime import datetime
>>> import pytz # pip install pytz
>>> ts = os.path.getctime(some_file)
>>> dt = datetime.fromtimestamp(ts, pytz.timezone('America/New_York'))
>>> dt.isoformat()
'2015-11-27T00:29:06.839600-05:00'
The result is the same in this case.
If you need the time zone name/abbreviation/zone id, store it separately.
>>> dt.astimezone().strftime('%Y-%m-%d %H:%M:%S%z (%Z)')
'2015-11-27 00:29:06-0500 (EST)'
Note: no, :
in the UTC offset and EST
timezone abbreviation is not part of the ISO 8601 time format. It is not unique.
Different libraries/different versions of the same library may use different time zone rules for the same date/timezone. If it is a future date then the rules might be unknown yet. In other words, the same UTC time may correspond to a different local time depending on what rules you use -- saving a time in ISO 8601 format preserves UTC time and the local time that corresponds to the current time zone rules in use on your platform. You might need to recalculate the local time on a different platform if it has different rules.
In this scenario, create another shared module in that import all the component which is being used in multiple module.
In shared component. declare those component. And then import shared module in appmodule as well as in other module where you want to access. It will work 100% , I did this and got it working.
@NgModule({
declarations: [HeaderComponent, NavigatorComponent],
imports: [
CommonModule, BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
FormsModule,
]
})
export class SharedmoduleModule { }
const routes: Routes = [
{
path: 'Parent-child-relationship',
children: [
{ path: '', component: HeaderComponent },
{ path: '', component: ParrentChildComponent }
]
}];
@NgModule({
declarations: [ParrentChildComponent, HeaderComponent],
imports: [ RouterModule.forRoot(routes), CommonModule, SharedmoduleModule ],
exports: [RouterModule]
})
export class TutorialModule {
}
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
FormsModule,
MatInputModule,
MatButtonModule,
MatSelectModule,
MatIconModule,
SharedmoduleModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
An entity manager can only be injected in classes running inside a transaction. In other words, it can only be injected in a EJB. Other classe must use an EntityManagerFactory to create and destroy an EntityManager.
Since your TestService is not an EJB, the annotation @PersistenceContext is simply ignored. Not only that, in JavaEE 5, it's not possible to inject an EntityManager nor an EntityManagerFactory in a JAX-RS Service. You have to go with a JavaEE 6 server (JBoss 6, Glassfish 3, etc).
Here's an example of injecting an EntityManagerFactory:
package com.test.service;
import java.util.*;
import javax.persistence.*;
import javax.ws.rs.*;
@Path("/service")
public class TestService {
@PersistenceUnit(unitName = "test")
private EntityManagerFactory entityManagerFactory;
@GET
@Path("/get")
@Produces("application/json")
public List get() {
EntityManager entityManager = entityManagerFactory.createEntityManager();
try {
return entityManager.createQuery("from TestEntity").getResultList();
} finally {
entityManager.close();
}
}
}
The easiest way to go here is to declare your service as a EJB 3.1, assuming you're using a JavaEE 6 server.
Related question: Inject an EJB into JAX-RS (RESTful service)
Use the map
method:
var a = [1, 2, 3]_x000D_
var b = ['a', 'b', 'c']_x000D_
_x000D_
var c = a.map(function(e, i) {_x000D_
return [e, b[i]];_x000D_
});_x000D_
_x000D_
console.log(c)
_x000D_
You should actually return "200 OK" and in the response body include a message about what happened with the posted data. Then it's up to your application to understand the message.
The thing is, HTTP status codes are exactly that - HTTP status codes. And those are meant to have meaning only at the transportation layer, not at the application layer. The application layer should really never even know that HTTP is being used. If you switched your transportation layer from HTTP to Homing Pigeons, it should not affect your application layer in any way.
Let me give you a non-virtual example. Let's say you fall in love with a girl and she loves you back but her family moves to a completely different country. She gives you her new snail-mail address. Naturally, you decide to send her a love letter. So you write your letter, put it into an envelope, write her address on the envelope, put a stamp on it and send it. Now let's consider these scenarios
In short: Returning "200 OK" doesn't mean that the server app has good news for you. It only means that it has some news.
PS: The 422 status code has a meaning only in the context of WebDAV. If you're not working with WebDAV, then 422 has exactly the same standard meaning as any other non-standard code = which is none.
This works perfectly:
public boolean deleteSingleRow(String rowId)
{
return db.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
}
You can also refer to this example.
I would suggest the following simple approach for conversion:
from datetime import datetime, timedelta
s = "20120213"
# you could also import date instead of datetime and use that.
date = datetime(year=int(s[0:4]), month=int(s[4:6]), day=int(s[6:8]))
For adding/subtracting an arbitary amount of days (seconds work too btw.), you could do the following:
date += timedelta(days=10)
date -= timedelta(days=5)
And convert back using:
s = date.strftime("%Y%m%d")
To convert the integer to a string safely, use:
s = "{0:-08d}".format(i)
This ensures that your string is eight charecters long and left-padded with zeroes, even if the year is smaller than 1000 (negative years could become funny though).
Further reference: datetime objects, timedelta objects
in your css :
#txtComputer {
font-size: 24px;
}
You can style an input entirely (background, color, etc.) and even use the hover event.
If you don't have httpd.conf
in folder /etc/apache2
, you should have apache2.conf - simply add:
ServerName localhost
Then restart the apache2
service.
Tried all of the options above. What worked for me was:
Domain
Path=/
Resulting Set-Cookie
header:
Set-Cookie: session_token=74528588-7c48-4546-a3ae-4326e22449e5; Expires=Sun, 16 Aug 2020 04:40:42 GMT; Path=/
Try this:
SELECT *
FROM information_schema.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_NAME = 'YourTable';
This should deliver you which Tables have references to the table you want to drop, once you drop these references, or the datasets which reference datasets in this table you will be able to drop the table
Ahh. Because I missed the point of you initial post, here is an example which also ITERATES. The first example did not. In this case, I retreive an ADODB recordset, then load the data into a collection, which is returned by the function to client code:
EDIT: Not sure what I screwed up in pasting the code, but the formatting is a little screwball. Sorry!
Public Function StatesCollection() As Collection
Dim cn As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Dim colReturn As New Collection
Set colReturn = New Collection
Dim SQL As String
SQL = _
"SELECT tblState.State, tblState.StateName " & _
"FROM tblState"
Set cn = New ADODB.Connection
Set cmd = New ADODB.Command
With cn
.Provider = DataConnection.MyADOProvider
.ConnectionString = DataConnection.MyADOConnectionString
.Open
End With
With cmd
.CommandText = SQL
.ActiveConnection = cn
End With
Set rs = cmd.Execute
With rs
If Not .EOF Then
Do Until .EOF
colReturn.Add Nz(!State, "")
.MoveNext
Loop
End If
.Close
End With
cn.Close
Set rs = Nothing
Set cn = Nothing
Set StatesCollection = colReturn
End Function
Just so I don't lose my answer that works:
It means the text is stored as wchar_t
characters rather than plain old char
characters.
(I originally said it meant unicode. I was wrong about that. But it can be used for unicode.)
Consider using a Spinner instead of a Number Picker in a Dialog. It's not exactly what was asked for, but it's much easier to implement, more contextual UI design, and should fulfill most use cases. The equivalent code for a Spinner is:
Spinner picker = new Spinner(this);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, yourStringList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
picker.setAdapter(adapter);
I checked the IL on several answers. This code efficiently provides an empty List:
using System.Linq;
…
var list = new[]{new{Id = default(int), Name = default(string)}}.Skip(1).ToList();
Lapack is a Linear Algebra package which is used by R (actually it's used everywhere) underneath solve()
, dgesv spits this kind of error when the matrix you passed as a parameter is singular.
As an addendum: dgesv performs LU decomposition, which, when using your matrix, forces a division by 0, since this is ill-defined, it throws this error. This only happens when matrix is singular or when it's singular on your machine (due to approximation you can have a really small number be considered 0)
I'd suggest you check its determinant if the matrix you're using contains mostly integers and is not big. If it's big, then take a look at this link.
Use the START command:
start [programPath]
If the path to the program contains spaces remember to add quotes. In this case you also need to provide a title for the opening console window
start "[title]" "[program path]"
If you need to provide arguments append them at the end (outside the command quotes)
start "[title]" "[program path]" [list of command args]
Use the /b option to avoid opening a new console window (but in that case you cannot interrupt the application using CTRL-C
You use !important
to override a css
property.
For example, you have a control in ASP.NET and it renders a control with a background blue (in the HTML). You want to change it, and you don't have the source control so you attach a new CSS file and write the same selector and change the color and after it add !important
.
Best practices is when you are branding / redesigning SharePoint sites, you use it a lot to override the default styles.
This should solve your problem:
td {
/* <http://www.w3.org/wiki/CSS/Properties/text-align>
* left, right, center, justify, inherit
*/
text-align: center;
/* <http://www.w3.org/wiki/CSS/Properties/vertical-align>
* baseline, sub, super, top, text-top, middle,
* bottom, text-bottom, length, or a value in percentage
*/
vertical-align: top;
}
In most cases there's really no difference.
Typically you always have to use foreach when you don't have an explicit numerical index, and you always have to use for when you don't actually have an iterable collection (e.g. iterating over a two-dimensional array grid in an upper triangle). There are some cases where you have a choice.
One could argue that for loops can be a little more difficult to maintain if magic numbers start to appear in the code. You should be right to be annoyed at not being able to use a for loop and have to build a collection or use a lambda to build a subcollection instead just because for loops have been banned.
Though this question has been answered. I would like to put something extra, i.e. if there is a file exist with the directory name that you are trying to create than it should prompt an error. For future visitors.
public static void makeDir()
{
File directory = new File(" dirname ");
if (directory.exists() && directory.isFile())
{
System.out.println("The dir with name could not be" +
" created as it is a normal file");
}
else
{
try
{
if (!directory.exists())
{
directory.mkdir();
}
String username = System.getProperty("user.name");
String filename = " path/" + username + ".txt"; //extension if you need one
}
catch (IOException e)
{
System.out.println("prompt for error");
}
}
}
Using git var
and filtering only those that start with alias
:
git var -l | grep -e "^alias"
It should be like import package_name.Class_Name
--> If you want to import a specific class
(or)
import package_name.*
--> To import all classes in a package
I think the easiest (and maybe most elegant) solution here is to leverage the fact that you can set default
to a callable. So, to get around admin's special handling of auto_now, you can just declare the field like so:
from django.utils import timezone
date_field = models.DateField(default=timezone.now)
It's important that you don't use timezone.now()
as the default value wouldn't update (i.e., default gets set only when the code is loaded). If you find yourself doing this a lot, you could create a custom field. However, this is pretty DRY already I think.
To get the current Id on a View:
ViewContext.RouteData.Values["id"].ToString()
To get the current controller:
ViewContext.RouteData.Values["controller"].ToString()
You can use encoding like ASCII to get a character per byte by using the System.Text.Encoding
class.
or try this
System.Text.ASCIIEncoding.Unicode.GetByteCount(string);
System.Text.ASCIIEncoding.ASCII.GetByteCount(string);
The best solution is using DATE() function and extracting yy, mm, and dd from the string with RIGHT(), MID() and LEFT() functions, the final will be some DATE(LEFT(),MID(),RIGHT()), details here
For linux users, and to sum up and add to what others have said here, you should know the following:
$CLASSPATH is what Java uses to look through multiple directories to find all the different classes it needs for your script (unless you explicitly tell it otherwise with the -cp override). Using -cp requires that you keep track of all the directories manually and copy-paste that line every time you run the program (not preferable IMO).
The colon (":") character separates the different directories. There is only one $CLASSPATH and it has all the directories in it. So, when you run "export CLASSPATH=...." you want to include the current value "$CLASSPATH" in order to append to it. For example:
export CLASSPATH=.
export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java-5.1.12.jar
In the first line above, you start CLASSPATH out with just a simple 'dot' which is the path to your current working directory. With that, whenever you run java it will look in the current working directory (the one you're in) for classes. In the second line above, $CLASSPATH grabs the value that you previously entered (.) and appends the path to a mysql dirver. Now, java will look for the driver AND for your classes.
echo $CLASSPATH
is super handy, and what it returns should read like a colon-separated list of all the directories, and .jar files, you want java looking in for the classes it needs.
Tomcat does not use CLASSPATH. Read what to do about that here: https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html
Or if you use gmaps.js, call:
map.refresh();
when your div is shown.
This is precisely the sort of scenario where analytics come to the rescue.
Given this test data:
SQL> select * from employment_history
2 order by Gc_Staff_Number
3 , start_date
4 /
GC_STAFF_NUMBER START_DAT END_DATE C
--------------- --------- --------- -
1111 16-OCT-09 Y
2222 08-MAR-08 26-MAY-09 N
2222 12-DEC-09 Y
3333 18-MAR-07 08-MAR-08 N
3333 01-JUL-09 21-MAR-09 N
3333 30-JUL-10 Y
6 rows selected.
SQL>
An inline view with an analytic LAG() function provides the right answer:
SQL> select Gc_Staff_Number
2 , start_date
3 , prev_end_date
4 from (
5 select Gc_Staff_Number
6 , start_date
7 , lag (end_date) over (partition by Gc_Staff_Number
8 order by start_date )
9 as prev_end_date
10 , current_flag
11 from employment_history
12 )
13 where current_flag = 'Y'
14 /
GC_STAFF_NUMBER START_DAT PREV_END_
--------------- --------- ---------
1111 16-OCT-09
2222 12-DEC-09 26-MAY-09
3333 30-JUL-10 21-MAR-09
SQL>
The inline view is crucial to getting the right result. Otherwise the filter on CURRENT_FLAG removes the previous rows.
The answer by Chinmay Kanchi is excellent but I wanted an example of a function which passes and returns a variables/arrays to a C++ code. I though I'd include it here in case it is useful to others.
Passing and returning an integer
The C++ code for a function which takes an integer and adds one to the returned value,
extern "C" int add_one(int i)
{
return i+1;
}
Saved as file test.cpp
, note the required extern "C" (this can be removed for C code).
This is compiled using g++, with arguments similar to Chinmay Kanchi answer,
g++ -shared -o testlib.so -fPIC test.cpp
The Python code uses load_library
from the numpy.ctypeslib
assuming the path to the shared library in the same directory as the Python script,
import numpy.ctypeslib as ctl
import ctypes
libname = 'testlib.so'
libdir = './'
lib=ctl.load_library(libname, libdir)
py_add_one = lib.add_one
py_add_one.argtypes = [ctypes.c_int]
value = 5
results = py_add_one(value)
print(results)
This prints 6 as expected.
Passing and printing an array
You can also pass arrays as follows, for a C code to print the element of an array,
extern "C" void print_array(double* array, int N)
{
for (int i=0; i<N; i++)
cout << i << " " << array[i] << endl;
}
which is compiled as before and the imported in the same way. The extra Python code to use this function would then be,
import numpy as np
py_print_array = lib.print_array
py_print_array.argtypes = [ctl.ndpointer(np.float64,
flags='aligned, c_contiguous'),
ctypes.c_int]
A = np.array([1.4,2.6,3.0], dtype=np.float64)
py_print_array(A, 3)
where we specify the array, the first argument to print_array
, as a pointer to a Numpy array of aligned, c_contiguous 64 bit floats and the second argument as an integer which tells the C code the number of elements in the Numpy array. This then printed by the C code as follows,
1.4
2.6
3.0
One neat trick to disable margin collapsing that has no visual impact, as far as I know, is setting the padding of the parent to 0.05px
:
.parentClass {
padding: 0.05px;
}
The padding is no longer 0 so collapsing won't occur anymore but at the same time the padding is small enough that visually it will round down to 0.
If some other padding is desired, then apply padding only to the "direction" in which margin collapsing is not desired, for example padding-top: 0.05px;
.
Working example:
.noCollapse {_x000D_
padding: 0.05px;_x000D_
}_x000D_
_x000D_
.parent {_x000D_
background-color: red;_x000D_
width: 150px;_x000D_
}_x000D_
_x000D_
.children {_x000D_
margin-top: 50px;_x000D_
_x000D_
background-color: lime; _x000D_
width: 100px;_x000D_
height: 100px;_x000D_
}
_x000D_
<h3>Border collapsing</h3>_x000D_
<div class="parent">_x000D_
<div class="children">_x000D_
</div>_x000D_
</div>_x000D_
_x000D_
<h3>No border collapsing</h3>_x000D_
<div class="parent noCollapse">_x000D_
<div class="children">_x000D_
</div>_x000D_
</div>
_x000D_
Edit: changed the value from 0.1
to 0.05
. As Chris Morgan mentioned in a comment bellow, and from this small test, it seems that indeed Firefox takes the 0.1px
padding into consideration. Though, 0.05px
seemes to do the trick.
Another Solution for detecting Shift+Enter Key with Angular2+
Inside Component.html
<input type="text" (keydown.shift.enter)="newLine($event)">
Inside Component.ts
newLine(event){
if(event.keyCode==13 && event.shiftKey){
alert('Shift+Enter key Pressed');
}
}
This is an old question, but is still regularly viewed/needed. I want to post to caution readers like me that whitespace as mentioned in the OP's question is not the same as Regex's definition, to include newlines, tabs, and space characters -- Git asks you to be explicit. See some options here: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
As stated, git diff -b
or git diff --ignore-space-change
will ignore spaces at line ends. If you desire that setting to be your default behavior, the following line adds that intent to your .gitconfig file, so it will always ignore the space at line ends:
git config --global core.whitespace trailing-space
In my case, I found this question because I was interested in ignoring "carriage return whitespace differences", so I needed this:
git diff --ignore-cr-at-eol
or
git config --global core.whitespace cr-at-eol
from here.
You can also make it the default only for that repo by omitting the --global parameter, and checking in the settings file for that repo. For the CR problem I faced, it goes away after check-in if warncrlf or autocrlf = true in the [core] section of the .gitconfig file.
To create a new commit that 'undoes' the changes of a past commit, use:
$ git revert <commit-hash>
It's also possible to actually remove a commit from an arbitrary point in the past by rebasing and then resetting, but you really don't want to do that if you have already pushed your commits to another repository (or someone else has pulled from you).
If your previous commit is a merge commit you can run this command
$ git revert -m 1 <commit-hash>
See schacon.github.com/git/howto/revert-a-faulty-merge.txt for proper ways to re-merge an un-merged branch
Another more manual option to get it:
.nuget\nuget.exe install Newtonsoft.Json -Version 4.0.5
In JavaScript this
always refers to the “owner” of the function we're executing, or rather, to the object that a function is a method of. When we define our faithful function doSomething() in a page, its owner is the page, or rather, the window object (or global object) of JavaScript.
This comes in late but was quite helpful. I am Just posting for future reference
DataTable dt = new DataTable();
Data.DataView dv = default(Data.DataView);
dv = (Data.DataView)ds.Select(DataSourceSelectArguments.Empty);
dt = dv.ToTable();
Here it is a solution using map function:
>>> a = [3, 7, 19]
>>> map(lambda x: (x, a[x]), range(len(a)))
[(0, 3), (1, 7), (2, 19)]
And a solution using list comprehensions:
>>> a = [3,7,19]
>>> [(x, a[x]) for x in range(len(a))]
[(0, 3), (1, 7), (2, 19)]
Install-Package:
**Microsoft.EntityFrameworkCore.SqlServer**
then add the top of your class:
**Microsoft.EntityFrameworkCore;**
that's worked for me
In my case, I had to call an API repeatedly in a loop, which resulted in halt of my system returning a 403 Forbidden Error
. Since my API provider does not allow multiple requests from the same client within milliseconds, I had to use a delay of 1 second at least :
foreach (var it in list)
{
Thread.Sleep(1000);
// Call API
}
I had this same problem. For me, the reason turned out to be that I had a mismatch in the name of the class and the name of the file. I declared class "GenSig" in a file called "SignatureTester.java".
I changed the name of the class to "SignatureTester", and the "Run as Java Application" option showed up immediately.
This code is all you need:
static void Main(string[] args) {
String xml = @"
<transactions>
<transaction name=""Fred"" amount=""5,20"" />
<transaction name=""John"" amount=""10,00"" />
<transaction name=""Fred"" amount=""3,00"" />
</transactions>";
XDocument xmlDocument = XDocument.Parse(xml);
var query = from x in xmlDocument.Descendants("transaction")
group x by x.Attribute("name").Value into g
select new { Name = g.Key, Amount = g.Sum(t => Decimal.Parse(t.Attribute("amount").Value)) };
foreach (var item in query) {
Console.WriteLine("Name: {0}; Amount: {1:C};", item.Name, item.Amount);
}
}
And the content is:
Name: Fred; Amount: R$ 8,20;
Name: John; Amount: R$ 10,00;
That is the way of doing this in C# - in a declarative way!
I hope this helps,
Ricardo Lacerda Castelo Branco
Notifications are greyscale as explained below. They are not black-and-white, despite what others have written. You have probably seen icons with multiple shades, like network strength bars.
Prior to API 21 (Lollipop 5.0), colour icons work. You could force your application to target API 20, but that limits the features available to your application, so it is not recommended. You could test the running API level and set either a colour icon or a greyscale icon appropriately, but this is likely not worthwhile. In most cases, it is best to go with a greyscale icon.
Images have four channels, RGBA (red / green / blue / alpha). For notification icons, Android ignores the R, G, and B channels. The only channel that counts is Alpha, also known as opacity. Design your icon with an editor that gives you control over the Alpha value of your drawing colours.
How Alpha values generate a greyscale image:
Changing it up with setColor
:
Call NotificationCompat.Builder.setColor(int argb)
. From the documentation for Notification.color
:
Accent color (an ARGB integer like the constants in Color) to be applied by the standard Style templates when presenting this notification. The current template design constructs a colorful header image by overlaying the icon image (stenciled in white) atop a field of this color. Alpha components are ignored.
My testing with setColor shows that Alpha components are not ignored. Higher Alpha values turn a pixel white. Lower Alpha values turn a pixel to the background colour (black on my device) in the notification area, or to the specified colour in the pull-down notification.
SELECT IDENT_CURRENT('databasename.dbo.tablename') AS your identity column;
With this code you can easily draw a circle... C# is great and easy my friend
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Graphics myGraphics = base.CreateGraphics();
Pen myPen = new Pen(Color.Red);
SolidBrush mySolidBrush = new SolidBrush(Color.Red);
myGraphics.DrawEllipse(myPen, 50, 50, 150, 150);
}
}
I found this problem too. Because centos service depend on multi-user.target for none desktop Cenots 7.2. so I delete multi-user.target from my .service file. It had missed.
Where a
is the slice, and i
is the index of the element you want to delete:
a = append(a[:i], a[i+1:]...)
...
is syntax for variadic arguments in Go.
Basically, when defining a function it puts all the arguments that you pass into one slice of that type. By doing that, you can pass as many arguments as you want (for example, fmt.Println
can take as many arguments as you want).
Now, when calling a function, ...
does the opposite: it unpacks a slice and passes them as separate arguments to a variadic function.
So what this line does:
a = append(a[:0], a[1:]...)
is essentially:
a = append(a[:0], a[1], a[2])
Now, you may be wondering, why not just do
a = append(a[1:]...)
Well, the function definition of append
is
func append(slice []Type, elems ...Type) []Type
So the first argument has to be a slice of the correct type, the second argument is the variadic, so we pass in an empty slice, and then unpack the rest of the slice to fill in the arguments.
#include<stdio.h>
#include<pthread.h>
void* myprint(void *x)
{
int k = *((int *)x);
printf("\n Thread created.. value of k [%d]\n",k);
//k =11;
pthread_exit((void *)k);
}
int main()
{
pthread_t th1;
int x =5;
int *y;
pthread_create(&th1,NULL,myprint,(void*)&x);
pthread_join(th1,(void*)&y);
printf("\n Exit value is [%d]\n",y);
}
GregorianCalendar c = new GregorianCalendar();
c.setTime(yourDate);
XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
The jsfiddle link to where i tried out your query http://jsfiddle.net/A8Dnv/1/ its working fine @Imrul as mentioned you are using C# on server side and you dont mind that either: http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.escape.aspx
Because of the GDPR it makes no sense to use the iframe, you should rather use the object tag with the embed tag and also use the embed link.
<object width="100%" height="333">
<param name="movie" value="https://www.youtube-nocookie.com/embed/Sdg0ef2PpBw">
<embed src="https://www.youtube-nocookie.com/embed/Sdg0ef2PpBw" width="100%" height="333">
</object>
_x000D_
You should also activate the extended data protection mode function to receive the no cookie url.
type="application/x-shockwave-flash"
flash does not have to be used
Nocookie, however, means that data is still being transmitted, namely the thumbnail that is loaded from YouTube. But at least data is no longer passed on to advertising networks (as example DoubleClick). And no user data is stored on your website by youtube.
This method uses regexp, it should work:
awk '$2 ~ /findtext/ {print $3}' <infile>
$('.update-cart').click(function(e) {
updateCartWidget();
e.stopPropagation();
e.preventDefault();
});
$('.update-cart').click(function() {
updateCartWidget();
return false;
});
The following methods achieve the exact same thing.
There is a way to create "const" variables in Java, but only for specific classes. Just define a class with final properties and subclass it. Then use the base class where you would want to use "const". Likewise, if you need to use "const" methods, add them to the base class. The compiler will not allow you to modify what it thinks is the final methods of the base class, but it will read and call methods on the subclass.
You can simply pass your data frame into the following function:
rotate_x <- function(data, column_to_plot, labels_vec, rot_angle) {
plt <- barplot(data[[column_to_plot]], col='steelblue', xaxt="n")
text(plt, par("usr")[3], labels = labels_vec, srt = rot_angle, adj = c(1.1,1.1), xpd = TRUE, cex=0.6)
}
Usage:
rotate_x(mtcars, 'mpg', row.names(mtcars), 45)
You can change the rotation angle of the labels as needed.
That should work for you
tab separated
hive -e 'select * from some_table' > /home/yourfile.tsv
comma separated
hive -e 'select * from some_table' | sed 's/[\t]/,/g' > /home/yourfile.csv
First, sudo pip install 'package-name'
means nothing it will return
sudo: pip: command not found
You get the Permission denied, you shouldn't use pip install as root anyway. You can just install the packages into your own user like mentionned above with
pip install 'package-name' --user
and it will work as you intend. If you need it in any other user just run the same command and you'll be good to go.
You do need to have a settings.xml linked under user settings (Located in preferences under maven)
But, if that doesn't fix it, like it didn't for many of you. You also have to delete the directory:
.m2/repository/org/apache/maven/archetypes/maven-archetype-quickstart
then quit eclipse and try again.
This is what solved my problem.
Well, a for or while loop differs from a do while loop. A do while executes the statements atleast once, even if the condition turns out to be false.
The for loop you specified is absolutely correct.
Although i will do all the loops for you once again.
int sum = 0;
// for loop
for (int i = 1; i<= 100; i++){
sum = sum + i;
}
System.out.println(sum);
// while loop
sum = 0;
int j = 1;
while(j<=100){
sum = sum + j;
j++;
}
System.out.println(sum);
// do while loop
sum = 0;
j = 1;
do{
sum = sum + j;
j++;
}
while(j<=100);
System.out.println(sum);
In the last case condition j <= 100 is because, even if the condition of do while turns false, it will still execute once but that doesn't matter in this case as the condition turns true, so it continues to loop just like any other loop statement.
delete from t
where id in (1, 4, 6, 7)
// array of $ids that you need to select
$ids = array('1', '2', '3', '4', '5', '6', '7', '8');
// create sql part for IN condition by imploding comma after each id
$in = '(' . implode(',', $ids) .')';
// create sql
$sql = 'SELECT * FROM products WHERE catid IN ' . $in;
// see what you get
var_dump($sql);
Update: (a short version and update missing comma)
$ids = array('1','2','3','4');
$sql = 'SELECT * FROM products WHERE catid IN (' . implode(',', $ids) . ')';
If you're getting this, you may have forgotten to put #include <thread>
at the beginning of your file. OP's signature seems like it should work.
you can use directly (blur) event in input tag.
<div>
<input [value] = "" (blur) = "result = $event.target.value" placeholder="Type Something">
{{result}}
</div>
and you will get output in "result"
The proper test is:
if (capital != null && capital.length < 1) {
This ensures that capital
is always non null, when you perform the length check.
Also, as the comments suggest, capital
is null
because you never initialize it.
This should work. I would trim the whitespace from the input field first of all:
if($('#Field').val() != "") {
var value = $('#Field').val().replace(/^\s\s*/, '').replace(/\s\s*$/, '');
var intRegex = /^\d+$/;
if(!intRegex.test(value)) {
errors += "Field must be numeric.<br/>";
success = false;
}
} else {
errors += "Field is blank.</br />";
success = false;
}
You can either use the == operator or the Object.equals(Object) method.
The == operator checks whether the two subjects are the same object, whereas the equals method checks for equal contents (length and characters).
if(objectA == objectB) {
// objects are the same instance. i.e. compare two memory addresses against each other.
}
if(objectA.equals(objectB)) {
// objects have the same contents. i.e. compare all characters to each other
}
Which you choose depends on your logic - use == if you can and equals if you do not care about performance, it is quite fast anyhow.
String.intern() If you have two strings, you can internate them, i.e. make the JVM create a String pool and returning to you the instance equal to the pool instance (by calling String.intern()). This means that if you have two Strings, you can call String.intern() on both and then use the == operator. String.intern() is however expensive, and should only be used as an optimalization - it only pays off for multiple comparisons.
All in-code Strings are however already internated, so if you are not creating new Strings, you are free to use the == operator. In general, you are pretty safe (and fast) with
if(objectA == objectB || objectA.equals(objectB)) {
}
if you have a mix of the two scenarios. The inline
if(objectA == null ? objectB == null : objectA.equals(objectB)) {
}
can also be quite useful, it also handles null values since String.equals(..) checks for null.
@RayOnAir, I have same issue with previous solutions. I come close to @RayOnAir solution too. One thing that improved is close already opened popover when click on other popover marker. So my code is:
var clicked_popover_marker = null;
var popover_marker = '#pricing i';
$(popover_marker).popover({
html: true,
trigger: 'manual'
}).click(function (e) {
clicked_popover_marker = this;
$(popover_marker).not(clicked_popover_marker).popover('hide');
$(clicked_popover_marker).popover('toggle');
});
$(document).click(function (e) {
if (e.target != clicked_popover_marker) {
$(popover_marker).popover('hide');
clicked_popover_marker = null;
}
});
/// <summary>
/// Given two list, compare and extract differences
/// http://stackoverflow.com/questions/5620266/the-opposite-of-intersect
/// </summary>
public class CompareList
{
/// <summary>
/// Returns list of items that are in initial but not in final list.
/// </summary>
/// <param name="listA"></param>
/// <param name="listB"></param>
/// <returns></returns>
public static IEnumerable<string> NonIntersect(
List<string> initial, List<string> final)
{
//subtracts the content of initial from final
//assumes that final.length < initial.length
return initial.Except(final);
}
/// <summary>
/// Returns the symmetric difference between the two list.
/// http://en.wikipedia.org/wiki/Symmetric_difference
/// </summary>
/// <param name="initial"></param>
/// <param name="final"></param>
/// <returns></returns>
public static IEnumerable<string> SymmetricDifference(
List<string> initial, List<string> final)
{
IEnumerable<string> setA = NonIntersect(final, initial);
IEnumerable<string> setB = NonIntersect(initial, final);
// sum and return the two set.
return setA.Concat(setB);
}
}
You are writing if(true)
so it will always show "Hello " message.
You should take decision on the basis of value of n
returned.
If you want to do a custom analysis of your heapdump then there's:
This library is fast but you will need to write your analysis code in Java.
From the docs:
If it's reconnecting and getting connection ID 2, the server has almost definitely just crashed.
Contact the server admin and get them to diagnose the problem. No non-malicious SQL should crash the server, and the output of mysqldump certainly should not.
It is probably the case that the server admin has made some big operational error such as assigning buffer sizes of greater than the architecture's address-space limits, or more than virtual memory capacity. The MySQL error-log will probably have some relevant information; they will be monitoring this if they are competent anyway.
In case there are many people using your vagrant file - you might want to set name dynamically. Below is the example how to do it using username from your HOST machine as the name of the box and hostname:
require 'etc'
vagrant_name = "yourProjectName-" + Etc.getlogin
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.hostname = vagrant_name
config.vm.provider "virtualbox" do |v|
v.name = vagrant_name
end
end
If you want to play a really dangerous game, then this is by far the fastest way there is (around four times faster than the Array.Reverse
method). It's an in-place reverse using pointers.
Note that I really do not recommend this for any use, ever (have a look here for some reasons why you should not use this method), but it's just interesting to see that it can be done, and that strings aren't really immutable once you turn on unsafe code.
public static unsafe string Reverse(string text)
{
if (string.IsNullOrEmpty(text))
{
return text;
}
fixed (char* pText = text)
{
char* pStart = pText;
char* pEnd = pText + text.Length - 1;
for (int i = text.Length / 2; i >= 0; i--)
{
char temp = *pStart;
*pStart++ = *pEnd;
*pEnd-- = temp;
}
return text;
}
}
jQuery way:
$('input[name=myInputName]').change(function(ev) {
// your code
});
As an aside, under Windows, ProcessExplorer is fantastic for observing the existing TCP/IP connections for each process.
Another way to do this is:
mongo mongodb://mongoDbIPorDomain:port
With stderr (where most of the errors go to):
cmd /c yourscript.cmd > logall.txt 2>&1
I solved this problem by searching "mvc". The System.Web.Mvc appeared in search results, despite it is not contained in the list.
add float: left property to the image.
#rb-menu-com li .submenu div img {
border:1px solid #fff;
float:left;
}
You can install mod_security
and put in /etc/modsecurity/modsecurity.conf
:
SecRuleEngine On
SecAuditEngine On
SecAuditLog /var/log/apache2/modsec_audit.log
SecRequestBodyAccess on
SecAuditLogParts ABIJDFHZ
Try to remove the constructor and destructors, it's working for me....
The signature of main method must be
public static void main(String[] args)
A class can define multiple methods with the name main. The signature of these methods does not match the signature of the main method. These other methods with different signatures are not considered the "main" method.
I was facing with this problem some time ago and I found java.util.LinkedList
is best for my case. It has several methods, with different namings, but they're doing what is needed:
push() -> LinkedList.addLast(); // Or just LinkedList.add();
pop() -> LinkedList.pollLast();
shift() -> LinkedList.pollFirst();
unshift() -> LinkedList.addFirst();
Commenting on Ken Bertelson solution and answering Jan Hettich:
the takes_ary_as_arg descTable[@] optsTable[@]
line in try_with_local_arys()
function sends:
descTable
and optsTable
arrays which are accessible to the takes_ary_as_arg
function. takes_ary_as_arg()
function receives descTable[@]
and optsTable[@]
as strings, that means $1 == descTable[@]
and $2 == optsTable[@]
.in the beginning of takes_ary_as_arg()
function it uses ${!parameter}
syntax, which is called indirect reference or sometimes double referenced, this means that instead of using $1
's value, we use the value of the expanded value of $1
, example:
baba=booba
variable=baba
echo ${variable} # baba
echo ${!variable} # booba
likewise for $2
.
argAry1=("${!1}")
creates argAry1
as an array (the brackets following =
) with the expanded descTable[@]
, just like writing there argAry1=("${descTable[@]}")
directly.
the declare
there is not required.N.B.: It is worth mentioning that array initialization using this bracket form initializes the new array according to the IFS
or Internal Field Separator which is by default tab, newline and space. in that case, since it used [@]
notation each element is seen by itself as if he was quoted (contrary to [*]
).
In BASH
, local variable scope is the current function and every child function called from it, this translates to the fact that takes_ary_as_arg()
function "sees" those descTable[@]
and optsTable[@]
arrays, thus it is working (see above explanation).
Being that case, why not directly look at those variables themselves? It is just like writing there:
argAry1=("${descTable[@]}")
See above explanation, which just copies descTable[@]
array's values according to the current IFS
.
This is passing, in essence, nothing by value - as usual.
I also want to emphasize Dennis Williamson comment above: sparse arrays (arrays without all the keys defines - with "holes" in them) will not work as expected - we would loose the keys and "condense" the array.
That being said, I do see the value for generalization, functions thus can get the arrays (or copies) without knowing the names:
for real copies: we can use an eval for the keys, for example:
eval local keys=(\${!$1})
and then a loop using them to create a copy.
Note: here !
is not used it's previous indirect/double evaluation, but rather in array context it returns the array indices (keys).
descTable
and optsTable
strings (without [@]
), we could use the array itself (as in by reference) with eval
. for a generic function that accepts arrays.Here's a link to my tutorial, which walks you through :
http://mikesknowledgebase.com/pages/Services/WebServices-Page1.htm
All source code is provided, free of charge. Enjoy.
public class Arr {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a[] = {1,2,3};
//let a[] is your original array
System.out.println(a[0] + " " + a[1] + " " + a[2]);
int b[];
//let b[] is your temporary array with size greater than a[]
//I have took 5
b = new int[5];
//now assign all a[] values to b[]
for(int i = 0 ; i < a.length ; i ++)
b[i] = a[i];
//add next index values to b
b[3] = 4;
b[4] = 5;
//now assign b[] to a[]
a = b;
//now you can heck that size of an original array increased
System.out.println(a[0] + " " + a[1] + " " + a[2] + " " + a[3] + " "
+ a[4]);
}
}
Output for the above code is:
1 2 3
1 2 3 4 5
Try choosing project -> clean. A simple clean may fix it up.
Fragments are of particular use in some cases like where we want to keep a navigation drawer in all our pages. You can inflate a frame layout with whatever fragment you want and still have access to the navigation drawer.
If you had used an activity, you would have had to keep the drawer in all activities which makes for redundant code. This is one interesting use of a fragment.
I'm new to Android and still think a fragment is helpful this way.
Possibly the easiest way to make PHP perform a POST request is to use cURL, either as an extension or simply shelling out to another process. Here's a post sample:
// where are we posting to?
$url = 'http://foo.com/script.php';
// what post fields?
$fields = array(
'field1' => $field1,
'field2' => $field2,
);
// build the urlencoded data
$postvars = http_build_query($fields);
// open connection
$ch = curl_init();
// set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars);
// execute post
$result = curl_exec($ch);
// close connection
curl_close($ch);
Also check out Zend_Http set of classes in the Zend framework, which provides a pretty capable HTTP client written directly in PHP (no extensions required).
2014 EDIT - well, it's been a while since I wrote that. These days it's worth checking Guzzle which again can work with or without the curl extension.
#import "ViewController.h"
@interface ViewController ()
{
NSMutableArray *name;
}
@end
- (void)viewDidLoad
{
[super viewDidLoad];
name=[[NSMutableArray alloc]init];
[name addObject:@"ronak"];
[name addObject:@"vibha"];
[name addObject:@"shivani"];
[name addObject:@"nidhi"];
[name addObject:@"firdosh"];
[name addObject:@"himani"];
_tableview_outlet.delegate = self;
_tableview_outlet.dataSource = self;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [name count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [name objectAtIndex:indexPath.row];
return cell;
}
If some item(s) exist in both lists you may use
var all = list1.Concat(list2).Concat(list3) ... Concat(listN).Distinct().ToList();
I understand that this is fairly old question and has some pretty good answers. But, here is my two cents for the sake of completeness.
As per the official documentation, there are four ways, you can allow complete access for robots to access your site.
Specify a global matcher with a disallow segment as mentioned by @unor. So your /robots.txt
looks like this.
User-agent: *
Disallow:
Create a /robots.txt
file with no content in it. Which will default to allow all for all type of Bots
.
Do not create a /robots.txt
altogether. Which should yield the exact same results as the above two.
From the robots documentation for meta tags, You can use the following meta tag on all your pages on your site to let the Bots
know that these pages are not supposed to be indexed.
<META NAME="ROBOTS" CONTENT="NOINDEX">
In order for this to be applied to your entire site, You will have to add this meta tag for all of your pages. And this tag should strictly be placed under your HEAD
tag of the page. More about this meta tag here.
GPL-compiled ffmpeg can be used from non-GPL program (commercial project) only if it is invoked in the separate process as command line utility; all wrappers that are linked with ffmpeg library (including Microsoft's FFMpegInterop) can use only LGPL build of ffmpeg.
You may try my .NET wrapper for FFMpeg: Video Converter for .NET (I'm an author of this library). It embeds FFMpeg.exe into the DLL for easy deployment and doesn't break GPL rules (FFMpeg is NOT linked and wrapper invokes it in the separate process with System.Diagnostics.Process).
Yes, you can. I have a 64-bit Debian running in VMware on Windows XP 32-Bit. As long as you set the Guest to use two processors, it will work just fine.
below is used to a add a new remote:
git remote add origin [email protected]:User/UserRepo.git
below is used to change the url of an existing remote repository:
git remote set-url origin [email protected]:User/UserRepo.git
below will push your code to the master branch of the remote repository defined with origin
and -u
let you point your current local branch to the remote master branch:
git push -u origin master
Just an update, its seem that PHP guys are working on supporting thread and its available now.
Here is the link to it: http://php.net/manual/en/book.pthreads.php
Most answers either say it's impossible, or require you to use a WeakMap or Symbol, which are ES6 features that would probably require polyfills. There's however another way! Check out this out:
// 1. Create closure_x000D_
var SomeClass = function() {_x000D_
// 2. Create `key` inside a closure_x000D_
var key = {};_x000D_
// Function to create private storage_x000D_
var private = function() {_x000D_
var obj = {};_x000D_
// return Function to access private storage using `key`_x000D_
return function(testkey) {_x000D_
if(key === testkey) return obj;_x000D_
// If `key` is wrong, then storage cannot be accessed_x000D_
console.error('Cannot access private properties');_x000D_
return undefined;_x000D_
};_x000D_
};_x000D_
var SomeClass = function() {_x000D_
// 3. Create private storage_x000D_
this._ = private();_x000D_
// 4. Access private storage using the `key`_x000D_
this._(key).priv_prop = 200;_x000D_
};_x000D_
SomeClass.prototype.test = function() {_x000D_
console.log(this._(key).priv_prop); // Using property from prototype_x000D_
};_x000D_
return SomeClass;_x000D_
}();_x000D_
_x000D_
// Can access private property from within prototype_x000D_
var instance = new SomeClass();_x000D_
instance.test(); // `200` logged_x000D_
_x000D_
// Cannot access private property from outside of the closure_x000D_
var wrong_key = {};_x000D_
instance._(wrong_key); // undefined; error logged
_x000D_
I call this method accessor pattern. The essential idea is that we have a closure, a key inside the closure, and we create a private object (in the constructor) that can only be accessed if you have the key.
If you are interested, you can read more about this in my article. Using this method, you can create per object properties that cannot be accessed outside of the closure. Therefore, you can use them in constructor or prototype, but not anywhere else. I haven't seen this method used anywhere, but I think it's really powerful.
It looks like you are passing an NSString
parameter where you should be passing an NSData
parameter:
NSError *jsonError;
NSData *objectData = [@"{\"2\":\"3\"}" dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:objectData
options:NSJSONReadingMutableContainers
error:&jsonError];
Do not hesitate to put constraints on the database. You'll be sure to have a consistent database, and that's one of the good reasons to use a database. Especially if you have several applications requesting it (or just one application but with a direct mode and a batch mode using different sources).
With MySQL you do not have advanced constraints like you would have in postgreSQL but at least the foreign key constraints are quite advanced.
We'll take an example, a company table with a user table containing people from theses company
CREATE TABLE COMPANY (
company_id INT NOT NULL,
company_name VARCHAR(50),
PRIMARY KEY (company_id)
) ENGINE=INNODB;
CREATE TABLE USER (
user_id INT,
user_name VARCHAR(50),
company_id INT,
INDEX company_id_idx (company_id),
FOREIGN KEY (company_id) REFERENCES COMPANY (company_id) ON...
) ENGINE=INNODB;
Let's look at the ON UPDATE clause:
And now on the ON DELETE side:
usually my default is: ON DELETE RESTRICT ON UPDATE CASCADE. with some ON DELETE CASCADE
for track tables (logs--not all logs--, things like that) and ON DELETE SET NULL
when the master table is a 'simple attribute' for the table containing the foreign key, like a JOB table for the USER table.
Edit
It's been a long time since I wrote that. Now I think I should add one important warning. MySQL has one big documented limitation with cascades. Cascades are not firing triggers. So if you were over confident enough in that engine to use triggers you should avoid cascades constraints.
MySQL triggers activate only for changes made to tables by SQL statements. They do not activate for changes in views, nor by changes to tables made by APIs that do not transmit SQL statements to the MySQL Server
==> See below the last edit, things are moving on this domain
Triggers are not activated by foreign key actions.
And I do not think this will get fixed one day. Foreign key constraints are managed by the InnoDb storage and Triggers are managed by the MySQL SQL engine. Both are separated. Innodb is the only storage with constraint management, maybe they'll add triggers directly in the storage engine one day, maybe not.
But I have my own opinion on which element you should choose between the poor trigger implementation and the very useful foreign keys constraints support. And once you'll get used to database consistency you'll love PostgreSQL.
as stated by @IstiaqueAhmed in the comments, the situation has changed on this subject. So follow the link and check the real up-to-date situation (which may change again in the future).
First, double check that the branch has been actually pushed remotely, by using the command git ls-remote origin
. If the new branch appears in the output, try and give the command git fetch
: it should download the branch references from the remote repository.
If your remote branch still does not appear, double check (in the ls-remote
output) what is the branch name on the remote and, specifically, if it begins with refs/heads/
. This is because, by default, the value of remote.<name>.fetch
is:
+refs/heads/*:refs/remotes/origin/*
so that only the remote references whose name starts with refs/heads/
will be mapped locally as remote-tracking references under refs/remotes/origin/
(i.e., they will become remote-tracking branches)
Put a single listener on the table. When it gets a click from an input with a button that has a name of "edit" and value "edit", change its value to "modify". Get rid of the input's id (they aren't used for anything here), or make them all unique.
<script type="text/javascript">
function handleClick(evt) {
var node = evt.target || evt.srcElement;
if (node.name == 'edit') {
node.value = "Modify";
}
}
</script>
<table id="table1" border="1" onclick="handleClick(event);">
<thead>
<tr>
<th>Select
</thead>
<tbody>
<tr>
<td>
<form name="f1" action="#" >
<input id="edit1" type="submit" name="edit" value="Edit">
</form>
<tr>
<td>
<form name="f2" action="#" >
<input id="edit2" type="submit" name="edit" value="Edit">
</form>
<tr>
<td>
<form name="f3" action="#" >
<input id="edit3" type="submit" name="edit" value="Edit">
</form>
</tbody>
</table>
It will redirect your store page to your contact page
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Redirect 301 /storepage /contactpage
</IfModule>
Here's full list of black dotlikes from unicode
● - ●
- Black Circle
⏺ - ⏺
- Black Circle for Record
⚫ - ⚫
- Medium Black Circle
⬤ - ⬤
- Black Large Circle
⧭ - ⧭
- Black Circle with Down Arrow
🞄 - 🞄
- Black Slightly Small Circle
• - •
- Bullet (also - •
- Message Waiting)
∙ - ∙
- Bullet Operator
⋅ - ⋅
- Dot Operator (also · - ·
- Middle Dot)
🌑 - 🌑
- New Moon Symbol
Here's a code that really works for IE and FF (at least):
<html>
<head>
<title>Test</title>
<style type="text/css">
table{
width: 400px;
}
tbody {
height: 100px;
overflow: scroll;
}
div {
height: 100px;
width: 400px;
position: relative;
}
tr.alt td {
background-color: #EEEEEE;
}
</style>
<!--[if IE]>
<style type="text/css">
div {
overflow-y: scroll;
overflow-x: hidden;
}
thead tr {
position: absolute;
top: expression(this.offsetParent.scrollTop);
}
tbody {
height: auto;
}
</style>
<![endif]-->
</head>
<body>
<div >
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th style="background: lightgreen;">user</th>
<th style="background: lightgreen;">email</th>
<th style="background: lightgreen;">id</th>
<th style="background: lightgreen;">Y/N</th>
</tr>
</thead>
<tbody align="center">
<!--[if IE]>
<tr>
<td colspan="4">on IE it's overridden by the header</td>
</tr>
<![endif]-->
<tr>
<td>user 1</td>
<td>[email protected]</td>
<td>1</td>
<td>Y</td>
</tr>
<tr class="alt">
<td>user 2</td>
<td>[email protected]</td>
<td>2</td>
<td>N</td>
</tr>
<tr>
<td>user 3</td>
<td>[email protected]</td>
<td>3</td>
<td>Y</td>
</tr>
<tr class="alt">
<td>user 4</td>
<td>[email protected]</td>
<td>4</td>
<td>N</td>
</tr>
<tr>
<td>user 5</td>
<td>[email protected]</td>
<td>5</td>
<td>Y</td>
</tr>
<tr class="alt">
<td>user 6</td>
<td>[email protected]</td>
<td>6</td>
<td>N</td>
</tr>
<tr>
<td>user 7</td>
<td>[email protected]</td>
<td>7</td>
<td>Y</td>
</tr>
<tr class="alt">
<td>user 8</td>
<td>[email protected]</td>
<td>8</td>
<td>N</td>
</tr>
</tbody>
</table>
</div>
</body></html>
I've changed the original code to make it clearer and also to put it working fine in IE and also FF..
Original code HERE
If you want to secure your API in a server to server fashion (no redirection to website for 2 legged authentication). You can look at OAuth2 Client Credentials Grant protocol.
https://dev.twitter.com/docs/auth/application-only-auth
I have developed a library that can help you easily add this kind of support to your WebAPI. You can install it as a NuGet package:
https://nuget.org/packages/OAuth2ClientCredentialsGrant/1.0.0.0
The library targets .NET Framework 4.5.
Once you add the package to your project, it will create a readme file in the root of your project. You can look at that readme file to see how to configure/use this package.
Cheers!
The answer may be that you have not initialized the database yet. After installing postgres, but before initializing the database, the postgres*.sql files will be absent. After initializing the database the postgres*.sql files will appear. (Centos 6, Postgres 9.3 demonstrated here)
[root@localhost /]# yum -y install postgresql93 postgresql93-server
[root@localhost /]# ls /var/lib/pgsql/9.3/data/
[root@localhost /]#
[root@localhost /]# service postgresql-9.3 initdb
Initializing database: [ OK ]
[root@localhost /]# ls /var/lib/pgsql/9.3/data/
base pg_ident.conf pg_serial pg_subtrans pg_xlog
global pg_log pg_snapshots pg_tblspc postgresql.conf
pg_clog pg_multixact pg_stat pg_twophase
pg_hba.conf pg_notify pg_stat_tmp PG_VERSION
[root@localhost /]#
Works for me!
Error: Offending RSA key in /var/lib/sss/pubconf/known_hosts:4
This indicates you have an offending RSA key at line no. 4
Solution 1:
1.
vi /var/lib/sss/pubconf/known_hosts
2.
remove line no: 4
.3.
Save and Exit, and Retry
.
Solution 2:
ssh-keygen -R "you server hostname or ip"
OR
Solution 3:
sed -i '4d' /root/.ssh/known_hosts
This will remove 4th
line of /root/.ssh/known_hosts
in place(-i
).
just parse as an array:
Review[] reviews = new Gson().fromJson(jsonString, Review[].class);
then if you need you can also create a list in this way:
List<Review> asList = Arrays.asList(reviews);
P.S. your json string should be look like this:
[
{
"reviewerID": "A2SUAM1J3GNN3B1",
"asin": "0000013714",
"reviewerName": "J. McDonald",
"helpful": [2, 3],
"reviewText": "I bought this for my husband who plays the piano.",
"overall": 5.0,
"summary": "Heavenly Highway Hymns",
"unixReviewTime": 1252800000,
"reviewTime": "09 13, 2009"
},
{
"reviewerID": "A2SUAM1J3GNN3B2",
"asin": "0000013714",
"reviewerName": "J. McDonald",
"helpful": [2, 3],
"reviewText": "I bought this for my husband who plays the piano.",
"overall": 5.0,
"summary": "Heavenly Highway Hymns",
"unixReviewTime": 1252800000,
"reviewTime": "09 13, 2009"
},
[...]
]
The usual rules should apply for how you send the request. If the request is to retrieve information (e.g. a partial search 'hint' result, or a new page to be displayed, etc...) you can use GET. If the data being sent is part of a request to change something (update a database, delete a record, etc..) then use POST.
Server-side, there's no reason to use the raw input, unless you want to grab the entire post/get data block in a single go. You can retrieve the specific information you want via the _GET/_POST arrays as usual. AJAX libraries such as MooTools/jQuery will handle the hard part of doing the actual AJAX calls and encoding form data into appropriate formats for you.
<select name="foo" id="foo">
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
</select>
<input type="button" id="button" value="Button" />
});
<script> ("#foo").val() </script>
which returns 1 if you have selected a and so on..
You can bind the menu items to a site map and use the roles attribute. You will need to enable Security Trimming in your Web.Config to do this. This is the simplest way.
Site Navigation Overview: http://msdn.microsoft.com/en-us/library/e468hxky.aspx
Security Trimming Info: http://msdn.microsoft.com/en-us/library/ms178428.aspx
SiteMap Binding Info: http://www.w3schools.com/aspnet/aspnet_navigation.asp
Good Tutorial/Overview here: http://weblogs.asp.net/jgalloway/archive/2008/01/26/asp-net-menu-and-sitemap-security-trimming-plus-a-trick-for-when-your-menu-and-security-don-t-match-up.aspx
Another option that works, but is less ideal is to use the loginview control which can display controls based on role. This might be the quickest (but least flexible/performant) option. You can find a guide here: http://weblogs.asp.net/sukumarraju/archive/2010/07/28/role-based-authorization-using-loginview-control.aspx
You can use this method to send whatever confirmation message you want like "OK" or the password. This is my solution with an example:
def SpecialConfirmation(command, message, reply):
net_connect.config_mode() # To enter config mode
net_connect.remote_conn.sendall(str(command)+'\n' )
time.sleep(3)
output = net_connect.remote_conn.recv(65535).decode('utf-8')
ReplyAppend=''
if str(message) in output:
for i in range(0,(len(reply))):
ReplyAppend+=str(reply[i])+'\n'
net_connect.remote_conn.sendall(ReplyAppend)
output = net_connect.remote_conn.recv(65535).decode('utf-8')
print (output)
return output
CryptoPkiEnroll=['','','no','no','yes']
output=SpecialConfirmation ('crypto pki enroll TCA','Password' , CryptoPkiEnroll )
print (output)
You can use the TypeDescriptor class to do this:
foreach(PropertyDescriptor descriptor in TypeDescriptor.GetProperties(obj))
{
string name=descriptor.Name;
object value=descriptor.GetValue(obj);
Console.WriteLine("{0}={1}",name,value);
}
TypeDescriptor lives in the System.ComponentModel namespace and is the API that Visual Studio uses to display your object in its property browser. It's ultimately based on reflection (as any solution would be), but it provides a pretty good level of abstraction from the reflection API.
Incase anyone happens to land here (like I did) looking to add a CA (in my case Charles Proxy) for httplib2, it looks like you can append it to the cacerts.txt
file included with the python package.
For example:
cat ~/Desktop/charles-ssl-proxying-certificate.pem >> /usr/local/google-cloud-sdk/lib/third_party/httplib2/cacerts.txt
The environment variables referenced in other solutions appear to be requests-specific and were not picked up by httplib2 in my testing.
Here is it: http://www.htmlcssvqs.com/8ed/examples/chapter-17/webm-video-with-autoplay-loop.html You have to add the tags: autoplay="autoplay" loop="loop" or just "autoplay" and "loop".
Just use the method .decode('base64')
and go to be happy.
You need, too, to detect the mimetype/extension of the image, as you can save it correctly, in a brief example, you can use the code below for a django view:
def receive_image(req):
image_filename = req.REQUEST["image_filename"] # A field from the Android device
image_data = req.REQUEST["image_data"].decode("base64") # The data image
handler = open(image_filename, "wb+")
handler.write(image_data)
handler.close()
And, after this, use the file saved as you want.
Simple. Very simple. ;)
Use Following Method to Update GUI.
Public Void UpdateUI()
{
//Here update your label, button or any string related object.
//Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { }));
}
Keep it in Mind when you use this method at that time do not Update same object direct from dispatcher thread otherwise you get only that updated string and this method is helpless/useless. If still not working then Comment that line inside method and un-comment commented one both have nearly same effect just different way to access it.
You can set environment variables as mentioned in the other answers (like here)
or
you can open Start > CMD as administrator and write
C:\xampp\php phpfile.php
I had the same issue and none of the other answers worked. It seems to occur frequently when you connect to the device using the wifi mode (running command 'adb tcpip 5555'). I found this solution, its sort of a workaround but it does work.
This process is a little lengthy but its the only one that has worked everytime for me.
Dim originally (in BASIC) stood for Dimension, as it was used to define the dimensions of an array.
(The original implementation of BASIC was Dartmouth BASIC, which descended from FORTRAN, where DIMENSION is spelled out.)
Nowadays, Dim is used to define any variable, not just arrays, so its meaning is not intuitive anymore.
Assuming two apps TestA and TestB. TestB wants to query if TestA is installed. "TestA" defines the following URL scheme in its info.plist file:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>testA</string>
</array>
</dict>
</array>
The second app "TestB" tries to find out if "TestA" is installed by calling:
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"TestA://"]];
But this will normally return NO in iOS9 because "TestA" needs to be added to the LSApplicationQueriesSchemes entry in TestB's info.plist file. This is done by adding the following code to TestB's info.plist file:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>TestA</string>
</array>
A working implementation can be found here: https://github.com/gatzsche/LSApplicationQueriesSchemes-Working-Example
You can try to install a demo certificate (some ssl providers offers them for free for a month) to be sure if the problem is related to cert validity or not.
On Linux Mint, the official instructions did not work for me. I had to go into /etc/apt/sources.list.d/additional-repositories.list
and change serena
to xenial
.