You can use result.className = 'red';
, but you can also use result.classList.add('red');
. The .classList.add(str)
way is usually easier if you need to add a class in general, and don't want to check if the class is already in the list of classes.
Problems only surface when I am I trying to give the first loaded content an active state
Does this mean that you want to add a class to the first button?
$('.o-links').click(function(e) { // ... }).first().addClass('O_Nav_Current');
instead of using IDs for the slider's items and resetting html contents you can use classes and indexes:
CSS:
.image-area { width: 100%; height: auto; display: none; } .image-area:first-of-type { display: block; }
JavaScript:
var $slides = $('.image-area'), $btns = $('a.o-links'); $btns.on('click', function (e) { var i = $btns.removeClass('O_Nav_Current').index(this); $(this).addClass('O_Nav_Current'); $slides.filter(':visible').fadeOut(1000, function () { $slides.eq(i).fadeIn(1000); }); e.preventDefault(); }).first().addClass('O_Nav_Current');
first of all;
a Fragment
must be inside a FragmentActivity
, that's the first rule,
a FragmentActivity
is quite similar to a standart Activity
that you already know, besides having some Fragment oriented methods
second thing about Fragments, is that there is one important method you MUST call, wich is onCreateView
, where you inflate your layout, think of it as the setContentLayout
here is an example:
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mView = inflater.inflate(R.layout.fragment_layout, container, false); return mView; }
and continu your work based on that mView, so to find a View
by id, call mView.findViewById(..);
for the FragmentActivity
part:
the xml part "must" have a FrameLayout
in order to inflate a fragment in it
<FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" > </FrameLayout>
as for the inflation part
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, new YOUR_FRAGMENT, "TAG").commit();
begin with these, as there is tons of other stuf you must know about fragments and fragment activities, start of by reading something about it (like life cycle) at the android developer site
I have the same issue. I've just run "$ flutter clean"
, then everything is OK.
their is no need to create asset directory and under it images directory and then you put image. Better is to just create Images directory inside your project where pubspec.yaml exist and put images inside it and access that images just like as shown in tutorial/documention
assets: - images/lake.jpg // inside pubspec.yaml
Support for TLS 1.0 and 1.1 was dropped for PyPI. If your system does not use a more recent version, it could explain your error.
Could you try reinstalling pip system-wide, to update your system dependencies to a newer version of TLS?
This seems to be related to Unable to install Python libraries
See Dominique Barton's answer:
Apparently pip is trying to access PyPI via HTTPS (which is encrypted and fine), but with an old (insecure) SSL version. Your system seems to be out of date. It might help if you update your packages.
On Debian-based systems I'd try:
apt-get update && apt-get upgrade python-pip
On Red Hat Linux-based systems:
yum update python-pip # (or python2-pip, at least on Red Hat Linux 7)
On Mac:
sudo easy_install -U pip
You can also try to update
openssl
separately.
file = open("path/of/file/(optional)/filename.txt", "w") #a=append,w=write,r=read
any_string = "Hello\nWorld"
file.write(any_string)
file.close()
I'm surprised no one mentioned the HTML entities  
and  
which produce horizontal white space equivalent to the characters n and m, respectively. If you want to accumulate horizontal white space quickly, those are more efficient than
.
 
 
Along with <space>
and  
, these are the five entities HTML provides for horizontal white space.
Note that except for
, all entities allow breaking. Whatever text surrounds them will wrap to a new line if it would otherwise extend beyond the container boundary. With
it would wrap to a new line as a block even if the text before
could fit on the previous line.
Depending on your use case, that may be desired or undesired. For me, unless I'm dealing with things like names (John
Doe), addresses or references (see eq.
5), breaking as a block is usually undesired.
Wow! There are so many solutions to this problem!
Try this easy one!
Change your password!
Just the other day, I started getting this notice that my password would expire in 14 days. Now 2 days later, I am getting this error:
I really didn't feel like hacking git or OpenSSL libraries, so I just changed the Windows password on my computer and it worked!
Update
Then it started happening again. From Team Explorer go to Sync. Then do Actions > Open Command Prompt. In the command prompt type git push origin
. That might work for you.
I had to add thymeleaf dependency to pom.xml. Without this dependency Spring boot didn't find static resources.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
Enclose your code with the html and body tags. Size attribute does not correspond to font-size and it looks like its domain does not go beyond value 7. Furthermore font tag is not supported in HTML5. Consider this code for your case
<!DOCTYPE html>
<html>
<body>
<font size="2" face="Courier New" >
<table width="100%">
<tr>
<td><b>Client</b></td>
<td><b>InstanceName</b></td>
<td><b>dbname</b></td>
<td><b>Filename</b></td>
<td><b>KeyName</b></td>
<td><b>Rotation</b></td>
<td><b>Path</b></td>
</tr>
<tr>
<td>NEWDEV6</td>
<td>EXPRESS2012</td>
<td>master</td><td>master.mdf</td>
<td>test_key_16</td><td>0</td>
<td>d:\Program Files\Microsoft SQL Server\MSSQL11.EXPRESS2012\MSSQL\DATA\master.mdf</td>
</tr>
</table>
</font>
<font size="5" face="Courier New" >
<table width="100%">
<tr>
<td><b>Client</b></td>
<td><b>InstanceName</b></td>
<td><b>dbname</b></td>
<td><b>Filename</b></td>
<td><b>KeyName</b></td>
<td><b>Rotation</b></td>
<td><b>Path</b></td></tr>
<tr>
<td>NEWDEV6</td>
<td>EXPRESS2012</td>
<td>master</td>
<td>master.mdf</td>
<td>test_key_16</td>
<td>0</td>
<td>d:\Program Files\Microsoft SQL Server\MSSQL11.EXPRESS2012\MSSQL\DATA\master.mdf</td></tr>
</table></font>
</body>
</html>
I think it is not possible in the latest browsers.
The only way you can do that is to take another hidden password field and use it for your logic after taking value from visible password field while submitting and put dummy string in visible password field.
In this case the browser can store a dummy string instead of the actual password.
When using bootstrap 4 or 5, flexbox could be used to achieve desired effect:
<body class="d-flex flex-column min-vh-100">
<header>HEADER</header>
<content>CONTENT</content>
<footer class="mt-auto"></footer>
</body>
Please check the examples: Bootstrap 4 Bootstrap 5
In bootstrap 3 and without use of bootstrap. The simplest and cross browser solution for this problem is to set a minimal height for body
object. And then set absolute
position for the footer with bottom: 0
rule.
body {
min-height: 100vh;
position: relative;
margin: 0;
padding-bottom: 100px; //height of the footer
box-sizing: border-box;
}
footer {
position: absolute;
bottom: 0;
height: 100px;
}
Please check this example: Bootstrap 3
npm start
will run whatever you have defined for the start
command of the scripts
object in your package.json
file.
So if it looks like this:
"scripts": {
"start": "ng serve"
}
Then npm start
will run ng serve
.
No JS needed really ...
Just add a type
attribute to the button with a value of button
<Button type="button" color="primary" onClick={this.onTestClick}>primary</Button>
By default, button elements are of the type "submit" which causes them to submit their enclosing form element (if any). Changing the type
to "button" prevents that.
The problem is that the package that used to connect PHP to MySQL is deprecated (php5-mysql). If you install the new package,
sudo apt-get install php-mysql
this will automatically update Apache and PHP 7.
For non-Windows users:
import pandas as pd
import os
os.chdir("../data_folder")
df = pd.read_csv("data.csv")
For Windows users:
import pandas as pd
df = pd.read_csv(r"C:\data_folder\data.csv")
The prefix r in location above saves time when giving the location to the pandas Dataframe.
I had the same problem and i solved it by including jquery-3.1.1.min before including any js and it worked like a charm. Hope it helps.
If you wanna use a double conditional css module is always somehow confusing so i would advise you to follow this pattern
import styles from "./styles.module.css"
const Conditonal=({large, redColor}) => {
return(
<div className={[large && styles.large] + [redColor && styles.color]>
...
</div>
)
}
export default Conditonal
and if its just one conditonal statement with two class name, use this
import styles from "./styles.module.css"
const Conditonal=({redColor}) => {
return(
<div className={styles.large + [redColor && styles.color]>
...
</div>
)
}
export default Conditonal
Very useful. I modified it to copy a JavaScript variable value to clipboard:
function copyToClipboard(val){
var dummy = document.createElement("input");
dummy.style.display = 'none';
document.body.appendChild(dummy);
dummy.setAttribute("id", "dummy_id");
document.getElementById("dummy_id").value=val;
dummy.select();
document.execCommand("copy");
document.body.removeChild(dummy);
}
Those error messages
CMake Error at ... (project):
No CMAKE_C_COMPILER could be found.
-- Configuring incomplete, errors occurred!
See also ".../CMakeFiles/CMakeOutput.log".
See also ".../CMakeFiles/CMakeError.log".
or
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.
Please set CMAKE_CXX_COMPILER to a valid compiler path or name.
...
-- Configuring incomplete, errors occurred!
just mean that CMake was unable to find your C/CXX compiler to compile a simple test program (one of the first things CMake tries while detecting your build environment).
The steps to find your problem are dependent on the build environment you want to generate. The following tutorials are a collection of answers here on Stack Overflow and some of my own experiences with CMake on Microsoft Windows 7/8/10 and Ubuntu 14.04.
Preconditions
You have a clean build directory (because CMake does cache things from the last try) e.g. as sub-directory of your source tree
Windows cmd.exe
> rmdir /s /q VS2015
> mkdir VS2015
> cd VS2015
Bash shell
$ rm -rf MSYS
$ mkdir MSYS
$ cd MSYS
and make sure your command shell points to your newly created binary output directory.
General things you can/should try
Is CMake able find and run with any/your default compiler? Run without giving a generator
> cmake ..
-- Building for: Visual Studio 14 2015
...
Perfect if it correctly determined the generator to use - like here Visual Studio 14 2015
What was it that actually failed?
In the previous build output directory look at CMakeFiles\CMakeError.log
for any error message that make sense to you or try to open/compile the test project generated at CMakeFiles\[Version]\CompilerIdC
|CompilerIdCXX
directly from the command line (as found in the error log).
CMake can't find Visual Studio
Try to select the correct generator version:
> cmake --help
> cmake -G "Visual Studio 14 2015" ..
If that doesn't help, try to set the Visual Studio environment variables first (the path could vary):
> "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
> cmake ..
or use the Developer Command Prompt for VS2015
short-cut in your Windows Start Menu under All Programs
/Visual Studio 2015
/Visual Studio Tools
(thanks at @Antwane for the hint).
Background: CMake does support all Visual Studio releases and flavors (Express, Community, Professional, Premium, Test, Team, Enterprise, Ultimate, etc.). To determine the location of the compiler it uses a combination of searching the registry (e.g. at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[Version];InstallDir
), system environment variables and - if none of the others did come up with something - plainly try to call the compiler.
CMake can't find GCC (MinGW/MSys)
You start the MSys bash
shell with msys.bat
and just try to directly call gcc
$ gcc
gcc.exe: fatal error: no input files
compilation terminated.
Here it did find gcc
and is complaining that I didn't gave it any parameters to work with.
So the following should work:
$ cmake -G "MSYS Makefiles" ..
-- The CXX compiler identification is GNU 4.8.1
...
$ make
If GCC was not found call export PATH=...
to add your compilers path (see How to set PATH environment variable in CMake script?) and try again.
If it's still not working, try to set the CXX
compiler path directly by exporting it (path may vary)
$ export CC=/c/MinGW/bin/gcc.exe
$ export CXX=/c/MinGW/bin/g++.exe
$ cmake -G "MinGW Makefiles" ..
-- The CXX compiler identification is GNU 4.8.1
...
$ mingw32-make
For more details see How to specify new GCC path for CMake
Note: When using the "MinGW Makefiles" generator you have to use the mingw32-make
program distributed with MinGW
Still not working? That's weird. Please make sure that the compiler is there and it has executable rights (see also preconditions chapter above).
Otherwise the last resort of CMake is to not try any compiler search itself and set CMake's internal variables directly by
$ cmake -DCMAKE_C_COMPILER=/c/MinGW/bin/gcc.exe -DCMAKE_CXX_COMPILER=/c/MinGW/bin/g++.exe ..
For more details see Cmake doesn't honour -D CMAKE_CXX_COMPILER=g++ and Cmake error setting compiler
Alternatively those variables can also be set via cmake-gui.exe
on Windows. See Cmake cannot find compiler
Background: Much the same as with Visual Studio. CMake supports all sorts of GCC flavors. It searches the environment variables (CC, CXX, etc.) or simply tries to call the compiler. In addition it will detect any prefixes (when cross-compiling) and tries to add it to all binutils of the GNU compiler toolchain (ar
, ranlib
, strip
, ld
, nm
, objdump
, and objcopy
).
The justify-self
and justify-items
properties are not implemented in flexbox. This is due to the one-dimensional nature of flexbox, and that there may be multiple items along the axis, making it impossible to justify a single item. To align items along the main, inline axis in flexbox you use the justify-content
property.
Reference: Box alignment in CSS Grid Layout
If you are using Visual Studio 2017 and come across this question, you might consider AxoCover. It's a free VS extension that integrates OpenCover, but supports VS2017 (it also appears to be under active development. +1).
I'd share what I did, which works not only for Git, but MSYS/MinGW as well.
The HOME
environment variable is not normally set for Windows applications, so creating it through Windows did not affect anything else. From the Computer Properties (right-click on Computer - or whatever it is named - in Explorer, and select Properties, or Control Panel -> System and Security -> System), choose Advanced system settings
, then Environment Variables...
and create a new one, HOME
, and assign it wherever you like.
If you can't create new environment variables, the other answer will still work. (I went through the details of how to create environment variables precisely because it's so dificult to find.)
This code will stop all containers with the image centos:6. I couldn't find an easier solution for that.
docker ps | grep centos:6 | awk '{print $1}' | xargs docker stop
Or even shorter:
docker stop $(docker ps -a | grep centos:6 | awk '{print $1}')
Add the following in tsconfig.json
:
"typeRoots": [ "../node_modules/@types" ]
You can use PowerShell too (same as me).
For example:
rm $env:LOCALAPPDATA\NuGet\Cache\*.nupkg
Or 'quiet' mode (without error messages):
rm $env:LOCALAPPDATA\NuGet\Cache\*.nupkg 2> $null
Replace the startsWith function with:
yourString.indexOf(searchString, position) // where position can be set to 0
This will support all browsers including IE
Position can be set to 0 for string matching from the start meaning 0th position.
I got same error and found that my Microsoft Visual C++ is 32 bit and Windows is 64 bit. I tried to install WAMP 7 32 bit and the problem was solved.
Maybe we need to install WAMP 32 bit if Visual Studio is 32 bit. And vice versa.
One working example for me.
Controller:
public function tableView()
{
$sites = Site::all();
return view('main.table', compact('sites'));
}
View:
<script>
var sites = {!! json_encode($sites->toArray()) !!};
</script>
To prevent malicious / unintended behaviour, you can use JSON_HEX_TAG
as suggested by Jon in the comment that links to this SO answer
<script>
var sites = {!! json_encode($sites->toArray(), JSON_HEX_TAG) !!};
</script>
Button inputs don't have a submit event. Try attaching the event handler to the form instead:
<script type="text/javascript">
$('#login_form').submit(function() {
$('#gif').show();
return true;
});
</script>
Instead of if-else condition use if in both conditions. it will work that way but not sure why.
Check to see if you have previously disabled caching in Chrome when the developer console is open - the setting is under the console, settings icon > General tab: Disable cache (while DevTools is open)
Latest version of SpringBoot makes uploading multiple files very easy also. On the browser side you just need the standard HTML upload form, but with multiple input elements (one per file to upload, which is very important), all having the same element name (name="files" for the example below)
Then in your Spring @Controller class on the server all you need is something like this:
@RequestMapping(value = "/upload", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<?> upload(
@RequestParam("files") MultipartFile[] uploadFiles) throws Exception
{
...now loop over all uploadFiles in the array and do what you want
return new ResponseEntity<>(HttpStatus.OK);
}
Those are the tricky parts. That is, knowing to create multiple input elements each named "files", and knowing to use a MultipartFile[] (array) as the request parameter are the tricky things to know, but it's just that simple. I won't get into how to process a MultipartFile entry, because there's plenty of docs on that already.
I resolved this same problem in python using flask and with this library. flask_cors
Reference: https://flask-cors.readthedocs.io/en/latest/
It used to be installed with the .NET framework. MsBuild v12.0 (2013) is now bundled as a stand-alone utility and has it's own installer.
http://www.microsoft.com/en-us/download/confirmation.aspx?id=40760
To reference the location of MsBuild.exe from within an MsBuild script, use the default $(MsBuildToolsPath) property.
Pass your date in the date object:
var d = new Date('2013-03-10T02:00:00Z');
d.toLocaleDateString().replace(/\//g, '-');
I can't give an authoritative answer, but provide an overview of a likely cause. This reference shows pretty clearly that for the instructions in the body of your loop there is a 3:1 ratio between latency and throughput. It also shows the effects of multiple dispatch. Since there are (give-or-take) three integer units in modern x86 processors, it's generally possible to dispatch three instructions per cycle.
So between peak pipeline and multiple dispatch performance and failure of these mechanisms, we have a factor of six in performance. It's pretty well known that the complexity of the x86 instruction set makes it quite easy for quirky breakage to occur. The document above has a great example:
The Pentium 4 performance for 64-bit right shifts is really poor. 64-bit left shift as well as all 32-bit shifts have acceptable performance. It appears that the data path from the upper 32 bits to the lower 32 bit of the ALU is not well designed.
I personally ran into a strange case where a hot loop ran considerably slower on a specific core of a four-core chip (AMD if I recall). We actually got better performance on a map-reduce calculation by turning that core off.
Here my guess is contention for integer units: that the popcnt
, loop counter, and address calculations can all just barely run at full speed with the 32-bit wide counter, but the 64-bit counter causes contention and pipeline stalls. Since there are only about 12 cycles total, potentially 4 cycles with multiple dispatch, per loop body execution, a single stall could reasonably affect run time by a factor of 2.
The change induced by using a static variable, which I'm guessing just causes a minor reordering of instructions, is another clue that the 32-bit code is at some tipping point for contention.
I know this is not a rigorous analysis, but it is a plausible explanation.
While some of the answers were very useful and informative, I thought I would write down the answer I came up with. The answer from Alex was very good, it is however limited in the sense that the height of the div needs to be hard coded in the CSS.
So the solution I came up with uses JS (no jQuery) and is actually a stripped down version (almost to the minimum) of over solutions to solve similar problems I found on Statckoverflow:
HTML
<div class="header">
<p class="menu"><a href="#S1" onclick="test('S1'); return false;">S1</a></p>
<p class="menu"><a href="#S2" onclick="test('S2'); return false;">S2</a></p>
<p class="menu"><a href="#S3" onclick="test('S3'); return false;">S3</a></p>
<p class="menu"><a href="#S4" onclick="test('S4'); return false;">S3</a></p>
</div>
<div style="width: 100%;">
<div id="S1" class="curtain">
blabla
</div>
<div id="S2" class="curtain">
blabla
</div>
<div id="S3" class="curtain">
blabla
</div>
<div id="S4" class="curtain">
blabla
</div>
</div>
NOTE THE "RETURN FALSE;" in the on click call. This is important if you want to avoid having your browser jumping to the link itself (and let the effect being managed by your JS).
JS code:
<script>
function scrollTo(to, duration) {
if (document.body.scrollTop == to) return;
var diff = to - document.body.scrollTop;
var scrollStep = Math.PI / (duration / 10);
var count = 0, currPos;
start = element.scrollTop;
scrollInterval = setInterval(function(){
if (document.body.scrollTop != to) {
count = count + 1;
currPos = start + diff * (0.5 - 0.5 * Math.cos(count * scrollStep));
document.body.scrollTop = currPos;
}
else { clearInterval(scrollInterval); }
},10);
}
function test(elID)
{
var dest = document.getElementById(elID);
scrollTo(dest.offsetTop, 500);
}
</script>
It's incredibly simple. It finds the vertical position of the div in the document using its unique ID (in the function test). Then it calls the scrollTo function passing the starting position (document.body.scrollTop) and the destination position (dest.offsetTop). It performs the transition using some sort of ease-inout curve.
Thanks everyone for your help.
Knowing a bit of coding can help you avoiding (sometimes heavy) libraries, and giving you (the programmer) more control.
I forced closed all Java.exe from taskmanger, restarted Android Studio and it worked for me
Try this mate, you can chuck it in the body like so...
[HttpPost]
[Route("~/API/ChangeTheNameIfNeeded")]
public bool SampleCall([FromBody]JObject data)
{
var firstName = data["firstName"].ToString();
var lastName= data["lastName"].ToString();
var email = data["email"].ToString();
var obj= data["toLastName"].ToObject<SomeObject>();
return _someService.DoYourBiz(firstName, lastName, email, obj);
}
This is issue with ios 8 Add this to your code
if (IS_OS_8_OR_LATER)
{
[locationmanager requestWhenInUseAuthorization];
[locationmanager requestAlwaysAuthorization];
}
and to info.plist:
<key>NSLocationUsageDescription</key>
<string>I need location</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>I need location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>I need location</string>
In my case I was modifying the request to append a header (using Fiddler) to an https
request, but I did not configure it to decrypt https traffic. You can export a manually-created certificate from Fiddler, so you can trust/import the certificate by your browsers. See above link for details, some steps include:
A solution is add the corresponding Debian package way to your repository. For this, type the below commands:
echo "deb ftp.us.debian.org/debian wheezy main" >> /etc/apt/sources.list
sudo apt-get update
sudo apt-get install ia32-libs-i386
The first line writes in the end of the sources.list
file the package way.
This works for me. I wish that helps you.
You JSON doesn't match your struct fields: E.g. "district" in JSON and "District" as the field.
Also: Your Item is a slice type but your JSON is a dict value. Do not mix this up. Slices decode from arrays.
simplexml_load_file()
interprets an XML file (either a file on your disk or a URL) into an object. What you have in $feed
is a string.
You have two options:
Use file_get_contents()
to get the XML feed as a string, and use e simplexml_load_string()
:
$feed = file_get_contents('...');
$items = simplexml_load_string($feed);
Load the XML feed directly using simplexml_load_file()
:
$items = simplexml_load_file('...');
Here is an example of using flex that also works in Internet Explorer 11 and Chrome.
HTML
<!DOCTYPE html>_x000D_
<html>_x000D_
<head>_x000D_
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >_x000D_
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >_x000D_
<title>Flex Test</title>_x000D_
<style>_x000D_
html, body {_x000D_
margin: 0px;_x000D_
padding: 0px;_x000D_
height: 100vh;_x000D_
}_x000D_
.main {_x000D_
display: -webkit-flex;_x000D_
display: flex;_x000D_
-ms-flex-direction: row;_x000D_
flex-direction: row;_x000D_
align-items: stretch;_x000D_
min-height: 100vh;_x000D_
}_x000D_
_x000D_
.main::after {_x000D_
content: '';_x000D_
height: 100vh;_x000D_
width: 0;_x000D_
overflow: hidden;_x000D_
visibility: hidden;_x000D_
float: left;_x000D_
}_x000D_
_x000D_
.left {_x000D_
width: 200px;_x000D_
background: #F0F0F0;_x000D_
flex-shrink: 0;_x000D_
}_x000D_
_x000D_
.right {_x000D_
flex-grow: 1;_x000D_
background: yellow;_x000D_
}_x000D_
</style>_x000D_
</head>_x000D_
_x000D_
<body>_x000D_
<div class="main">_x000D_
<div class="left">_x000D_
<div style="height: 300px;">_x000D_
</div>_x000D_
</div>_x000D_
_x000D_
<div class="right">_x000D_
<div style="height: 1000px;">_x000D_
test test test_x000D_
</div>_x000D_
</div>_x000D_
</div>_x000D_
</body>_x000D_
</html>
_x000D_
you have error in your code unexpected token
.use:
$('#purpose').on('change', function () {
if (this.value == '1') {
$("#business").show();
} else {
$("#business").hide();
}
});
Update: You can narrow down the code using .toggle()
$('#purpose').on('change', function () {
$("#business").toggle(this.value == '1');
});
GIT has the most irritating way of resolving conflicts (Unlike svn where you can simply compare and do the changes). I strongly feel git has complex conflict resolution process. If I were to resolve, I would simply take another code from GIT as fresh, add my changes and commit them. It simple and not so process oriented.
My solution is to use an empty / whichever is needed with a transparent spacer gif since padding isnt 100% supported.
<td width="2" style="font-size:1px; line-height:1px;" bgcolor="#FFFFFF">
<img width="2" border="0" src="spacer50.gif" style="display:block;
padding:0; margin:0; border:none;" />
</td>
html
"input type ="text" id="txtnothing" runat ="server" "
javacript
var txt = document.getElementById("txtnothing");
txt.value = Date.now();
code
If Not (Session("txtnothing") Is Nothing OrElse String.IsNullOrEmpty(Session("txtnothing"))) Then
If Session("txtnothing") = txtnothing.Value Then
lblMsg.Text = "Please try again not a valid request"
Exit Sub
End If
End If
Session("txtnothing") = txtnothing.Value
As a service
You can set this one by:
Going first to your installation directory (in my case it’s c:\xampplite
). It could be somewhere else depending on your installation. Have also my full version in c:\x2\xampp
.
Once your in the installation directory, find xampp-control.exe
and click/double-click to launch it.
You should first stop all running instances of your apache2
and mysqld
/mysql
processes to do this.
Click the checkmark next to Apache and MySQL with the header name service. It will warn you that it’s installing as a service which of course is what we like it to do. Click Yes.
Also do step 5 with MySQL. We’re almost done.
Click Start ? Run
Type services.msc (it can also be done in the control panel under administrative tools which is a way lot of click than this one). Find the Apache 2 and MySQL services.
Double click each one and set the startup type to Automatic (you will be presented with three options: Automatic, Manual, and Disabled):
net start apache2
Be warned though that any change in the services just like the registry can cause your system to stall.
Click the start button to manually start it (just for the session though). At the next restart it’ll be automated.
Do the same with MySQL.
As a startup program
Find xampp_start.exe from your installation directory.
Press Ctrl + C to copy it or right-click the file and hit copy.
Go to C:\Documents and Settings\Administrator\Start Menu\Programs\Startup and right click on it and hit Paste Shortcut.
When you restart it’ll be starting also and you’ll see something like this:
You can stop it by issuing the xampp_stop.exe
command in your installation directory.
Also worth mentioning is that if you right click again on the shortcut and hit properties, try to change the run option to minimized. This way the shortcut will be on your taskbar once started.
You can use the box-shadow property on a tr element as a subtitute for a border. As a plus, any border-radius property on the same element will also apply to the box shadow.
box-shadow: 0px 0px 0px 1px rgb(0, 0, 0);
You could also create the input button in this way:
var button = '<input type="button" id="questionButton" value='+variable+'> <br />';
It might be the syntax of the Button creation that is off somehow.
So I got things working (based on @user1671599 answer) and wanted to share it with you guys.
(I hope I'm doing it right since it's my first app in Python)
I did this -
Project structure:
server.py:
from server.AppStarter import AppStarter
import os
static_folder_root = os.path.join(os.path.dirname(os.path.abspath(__file__)), "client")
app = AppStarter()
app.register_routes_to_resources(static_folder_root)
app.run(__name__)
AppStarter.py:
from flask import Flask, send_from_directory
from flask_restful import Api, Resource
from server.ApiResources.TodoList import TodoList
from server.ApiResources.Todo import Todo
class AppStarter(Resource):
def __init__(self):
self._static_files_root_folder_path = '' # Default is current folder
self._app = Flask(__name__) # , static_folder='client', static_url_path='')
self._api = Api(self._app)
def _register_static_server(self, static_files_root_folder_path):
self._static_files_root_folder_path = static_files_root_folder_path
self._app.add_url_rule('/<path:file_relative_path_to_root>', 'serve_page', self._serve_page, methods=['GET'])
self._app.add_url_rule('/', 'index', self._goto_index, methods=['GET'])
def register_routes_to_resources(self, static_files_root_folder_path):
self._register_static_server(static_files_root_folder_path)
self._api.add_resource(TodoList, '/todos')
self._api.add_resource(Todo, '/todos/<todo_id>')
def _goto_index(self):
return self._serve_page("index.html")
def _serve_page(self, file_relative_path_to_root):
return send_from_directory(self._static_files_root_folder_path, file_relative_path_to_root)
def run(self, module_name):
if module_name == '__main__':
self._app.run(debug=True)
try this
$(this).parent().css("backgroundImage", "url('../images/r-srchbg_white.png') no-repeat");
ngStyle
accepts a map:
$scope.myStyle = {
"width" : "900px",
"background" : "red"
};
If you are MAC user then you can open KeyChain Access Application from finder and then look for your account listed there. Just click on it and update your password. Now give a try and things will fall in place.
link for reference: Updating your credentials via Keychain Access
Worked for me. :)
In Capybara you can use only find with xpath
find(:xpath, "//*[@id='organizationSelect']/option[2]").click
and method click
Go to Control Panel -> Programs -> Programs and features
Go to Windows Features and disable Internet Explorer 11
Then click on Display installed updates
Search for Internet explorer
Right-click on Internet Explorer 11 -> Uninstall
Do the same with Internet Explorer 10
I think it will be okay.
$('#drop').change(
function() {
var val1 = $('#pick option:selected').val();
var val2 = $('#drop option:selected').val();
// Do something with val1 and val2 ...
}
);
Here is a solution that worked for me running on a MacBook Pro (desktop).
I was getting the same error and it turns out it's because I had the USB connected to a peripheral device (my monitor) rather than a USB on the PC itself. It stopped any errors right away and is a simple solution.
oh boy, this got resolved, I just had to name my Installed JRE appropriately. I had only the jdk installed and eclipse had taken the default jdk name, i renamed it to JavaSE-1.6 and voila it worked, though i had to redo everthing from the scratch.
This worked for me:
import win32com.client as client
required_command = "cmd" # Enter your command here
required_password = "Simple1" # Enter your password here
def run_as(required_command, required_password):
shell = client.Dispatch("WScript.shell")
shell.Run(f"runas /user:administrator {required_command}")
time.sleep(1)
shell.SendKeys(f"{required_password}\r\n", 0)
if __name__ = '__main__':
run_as(required_command, required_password)
Below are the references I used for above code: https://win32com.goermezer.de/microsoft/windows/controlling-applications-via-sendkeys.html https://www.oreilly.com/library/view/python-cookbook/0596001673/ch07s16.html
This should do the trick:
<table width="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50" height="40" valign="top" rowspan="3">
<img alt="" src="" width="40" height="40" style="margin: 0; border: 0; padding: 0; display: block;">
</td>
<td width="350" height="40" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; color: #000000;">
<a href="" style="color: #D31145; font-weight: bold; text-decoration: none;">LAST FIRST</a><br>
REALTOR | P 123.456.789
</td>
</tr>
<tr>
<td width="350" height="70" valign="bottom" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; color: #000000;">
<img alt="" src="" width="200" height="60" style="margin: 0; border: 0; padding: 0; display: block;">
</td>
</tr>
<tr>
<td width="350" height="20" valign="bottom" style="font-family: Helvetica, Arial, sans-serif; font-size: 10px; color: #000000;">
all your minor text here | all your minor text here | all your minor text here
</td>
</tr>
</table>
UPDATE: Adjusted code per the comments:
After viewing your jsFiddle, an important thing to note about tables is that table cell widths in each additional row all have to be the same width as the first, and all cells must add to the total width of your table.
Here is an example that will NOT WORK:
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" bgcolor="#252525">
</td>
<td width="400" bgcolor="#454545">
</td>
</tr>
<tr>
<td width="300" bgcolor="#252525">
</td>
<td width="300" bgcolor="#454545">
</td>
</tr>
</table>
Although the 2nd row does add up to 600, it (and any additional rows) must have the same 200-400 split as the first row, unless you are using colspans. If you use a colspan, you could have one row, but it needs to have the same width as the cells it is spanning, so this works:
<table width="600" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" bgcolor="#252525">
</td>
<td width="400" bgcolor="#454545">
</td>
</tr>
<tr>
<td width="600" colspan="2" bgcolor="#353535">
</td>
</tr>
</table>
Not a full tutorial, but I hope that helps steer you in the right direction in the future.
Here is the code you are after:
<table width="900" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="57" height="43" valign="top" rowspan="2">
<img alt="Rashel Adragna" src="http://zoparealtygroup.com/wp-content/uploads/2013/10/sig_head.png" width="47" height="43" style="margin: 0; border: 0; padding: 0; display: block;">
</td>
<td width="843" height="43" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; color: #000000;">
<a href="" style="color: #D31145; font-weight: bold; text-decoration: none;">RASHEL ADRAGNA</a><br>
REALTOR | P 855.900.24KW
</td>
</tr>
<tr>
<td width="843" height="64" valign="bottom" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; color: #000000;">
<img alt="Zopa Realty Group logo" src="http://zoparealtygroup.com/wp-content/uploads/2013/10/sig_logo.png" width="177" height="54" style="margin: 0; border: 0; padding: 0; display: block;">
</td>
</tr>
<tr>
<td width="843" colspan="2" height="20" valign="bottom" align="center" style="font-family: Helvetica, Arial, sans-serif; font-size: 10px; color: #000000;">
all your minor text here | all your minor text here | all your minor text here
</td>
</tr>
</table>
You'll note that I've added an extra 10px to some of your table cells. This in combination with align/valigns act as padding between your cells. It is a clever way to aviod actually having to add padding, margins or empty padding cells.
import urllib
urllib.request.urlretrieve("https://raw.githubusercontent.com/dnishimoto/python-deep-learning/master/list%20iterators%20and%20generators.ipynb", "test.ipynb")
downloads a single raw juypter notebook to file.
Close the modal box using javascript
$('#product-options').modal('hide');
Open the modal box using javascript
$('#product-options').modal('show');
Toggle the modal box using javascript
$('#myModal').modal('toggle');
Means close the modal if it's open and vice versa.
If you only want to install the latest official JRE from Oracle, you can get it there, install it, and export the new JAVA_HOME in the terminal.
java -version
gives you an error and a popupexport JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
java -version
now gives you java version "1.7.0_45"
That's the cleanest way I found to install the latest JRE.
You can add the export JAVA_HOME
line in your .bashrc
to have java
permanently in your Terminal:
echo export JAVA_HOME=\"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home\" >> ~/.bashrc
var noHtml = Regex.Replace(inputHTML, @"<[^>]*(>|$)| |‌|»|«", string.Empty).Trim();
Your foldername is scripts
?
Change
<script src="../Script/login.js">
to
<script src='scripts/login.js' type='text/javascript'></script>
for multiple dropdowns
$('[id^=RBLExperienceApplicable][value='+ SelectedVAlue +']').attr("checked","checked");
here RBLExperienceApplicable
is the matching part of the radio button groups input tag ids.
and [id^=RBLExperienceApplicable]
matches all the radio button whose id start with RBLExperienceApplicable
Simple.
Assuming that in your Activity-1
, you did this:
String stringExtra = "Some string you want to pass";
Intent intent = new Intent(this, AndroidTabRestaurantDescSearchListView.class);
//include the string in your intent
intent.putExtra("string", stringExtra);
startActivity(intent);
And in your AndroidTabRestaurantDescSearchListView class, do this:
//fetch the string from the intent
String extraFromAct1 = getIntent().getStringExtra("string");
Intent intent = new Intent(this, RatingDescriptionSearchActivity.class);
//attach same string and send it with the intent
intent.putExtra("string", extraFromAct1);
startActivity(intent);
Then in your RatingDescriptionSearchActivity class, do this:
String extraFromAct1 = getIntent().getStringExtra("string");
In Tomcat a .java and .class file will be created for every jsp files with in the application and the same can be found from the path below,
Apache-Tomcat\work\Catalina\localhost\'ApplicationName'\org\apache\jsp\index_jsp.java
In your case the jsp name is error.jsp so the path should be something like below
Apache-Tomcat\work\Catalina\localhost\'ApplicationName'\org\apache\jsp\error_jsp.java
in line no 124 you are trying to access a null object which results in null pointer exception.
If the <i>
tag isn't displayed as a block and causing the probelm then this should work:
<td style="white-space:nowrap;"><i class="flag-bfh-ES"></i> +34 666 66 66 66</td>
Use this example, you can split with the colspan
attribute
<TABLE BORDER>
<TR>
<TD>Item 1</TD>
<TD>Item 1</TD>
<TD COLSPAN=2>Item 2</TD>
</TR>
<TR>
<TD>Item 3</TD>
<TD>Item 3</TD>
<TD>Item 4</TD>
<TD>Item 5</TD>
</TR>
</TABLE>
More examples at http://hypermedia.univ-paris8.fr/jean/internet/ex_table.html.
Step 1: Install update http://httpjunkie.com/2013/340/develop-mvc-5-with-asp-net-identity-in-visual-studio-2012/.
OK, so that gets you to be able to start from a blank ASP.NET MVC project, but a lot of people want the FULL INTERNET APPLICATION as shipped with Visual Studio 2013.
So I have a step 2: http://httpjunkie.com/2013/340/develop-mvc-5-with-asp-net-identity-in-visual-studio-2012/
If you follow that tutorial on my website I follow it up with a full install of Foundation 5 and a cool Hybrid OffCanvas/Top-Bar navigation.
Check empty input with removing space(if user enter space) from input using trim
$(document).ready(function(){
$('#button').click(function(){
if($.trim($('#fname').val()) == '')
{
$('#fname').css("border-color", "red");
alert("Empty");
}
});
});
Try redirecting the output like this:
$key = & 'gpg' --decrypt "secret.gpg" --quiet --no-verbose >$null 2>&1
You can use this
var fs = require('fs');
var myCss = {
style : fs.readFileSync('./style.css','utf8');
};
app.get('/', function(req, res){
res.render('index.ejs', {
title: 'My Site',
myCss: myCss
});
});
put this on template
<%- myCss.style %>
just build style.css
<style>
body {
background-color: #D8D8D8;
color: #444;
}
</style>
I try this for some custom css. It works for me
For reading and editing, Geany for Windows is another good option. I've run in to limit issues with Notepad++, but not yet with Geany.
You can use the below code on your string and you will get the complete string without html part.
string title = "<b> Hulk Hogan's Celebrity Championship Wrestling <font color=\"#228b22\">[Proj # 206010]</font></b> (Reality Series, )".Replace(" ",string.Empty);
string s = Regex.Replace(title, "<.*?>", String.Empty);
Stupid as it may sound but all "Provisioning Profiles" re-appear under "Organizer - Devices" once you connect a real device.
I also had to set the following META tag:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def your_view(request):
if request.method == "POST":
# do something
return HttpResponse("Your response")
I'm not an expert in JQuery but I have the same scenario and I able to accomplis like this:
$("#data tr").click(function(){
$(this).addClass("selected").siblings().removeClass("selected");
});
Style:
<style type="text/css">
.selected {
background: red;
}
</style>
I modified K3N's code to work for my purpose, and I added some comments to help others figure out how sessionStorage works.
<script>
// Run on page load
window.onload = function() {
// If sessionStorage is storing default values (ex. name), exit the function and do not restore data
if (sessionStorage.getItem('name') == "name") {
return;
}
// If values are not blank, restore them to the fields
var name = sessionStorage.getItem('name');
if (name !== null) $('#inputName').val(name);
var email = sessionStorage.getItem('email');
if (email !== null) $('#inputEmail').val(email);
var subject= sessionStorage.getItem('subject');
if (subject!== null) $('#inputSubject').val(subject);
var message= sessionStorage.getItem('message');
if (message!== null) $('#inputMessage').val(message);
}
// Before refreshing the page, save the form data to sessionStorage
window.onbeforeunload = function() {
sessionStorage.setItem("name", $('#inputName').val());
sessionStorage.setItem("email", $('#inputEmail').val());
sessionStorage.setItem("subject", $('#inputSubject').val());
sessionStorage.setItem("message", $('#inputMessage').val());
}
</script>
Try devenv /setup
on the Visual Studio Command Prompt with administrative rights.
I had the same problem with Visual Studio 2013 Ultimate. I tried the solution by Reza posted here, but it didn't work.
Eventually I couldn't close Visual Studio. It was showing a similar dialog when I tried to close, and it wasn't closing. I tried this: Error message "No exports were found that match the constraint contract name". Neither.
I noticed a message in the Team Explorer window saying "Page 'somenumber' cannot be found". I tried that way, and I found this answer: Page '312e8a59-2712-48a1-863e-0ef4e67961fc' not found using Visual Studio 2012. So I run devenv /setup
on the Visual Studio Command Prompt with administrative rights.
It did the job, and everything is fine now.
Try to use document.createEvent
described here https://developer.mozilla.org/en-US/docs/Web/API/document.createEvent
The code for function that simulates click should look something like this:
function simulateClick() {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
var a = document.getElementById("gift-close");
a.dispatchEvent(evt);
}
If I understand correctly, you want this fiddle.
table {_x000D_
background: gray;_x000D_
}_x000D_
td { _x000D_
display: block;_x000D_
float: left;_x000D_
padding: 10px 0;_x000D_
margin-right:50px;_x000D_
background: white;_x000D_
}_x000D_
td:last-child {_x000D_
margin-right: 0;_x000D_
}
_x000D_
<table>_x000D_
<tr>_x000D_
<td>Hello HTML!</td>_x000D_
<td>Hello CSS!</td>_x000D_
<td>Hello JS!</td>_x000D_
</tr>_x000D_
</table>
_x000D_
fun lil batch file
@set E=ECHO &set S=SET &set CS=CScript //T:3 //nologo %~n0.vbs /REALTIME^>nul^& timeout 1 /NOBREAK^>nul^& del /Q %~n0.vbs&CLS
@%E%off&color 4a&title %~n0&%S%CX=CLS^&EXIT&%S%BS=^>%~n0.vbs&%S%G=GOTO &%S%H=shell&AT>NUL
IF %ERRORLEVEL% EQU 0 (
%G%2
) ELSE (
if not "%minimized%"=="" %G%1
)
%S%minimized=true & start /min cmd /C "%~dpnx0"&%CX%
:1
%E%%S%%H%=CreateObject("%H%.Application"):%H%.%H%Execute "%~dpnx0",,"%CD%", "runas", 1:%S%%H%=nothing%BS%&%CS%&%CX%
:2
%E%%~dpnx0 fvcLing admin mode look up&wmic process where name="cmd.exe" CALL setpriority "realtime"& timeout 3 /NOBREAK>nul
:3
%E%x=msgbox("end of line" ,48, "%~n0")%BS%&%CS%&%CX%
Bootstrap 2.3.x and later supports the dropdown-submenu
..
<ul class="dropdown-menu">
<li><a href="#">Login</a></li>
<li class="dropdown-submenu">
<a tabindex="-1" href="#">More options</a>
<ul class="dropdown-menu">
<li><a tabindex="-1" href="#">Second level</a></li>
<li><a href="#">Second level</a></li>
<li><a href="#">Second level</a></li>
</ul>
</li>
<li><a href="#">Logout</a></li>
</ul>
Strange enough, my problem was coming from PHP.
A REST API call was failing, and it was breaking the loading of the libraries afterwards. Since failure was from the REST call, it was not giving me a php compile error.
Keep this as an option also, if loading jquery seems ok.
Just to confirm answers here, my resolution was to copy the DLL that was not loading AND the ocx file that accompanied it to the system32 folder, that resolved my issue.
Try using this:
$(".move_to").on("click", function(e){
e.preventDefault();
$('#contactsForm').attr('action', "/test1").submit();
});
Moving the order in which you use .preventDefault()
might fix your issue. You also didn't use function(e)
so e.preventDefault();
wasn't working.
Here it is working: http://jsfiddle.net/TfTwe/1/ - first of all, click the 'Check action attribute.' link. You'll get an alert saying undefined
. Then click 'Set action attribute.' and click 'Check action attribute.' again. You'll see that the form's action attribute has been correctly set to /test1
.
I was totally lost on why my Gridview.Databind()
would not refresh.
My issue, I discovered, was my gridview was inside a UpdatePanel. To get my GridView to FINALLY refresh was this:
gvServerConfiguration.Databind()
uppServerConfiguration.Update()
uppServerConfiguration is the id associated with my UpdatePanel in my asp.net code.
Hope this helps someone.
You are missing the dot on the selector, and you can use toggleClass method on jquery:
$(".result").hover(
function () {
$(this).toggleClass("result_hover")
}
);
Go to Settings, Apps, All and uninstall Google Play Store. This will replace by the old version and then you can download without the "Insufficient Storage ERROR" It works for me
@echo off
title Command Executer
color 1b
echo Command Executer by: YourNameHere
echo #################################
: execute
echo Please Type A Command Here:
set /p cmd=Command:
%cmd%
goto execute
Don't fart around with inserting spaces. For one, older versions of IE won't know what you're talking about. Besides that, though, there are cleaner ways in general.
For colorless indents, use the text-indent
property.
p { text-indent: 1em; }
Edit:
If you want the space to be colored, you might consider adding a thick left border to the first letter. (I'd almost-but-not-quite say "instead", because the indent can be an issue if you use both. But it feels dirty to me to rely solely on the border to indent.) You can specify how far away, and how wide, the color is using the first letter's left margin/padding/border width.
p:first-letter { border-left: 1em solid red; }
While Python 3 deals in Unicode, the Windows console or POSIX tty that you're running inside does not. So, whenever you print
, or otherwise send Unicode strings to stdout
, and it's attached to a console/tty, Python has to encode it.
The error message indirectly tells you what character set Python was trying to use:
File "C:\Python32\lib\encodings\cp850.py", line 19, in encode
This means the charset is cp850
.
You can test or yourself that this charset doesn't have the appropriate character just by doing '\u2013'.encode('cp850')
. Or you can look up cp850 online (e.g., at Wikipedia).
It's possible that Python is guessing wrong, and your console is really set for, say UTF-8. (In that case, just manually set sys.stdout.encoding='utf-8'
.) It's also possible that you intended your console to be set for UTF-8 but did something wrong. (In that case, you probably want to follow up at superuser.com.)
But if nothing is wrong, you just can't print that character. You will have to manually encode it with one of the non-strict error-handlers. For example:
>>> '\u2013'.encode('cp850')
UnicodeEncodeError: 'charmap' codec can't encode character '\u2013' in position 0: character maps to <undefined>
>>> '\u2013'.encode('cp850', errors='replace')
b'?'
So, how do you print a string that won't print on your console?
You can replace every print
function with something like this:
>>> print(r['body'].encode('cp850', errors='replace').decode('cp850'))
?
… but that's going to get pretty tedious pretty fast.
The simple thing to do is to just set the error handler on sys.stdout
:
>>> sys.stdout.errors = 'replace'
>>> print(r['body'])
?
For printing to a file, things are pretty much the same, except that you don't have to set f.errors
after the fact, you can set it at construction time. Instead of this:
with open('path', 'w', encoding='cp850') as f:
Do this:
with open('path', 'w', encoding='cp850', errors='replace') as f:
… Or, of course, if you can use UTF-8 files, just do that, as Mark Ransom's answer shows:
with open('path', 'w', encoding='utf-8') as f:
This works:
function showhide(id) {_x000D_
var e = document.getElementById(id);_x000D_
e.style.display = (e.style.display == 'block') ? 'none' : 'block';_x000D_
}
_x000D_
<!DOCTYPE html>_x000D_
<html> _x000D_
<body>_x000D_
_x000D_
<a href="javascript:showhide('uniquename')">_x000D_
Click to show/hide._x000D_
</a>_x000D_
_x000D_
<div id="uniquename" style="display:none;">_x000D_
<p>Content goes here.</p>_x000D_
</div>_x000D_
_x000D_
</body>_x000D_
</html>
_x000D_
That's it!
$(document).ready(function () {
Addrow();
})
$("#add").click(function () {
Addrow();
})
rowcount = $("#tbuser td").closest.length;
function Addrow() {
rowcount++;
debugger
var markup = "<tr><td></td><td><input type='text' name='stuclass' id='stuclass'/></td><td><select name='Institute' class='Institute_" + rowcount + "'></select></td><td><input type='text' name='obtmark' id='obtmark'/></td><td><input type='text' name='totalmark' id='totalmark'/></td><td><input type='text' name='per' id='per'/></td><td><button type='button' id='delete' onclick='deleterow(this);'>DELETE</button></td></tr>";
$(".tbuser tbody").append(markup);
$.ajax({
type: 'GET',
url: '@Url.Action("bindinst", "Home")',
data: '',
dataType: "json",
success: function (data) {
debugger;
$(".Institute_" + rowcount).empty();
$(".Institute_" + rowcount).append('<option Value="">--Select--</option>');
$.each(data, function (i, result) {
$(".Institute_" + rowcount).append('<option Value="' + result.Value + '">' + result.Text + '</option>');
});
},
});
}
On Mojave, I ran into errors with finding the SSL libraries, here's what finally worked without having to modify mysql_config
:
sudo pip install MySQL-Python --global-option=build_ext --global-option="-I/usr/local/opt/openssl/include" --global-option="-L/usr/local/opt/openssl/lib"
Hopefully that will save someone a few hours of heartache
Several things here.
First off, you're defining your CSS in 3 places!
In line, in the head and externally. I suggest you only choose one. I'm going to suggest externally.
I suggest you update your code in your ASP form from
<td style="background-color: #A3A3A3; color: #FFFFFF; font-family: 'Arial Black'; font-size: large; font-weight: bold;"
class="style6">
to this:
<td class="style6">
And then update your css too
.style6
{
height: 79px; background-color: #A3A3A3; color: #FFFFFF; font-family: 'Arial Black'; font-size: large; font-weight: bold;
}
This removes the inline.
Now, to move it from the head of the webForm.
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>AR Toolbox</title>
<link rel="Stylesheet" href="css/master.css" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<table class="style1">
<tr>
<td class="style6">
<asp:Menu ID="Menu1" runat="server">
<Items>
<asp:MenuItem Text="Home" Value="Home"></asp:MenuItem>
<asp:MenuItem Text="About" Value="About"></asp:MenuItem>
<asp:MenuItem Text="Compliance" Value="Compliance">
<asp:MenuItem Text="Item 1" Value="Item 1"></asp:MenuItem>
<asp:MenuItem Text="Item 2" Value="Item 2"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Tools" Value="Tools"></asp:MenuItem>
<asp:MenuItem Text="Contact" Value="Contact"></asp:MenuItem>
</Items>
</asp:Menu>
</td>
</tr>
<tr>
<td class="style6">
<img alt="South University'" class="style7"
src="file:///C:/Users/jnewnam/Documents/Visual%20Studio%202010/WebSites/WebSite1/img/suo_n_seal_hor_pantone.png" /></td>
</tr>
<tr>
<td class="style2">
<table class="style3">
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="color: #FFFFFF; background-color: #A3A3A3">
This is the footer.</td>
</tr>
</table>
</form>
</body>
</html>
Now, in a new file called master.css (in your css folder) add
ul {
list-style-type:none;
margin:0;
padding:0;
}
li {
display:inline;
padding:20px;
}
.style1
{
width: 100%;
}
.style2
{
height: 459px;
}
.style3
{
width: 100%;
height: 100%;
}
.style6
{
height: 79px; background-color: #A3A3A3; color: #FFFFFF; font-family: 'Arial Black'; font-size: large; font-weight: bold;
}
.style7
{
width: 345px;
height: 73px;
}
The runas command does not allow a password on its command line. This is by design (and also the reason you cannot pipe a password to it as input). Raymond Chen says it nicely:
The RunAs program demands that you type the password manually. Why doesn't it accept a password on the command line?
This was a conscious decision. If it were possible to pass the password on the command line, people would start embedding passwords into batch files and logon scripts, which is laughably insecure.
In other words, the feature is missing to remove the temptation to use the feature insecurely.
I guess problem is in width attributes in table and td remove 'px' for example
<table border="0" cellpadding="0" cellspacing="0" width="580px" style="background-color: #0290ba;">
Should be
<table border="0" cellpadding="0" cellspacing="0" width="580" style="background-color: #0290ba;">
I ended up needing to request Resharper to clear its cache along with doing it manually through Windows File Explorer. This finally resolved the issue for me.
Read this https://docs.djangoproject.com/en/dev/howto/static-files/:
For local development, if you are using runserver or adding staticfiles_urlpatterns to your URLconf, you’re done with the setup – your static files will automatically be served at the default (for newly created projects) STATIC_URL of /static/.
And try:
~/tmp$ django-admin.py startproject myprj
~/tmp$ cd myprj/
~/tmp/myprj$ chmod a+x manage.py
~/tmp/myprj$ ./manage.py startapp myapp
Then add 'myapp'
to INSTALLED_APPS
(myprj/settings.py
).
~/tmp/myprj$ cd myapp/
~/tmp/myprj/myapp$ mkdir static
~/tmp/myprj/myapp$ echo 'alert("hello!");' > static/hello.js
~/tmp/myprj/myapp$ mkdir templates
~/tmp/myprj/myapp$ echo '<script src="{{ STATIC_URL }}hello.js"></script>' > templates/hello.html
Edit myprj/urls.py
:
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
class HelloView(TemplateView):
template_name = "hello.html"
urlpatterns = patterns('',
url(r'^$', HelloView.as_view(), name='hello'),
)
And run it:
~/tmp/myprj/myapp$ cd ..
~/tmp/myprj$ ./manage.py runserver
It works!
table tr td:nth-child(2) {
background: #ccc;
}
Working example: http://jsfiddle.net/gqr3J/
Just add the following code after the final message you give using PHP code
Print'window.location.assign("index.php")
Use genfromtxt
instead. It's a much more general method than loadtxt
:
import numpy as np
print np.genfromtxt('col.txt',dtype='str')
Using the file col.txt
:
foo bar
cat dog
man wine
This gives:
[['foo' 'bar']
['cat' 'dog']
['man' 'wine']]
If you expect that each row has the same number of columns, read the first row and set the attribute filling_values
to fix any missing rows.
If the log indicates java.lang.UnsupportedClassVersionError: JVM**** bad major version.
Then the code and server is not compiled with the same JDK version.
To fix this, please switch the JDK version either in code or server JDK.
Try this:- In the below use case, im switching to 1.7_64 (JDK 1.7 64 bit)
c:\IBM\WebSphere\WSRR\v8.5\bin\managesdk.bat -enableProfile -profileName WSRRSrv01 -sdkname 1.7_64
Just set the view as null that will close the AlertDialog simple.
Instead of
<input id="Remember" name="Remember" type="checkbox" value="@Model.Remember" />
use:
@Html.EditorFor(x => x.Remember)
That will give you a checkbox specifically for Remember
<iframe src="http://docs.google.com/gview?url=http://domain.com/pdf.pdf&embedded=true"
style="width:600px; height:500px;" frameborder="0"></iframe>
Google docs allows you to embed PDFs, Microsoft Office Docs, and other applications by just linking to their services with an iframe. Its user-friendly, versatile, and attractive.
Here is an example of drawing a table using raphael.js. We can draw tables directly to the canvas of the browser using Raphael.js Raphael.js is a javascript library designed specifically for artists and graphic designers.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id='panel'></div>
</body>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"> </script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
paper = new Raphael(0,0,500,500);// width:500px, height:500px
var x = 100;
var y = 50;
var height = 50
var width = 100;
WriteTableRow(x,y,width*2,height,paper,"TOP Title");// draw a table header as merged cell
y= y+height;
WriteTableRow(x,y,width,height,paper,"Score,Player");// draw table header as individual cells
y= y+height;
for (i=1;i<=4;i++)
{
var k;
k = Math.floor(Math.random() * (10 + 1 - 5) + 5);//prepare table contents as random data
WriteTableRow(x,y,width,height,paper,i+","+ k + "");// draw a row
y= y+height;
}
function WriteTableRow(x,y,width,height,paper,TDdata)
{ // width:cell width, height:cell height, paper: canvas, TDdata: texts for a row. Separated each cell content with a comma.
var TD = TDdata.split(",");
for (j=0;j<TD.length;j++)
{
var rect = paper.rect(x,y,width,height).attr({"fill":"white","stroke":"red"});// draw outline
paper.text(x+width/2, y+height/2, TD[j]) ;// draw cell text
x = x + width;
}
}
</script>
</html>
Please check the preview image: https://i.stack.imgur.com/RAFhH.png
<?php $sql = "SELECT * FROM guest_book";
$res = mysql_query($sql);
if (mysql_num_rows($res)) {
$query = mysql_query("SELECT * FROM guest_book ORDER BY id");
$i=1;
while($row = mysql_fetch_assoc($query)){
?>
<input type="checkbox" name="checkboxstatus[<?php echo $i; ?>]" value="<?php echo $row['id']; ?>" />
<?php $i++; }} ?>
<input type="submit" value="Delete" name="Delete" />
if($_REQUEST['Delete'] != '')
{
if(!empty($_REQUEST['checkboxstatus'])) {
$checked_values = $_REQUEST['checkboxstatus'];
foreach($checked_values as $val) {
$sqldel = "DELETE from guest_book WHERE id = '$val'";
mysql_query($sqldel);
}
}
}
This is asking the wrong question. The right question to ask is, why am I spending time sorting socks? How much does it cost on yearly basis, when you value your free time for X monetary units of your choice?
And more often than not, this is not just any free time, it's morning free time, which you could be spending in bed, or sipping your coffee, or leaving a bit early and not being caught in the traffic.
It's often good to take a step back, and think a way around the problem.
And there is a way!
Find a sock you like. Take all relevant features into account: colour in different lighting conditions, overall quality and durability, comfort in different climatic conditions, and odour absorption. Also important is, they should not lose elasticity in storage, so natural fabrics are good, and they should be available in a plastic wrapping.
It's better if there's no difference between left and right foot socks, but it's not critical. If socks are left-right symmetrical, finding a pair is O(1) operation, and sorting the socks is approximate O(M) operation, where M is the number of places in your house, which you have littered with socks, ideally some small constant number.
If you chose a fancy pair with different left and right sock, doing a full bucket sort to left and right foot buckets take O(N+M), where N is the number of socks and M is same as above. Somebody else can give the formula for average iterations of finding the first pair, but worst case for finding a pair with blind search is N/2+1, which becomes astronomically unlikely case for reasonable N. This can be sped up by using advanced image recognition algorithms and heuristics, when scanning the pile of unsorted socks with Mk1 Eyeball.
So, an algorithm for achieving O(1) sock pairing efficiency (assuming symmetrical sock) is:
You need to estimate how many pairs of socks you will need for the rest of your life, or perhaps until you retire and move to warmer climates with no need to wear socks ever again. If you are young, you could also estimate how long it takes before we'll all have sock-sorting robots in our homes, and the whole problem becomes irrelevant.
You need to find out how you can order your selected sock in bulk, and how much it costs, and do they deliver.
Order the socks!
Get rid of your old socks.
An alternative step 3 would involve comparing costs of buying the same amount of perhaps cheaper socks a few pairs at a time over the years and adding the cost of sorting socks, but take my word for it: buying in bulk is cheaper! Also, socks in storage increase in value at the rate of stock price inflation, which is more than you would get on many investments. Then again there is also storage cost, but socks really do not take much space on the top shelf of a closet.
Problem solved. So, just get new socks, throw/donate your old ones away, and live happily ever after knowing you are saving money and time every day for the rest of your life.
You need to use ==
or ===
for comparison. =
assigns a new value.
Besides that, using ==
is pointless when dealing with booleans only. Just use if(foo)
instead of if(foo == true)
.
Note: ||= does not exist. (logical or) You can use
y= y || expr; // expr is NOT evaluated if y==true
or
y = expr ? true : y; // expr is always evaluated.
I had the same problem on Visual Studio 2010 on C++ and I surpassed it by Tools -> Options -> Text Editor -> C/C++ -> Advanced -> Disable database -> False, Ok ; Close VS; open VS and voila.
This worked for me:-
<!DOCTYPE html>
<html>
<head>
<title>CAR APPLICATION</title>
</head>
<body>
<center>
<h1>CAR APPLICATION</h1>
</center>
<table border="5" bordercolor="red" align="center">
<tr>
<th colspan="3">ABCD</th>
</tr>
<tr>
<th>Name</th>
<th>Origin</th>
<th>Photo</th>
</tr>
<tr>
<td>Bugatti Veyron Super Sport</th>
<td>Molsheim, Alsace, France</th>
<!-- considering it is on the same folder that .html file -->
<td><img src=".\A.jpeg" alt="" border=3 height=100 width=300></img></th>
</tr>
<tr>
<td>SSC Ultimate Aero TT TopSpeed</th>
<td>United States</th>
<td border=3 height=100 width=100>Photo1</th>
</tr>
<tr>
<td>Koenigsegg CCX</th>
<td>Ängelholm, Sweden</th>
<td border=4 height=100 width=300>Photo1</th>
</tr>
<tr>
<td>Saleen S7</th>
<td>Irvine, California, United States</th>
<td border=3 height=100 width=100>Photo1</th>
</tr>
<tr>
<td> McLaren F1</th>
<td>Surrey, England</th>
<td border=3 height=100 width=100>Photo1</th>
</tr>
<tr>
<td>Ferrari Enzo</th>
<td>Maranello, Italy</th>
<td border=3 height=100 width=100>Photo1</th>
</tr>
<tr>
<td> Pagani Zonda F Clubsport</th>
<td>Modena, Italy</th>
<td border=3 height=100 width=100>Photo1</th>
</tr>
</table>
</body>
<html>
Did you try <br/>
, <br><br/>
or simply \n
? <br>
should be supported according to this source, though.
As ROM size does not count one does not need any additional RAM besides the TCP buffers. Just implement a big finite-state machine. Each state represents a multi-set of numbers read in. After reading a million numbers one has just to print the numbers corresponding to the reached state.
Please follow these steps carefully to enable it.
1) create Spring Boot project with SB V1.3 and add "Devtools" (1*) to dependencies
2) invoke Help->Find Action... and type "Registry", in the dialog search for "automake" and enable the entry "compiler.automake.allow.when.app.running", close dialog
3) enable background compilation in Settings->Build, Execution, Deployment->Compiler "Make project automatically"
4) open Spring Boot run config, you should get warning message if everything is configured correctly
5) Run your app, change your classes on-the-fly
Please report your experiences and problems as comments to this issue.
I still had an issue with it passing the format yyyy-MM-dd, but I got around it by changing the Date.cshtml:
@model DateTime?
@{
string date = string.Empty;
if (Model != null)
{
date = string.Format("{0}-{1}-{2}", Model.Value.Year, Model.Value.Month, Model.Value.Day);
}
@Html.TextBox(string.Empty, date, new { @class = "datefield", type = "date" })
}
In my case, it was the open_basedir which was defined. I commented it out (default) and my issue was resolved. I can now set the upload directory anywhere.
I don't really know Mac or Homebrew, but I know PostgreSQL very well.
You want to figure out where the logs are from PostgreSQL trying to start and what the socket directory is for PostgreSQL. By default when you build PG, the socket directory is /tmp/. If you didn't change that when you built PG and then you started PG, you should be able to see a socket file in /tmp if you do: ls -al /tmp
The socket file starts with a ".", so you won't see it with the '-a' to ls.
If you don't see a socket there, and you don't see anything from ps awux | grep postgres, then PG is probably not running, or maybe it is and it's the OSX-installed one. What might be happening is that you might be getting a conflict on listening on port 5432 on localhost- use netstat -anp to see what, if anything, is listening on 5432. If a Mac OSX PG is already listening on that port then that might be the problem.
Hope that helps. I have heard that homebrew can make things a bit ugly and a lot of people I've talked to encourage using a VM instead.
I have been struggling with VS2010/DNFW 4.5 integration and have finally got this working. Starting in VS 2008, a cache of assemblies was introduced that is used by Visual Studio called the "Referenced Assemblies". This file cache for VS 2010 is located at \Reference Assemblies\Microsoft\Framework.NetFramework\v4.0. Visual Studio loads framework assemblies from this location instead of from the framework installation directory. When Microsoft says that VS 2010 does not support DNFW 4.5 what they mean is that this directory does not get updated when DNFW 4.5 is installed. Once you have replace the files in this location with the updated DNFW 4.5 files, you will find that VS 2010 will happily function with DNFW 4.5.
How about a workaround?
In my case I took the value of the textarea in a jQuery variable, and changed all "<p> "
to <p class="clear">
and clear class to have certain height and margin, as the following example:
jQuery
tinyMCE.triggerSave();
var val = $('textarea').val();
val = val.replace(/<p> /g, '<p class="clear">');
the val is then saved to the database with the new val.
CSS
p.clear{height: 2px; margin-bottom: 3px;}
You can adjust the height & margin as you wish. And since 'p' is a display: block element. it should give you the expected output.
Hope that helps!
For those of you who with Nexus 5x who only see Kedacom usb device
in Device Manager and cannot get adb to see the phone...the trick is to Update driver...
on the Kedacom device and change it to "Android ADB interface/device"
Use Nesting column
To nest your content with the default grid, add a new .row and set of .col-sm-* columns within an existing .col-sm-* column. Nested rows should include a set of columns that add up to 12 or fewer (it is not required that you use all 12 available columns).
<div class="row">_x000D_
<div class="col-sm-9">_x000D_
Level 1: .col-sm-9_x000D_
<div class="row">_x000D_
<div class="col-xs-8 col-sm-6">_x000D_
Level 2: .col-xs-8 .col-sm-6_x000D_
</div>_x000D_
<div class="col-xs-4 col-sm-6">_x000D_
Level 2: .col-xs-4 .col-sm-6_x000D_
</div>_x000D_
</div>_x000D_
</div>_x000D_
</div>
_x000D_
It may be an issue with the configuration file. I had a similar problem, and I couldn't find a solution on the web. I noticed that I had two my.cnf
files, one in /etc/mysql
and the other in /etc
.
Follow the steps below:
Check for my.cnf
files on your computer using locate my.cnf
.
If there are two entries, i.e. /etc/my.cnf
and /etc/mysql/my.cnf
,
rename /etc/mysql/my.cnf
to something else, e.g /etc/mysql/my.cnf.old
Try to run MySQL again.
It could be easily achieved with CSS flex. Having HTML markup as follows:
<html>
<body>
<div class="container"></div>
<div class="footer"></div>
</body>
</html>
Following CSS should be used:
html {
height: 100%;
}
body {
min-height: 100%;
display: flex;
flex-direction: column;
}
body > .container {
flex-grow: 1;
}
Here's CodePen to play with: https://codepen.io/webdevchars/pen/GPBqWZ
Security Settings -> Advanced Audit Policy -> System Audit -> Logon/Logoff -> Audit Other Logon/Off Events -> On Success
Enables the following:
4800 - workstation locked
4801 - workstation unlocked
4802 - screensaver invoke
4803 - screensaver dismissed
Windows 10 professional
Found one possible helper:
https://github.com/theironcook/Backbone.ModelBinder
and for people who don't want to get in contact with forms at all: https://github.com/powmedia/backbone-forms
I will take a closer look at the first link and than give some feedback :)
You should be able to install m2e (maven project for eclipse) using the Help -> Install New Software dialog. On that dialog open the Juno site (http://download.eclipse.org/releases/juno) and expand the Collaboration group (or type m2e into the filter). Select the two m2e options and follow the installation dialog
I had the same problem and none of the other answers worked. My problem was a weird one where IE9 wasn't able to connect to any https sites, therefore since I was using the online maxcdn bootstrap files like,
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css
none of that css and js was being applied. Going into the Advanced tab of Internet Explorer options I verified that not having "use TLS 1.0" checked caused the problem with https sites and files, and once checked my bootstrap page was formatted as expected.
As others have noted use the proper doctype below (maybe a valid html4 doctype will work, but if you're starting anew might as well use html5.)
The respond js and html5 shim (if using that) are for IE8. IE9 doesn't need that. The code below uses the standard method of targeting ie8 and below.
--Art
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- content -->
</body>
</html>
You could use jQuery to show the div, and set it at wherever your mouse is:
html:
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<body>
<div id="trigger">
<h1>Hover me!</h1>
<p>Ill show you wonderful things</p>
</div>
<div id="secret">
shhhh
</div>
<script src="script.js"></script>
</body>
</html>
styles:
#trigger {
border: 1px solid black;
}
#secret {
display:none;
top:0;
position:absolute;
background: grey;
color:white;
width: 50%;
}
js:
$("#trigger").hover(function(e){
$("#secret").show().css('top', e.pageY + "px").css('left', e.pageX + "px");
},function(e){
$("#secret").hide()
})
You can find the example here Cheers! http://plnkr.co/edit/LAhs8X9F8N3ft7qFvjzy?p=preview
I was getting the same error when I used this code to update the record:
@mysqli_query($dbc,$query or die()))
After removing or die
, it started working properly.
Here's a batch script I made to return a timestamp. An optional first argument may be provided to be used as a field delimiter. For example:
c:\sys\tmp>timestamp.bat
20160404_144741
c:\sys\tmp>timestamp.bat -
2016-04-04_14-45-25
c:\sys\tmp>timestamp.bat :
2016:04:04_14:45:29
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
:: put your desired field delimiter here.
:: for example, setting DELIMITER to a hyphen will separate fields like so:
:: yyyy-MM-dd_hh-mm-ss
::
:: setting DELIMITER to nothing will output like so:
:: yyyyMMdd_hhmmss
::
SET DELIMITER=%1
SET DATESTRING=%date:~-4,4%%DELIMITER%%date:~-7,2%%DELIMITER%%date:~-10,2%
SET TIMESTRING=%TIME%
::TRIM OFF the LAST 3 characters of TIMESTRING, which is the decimal point and hundredths of a second
set TIMESTRING=%TIMESTRING:~0,-3%
:: Replace colons from TIMESTRING with DELIMITER
SET TIMESTRING=%TIMESTRING::=!DELIMITER!%
:: if there is a preceeding space substitute with a zero
echo %DATESTRING%_%TIMESTRING: =0%
Try
if (!(i == 'InvKey' || i == 'PostDate')) {
or
if (i != 'InvKey' || i != 'PostDate') {
that says if i does not equals InvKey
OR PostDate
You can create a function in your ~/.bashrc
file, so you get a ping command ping-t
on your console:
function ping-t { ping "$1" | while read pong; do echo "$(date): $pong"; done; }
Now you can call this on the console:
ping-t example.com
Sa 31. Mär 12:58:31 CEST 2018: PING example.com (93.184.216.34) 56(84) bytes of data.
Sa 31. Mär 12:58:31 CEST 2018: 64 bytes from 93.184.216.34 (93.184.216.34): icmp_seq=1 ttl=48 time=208 ms
Sa 31. Mär 12:58:32 CEST 2018: 64 bytes from 93.184.216.34 (93.184.216.34): icmp_seq=2 ttl=48 time=233 ms
For others who may run across this - it can also occur if someone carelessly leaves trailing spaces from a php include file. Example:
<?php
require_once('mylib.php');
session_start();
?>
In the case above, if the mylib.php has blank spaces after its closing ?> tag, this will cause an error. This obviously can get annoying if you've included/required many files. Luckily the error tells you which file is offending.
HTH
This Python snippet will git mv --force
all files in a directory to be lowercase. For example, foo/Bar.js will become foo/bar.js via git mv foo/Bar.js foo/bar.js --force
.
Modify it to your liking. I just figured I'd share :)
import os
import re
searchDir = 'c:/someRepo'
exclude = ['.git', 'node_modules','bin']
os.chdir(searchDir)
for root, dirs, files in os.walk(searchDir):
dirs[:] = [d for d in dirs if d not in exclude]
for f in files:
if re.match(r'[A-Z]', f):
fullPath = os.path.join(root, f)
fullPathLower = os.path.join(root, f[0].lower() + f[1:])
command = 'git mv --force ' + fullPath + ' ' + fullPathLower
print(command)
os.system(command)
I wrote the following code to convert an image from sdcard to a Base64 encoded string to send as a JSON object.And it works great:
String filepath = "/sdcard/temp.png";
File imagefile = new File(filepath);
FileInputStream fis = null;
try {
fis = new FileInputStream(imagefile);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Bitmap bm = BitmapFactory.decodeStream(fis);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 100 , baos);
byte[] b = baos.toByteArray();
encImage = Base64.encodeToString(b, Base64.DEFAULT);
You can also get value by name instead of id like this:
var message = $('textarea:input[name=message]').val();
The <figcaption>
tag in HTML5 allows you to enter text to your image for example:
<figcaption>
Your text here
</figcaption>.
You can then use CSS to position the text where it should be on the image.
If you're working with a multiline string, like a code file:
<html>
<title>test</title>
<body>
<h1>test</h1>
</body>
</html>
And want to replace all leading lines, to get this result:
<html>
<title>test</title>
<body>
<h1>test</h1>
</body>
</html>
You must add the multiline
flag to your regex, ^
and $
match line by line:
string.replace(/^\s+|\s+$/gm, '');
Relevant quote from docs:
The "m" flag indicates that a multiline input string should be treated as multiple lines. For example, if "m" is used, "^" and "$" change from matching at only the start or end of the entire string to the start or end of any line within the string.
Instead of using string interpolation you could simply format the DateTime using the ToString("u")
method and concatenate that with the rest of the string:
$startTime = Get-Date
Write-Host "The script was started " + $startTime.ToString("u")
Try to Use Flex as that is the new standard of html5.
http://jsfiddle.net/maxspan/1b431hxm/
<div id="row1">
<div id="column1">I am column one</div>
<div id="column2">I am column two</div>
</div>
#row1{
display:flex;
flex-direction:row;
justify-content: space-around;
}
#column1{
display:flex;
flex-direction:column;
}
#column2{
display:flex;
flex-direction:column;
}
From your code
<input type=button value="Select" onClick="sendValue(this.form.details);"
Im not sure that your this.form.details
valid or not.
IF it's valid, have a look in window.opener.document.getElementById('details').value = selvalue;
I can't found an input's id contain details
I'm just found only id=sku1
(recommend you to add "
like id="sku1"
).
And from your id it's hardcode. Let's see how to do with dynamic when a child has callback to update some textbox on the parent Take a look at here.
<html>
<head>
<script>
function callFromDialog(id,data){ //for callback from the dialog
document.getElementById(id).value = data;
// do some thing other if you want
}
function choose(id){
var URL = "secondPage.html?id=" + id + "&dummy=avoid#";
window.open(URL,"mywindow","menubar=1,resizable=1,width=350,height=250")
}
</script>
</head>
<body>
<input id="tbFirst" type="text" /> <button onclick="choose('tbFirst')">choose</button>
<input id="tbSecond" type="text" /> <button onclick="choose('tbSecond')">choose</button>
</body>
</html>
Look in function choose
I'm sent an id of textbox to the popup window (don't forget to add dummy data at last of URL param like &dummy=avoid#
)
<html>
<head>
<script>
function goSelect(data){
var idFromCallPage = getUrlVars()["id"];
window.opener.callFromDialog(idFromCallPage,data); //or use //window.opener.document.getElementById(idFromCallPage).value = data;
window.close();
}
function getUrlVars(){
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
</script>
</head>
<body>
<a href="#" onclick="goSelect('Car')">Car</a> <br />
<a href="#" onclick="goSelect('Food')">Food</a> <br />
</body>
</html>
I have add function getUrlVars for get URL param that the parent has pass to child.
Okay, when select data in the popup, for this case it's will call function goSelect
In that function will get URL param to sent back.
And when you need to sent back to the parent just use window.opener and the name of function like window.opener.callFromDialog
By fully is window.opener.callFromDialog(idFromCallPage,data);
Or if you want to use window.opener.document.getElementById(idFromCallPage).value = data;
It's ok too.
This answer got me 90% of the way there. I found the rest of my answer on the Microsoft site here.
The code below is what I'm using to target all ie by adding a .ie class to <html>
Use jQuery (which deprecated .browser in favor of user agents in 1.9+, see http://api.jquery.com/jQuery.browser/) to add an .ie class:
// ie identifier
$(document).ready(function () {
if (navigator.appName == 'Microsoft Internet Explorer') {
$("html").addClass("ie");
}
});
Your Manifest
Must Change like this Activity name must Specified like ".YourActivityname"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.th.mybook"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8" android:targetSdkVersion="8" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainTabPanel"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MyBookActivity" >
</activity>
</application>
This one works for me:
<tr style="height: 15px;"/>
AngularJS remembers the value and compares it to a previous value. This is basic dirty-checking. If there is a change in value, then it fires the change event.
The $apply()
method, which is what you call when you are transitioning from a non-AngularJS world into an AngularJS world, calls $digest()
. A digest is just plain old dirty-checking. It works on all browsers and is totally predictable.
To contrast dirty-checking (AngularJS) vs change listeners (KnockoutJS and Backbone.js): While dirty-checking may seem simple, and even inefficient (I will address that later), it turns out that it is semantically correct all the time, while change listeners have lots of weird corner cases and need things like dependency tracking to make it more semantically correct. KnockoutJS dependency tracking is a clever feature for a problem which AngularJS does not have.
So it may seem that we are slow, since dirty-checking is inefficient. This is where we need to look at real numbers rather than just have theoretical arguments, but first let's define some constraints.
Humans are:
Slow — Anything faster than 50 ms is imperceptible to humans and thus can be considered as "instant".
Limited — You can't really show more than about 2000 pieces of information to a human on a single page. Anything more than that is really bad UI, and humans can't process this anyway.
So the real question is this: How many comparisons can you do on a browser in 50 ms? This is a hard question to answer as many factors come into play, but here is a test case: http://jsperf.com/angularjs-digest/6 which creates 10,000 watchers. On a modern browser this takes just under 6 ms. On Internet Explorer 8 it takes about 40 ms. As you can see, this is not an issue even on slow browsers these days. There is a caveat: The comparisons need to be simple to fit into the time limit... Unfortunately it is way too easy to add a slow comparison into AngularJS, so it is easy to build slow applications when you don't know what you are doing. But we hope to have an answer by providing an instrumentation module, which would show you which are the slow comparisons.
It turns out that video games and GPUs use the dirty-checking approach, specifically because it is consistent. As long as they get over the monitor refresh rate (typically 50-60 Hz, or every 16.6-20 ms), any performance over that is a waste, so you're better off drawing more stuff, than getting FPS higher.
Put in all your svg:
fill="var(--svgcolor)"
In Css:
:root {
--svgcolor: tomato;
}
To use pseudo-classes:
span.github:hover {
--svgcolor:aquamarine;
}
Explanation
root = html page.
--svgcolor = a variable.
span.github = selecting a span element with a class github, a svg icon inside and assigning pseudo-class hover.
You've already got it: A if test else B
is a valid Python expression. The only problem with your dict comprehension as shown is that the place for an expression in a dict comprehension must have two expressions, separated by a colon:
{ (some_key if condition else default_key):(something_if_true if condition
else something_if_false) for key, value in dict_.items() }
The final if
clause acts as a filter, which is different from having the conditional expression.
The problem is with slashes: your variable contains them and the final command will be something like sed "s/string/path/to/something/g"
, containing way too many slashes.
Since sed
can take any char as delimiter (without having to declare the new delimiter), you can try using another one that doesn't appear in your replacement string:
replacement="/my/path"
sed --expression "s@pattern@$replacement@"
Note that this is not bullet proof: if the replacement string later contains @
it will break for the same reason, and any backslash sequences like \1
will still be interpreted according to sed
rules. Using |
as a delimiter is also a nice option as it is similar in readability to /
.
When a module is loaded from a file in Python, __file__
is set to its path. You can then use that with other functions to find the directory that the file is located in.
Taking your examples one at a time:
A = os.path.join(os.path.dirname(__file__), '..')
# A is the parent directory of the directory where program resides.
B = os.path.dirname(os.path.realpath(__file__))
# B is the canonicalised (?) directory where the program resides.
C = os.path.abspath(os.path.dirname(__file__))
# C is the absolute path of the directory where the program resides.
You can see the various values returned from these here:
import os
print(__file__)
print(os.path.join(os.path.dirname(__file__), '..'))
print(os.path.dirname(os.path.realpath(__file__)))
print(os.path.abspath(os.path.dirname(__file__)))
and make sure you run it from different locations (such as ./text.py
, ~/python/text.py
and so forth) to see what difference that makes.
I just want to address some confusion first. __file__
is not a wildcard it is an attribute. Double underscore attributes and methods are considered to be "special" by convention and serve a special purpose.
http://docs.python.org/reference/datamodel.html shows many of the special methods and attributes, if not all of them.
In this case __file__
is an attribute of a module (a module object). In Python a .py
file is a module. So import amodule
will have an attribute of __file__
which means different things under difference circumstances.
Taken from the docs:
__file__
is the pathname of the file from which the module was loaded, if it was loaded from a file. The__file__
attribute is not present for C modules that are statically linked into the interpreter; for extension modules loaded dynamically from a shared library, it is the pathname of the shared library file.
In your case the module is accessing it's own __file__
attribute in the global namespace.
To see this in action try:
# file: test.py
print globals()
print __file__
And run:
python test.py
{'__builtins__': <module '__builtin__' (built-in)>, '__name__': '__main__', '__file__':
'test_print__file__.py', '__doc__': None, '__package__': None}
test_print__file__.py
Here is how you can search the database in Swift using the FMDB library.
First, go to this link and add this to your project: FMDB. When you have done that, then here is how you do it. For example, you have a table called Person, and you have firstName and secondName and you want to find data by first name, here is a code for that:
func loadDataByfirstName(firstName : String, completion: @escaping CompletionHandler){
if isDatabaseOpened {
let query = "select * from Person where firstName like '\(firstName)'"
do {
let results = try database.executeQuery(query, values: [firstName])
while results.next() {
let firstName = results.string(forColumn: "firstName") ?? ""
let lastName = results.string(forColumn: "lastName") ?? ""
let newPerson = Person(firstName: firstName, lastName: lastName)
self.persons.append(newPerson)
}
completion(true)
}catch let err {
completion(false)
print(err.localizedDescription)
}
database.close()
}
}
Then in your ViewController you will write this to find the person detail you are looking for:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
SQLManager.instance.openDatabase { (success) in
if success {
SQLManager.instance.loadDataByfirstName(firstName: "Hardi") { (success) in
if success {
// You have your data Here
}
}
}
}
}
using System.IO;
...
Directory.CreateDirectory(@"C:\MP_Upload");
Directory.CreateDirectory does exactly what you want: It creates the directory if it does not exist yet. There's no need to do an explicit check first.
Any and all directories specified in path are created, unless they already exist or unless some part of path is invalid. The path parameter specifies a directory path, not a file path. If the directory already exists, this method does nothing.
(This also means that all directories along the path are created if needed: CreateDirectory(@"C:\a\b\c\d")
suffices, even if C:\a
does not exist yet.)
Let me add a word of caution about your choice of directory, though: Creating a folder directly below the system partition root C:\
is frowned upon. Consider letting the user choose a folder or creating a folder in %APPDATA%
or %LOCALAPPDATA%
instead (use Environment.GetFolderPath for that). The MSDN page of the Environment.SpecialFolder enumeration contains a list of special operating system folders and their purposes.
I had to remove a webproject. There was an old referencing DLL file inside, and I had to clean that webproject, and then it worked.
check both tables has same schema InnoDB MyISAM. I made them all the same in my case InnoDB and worked
When you log on Windows creates an access token. This identifies you, the groups you are a member of and your privileges. And note that whether a user is an administrator or not is determined by whether the user is a member of the Administrators group.
Without UAC, when you run a program it gets a copy of the access token, and this controls what the program can access.
With UAC, when you run a program it gets a restricted access token. This is the original access token with "Administrators" removed from the list of groups (and some other changes). Even though your user is a member of the Administrators group, the program can't use Administrator privileges.
When you select "Run as Administrator" and your user is an administrator the program is launched with the original unrestricted access token. If your user is not an administrator you are prompted for an administrator account, and the program is run under that account.
This is the sample code for the email and javascript.
params = getParams();
subject = "ULM Query of: ";
subject += unescape(params["FormsEditField3"]);
content = "Email: ";
content += unescape(params["FormsMultiLine2"]);
content += " Query: ";
content += unescape(params["FormsMultiLine4"]);
var email = "[email protected]";
document.write('<a href="mailto:'+email+'?subject='+subject+'&body='+content+'">SUBMIT QUERY</a>');
The color and window sizing are defined by the shortcut LNK file. I think I found a way that will do what you need, try this:
explorer.exe "Windows PowerShell.lnk"
The LNK file is in the all user start menu which is located in different places depending whether your on XP or Windows 7. In 7 the LNK file is here:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Windows PowerShell
Yes, many.
Including, but not limited to:
 
or
 
(no character reference available) 
or  
 
or  
 
or  
 
or  
 
(no character reference available) 
or  
 
or  
 
or  
 
or  
span{background-color: red;}
_x000D_
<table>_x000D_
<tr><td>non breaking space:</td><td> <span> </span> or <span> </span></td></tr>_x000D_
<tr><td>narrow no-break space:</td><td> <span> </span></td></tr>_x000D_
<tr><td>en space:</td><td> <span> </span> or <span> </span></td></tr>_x000D_
<tr><td>em space:</td><td> <span> </span> or <span> </span></td></tr>_x000D_
<tr><td>3-per-em space:</td><td> <span> </span> or <span> </span></td></tr>_x000D_
<tr><td>4-per-em space:</td><td> <span> </span> or <span> </span></td></tr>_x000D_
<tr><td>6-per-em space:</td><td> <span> </span></td></tr>_x000D_
<tr><td>figure space:</td><td> <span> </span> or <span> </span></td></tr>_x000D_
<tr><td>punctuation space:</td><td> <span> </span> or <span> </td></tr>_x000D_
<tr><td>thin space:</td><td> <span> </span> or <span> </span></td></tr>_x000D_
<tr><td>hair space:</td><td> <span> </span> or <span> </span></td></tr>_x000D_
</table>
_x000D_
I assume it has something to do with a quirk in our HTML because other places on the same page work just fine.
The only way I was able to solve this problem was to do:
if($('#element_id').css('display') == 'none')
{
// Take element is hidden action
}
else
{
// Take element is visible action
}
This question is almost a year old but I have found that if you make a custom comparator for objects you can use Collections.max for an array list of objects.
import java.util.Comparator;
public class compPopulation implements Comparator<Country> {
public int compare(Country a, Country b) {
if (a.getPopulation() > b.getPopulation())
return -1; // highest value first
if (a.getPopulation() == b.Population())
return 0;
return 1;
}
}
ArrayList<Country> X = new ArrayList<Country>();
// create some country objects and put in the list
Country ZZ = Collections.max(X, new compPopulation());
If checked:
$( "SELECTOR" ).attr( "checked" ) // Returns ‘true’ if present on the element, returns undefined if not present
$( "SELECTOR" ).prop( "checked" ) // Returns true if checked, false if unchecked.
$( "SELECTOR" ).is( ":checked" ) // Returns true if checked, false if unchecked.
Get the checked val:
$( "SELECTOR:checked" ).val()
Get the checked val numbers:
$( "SELECTOR:checked" ).length
Check or uncheck checkbox
$( "SELECTOR" ).prop( "disabled", false );
$( "SELECTOR" ).prop( "checked", true );
Use [String.getBytes()][1]
to convert to bytes and use [String(byte[] data)][2]
constructor to convert back to string.
Yes, Spring framework logging is very detailed, You did not mention in your post, if you are already using a logging framework or not. If you are using log4j then just add spring appenders to the log4j config (i.e to log4j.xml or log4j.properties), If you are using log4j xml config you can do some thing like this
<category name="org.springframework.beans">
<priority value="debug" />
</category>
or
<category name="org.springframework">
<priority value="debug" />
</category>
I would advise you to test this problem in isolation using JUnit test, You can do this by using spring testing module in conjunction with Junit. If you use spring test module it will do the bulk of the work for you it loads context file based on your context config and starts container so you can just focus on testing your business logic. I have a small example here
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:springContext.xml"})
@Transactional
public class SpringDAOTest
{
@Autowired
private SpringDAO dao;
@Autowired
private ApplicationContext appContext;
@Test
public void checkConfig()
{
AnySpringBean bean = appContext.getBean(AnySpringBean.class);
Assert.assertNotNull(bean);
}
}
I am not advising you to change the way you load logging but try this in your dev environment, Add this snippet to your web.xml file
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
UPDATE log4j config file
I tested this on my local tomcat and it generated a lot of logging on application start up. I also want to make a correction: use debug not info as @Rayan Stewart mentioned.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="debug" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{HH:mm:ss} %p [%t]:%c{3}.%M()%L - %m%n" />
</layout>
</appender>
<appender name="springAppender" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="C:/tomcatLogs/webApp/spring-details.log" />
<param name="append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{MM/dd/yyyy HH:mm:ss} [%t]:%c{5}.%M()%L %m%n" />
</layout>
</appender>
<category name="org.springframework">
<priority value="debug" />
</category>
<category name="org.springframework.beans">
<priority value="debug" />
</category>
<category name="org.springframework.security">
<priority value="debug" />
</category>
<category
name="org.springframework.beans.CachedIntrospectionResults">
<priority value="debug" />
</category>
<category name="org.springframework.jdbc.core">
<priority value="debug" />
</category>
<category name="org.springframework.transaction.support.TransactionSynchronizationManager">
<priority value="debug" />
</category>
<root>
<priority value="debug" />
<appender-ref ref="springAppender" />
<!-- <appender-ref ref="STDOUT"/> -->
</root>
</log4j:configuration>
Add bottom:100%
to your #menu:hover ul li:hover ul
rule
#menu:hover ul li:hover ul {
position: absolute;
margin-top: 1px;
font: 10px;
bottom: 100%; /* added this attribute */
}
Or better yet to prevent the submenus from having the same effect, just add this rule
#menu>ul>li:hover>ul {
bottom:100%;
}
source: http://jsfiddle.net/W5FWW/4/
And to get back the border you can add the following attribute
#menu>ul>li:hover>ul {
bottom:100%;
border-bottom: 1px solid transparent
}
import os.path
dirname = os.path.dirname(__file__) or '.'
Git will prompt you for a passowrd if you are using https
protocol. If you use ssh
, it will do the authentication using your private key instead of asking for password. (https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account)
Here is how to fix this:
git remote -v
This will show the url for origin. And you will notice https
in this url. (Example : https://github.com/PrestaShop/PrestaShop.git)
Now, you will have to just remove this first and add the url with ssh
git remote remove origin
git remote add origin [email protected]:PrestaShop/PrestaShop.git
Just use this:
{{you_date_field|date:'Y-m-d'}}
This will show something like 2016-10-16. You can use the format as you want.
I use Jena and I add the fellowing dependence to pom.xml
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
</dependency>
I try to add slf4j-simple but it just disappear the "SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”" error but logback-classic show more detail infomation.
Suppose you want to insert a particular line of text (not an empty line):
@echo off
FOR /F %%C IN ('FIND /C /V "" ^<%origfile%') DO SET totallines=%%C
set /a totallines+=1
@echo off
<%origfile% (FOR /L %%i IN (1,1,%totallines%) DO (
SETLOCAL EnableDelayedExpansion
SET /p L=
IF %%i==%insertat% ECHO(!TL!
ECHO(!L!
ENDLOCAL
)
) >%tempfile%
COPY /Y %tempfile% %origfile% >NUL
DEL %tempfile%
It depends upon the context. Some possible contexts in HTML:
See OWASP's Cross Site Scripting Prevention Cheat Sheet, especially the "Why Can't I Just HTML Entity Encode Untrusted Data?" and "XSS Prevention Rules" sections. However, it's best to read the whole document.
Another option is:
Create a shortcut to the Eclipse.exe. Open the shortcut and change the target to:
"C:\Program Files\eclipse\eclipse.exe" -vm "c:\Program Files\Java\jdk1.7.0_04\bin\javaw.exe"
For your installation, make sure the locations point to the correct Eclipse installation directory and the correct javaw.exe
installation directory.
(The 64/32 bit versions of Eclipse and Java need to be the same, of course.)
Fields in interfaces are implicitly public static final
. (Also methods are implicitly public, so you can drop the public
keyword.) Even if you use an abstract class instead of an interface, I strongly suggest making all non-constant (public static final
of a primitive or immutable object reference) private
. More generally "prefer composition to inheritance" - a Tile
is-not-a Rectangle
(of course, you can play word games with "is-a" and "has-a").
See if the BSD C Standard Library has fcvt(). You could start with the source for it that rather than writing your code from scratch. The UNIX 98 standard fcvt() apparently does not output scientific notation so you would have to implement it yourself, but I don't think it would be hard.
You need to define a resource reference in your application and then map that logical resource reference to the physical resource (data source) during deployment.
In your web.xml
, add the following configuration (modifying the names and properties as appropriate):
<resource-ref>
<description>Resource reference to my database</description>
<res-ref-name>jdbc/MyDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
Then, during application deployment, WAS will prompt you to map this resource reference (jdbc/MyDB
) to the data source you created in WAS.
In your code, you can obtain the DataSource similar to how you've shown it in your example; however, the JNDI name you'll use to look it up should actually be the resource reference's name you defined (res-ref-name
), rather than the JNDI name of the physical data source. Also, you'll need to prefix the res-ref-name with the application naming context (java:comp/env/
).
Context ctx = new InitialContext();
DataSource dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/MyDB");
Given an input file with four billion integers, provide an algorithm to generate an integer which is not contained in the file. Assume you have 1 GiB memory. Follow up with what you would do if you have only 10 MiB of memory.
The size of the file is 4 * 109 * 4 bytes = 16 GiB
In case of 32-bit Unsigned Integer
0 <= Number < 2^32
0 <= Number < 4,294,967,296
My proposed solution: C++ without error checking
#include <vector>
#include <fstream>
#include <iostream>
using namespace std;
int main ()
{
const long SIZE = 1L << 32;
std::vector<bool> checker(SIZE, false);
std::ifstream infile("file.txt"); // TODO: error checking
unsigned int num = 0;
while (infile >> num)
{
checker[num] = true ;
}
infile.close();
// print missing numbers
for (long i = 0; i < SIZE; i++)
{
if (!checker[i])
cout << i << endl ;
}
return 0;
}
Complexity
You can have the script call itself with psexec's -h
option to run elevated.
I'm not sure how you would detect if it's already running as elevated or not... maybe re-try with elevated perms only if there's an Access Denied error?
Or, you could simply have the commands for the xcopy
and reg.exe
always be run with psexec -h
, but it would be annoying for the end-user if they need to input their password each time (or insecure if you included the password in the script)...
Try this, at the end of the each loop, ids array will contain all the hexcodes.
var ids = [];
$(document).ready(function($) {
var $div = $("<div id='hexCodes'></div>").appendTo(document.body), code;
$(".color_cell").each(function() {
code = $(this).attr('id');
ids.push(code);
$div.append(code + "<br />");
});
});
It may be possible that there is no other application running. It is possible that the socket wasn't cleanly shutdown from a previous session in which case you may have to wait for a while before the TIME_WAIT expires on that socket. Unfortunately, you won't be able to use the port till that socket expires. If you can start your server after waiting for a while (a few minutes) then the problem is not due to some other application running on port 8080.
Actually, if you try to use function "children" it will not be succesfull because it's possible to the table has a first child like 'th'. So you have to use function 'find' instead.
Wrong way:
var $row = $(this).closest('table').children('tr:first');
Correct way:
var $row = $(this).closest('table').find('tr:first');
new Date("2011-07-14 11:23:00");
works fine for me.
same as Igor but should work without line 2:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
So.. I had noticed in event viewer that this crash corresponded to a "System.IO.FileNotFoundException" error.
So I fired ProcMon and noticed that one of the program dlls was failing to load vcruntime140. So I simply installed vs15 redist and it worked.
This is not possible from HTML on. The closest what you can get is the accept-charset
attribute of the <form>
. Only MSIE browser adheres that, but even then it is doing it wrong (e.g. CP1252 is actually been used when it says that it has sent ISO-8859-1). Other browsers are fully ignoring it and they are using the charset as specified in the Content-Type
header of the response. Setting the character encoding right is basically fully the responsiblity of the server side. The client side should just send it back in the same charset as the server has sent the response in.
To the point, you should really configure the character encoding stuff entirely from the server side on. To overcome the inability to edit URIEncoding
attribute, someone here on SO wrote a (complex) filter: Detect the URI encoding automatically in Tomcat. You may find it useful as well (note: I haven't tested it).
Update:
Noted should be that the meta tag as given in your question is ignored when the content is been transferred over HTTP. Instead, the HTTP response Content-Type
header will be used to determine the content type and character encoding. You can determine the HTTP header with for example Firebug, in the Net panel.
This happens when the pointer passed to free() is not valid or has been modified somehow. I don't really know the details here. The bottom line is that the pointer passed to free() must be the same as returned by malloc(), realloc() and their friends. It's not always easy to spot what the problem is for a novice in their own code or even deeper in a library. In my case, it was a simple case of an undefined (uninitialized) pointer related to branching.
The free() function frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc() or realloc(). Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is NULL, no operation is performed. GNU 2012-05-10 MALLOC(3)
char *words; // setting this to NULL would have prevented the issue
if (condition) {
words = malloc( 512 );
/* calling free sometime later works here */
free(words)
} else {
/* do not allocate words in this branch */
}
/* free(words); -- error here --
*** glibc detected *** ./bin: munmap_chunk(): invalid pointer: 0xb________ ***/
There are many similar questions here about the related free() and rellocate() functions. Some notable answers providing more details:
*** glibc detected *** free(): invalid next size (normal): 0x0a03c978 ***
*** glibc detected *** sendip: free(): invalid next size (normal): 0x09da25e8 ***
glibc detected, realloc(): invalid pointer
IMHO running everything in a debugger (Valgrind) is not the best option because errors like this are often caused by inept or novice programmers. It's more productive to figure out the issue manually and learn how to avoid it in the future.
I have been exactly in your case in the past. And I went for magic methods.
This was a mistake, the last part of your question says it all :
@property
phpdoc annotation but that requires to maintain them: quite a pain)getXXX()
is not only returning a private property but doing real logic. You have the same naming. For example you have $user->getName()
(returns private property) and $user->getToken($key)
(computed). The day your getter gets more than a getter and needs to do some logic, everything is still consistent.Finally, and this is the biggest problem IMO : this is magic. And magic is very very bad, because you have to know how the magic works to use it properly. That's a problem I've met in a team: everybody has to understand the magic, not just you.
Getters and setters are a pain to write (I hate them) but they are worth it.
There's a truly horrifying amount of ancient code out there in the wild, much of it in the form of common CPAN modules. I've found I have to be fairly careful enabling Unicode if I use external modules that might be affected by it, and am still trying to identify and fix some Unicode-related failures in several Perl scripts I use regularly (in particular, iTiVo fails badly on anything that's not 7-bit ASCII due to transcoding issues).
Based on Derek's answer, I verified that
document.getElementById('testTarget')
.dispatchEvent(new MouseEvent('click', {shiftKey: true}))
works as expected even with key modifiers. And this is not a deprecated API, as far as I can see. You can verify on this page as well.
This is another way:
1.Create a BaseFragment like this:
public abstract class BaseFragment extends Fragment implements OnClickListener
2.Use
public class FragmentA extends BaseFragment
instead of
public class FragmentA extends Fragment
3.In your activity:
public class MainActivity extends ActionBarActivity implements OnClickListener
and
BaseFragment fragment = new FragmentA;
public void onClick(View v){
fragment.onClick(v);
}
Hope it helps.
Simplest solution would be to use tool which allows you to directly specify ranges, like gnu shuf
shuf -i1-10 -n1
If you want to use $RANDOM
, it would be more precise to throw out the last 8 numbers in 0...32767, and just treat it as 0...32759, since taking 0...32767 mod 10 you get the following distribution
0-8 each: 3277
8-9 each: 3276
So, slightly slower but more precise would be
while :; do ran=$RANDOM; ((ran < 32760)) && echo $(((ran%10)+1)) && break; done
Use the Thread.IsAlive
flag. This is to give the thread status.
I use abline()
with extremely wide vertical lines to fill the plot space:
abline(v = xpoints, col = "grey90", lwd = 80)
You have to create the frame, then the ablines, and then plot the points so they are visible on top. You can even use a second abline()
statement to put thin white or black lines over the grey, if desired.
Example:
xpoints = 1:20
y = rnorm(20)
plot(NULL,ylim=c(-3,3),xlim=xpoints)
abline(v=xpoints,col="gray90",lwd=80)
abline(v=xpoints,col="white")
abline(h = 0, lty = 2)
points(xpoints, y, pch = 16, cex = 1.2, col = "red")
ModelMapper is another library worth checking out. ModelMapper's design is different from other libraries in that it:
Check out the ModelMapper site for more info:
Here are the high-level differences:
All of the above answers were perfectly clear and complete, but just for the record I'd like to confirm that the meaning of * and ** in python has absolutely no similarity with the meaning of similar-looking operators in C.
They are called the argument-unpacking and keyword-argument-unpacking operators.
To copy myfile.txt
to /foo/bar/myfile.txt
, use:
mkdir -p /foo/bar && cp myfile.txt $_
There's a few components to this, so I'll cover all the syntax step by step.
The mkdir utility, as specified in the POSIX standard, makes directories. The -p
argument, per the docs, will cause mkdir to
Create any missing intermediate pathname components
meaning that when calling mkdir -p /foo/bar
, mkdir will create /foo
and /foo/bar
if /foo
doesn't already exist. (Without -p
, it will instead throw an error.
The &&
list operator, as documented in the POSIX standard (or the Bash manual if you prefer), has the effect that cp myfile.txt $_
only gets executed if mkdir -p /foo/bar
executes successfully. This means the cp
command won't try to execute if mkdir
fails for one of the many reasons it might fail.
Finally, the $_
we pass as the second argument to cp
is a "special parameter" which can be handy for avoiding repeating long arguments (like file paths) without having to store them in a variable. Per the Bash manual, it:
expands to the last argument to the previous command
In this case, that's the /foo/bar
we passed to mkdir
. So the cp
command expands to cp myfile.txt /foo/bar
, which copies myfile.txt
into the newly created /foo/bar
directory.
Note that $_
is not part of the POSIX standard, so theoretically a Unix variant might have a shell that doesn't support this construct. However, I don't know of any modern shells that don't support $_
; certainly Bash, Dash, and zsh all do.
A final note: the command I've given at the start of this answer assumes that your directory names don't have spaces in. If you're dealing with names with spaces, you'll need to quote them so that the different words aren't treated as different arguments to mkdir
or cp
. So your command would actually look like:
mkdir -p "/my directory/name with/spaces" && cp "my filename with spaces.txt" "$_"
str1.toLowerCase().contains(str2.toLowerCase())
I had to do recently something similar, I used this snippet:
const getNode = () =>
for (let el = this.$el; el && el.parentNode; el = el.parentNode){
if (/* insert your condition here */) return el;
}
return null
})
The function will returns the element that fulfills your condition. It was a CSS class on the element that I was looking for. If there isn't such element then it will return null
In case somebody would look for multiple elements it only returns closest parent to the element that you provided.
My example was:
if (el.classList?.contains('o-modal')) return el;
I used it in a vue component (this.$el) change that to your document.getElementById
function and you're good to go. Hope it will be useful for some people ??
Which OS?
Everything you download should be placed in the android-sdk folder (in my case: j:\android-sdk-windows).
You can execute "SDK Setup.exe" (or the mac/linux command for this) and download everything and just copy your complete android-sdk folder to another computer. I have the complete SDK + Eclipse + Workspace on an external HDD that I can just plug in to another Computer and it works (except for JDK which should be installed and the AVD's which are located in the user directory). Don't forget to set the ANDROID_HOME environment var to point to your install dir.
Update: In the SDK Downloader you have a "force https:// sources to be fetched using http://" checkbox under the settings menu. Maybe check (or if checked) uncheck this may help you to download everthing from your firewalled computer.
Limiting the length of the input is definitely easier. You could accept an arbitrarily-long input by using a loop, reading in a bit at a time, re-allocating space for the string as necessary...
But that's a lot of work, so most C programmers just chop off the input at some arbitrary length. I suppose you know this already, but using fgets() isn't going to allow you to accept arbitrary amounts of text - you're still going to need to set a limit.
Just adding my problem i had:
$this->load->model("planning/plan_model.php");
and the .php
shouldnt be there, so it should have been:
$this->load->model("planning/plan_model");
hope this helps someone
You can remove database directly as:
$ mysqladmin -h [host] -u [user] -p drop [database_name]
[Enter Password]
Do you really want to drop the 'hairfree' database [y/N]: y
Response you are getting is in object form i.e.
{
"dstOffset" : 3600,
"rawOffset" : 36000,
"status" : "OK",
"timeZoneId" : "Australia/Hobart",
"timeZoneName" : "Australian Eastern Daylight Time"
}
Replace below line of code :
List<Post> postsList = Arrays.asList(gson.fromJson(reader,Post.class))
with
Post post = gson.fromJson(reader, Post.class);
no, but it runs fine on win64, and can create win64 .EXEs
I understand your frustration the " Graphics view widget" is not the best way to do this, yes it can be done, but it's almost exactly the same as using a label ( for what you want any way) now all the ways listed do work but...
For you and any one else that may come across this question he easiest way to do it ( what you're asking any way ) is this.
QPixmap pix("Path\\path\\entername.jpeg");
ui->label->setPixmap(pix);
}
Reassign owned didn't work for me as I was wanted to change tables owned by postgres.
I ended up using Alex's method, however I wanted to do this from within psql. The following was sufficient for me.
DO $$
DECLARE
rec record;
BEGIN
FOR rec in
SELECT *
FROM pg_tables
where schemaname = 'public'
LOOP
EXECUTE 'alter table ' || quote_ident(rec.tablename) || ' owner to new_owner';
END LOOP;
END
$$;
merged = map(names(first), ~c(first[[.x]], second[[.x]])
merged = set_names(merged, names(first))
Using purrr. Also solves the problem of your lists not being in order.
You can just use nrows
. For instance
pd.read_csv('data.csv',nrows=6)
will show the first 6 rows from data.csv
.
Including the header afxwin.h
signalizes use of MFC. The following instructions (based on those on CodeProject.com) could help to get MFC code compiling:
Download and install the Windows Driver Kit.
Select menu Tools > Options… > Projects and Solutions > VC++ Directories.
In the drop-down menu Show directories for select Include files.
Add the following paths (replace $(WDK_directory)
with the directory where you installed Windows Driver Kit in the first step):
$(WDK_directory)\inc\mfc42
$(WDK_directory)\inc\atl30
In the drop-down menu Show directories for select Library files and add (replace $(WDK_directory)
like before):
$(WDK_directory)\lib\mfc\i386
$(WDK_directory)\lib\atl\i386
In the $(WDK_directory)\inc\mfc42\afxwin.inl
file, edit the following lines (starting from 1033):
_AFXWIN_INLINE CMenu::operator==(const CMenu& menu) const
{ return ((HMENU) menu) == m_hMenu; }
_AFXWIN_INLINE CMenu::operator!=(const CMenu& menu) const
{ return ((HMENU) menu) != m_hMenu; }
to
_AFXWIN_INLINE BOOL CMenu::operator==(const CMenu& menu) const
{ return ((HMENU) menu) == m_hMenu; }
_AFXWIN_INLINE BOOL CMenu::operator!=(const CMenu& menu) const
{ return ((HMENU) menu) != m_hMenu; }
In other words, add BOOL
after _AFXWIN_INLINE
.
Watch this.
The video says that you need to just add self.view.layoutIfNeeded()
like the following:
UIView.animate(withDuration: 1.0, animations: {
self.centerX.constant -= 75
self.view.layoutIfNeeded()
}, completion: nil)
When you do a push, git only takes the changes that you have committed.
Remember when you do a git status
it shows you the files you changed since the last push?
Once you commit those changes and do a push they are the only files that get pushed so you don't have to worry about thinking that the entire master gets pushed because in reality it does not.
How to push a single file:
git commit yourfile.js
git status
git push origin master
You can replace the values "null" from the original file & field/column.
To expound upon @clyfe's answer. You can get a list of your instance methods using the following code (assuming that you have an Object Class named "Parser"):
Parser.new.methods - Object.new.methods
Version 1:
// Update data of question values with $data from formulay
$Q1 = Question::find($id);
$Q1->fill($data);
$Q1->push();
Version 2:
$Q1 = Question::find($id);
$Q1->field = 'YOUR TEXT OR VALUE';
$Q1->save();
In case of answered question you can use them:
$page = Page::find($id);
$page2update = $page->where('image', $path);
$page2update->image = 'IMGVALUE';
$page2update->save();
Use the ALTER DATABASE
and ALTER TABLE
commands.
ALTER DATABASE databasename CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Or if you're still on MySQL 5.5.2 or older which didn't support 4-byte UTF-8, use utf8
instead of utf8mb4
:
ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Err, what about just calling Directory.Delete(path, true);
?
why, how and which parameters are passed to Asynctask<>, see detail here. I think it is the best explanation.
Google's Android Documentation Says that :
An asynchronous task is defined by 3 generic types, called Params, Progress and Result, and 4 steps, called onPreExecute, doInBackground, onProgressUpdate and onPostExecute.
AsyncTask's generic types :
The three types used by an asynchronous task are the following:
Params, the type of the parameters sent to the task upon execution. Progress, the type of the progress units published during the background computation. Result, the type of the result of the background computation. Not all types are always used by an asynchronous task. To mark a type as unused, simply use the type Void:
private class MyTask extends AsyncTask<Void, Void, Void> { ... }
You Can further refer : http://developer.android.com/reference/android/os/AsyncTask.html
Or You Can clear whats the role of AsyncTask by refering Sankar-Ganesh's Blog
Well The structure of a typical AsyncTask class goes like :
private class MyTask extends AsyncTask<X, Y, Z>
protected void onPreExecute(){
}
This method is executed before starting the new Thread. There is no input/output values, so just initialize variables or whatever you think you need to do.
protected Z doInBackground(X...x){
}
The most important method in the AsyncTask class. You have to place here all the stuff you want to do in the background, in a different thread from the main one. Here we have as an input value an array of objects from the type “X” (Do you see in the header? We have “...extends AsyncTask” These are the TYPES of the input parameters) and returns an object from the type “Z”.
protected void onProgressUpdate(Y y){
} This method is called using the method publishProgress(y) and it is usually used when you want to show any progress or information in the main screen, like a progress bar showing the progress of the operation you are doing in the background.
protected void onPostExecute(Z z){
} This method is called after the operation in the background is done. As an input parameter you will receive the output parameter of the doInBackground method.
What about the X, Y and Z types?
As you can deduce from the above structure:
X – The type of the input variables value you want to set to the background process. This can be an array of objects.
Y – The type of the objects you are going to enter in the onProgressUpdate method.
Z – The type of the result from the operations you have done in the background process.
How do we call this task from an outside class? Just with the following two lines:
MyTask myTask = new MyTask();
myTask.execute(x);
Where x is the input parameter of the type X.
Once we have our task running, we can find out its status from “outside”. Using the “getStatus()” method.
myTask.getStatus(); and we can receive the following status:
RUNNING - Indicates that the task is running.
PENDING - Indicates that the task has not been executed yet.
FINISHED - Indicates that onPostExecute(Z) has finished.
Hints about using AsyncTask
Do not call the methods onPreExecute, doInBackground and onPostExecute manually. This is automatically done by the system.
You cannot call an AsyncTask inside another AsyncTask or Thread. The call of the method execute must be done in the UI Thread.
The method onPostExecute is executed in the UI Thread (here you can call another AsyncTask!).
The input parameters of the task can be an Object array, this way you can put whatever objects and types you want.
//In module.js add below code
export function multiply() {
return 2 * 3;
}
// Consume the module in calc.js
import { multiply } from './modules.js';
const result = multiply();
console.log(`Result: ${result}`);
// Module.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Module</title>
</head>
<body>
<script type="module" src="./calc.js"></script>
</body>
</html>
Its a design pattern same code can be found below, please use a live server to test it else you will get CORS error
https://github.com/rohan12patil/JSDesignPatterns/tree/master/Structural%20Patterns/module
get current activity from parent, then using this code
getActivity().getSupportFragmentManager()
For this type of thing you should use Google Fusion Tables. The API is designed for that purpose.
Apache is an HTTP web server which serve as HTTP.
Apache Tomcat is a java servlet container. It features same as web server but is customized to execute java servlet and JSP pages.
There's no good substitute to testing on an actual device.
Real devices have higher display densities, meaning that pixels are smaller. If you don't test on a real device, you may not realise that your design includes text that is too small to read or buttons that are too small to tap.
You use real devices with your fingers, not a mouse. This means that the accuracy of your taps is much lower and what you are tapping is obscured by your finger. If you don't test on a real device, you may not realise you've introduced usability problems into your design.
New Features in C99
I received this error when I tried to launch app from Xcode as I figured I had selected distribution profile only. Build was successful so I created .ipa file. I used testflightapp.com to run the app. You can use iTunes as well.
Modern browser's now handle this for you. Chrome, IE9, and Firefox support the offsetX/Y like this, passing in the event from the click handler.
function getRelativeCoords(event) {
return { x: event.offsetX, y: event.offsetY };
}
Most modern browsers also support layerX/Y, however Chrome and IE use layerX/Y for the absolute offset of the click on the page including margin, padding, etc. In Firefox, layerX/Y and offsetX/Y are equivalent, but offset didn't previously exist. So, for compatibility with slightly older browsers, you can use:
function getRelativeCoords(event) {
return { x: event.offsetX || event.layerX, y: event.offsetY || event.layerY };
}
The default submit Action is Ext.form.action.Submit, which uses an Ajax request to submit the form's values to a configured URL. To enable normal browser submission of an Ext form, use the standardSubmit config option.
Link: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.Basic-cfg-standardSubmit
solution: put standardSubmit :true in your config. Hope that this will help you :)
This is an older question, but there is actually an answer to this in the PowerShell documentation. I had the same problem, and for once RTFM actually solved it. Almost.
Documentation for the -File parameter states that "In rare cases, you might need to provide a Boolean value for a switch parameter. To provide a Boolean value for a switch parameter in the value of the File parameter, enclose the parameter name and value in curly braces, such as the following: -File .\Get-Script.ps1 {-All:$False}"
I had to write it like this:
PowerShell.Exe -File MyFile.ps1 {-SomeBoolParameter:False}
So no '$' before the true/false statement, and that worked for me, on PowerShell 4.0
Not pretty, but here is a way to implement an exit()
command in R which works for me.
exit <- function() {
.Internal(.invokeRestart(list(NULL, NULL), NULL))
}
print("this is the last message")
exit()
print("you should not see this")
Only lightly tested, but when I run this, I see this is the last message
and then the script aborts without any error message.
My complex solution (or tutorial) for rss-feed (get in RSSItems) works only on device:
#define CACHE_DIR [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject]
for (RSSItem *item in _dataSource) {
url = [NSURL URLWithString:[item link]];
request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"GET"];
[NSURLConnection sendAsynchronousRequest:request
queue:queue
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
@autoreleasepool {
if (!error) {
NSString *html = [[NSString alloc] initWithData:data
encoding:NSWindowsCP1251StringEncoding];
{
NSError *error = nil;
HTMLParser *parser = [[HTMLParser alloc] initWithString:html error:&error];
if (error) {
NSLog(@"Error: %@", error);
return;
}
HTMLNode *bodyNode = [parser body];
NSArray *spanNodes = [bodyNode findChildTags:@"div"];
for (HTMLNode *spanNode in spanNodes) {
if ([[spanNode getAttributeNamed:@"class"] isEqualToString:@"page"]) {
NSString *absStr = [[response URL] absoluteString];
for (RSSItem *anItem in _dataSource)
if ([absStr isEqualToString:[anItem link]]){
NSArray *spanNodes = [bodyNode findChildTags:@"img"];
for (HTMLNode *spanNode in spanNodes){
NSString *imgUrl = [spanNode getAttributeNamed:@"src"];
if (imgUrl){
[anItem setImage:imgUrl];
break;
}
}
[anItem setHtml:[spanNode rawContents]];
[self subProcessRSSItem:anItem];
}
}
}
[parser release];
}
if (error) {
NSLog(@"Error: %@", error);
return;
}
[[NSNotificationCenter defaultCenter] postNotificationName:notification_updateDatasource
object:self
userInfo:nil];
}else
NSLog(@"Error",[error userInfo]);
}
}];
and
- (void)subProcessRSSItem:(RSSItem*)item{
NSString *html = [item html];
if (html) {
html = [html stringByReplacingOccurrencesOfString:@"<div class=\"clear\"></div>"
withString:@""];
html = [html stringByReplacingOccurrencesOfString:@"<p class=\"link\">"
withString:@""];
html = [html stringByReplacingOccurrencesOfString:@"<div class=\"page\">"
withString:@""];
html = [html stringByReplacingOccurrencesOfString:@"</div>"
withString:@""];
NSArray *array1 = [html componentsSeparatedByString:@"<a"];
if ([array1 count]==2) {
NSArray *array2 = [html componentsSeparatedByString:@"a>"];
html = [[array1 objectAtIndex:0] stringByAppendingString:[array2 objectAtIndex:1]];
}
NSURL *url;
NSString *fileName;
NSString *filePath;
BOOL success;
if ([item image]) {
url = [NSURL URLWithString:
[hostString stringByAppendingString:[item image]]];
NSData *imageData = [NSData dataWithContentsOfURL:url];
fileName = [[[url relativePath] componentsSeparatedByString:@"/"] lastObject];
filePath = [NSString stringWithFormat:@"%@/%@",
CACHE_DIR,
fileName];
//save image locally
success = [[NSFileManager defaultManager] createFileAtPath:filePath
contents:imageData
attributes:nil];
//replace links
html = [html stringByReplacingOccurrencesOfString:[item image]
withString:filePath];
[item setImage:fileName];
//????????? ?????????? ??????????, ??????? ???????? ??????????? ??????
[[NSNotificationCenter defaultCenter] postNotificationName:notification_updateRow
object:self
userInfo:[NSDictionary dictionaryWithObject:@([_dataSource indexOfObject:item])
forKey:@"row"]];
}
//finalize html
html = [NSString stringWithFormat:@"<html><body>%@</body></html>",html];
fileName = [[[item link] componentsSeparatedByString:@"/"] lastObject];
filePath = [NSString stringWithFormat:@"%@/%@",
CACHE_DIR,
fileName];
success = [[NSFileManager defaultManager] createFileAtPath:filePath
contents:[html dataUsingEncoding:NSUTF8StringEncoding]
attributes:nil];
[item setHtml:
(success)?filePath:nil];//for direct download in other case
}
}
on View controller
- (void)viewDidAppear:(BOOL)animated{
RSSItem *item = [[DataSingleton sharedSingleton] selectedRSSItem];
NSString* htmlString = [NSString stringWithContentsOfFile:[item html]
encoding:NSUTF8StringEncoding error:nil];
NSURL *baseURL = [NSURL URLWithString:CACHE_DIR];
[_webView loadHTMLString:htmlString
baseURL:baseURL];
}
rss item class
#import <Foundation/Foundation.h>
@interface RSSItem : NSObject
@property(nonatomic,retain) NSString *title;
@property(nonatomic,retain) NSString *link;
@property(nonatomic,retain) NSString *guid;
@property(nonatomic,retain) NSString *category;
@property(nonatomic,retain) NSString *description;
@property(nonatomic,retain) NSString *pubDate;
@property(nonatomic,retain) NSString *html;
@property(nonatomic,retain) NSString *image;
@end
part of any html with image
<html><body>
<h2>blah-blahTC One Tab 7</h2>
<p>blah-blah ??? One.</p>
<p><img width="600" height="412" alt="" src="/Users/wins/Library/Application Support/iPhone Simulator/5.0/Applications/2EAD8889-6482-48D4-80A7-9CCFD567123B/Library/Caches/htc-one-tab-7-concept-1(1).jpg"><br><br>
blah-blah (Hasan Kaymak) blah-blah HTC One Tab 7, blah-blah HTC One. <br><br>
blah-blah
microSD.<br><br>
blah-blah Wi-Fi to 4G LTE.</p>
</p>
</body></html>
image saved for name htc-one-tab-7-concept-1(1).jpg
I don´t remember the source of this answer (I guess I found it in a .ppt in the internet), but the answer is quite simple.
A Library and a Framework are a set of classes, modules and/or code (depending of the programing language) that can be used in your applications and helps you to solve an especific "problem".
That problem can be log or debuging info in an application, draw charts, create an specific file format (html, pdf, xls), connect to a data base, create a part of an application or a complete application or a code applied to a Design Pattern.
You can have a Framework or a Library to solve all these problems and many more, normaly the frameworks helps you to solve more complex or bigger problems, but that a consecuence of their main difference, not a main definition for both.
The main difference betwen a Library and a Framework is the dependency betwen their own code, in oder words to use a Framework you need to use almost all the classes, modules or code in the FW, but to use a Library you can use one or few classes, modules or code in the lib in your own application
This means that if a Framework has, for example has 50 classes in order to use the framework in an app you need to use, let said, 10-15 or more classes in your code, because that is how is designed a Framework, some classes (objects of that classes) are inputs/parameters for methods in other classes in the framework. See the .NET framework, Spring, or any MVC framework.
But for example a log library, you can just use a Log class in your code, and helps you to solve the "logging problem", that doesn´t mean that the log library doesn't have more classes in his code, like classes to handle files, handle screen outputs, or even data bases, but you never touch/use that classes in your code, and that is the reason of why is a library and not a framework.
And also there are more categories than Frameworks and Libraries, but that is off topic.
You can use the stacking index of the div to make it appear on top of anything else. Make it a larger value that other elements and it well be on top of others.
use z-index
property. See Specifying the stack level: the 'z-index' property and
Elaborate description of Stacking Contexts
Something like
#divOnTop { z-index: 1000; }
<div id="divOnTop">I am on top</div>
What you have to look out for will be IE6. In IE 6 some elements like <select>
will be placed on top of an element with z-index value higher than the <select>
. You can have a workaround for this by placing an <iframe>
behind the div.
See this Internet Explorer z-index bug?
Sort the array just as before, but print the elements out in reverse order, using a loop that counts down rather than counting up.
Also, move the sort out of the loop - you are currently sorting the array over and over again when you only need to sort it once.
Arrays.sort(arr);
for(int i = 0; i < arr.length; i++){
//Arrays.sort(arr); // not here
System.out.print( " " +arr[i]);
}
for(int i = arr.length-1; i >= 0; i--){
//Arrays.sort(arr); // not here
System.out.print( " " +arr[i]);
}
NOTICE: This is never a recommended use of git. This will overwrite changes on the remote. Only do this if you know 100% that your local changes should be pushed to the remote master.
Try this: git push -f origin master
In your test code your are trying to pass App
to the spyOn function, but spyOn will only work with objects, not classes. Generally you need to use one of two approaches here:
1) Where the click handler calls a function passed as a prop, e.g.
class App extends Component {
myClickFunc = () => {
console.log('clickity clickcty');
this.props.someCallback();
}
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro" onClick={this.myClickFunc}>
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
You can now pass in a spy function as a prop to the component, and assert that it is called:
describe('my sweet test', () => {
it('clicks it', () => {
const spy = jest.fn();
const app = shallow(<App someCallback={spy} />)
const p = app.find('.App-intro')
p.simulate('click')
expect(spy).toHaveBeenCalled()
})
})
2) Where the click handler sets some state on the component, e.g.
class App extends Component {
state = {
aProperty: 'first'
}
myClickFunc = () => {
console.log('clickity clickcty');
this.setState({
aProperty: 'second'
});
}
render() {
return (
<div className="App">
<div className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h2>Welcome to React</h2>
</div>
<p className="App-intro" onClick={this.myClickFunc}>
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
You can now make assertions about the state of the component, i.e.
describe('my sweet test', () => {
it('clicks it', () => {
const app = shallow(<App />)
const p = app.find('.App-intro')
p.simulate('click')
expect(app.state('aProperty')).toEqual('second');
})
})
I use jupyter notebooks daily and had never experienced this issue before... until today. I had the notebook open all day but it wasn't running anything and then for no apparent reason stopped auto-saving with the '_xsrf' argument missing from POST
error message in the top right. FYI - this is a python3 notebook.
I don't know the cause of this problem but I have recently upgraded my python3 version to 3.7.2 and upgraded all of my site-packages to their latest version as of a few days ago which could possibly be the cause.
As for a solution, as suggested in the comment by @AlexK, I opened the same notebook in a new window (different browser in fact), using
jupyter notebook list
in the terminal to get the URL with login token.
This resulted in me having the notebook open and savable again but the information I had entered since the last successful auto-save was missing. Thankfully, my broken instance was still open and working apart from saving so I was able to simply copy and paste the information across then hit save. So, keep the broken instance open if you try this!
I'm not sure I quite understand the question but if you want to search objects on the database for a particular search string try:
SELECT owner, name, type, line, text
FROM dba_source
WHERE instr(UPPER(text), UPPER(:srch_str)) > 0;
From there if you need any more info you can just look up the object / line number.
Not free, but ReSharper is definitely one recommendation.
I tried this registry change with no success (though many others have said it works) http://codearetoy.wordpress.com/2010/12/23/jdk-not-found-on-installing-android-sdk/
I download the .zip version and used SDK Manager.exe in the end.
in exemple if you want to compile sources but have objects in an different directory :
You need to do :
gcc -c -o <obj/1.o> <srcs/1.c> <obj/2.o> <srcs/2.c> ...
but with most of macros the result will be all objects followed by all sources, like :
gcc -c -o <all OBJ path> <all SRC path>
so this will not compile anything ^^ and you will not be able to put your objects files in a different dir :(
the solution is to use these special macros
$@ $<
this will generate a .o file (obj/file.o) for each .c file in SRC (src/file.c)
$(OBJ):$(SRC)
gcc -c -o $@ $< $(HEADERS) $(FLAGS)
it means :
$@ = $(OBJ)
$< = $(SRC)
but lines by lines INSTEAD of all lines of OBJ followed by all lines of SRC
You can remove the duplicated values and keep the list order of insertion with one line of code, Python 3.8.2
mylist = ['b', 'b', 'a', 'd', 'd', 'c'] results = list({value:"" for value in mylist}) print(results) >>> ['b', 'a', 'd', 'c'] results = list(dict.fromkeys(mylist)) print(results) >>> ['b', 'a', 'd', 'c']
ffmpeg -codecs
should give you all the info about the codecs available.
You will see some letters next to the codecs:
Codecs:
D..... = Decoding supported
.E.... = Encoding supported
..V... = Video codec
..A... = Audio codec
..S... = Subtitle codec
...I.. = Intra frame-only codec
....L. = Lossy compression
.....S = Lossless compression
~Controller
namespace ListBindingTest.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
List<String> tmp = new List<String>();
tmp.Add("one");
tmp.Add("two");
tmp.Add("Three");
return View(tmp);
}
[HttpPost]
public ActionResult Send(IList<String> input)
{
return View(input);
}
}
}
~ Strongly Typed Index View
@model IList<String>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<div>
@using(Html.BeginForm("Send", "Home", "POST"))
{
@Html.EditorFor(x => x)
<br />
<input type="submit" value="Send" />
}
</div>
</body>
</html>
~ Strongly Typed Send View
@model IList<String>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Send</title>
</head>
<body>
<div>
@foreach(var element in @Model)
{
@element
<br />
}
</div>
</body>
</html>
This is all that you had to do man, change his MyViewModel model to IList.
In Kotlin with %100 score Detected time complexity: O(N) or O(N * log(N))
fun solution(A: IntArray): Int {
var min = 1
val b = A.sortedArray()
for (i in 0 until b.size) {
if (b[i] == min) {
min++
}
}
return min
}
This can occur on android too not just computers. Was browsing using Kiwi when the site I was on began to endlessly redirect so I cut net access to close it out and noticed my phone had DL'd something f.txt
in my downloaded files.
Deleted it and didn't open.
I prefer to use ToString()
and IFormatProvider
.
double value = 100000.3
Console.WriteLine(value.ToString("0,0.00", new CultureInfo("en-US", false)));
Output: 10,000.30
You can also do it from command line much easily.
From command line run:
javadoc YourClassName.java
To batch generate docs for multiple Class:
javadoc *.java
You can create an item in your custom SharePoint list doing something like this:
using (SPSite site = new SPSite("http://sharepoint"))
{
using (SPWeb web = site.RootWeb)
{
SPList list = web.Lists["My List"];
SPListItem listItem = list.AddItem();
listItem["Title"] = "The Title";
listItem["CustomColumn"] = "I am custom";
listItem.Update();
}
}
Using list.AddItem() should save the lists items being enumerated.
Without VBA macro, you can use this tips to get the username from the path :
=MID(INFO("DIRECTORY"),10,LEN(INFO("DIRECTORY"))-LEN(MID(INFO("DIRECTORY"),FIND("\",INFO("DIRECTORY"),10),1000))-LEN("C:\Users\"))
Here is what I would do.
Also I would use a template function to make the construction of select2nd easier.
#include <map>
#include <vector>
#include <algorithm>
#include <memory>
#include <string>
/*
* A class to extract the second part of a pair
*/
template<typename T>
struct select2nd
{
typename T::second_type operator()(T const& value) const
{return value.second;}
};
/*
* A utility template function to make the use of select2nd easy.
* Pass a map and it automatically creates a select2nd that utilizes the
* value type. This works nicely as the template functions can deduce the
* template parameters based on the function parameters.
*/
template<typename T>
select2nd<typename T::value_type> make_select2nd(T const& m)
{
return select2nd<typename T::value_type>();
}
int main()
{
std::map<int,std::string> m;
std::vector<std::string> v;
/*
* Please note: You must use std::back_inserter()
* As transform assumes the second range is as large as the first.
* Alternatively you could pre-populate the vector.
*
* Use make_select2nd() to make the function look nice.
* Alternatively you could use:
* select2nd<std::map<int,std::string>::value_type>()
*/
std::transform(m.begin(),m.end(),
std::back_inserter(v),
make_select2nd(m)
);
}
I accidentally named the js file .min
instead of .min.js
...
According to the MSDN documentation here, The basename argument specifies "The root name of the resource file without its extension but including any fully qualified namespace name. For example, the root name for the resource file named "MyApplication.MyResource.en-US.resources" is "MyApplication.MyResource"."
The ResourceManager will automatically try to retrieve the values for the current UI culture. If you want to use a specific language, you'll need to set the current UI culture to the language you wish to use.
The mouse's position is reported on the event
object received by a handler for the mousemove
event, which you can attach to the window (the event bubbles):
(function() {
document.onmousemove = handleMouseMove;
function handleMouseMove(event) {
var eventDoc, doc, body;
event = event || window.event; // IE-ism
// If pageX/Y aren't available and clientX/Y are,
// calculate pageX/Y - logic taken from jQuery.
// (This is to support old IE)
if (event.pageX == null && event.clientX != null) {
eventDoc = (event.target && event.target.ownerDocument) || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = event.clientX +
(doc && doc.scrollLeft || body && body.scrollLeft || 0) -
(doc && doc.clientLeft || body && body.clientLeft || 0);
event.pageY = event.clientY +
(doc && doc.scrollTop || body && body.scrollTop || 0) -
(doc && doc.clientTop || body && body.clientTop || 0 );
}
// Use event.pageX / event.pageY here
}
})();
(Note that the body of that if
will only run on old IE.)
Example of the above in action - it draws dots as you drag your mouse over the page. (Tested on IE8, IE11, Firefox 30, Chrome 38.)
If you really need a timer-based solution, you combine this with some state variables:
(function() {
var mousePos;
document.onmousemove = handleMouseMove;
setInterval(getMousePosition, 100); // setInterval repeats every X ms
function handleMouseMove(event) {
var dot, eventDoc, doc, body, pageX, pageY;
event = event || window.event; // IE-ism
// If pageX/Y aren't available and clientX/Y are,
// calculate pageX/Y - logic taken from jQuery.
// (This is to support old IE)
if (event.pageX == null && event.clientX != null) {
eventDoc = (event.target && event.target.ownerDocument) || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = event.clientX +
(doc && doc.scrollLeft || body && body.scrollLeft || 0) -
(doc && doc.clientLeft || body && body.clientLeft || 0);
event.pageY = event.clientY +
(doc && doc.scrollTop || body && body.scrollTop || 0) -
(doc && doc.clientTop || body && body.clientTop || 0 );
}
mousePos = {
x: event.pageX,
y: event.pageY
};
}
function getMousePosition() {
var pos = mousePos;
if (!pos) {
// We haven't seen any movement yet
}
else {
// Use pos.x and pos.y
}
}
})();
As far as I'm aware, you can't get the mouse position without having seen an event, something which this answer to another Stack Overflow question seems to confirm.
Side note: If you're going to do something every 100ms (10 times/second), try to keep the actual processing you do in that function very, very limited. That's a lot of work for the browser, particularly older Microsoft ones. Yes, on modern computers it doesn't seem like much, but there is a lot going on in browsers... So for example, you might keep track of the last position you processed and bail from the handler immediately if the position hasn't changed.
public class XMLParser {
public static void main(String[] args){
try {
DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = dBuilder.parse(new File("xml input"));
NodeList nl=doc.getDocumentElement().getChildNodes();
for(int k=0;k<nl.getLength();k++){
printTags((Node)nl.item(k));
}
} catch (Exception e) {/*err handling*/}
}
public static void printTags(Node nodes){
if(nodes.hasChildNodes() || nodes.getNodeType()!=3){
System.out.println(nodes.getNodeName()+" : "+nodes.getTextContent());
NodeList nl=nodes.getChildNodes();
for(int j=0;j<nl.getLength();j++)printTags(nl.item(j));
}
}
}
Recursively loop through and print out all the xml child tags in the document, in case you don't have to change the code to handle dynamic changes in xml, provided it's a well formed xml.
I don't use Gradle in anger myself (just a toy project so far) [author means they have used Gradle on only a toy project so far, not that Gradle is a toy project - see comments], but I'd say that the reasons one would consider using it would be because of the frustrations of Ant and Maven.
In my experience Ant is often write-only (yes I know it is possible to write beautifully modular, elegant builds, but the fact is most people don't). For any non-trivial projects it becomes mind-bending, and takes great care to ensure that complex builds are truly portable. Its imperative nature can lead to replication of configuration between builds (though macros can help here).
Maven takes the opposite approach and expects you to completely integrate with the Maven lifecycle. Experienced Ant users find this particularly jarring as Maven removes many of the freedoms you have in Ant. For example there's a Sonatype blog that enumerates many of the Maven criticisms and their responses.
The Maven plugin mechanism allows for very powerful build configurations, and the inheritance model means you can define a small set of parent POMs encapsulating your build configurations for the whole enterprise and individual projects can inherit those configurations, leaving them lightweight. Maven configuration is very verbose (though Maven 3 promises to address this), and if you want to do anything that is "not the Maven way" you have to write a plugin or use the hacky Ant integration. Note I happen to like writing Maven plugins but appreciate that many will object to the effort involved.
Gradle promises to hit the sweet spot between Ant and Maven. It uses Ivy's approach for dependency resolution. It allows for convention over configuration but also includes Ant tasks as first class citizens. It also wisely allows you to use existing Maven/Ivy repositories.
So if you've hit and got stuck with any of the Ant/Maven pain points, it is probably worth trying Gradle out, though in my opinion it remains to be seen if you wouldn't just be trading known problems for unknown ones. The proof of the pudding is in the eating though so I would reserve judgment until the product is a little more mature and others have ironed out any kinks (they call it bleeding edge for a reason). I'll still be using it in my toy projects though, It's always good to be aware of the options.
We just released pako https://github.com/nodeca/pako , port of zlib to javascript. I think that's now the fastest js implementation of deflate / inflate / gzip / ungzip. Also, it has democratic MIT licence. Pako supports all zlib options and it's results are binary equal.
Example:
var inflate = require('pako/lib/inflate').inflate;
var text = inflate(zipped, {to: 'string'});
I suggest you use null to represent a null value.
What is the exception you get?
BTW:
There is no year called 0 or 0000. (Though some dates allow this year)
And there is no 0 month of the year or 0 day of the month. (Which may be the cause of your problem)
You can also enter a very large number, and then press dd
if you wish to delete all the lines below the cursor.
When using a glob pattern, a question mark represents a single character and an asterisk represents a sequence of zero or more characters:
if [[ $gg == ????grid* ]] ; then echo $gg; fi
When using a regular expression, a dot represents a single character and an asterisk represents zero or more of the preceding character. So ".*
" represents zero or more of any character, "a*
" represents zero or more "a", "[0-9]*
" represents zero or more digits. Another useful one (among many) is the plus sign which represents one or more of the preceding character. So "[a-z]+
" represents one or more lowercase alpha character (in the C locale - and some others).
if [[ $gg =~ ^....grid.*$ ]] ; then echo $gg; fi
This is an update to this rather old question. I wanted to use the new SF Pro fonts on a website and found no fonts CDN, besides the above noted (applesocial.s3.amazonaws.com).
Clearly, this isn't an official content repository approved by Apple. Actually, I did not find ANY official fonts repository serving Apple fonts, ready to be used by web developers.
And there's a reason - if you read the license agreement that comes with downloading the new SF Pro and other fonts from https://developer.apple.com/fonts/ - it states in the first few paragraphs very clearly:
[...]you may use the Apple Font solely for creating mock-ups of user interfaces to be used in software products running on Apple’s iOS, macOS or tvOS operating systems, as applicable. The foregoing right includes the right to show the Apple Font in screen shots, images, mock-ups or other depictions, digital and/or print, of such software products running solely on iOS, macOS or tvOS.[...]
And:
Except as expressly provided for herein, you may not use the Apple Font to, create, develop, display or otherwise distribute any documentation, artwork, website content or any other work product.
Further:
Except as otherwise expressly permitted [...] (i) only one user may use the Apple Font at a time, and (ii) you may not make the Apple Font available over a network where it could be run or used by multiple computers at the same time.
No more questions for me. Apple clearly does not want their Fonts shared across the web outside their products.
The use of -X [WHATEVER]
merely changes the request's method string used in the HTTP request. This is easier to understand with two examples — one with -X [WHATEVER]
and one without — and the associated HTTP request headers for each:
# curl -XPANTS -o nul -v http://neverssl.com/
* Connected to neverssl.com (13.224.86.126) port 80 (#0)
> PANTS / HTTP/1.1
> Host: neverssl.com
> User-Agent: curl/7.42.0
> Accept: */*
# curl -o nul -v http://neverssl.com/
* Connected to neverssl.com (13.33.50.167) port 80 (#0)
> GET / HTTP/1.1
> Host: neverssl.com
> User-Agent: curl/7.42.0
> Accept: */*
If I'm reading your question right, you want to run a script in the post build actions part of the build.
I myself use PostBuildScript Plugin for running git clean -fxd
after the build has archived artifacts and published test results. My Jenkins slaves have SSD disks, so I do not have the room keep generated files in the workspace.
I got this to finally work in a semi-automatic fashion without the use of scripts... but it does take up 3 cells to pull it off. Borrowing from a bit from previous answers, I start with a cell that has nothing more than =NOW() it in to show the time. For example, we'll put this into cell A1...
=NOW()
This function updates automatically every minute. In the next cell, put a pointer formula using the sheets own name to point to the previous cell. For example, we'll put this in A2...
='Sheet Name'!A1
Cell formatting aside, cell A1 and A2 should at this point display the same content... namely the current time.
And, the last cell is the part I'm borrowing from previous solutions using a regex expression to pull the fomula from the second cell and then strip out the name of the sheet from said formula. For example, we'll put this into cell A3...
=REGEXREPLACE(FORMULATEXT(A2),"='?([^']+)'?!.*","$1")
At this point, the resultant value displayed in A3 should be the name of the sheet.
From my experience, as soon as the name of the sheet is changed, the formula in A2 is immediately updated. However that's not enough to trigger A3 to update. But, every minute when cell A1 recalculates the time, the result of the formula in cell A2 is subsequently updated and then that in turn triggers A3 to update with the new sheet name. It's not a compact solution... but it does seem to work.
In JavaScript you can use template literals:
let value = 100;
console.log(`The size is ${ value }`);
I had to use the **/* syntax to exclude the files in a folder:
"linterOptions": {
"exclude": [
"src/auto-generated/**/*",
"src/app/auto-generated/**/*"
]
},
you can go:
var cp = require('child_process');
and then:
cp.exec('./myScript.sh', function(err, stdout, stderr) {
// handle err, stdout, stderr
});
to run a command in your $SHELL.
Or go
cp.spawn('./myScript.sh', [args], function(err, stdout, stderr) {
// handle err, stdout, stderr
});
to run a file WITHOUT a shell.
Or go
cp.execFile();
which is the same as cp.exec() but doesn't look in the $PATH.
You can also go
cp.fork('myJS.js', function(err, stdout, stderr) {
// handle err, stdout, stderr
});
to run a javascript file with node.js, but in a child process (for big programs).
You might also have to access stdin and stdout with event listeners. e.g.:
var child = cp.spawn('./myScript.sh', [args]);
child.stdout.on('data', function(data) {
// handle stdout as `data`
});
EDIT: Cactus is now a dead project: http://attic.apache.org/projects/jakarta-cactus.html
You may want to look at cactus.
http://jakarta.apache.org/cactus/
Project Description
Cactus is a simple test framework for unit testing server-side java code (Servlets, EJBs, Tag Libs, Filters, ...).
The intent of Cactus is to lower the cost of writing tests for server-side code. It uses JUnit and extends it.
Cactus implements an in-container strategy, meaning that tests are executed inside the container.
You don't have to use dynamic SQL
update
R
set
Assoc_Item_1 = CASE WHEN @curr_row = 1 THEN foo.relsku ELSE Assoc_Item_1 END,
Assoc_Item_2 = CASE WHEN @curr_row = 2 THEN foo.relsku ELSE Assoc_Item_2 END,
Assoc_Item_3 = CASE WHEN @curr_row = 3 THEN foo.relsku ELSE Assoc_Item_3 END,
Assoc_Item_4 = CASE WHEN @curr_row = 4 THEN foo.relsku ELSE Assoc_Item_4 END,
Assoc_Item_5 = CASE WHEN @curr_row = 5 THEN foo.relsku ELSE Assoc_Item_5 END,
...
from
(Select relsku From @TSku Where tid = @curr_row1) foo
CROSS JOIN
@RelPro R
Where
R.RowID = @curr_row;
It depends on the tablix structure you are using. In a table, for example, you do not have column groups, so Reporting Services does not recognize which textboxes are the column headers and setting RepeatColumnHeaders property to True doesn't work.
Instead, you need to:
RepeatOnNewPage
property to True.
KeepWithGroup
property is set to After
.The KeepWithGroup
property specifies which group to which the static member needs to stick. If set to After
then the static member sticks with the group after it, or below it, acting as a group header. If set to Before
, then the static member sticks with the group before, or above it, acting as a group footer. If set to None
, Reporting Services decides where to put the static member.
Now when you view the report, the column headers repeat on each page of the tablix.
This video shows how to set it exactly as the answer described.
answer 1
answer 2
simply press Alt+F5 after updating your pom.xml. This will build your project again and download all jar files
There is a great solution for this problem ,You can use the Merge Keyword of Sql
Merge MyTargetTable hba
USING (SELECT Id = 8, Name = 'Product Listing Message') temp
ON temp.Id = hba.Id
WHEN NOT matched THEN
INSERT (Id, Name) VALUES (temp.Id, temp.Name);
You can check this before following, below is the sample
IF OBJECT_ID ('dbo.TargetTable') IS NOT NULL
DROP TABLE dbo.TargetTable
GO
CREATE TABLE dbo.TargetTable
(
Id INT NOT NULL,
Name VARCHAR (255) NOT NULL,
CONSTRAINT PK_TargetTable PRIMARY KEY (Id)
)
GO
INSERT INTO dbo.TargetTable (Name)
VALUES ('Unknown')
GO
INSERT INTO dbo.TargetTable (Name)
VALUES ('Mapping')
GO
INSERT INTO dbo.TargetTable (Name)
VALUES ('Update')
GO
INSERT INTO dbo.TargetTable (Name)
VALUES ('Message')
GO
INSERT INTO dbo.TargetTable (Name)
VALUES ('Switch')
GO
INSERT INTO dbo.TargetTable (Name)
VALUES ('Unmatched')
GO
INSERT INTO dbo.TargetTable (Name)
VALUES ('ProductMessage')
GO
Merge MyTargetTable hba
USING (SELECT Id = 8, Name = 'Listing Message') temp
ON temp.Id = hba.Id
WHEN NOT matched THEN
INSERT (Id, Name) VALUES (temp.Id, temp.Name);
The previous answers are now deprecated, you need to use ContextCompat.getColor
to retrieve the color properly:
root.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.white));
Another solution, since April 2015 is Git Large File Storage (LFS) (by GitHub).
It uses git-lfs (see git-lfs.github.com) and tested with a server supporting it: lfs-test-server:
You can store metadata only in the git repo, and the large file elsewhere.
source URL for image can be a URL on a website like http://www.google.co.il/images/srpr/nav_logo73.png or https://https.openbsd.org/images/tshirt-26_front.gif or if you want to use a local file try this: url("file:///MacintoshHDOriginal/Users/lowri/Desktop/acgnx/image s/images/acgn-site-background-X_07.jpg")
You can rewrite it to use the ELSE condition of a CASE
:
SELECT status,
CASE status
WHEN 'i' THEN 'Inactive'
WHEN 't' THEN 'Terminated'
ELSE 'Active'
END AS StatusText
FROM stage.tst
This is an intuitive solution using the viewport command that just sets the minimum height to the viewport height minus the footer height.
html,body{
height: 100%
}
#nonFooter{
min-height: calc(100vh - 30px)
}
#footer {
height:30px;
margin: 0;
clear: both;
width:100%;
}
Try this:
select col1, col2, 'ABC' as col3 from Table1 where col1 = 0;
Shortest way:
echo substr(uniqid(),-6); // result: 5ebf06
dim mydate = from cv in mydata.t1s
select cv.date1 asc
datetime mindata = mydate[0];
Well, I've got no problem here :
df <- data.frame(v=1:5, x=sample(LETTERS[1:5],5))
df
# v x
# 1 1 D
# 2 2 A
# 3 3 B
# 4 4 C
# 5 5 E
df <- df[order(df$x),]
df
# v x
# 2 2 A
# 3 3 B
# 4 4 C
# 1 1 D
# 5 5 E
public static void main(String[] args) {
List<String> strlist = new ArrayList<String>();
strlist.add("sdfs1");
strlist.add("sdfs2");
String[] strarray = new String[strlist.size()]
strlist.toArray(strarray );
System.out.println(strarray);
}
As far as I know, there's a good library called localeplanet
for Localization and Internationalization in JavaScript. Furthermore, I think it's native and has no dependencies to other libraries (e.g. jQuery)
Here's the website of library: http://www.localeplanet.com/
Also look at this article by Mozilla, you can find very good method and algorithms for client-side translation: http://blog.mozilla.org/webdev/2011/10/06/i18njs-internationalize-your-javascript-with-a-little-help-from-json-and-the-server/
The common part of all those articles/libraries is that they use a i18n
class and a get
method (in some ways also defining an smaller function name like _
) for retrieving/converting the key
to the value
. In my explaining the key
means that string you want to translate and the value
means translated string.
Then, you just need a JSON document to store key
's and value
's.
For example:
var _ = document.webL10n.get;
alert(_('test'));
And here the JSON:
{ test: "blah blah" }
I believe using current popular libraries solutions is a good approach.
Due to PermGen removal some options were removed (like -XX:MaxPermSize
), but options -Xms
and -Xmx
work in Java 8. It's possible that under Java 8 your application simply needs somewhat more memory. Try to increase -Xmx
value. Alternatively you can try to switch to G1 garbage collector using -XX:+UseG1GC
.
Note that if you use any option which was removed in Java 8, you will see a warning upon application start:
$ java -XX:MaxPermSize=128M -version
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
If you simply need to answer "y" to all the overwrite prompts, try this:
y | mv srcdir/* targetdir/
import endOfDayfrom 'date-fns/endOfDay'
import startOfDay from 'date-fns/startOfDay'
MyModel.find({
createdAt: {
$gte: startOfDay(new Date()),
$lte: endOfDay(new Date())
}
})
const moment = require('moment')
const today = moment().startOf('day')
MyModel.find({
createdAt: {
$gte: today.toDate(),
$lte: moment(today).endOf('day').toDate()
}
})
Important: all moments are mutable!
tomorrow = today.add(1, 'days')
does not work since it also mutates today
. Calling moment(today)
solves that problem by implicitly cloning today
.
For myself private repo, i use
[email protected]:username/blog.git
replace
CREATE TABLE t (d1 timestamp, d2 timestamp);
INSERT INTO t VALUES ('2010-03-11 12:00:00', '2010-03-30 05:00:00');
INSERT INTO t VALUES ('2010-03-11 12:00:00', '2010-03-30 13:00:00');
INSERT INTO t VALUES ('2010-03-11 00:00:00', '2010-03-30 13:00:00');
INSERT INTO t VALUES ('2010-03-10 12:00:00', '2010-03-30 13:00:00');
INSERT INTO t VALUES ('2010-03-10 12:00:00', '2010-04-01 13:00:00');
SELECT d2, d1, DATEDIFF(d2, d1) AS diff FROM t;
+---------------------+---------------------+------+
| d2 | d1 | diff |
+---------------------+---------------------+------+
| 2010-03-30 05:00:00 | 2010-03-11 12:00:00 | 19 |
| 2010-03-30 13:00:00 | 2010-03-11 12:00:00 | 19 |
| 2010-03-30 13:00:00 | 2010-03-11 00:00:00 | 19 |
| 2010-03-30 13:00:00 | 2010-03-10 12:00:00 | 20 |
| 2010-04-01 13:00:00 | 2010-03-10 12:00:00 | 22 |
+---------------------+---------------------+------+
5 rows in set (0.00 sec)
This is a two-step process:
you need to create a login to SQL Server for that user, based on its Windows account
CREATE LOGIN [<domainName>\<loginName>] FROM WINDOWS;
you need to grant this login permission to access a database:
USE (your database)
CREATE USER (username) FOR LOGIN (your login name)
Once you have that user in your database, you can give it any rights you want, e.g. you could assign it the db_datareader
database role to read all tables.
USE (your database)
EXEC sp_addrolemember 'db_datareader', '(your user name)'
Decode and save image as PNG
header('content-type: image/png');
ob_start();
$ret = fopen($fullurl, 'r', true, $context);
$contents = stream_get_contents($ret);
$base64 = 'data:image/PNG;base64,' . base64_encode($contents);
echo "<img src=$base64 />" ;
ob_end_flush();
I had also faced the same problem and spent 3 days to dig it out.
This happens because of your wrong TNS service entry.
First check whether you are able to connect to standby database from primary database using sql > sqlplus sys@orastand as sysdba
(orastand
is a standby database).
If you are not able to connect then it is a problem with the service. Correct the entry of service name in TNS file at primary end.
Check standby database the same way. Make the changes here too if required.
Make sure the log_archive_dest_2
parameter has the correct service name.
As @Agent_9191 and @partick mentioned you should use
$('tbody :visible').highlight(myArray[i]); // works for all children of tbody that are visible
or
$('tbody:visible').highlight(myArray[i]); // works for all visible tbodys
Additionally, since you seem to be applying a class to the highlighted words, instead of using jquery to alter the background for all matched highlights, just create a css rule with the background color you need and it gets applied directly once you assign the class.
.highlight { background-color: #FFFF88; }
According to the Go specification:
For an expression x of interface type and a type T, the primary expression x.(T) asserts that x is not nil and that the value stored in x is of type T.
A "type assertion" allows you to declare an interface value contains a certain concrete type or that its concrete type satisfies another interface.
In your example, you were asserting data (type interface{}) has the concrete type string. If you are wrong, the program will panic at runtime. You do not need to worry about efficiency, checking just requires comparing two pointer values.
If you were unsure if it was a string or not, you could test using the two return syntax.
str, ok := data.(string)
If data is not a string, ok will be false. It is then common to wrap such a statement into an if statement like so:
if str, ok := data.(string); ok {
/* act on str */
} else {
/* not string */
}
if you want to check the text of selected option regardless if its the 1st child.
var a = $("#select_id option:selected").text();
alert(a); //check if the value is correct.
if(a == "value") {-- execute code --}
Just in case if a range of characters need to be picked:
# For example, to get the date part from the string
substrRightRange <- function(x, m, n){substr(x, nchar(x)-m+1, nchar(x)-m+n)}
value <- "REGNDATE:20170526RN"
substrRightRange(value, 10, 8)
[1] "20170526"
If you have a large array and only want to see a subsection of the array you can type this into the watch window;
ptr+100,10
to show a list of the 10 elements starting at ptr[100]. Beware that the displayed array subscripts will start at [0], so you will have to remember that ptr[0] is really ptr[100] and ptr[1] is ptr[101] etc.
For PHPUnit 5.7.27 and PHP 5.6 and to test multiple exceptions in one test, it was important to force the exception testing. Using exception handling alone to assert the instance of Exception will skip testing the situation if no exception occurs.
public function testSomeFunction() {
$e=null;
$targetClassObj= new TargetClass();
try {
$targetClassObj->doSomething();
} catch ( \Exception $e ) {
}
$this->assertInstanceOf(\Exception::class,$e);
$this->assertEquals('Some message',$e->getMessage());
$e=null;
try {
$targetClassObj->doSomethingElse();
} catch ( Exception $e ) {
}
$this->assertInstanceOf(\Exception::class,$e);
$this->assertEquals('Another message',$e->getMessage());
}
The Left Hand Side (LHS) operand is the actual object being tested to the Right Hand Side (RHS) operand which is the actual constructor of a class. The basic definition is:
Checks the current object and returns true if the object
is of the specified object type.
Here are some good examples and here is an example taken directly from Mozilla's developer site:
var color1 = new String("green");
color1 instanceof String; // returns true
var color2 = "coral"; //no type specified
color2 instanceof String; // returns false (color2 is not a String object)
One thing worth mentioning is instanceof
evaluates to true if the object inherits from the classe's prototype:
var p = new Person("Jon");
p instanceof Person
That is p instanceof Person
is true since p
inherits from Person.prototype
.
I've added a small example with some sample code and an explanation.
When you declare a variable you give it a specific type.
For instance:
int i;
float f;
Customer c;
The above show you some variables, namely i
, f
, and c
. The types are integer
, float
and a user defined Customer
data type. Types such as the above could be for any language, not just JavaScript. However, with JavaScript when you declare a variable you don't explicitly define a type, var x
, x could be a number / string / a user defined data type. So what instanceof
does is it checks the object to see if it is of the type specified so from above taking the Customer
object we could do:
var c = new Customer();
c instanceof Customer; //Returns true as c is just a customer
c instanceof String; //Returns false as c is not a string, it's a customer silly!
Above we've seen that c
was declared with the type Customer
. We've new'd it and checked whether it is of type Customer
or not. Sure is, it returns true. Then still using the Customer
object we check if it is a String
. Nope, definitely not a String
we newed a Customer
object not a String
object. In this case, it returns false.
It really is that simple!
Check out native HTML5 form validation:
Short answer: When I send files between devices with OBEX I am almost never prompted to pair, so it is certainly possible.
1) An application and the device itself can each be set to need/not-need authentication modes, so often there was no requirement for pairing. For instance most OBEX (OPP) servers don't need any authentication at all so there is not need for pairing/bonding.
Presumably "Wireless Designs"'s answer was covering that case.
2) Then if pairing was required by the device/app:
2.1) Prior to v2.1 for pairing then the two devices needed to have matching passphrase/PINs. So this either needed user involvement (to enter the PINs) or knowledge in the softwareto know the PIN: either defined in the app if pin callback send pin="1234"
, or smarts in the OS like BlueZ and Win7 (see Slide 20 at my Bluetooth in Windows 7 doc) which has logic like: if(remotedevice=headset) then expectedPin ="0000"
. Don't know what Android does
2.2) In v2.1 Secure Simple Pairing (SSP) was added. Which changes pairing to:
if (either is pre-v2.1) then Legacy else if (Out-Of-Band channel) then OutOfBand else if (neither have "Man-in-the-Middle Protection Required") then (i.e. both have "Man-in-the-Middle Protection _Not_ Required") Just-Works else Depending on the two devices' "IO Capabilities", either NumericComparison or Passkey. Passkey is used when one device has KeyboardOnly -- and the peer device _isn't_ NoInputNoOutput. endif
From 32feet.NET's BluetoothWin32Authentication user guide, see also the SSP sections in [1]
So to have pairing be unprompted needs either "JustWorks" or "Out-of-Band" eg your NFC suggestion.
Hope that helps...
Combine JS & CSS :
button{
/* 1st state */
}
button:hover{
/* hover state */
}
button:active{
/* click state */
}
button.active{
/* after click state */
}
jQuery('button').click(function(){
jQuery(this).toggleClass('active');
});
I give the answer because I need to compare 2 files in notepad++ and there is no option available.
So first enable the plugin manager as asked by question here, Then follow this step to compare 2 files which is free in this software.
1.open notepad++, go to
Plugin -> Plugin Manager -> Show Plugin Manager
2.Show the available plugin list, choose Compare and Install
3.Restart Notepad++.
http://www.technicaloverload.com/compare-two-files-using-notepad/
The speed tradeoffs between various settings of -Xms and -Xmx depend on the application and system that you run your Java application on. It also depends on your JVM and other garbage collection parameters you use.
This question is 11 years old, and since then the effects of the JVM parameters on performance have become even harder to predict in advance. So you can try different values and see the effects on performance, or use a free tool like Optimizer Studio that will find the optimal JVM parameter values automatically.
read
does this:
user@host:~$ read -n1 -r -p "Press any key to continue..." key
[...]
user@host:~$
The -n1
specifies that it only waits for a single character. The -r
puts it into raw mode, which is necessary because otherwise, if you press something like backslash, it doesn't register until you hit the next key. The -p
specifies the prompt, which must be quoted if it contains spaces. The key
argument is only necessary if you want to know which key they pressed, in which case you can access it through $key
.
If you are using Bash, you can also specify a timeout with -t
, which causes read to return a failure when a key isn't pressed. So for example:
read -t5 -n1 -r -p 'Press any key in the next five seconds...' key
if [ "$?" -eq "0" ]; then
echo 'A key was pressed.'
else
echo 'No key was pressed.'
fi
myInt.ToString("D4");
import UIKit
class ViewController: UIViewController {
//
let scrollView: UIScrollView = {
let sv = UIScrollView()
sv.translatesAutoresizingMaskIntoConstraints = false
return sv
}()
let lipsumLbl: UILabel = { // you can use here any of your subview
let lbl = UILabel()
lbl.translatesAutoresizingMaskIntoConstraints = false
lbl.text = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eleifend nisi sit amet mi aliquet, ut efficitur risus pellentesque. Phasellus nulla justo, scelerisque ut libero id, aliquet ullamcorper lectus. Integer id iaculis nibh. Duis feugiat mi vitae magna tincidunt, vitae consequat dui tempor. Donec blandit urna nec urna volutpat, sit amet sagittis massa fringilla. Pellentesque luctus erat nec dui luctus, sed maximus urna fermentum. Nullam purus nibh, cursus vel ex nec, pulvinar lobortis leo. Proin ac libero rhoncus, bibendum lorem sed, congue sapien. Donec commodo, est non mollis malesuada, nisi massa tempus ipsum, a varius quam lorem vitae nunc.
Cras scelerisque nisi dolor, in gravida ex ornare a. Interdum et malesuada fames ac ante ipsum primis in faucibus. Maecenas vitae nisl id erat sollicitudin accumsan sit amet viverra sapien. Etiam scelerisque vulputate ante. Donec magna nibh, pharetra sed pretium ac, feugiat sit amet mi. Vestibulum in ipsum vitae dui vehicula pulvinar eget ut lectus. Fusce sagittis a elit ac elementum. Fusce iaculis nunc odio, at fermentum dolor varius et. Suspendisse consectetur congue massa non gravida. Sed id elit vitae nulla aliquam euismod. Pellentesque accumsan risus dolor, eu cursus nibh semper id.
Vestibulum vel tortor tellus. Suspendisse potenti. Pellentesque id sapien eu augue placerat dictum. Fusce tempus ligula at diam lacinia congue in ut metus. Maecenas volutpat tellus in tellus maximus imperdiet. Integer dignissim condimentum lorem, id luctus nisi maximus at. Nulla pretium, est sit amet mollis eleifend, tellus nulla viverra dolor, ac feugiat massa risus a lectus. Pellentesque ut pulvinar urna, blandit gravida ipsum. Nullam volutpat arcu nec fringilla auctor. Integer egestas enim commodo, faucibus neque ac, rutrum magna. Vivamus tincidunt rutrum auctor. Cras at rutrum felis. Fusce elementum lorem ut pharetra venenatis.
"""
lbl.textColor = .darkGray
lbl.font = UIFont.systemFont(ofSize: 16)
lbl.numberOfLines = 0
return lbl
}()
//======================================================================//
//
// MARK:- viewDidLoad
//
override func viewDidLoad() {
super.viewDidLoad()
setupViews()
setupAutoLayout()
}
func setupViews() {
title = "ScrollView Demo"
view.backgroundColor = .white
view.addSubview(scrollView)
scrollView.addSubview(lipsumLbl)
}
func setupAutoLayout() {
scrollView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
scrollView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
scrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
lipsumLbl.topAnchor.constraint(equalTo: scrollView.topAnchor).isActive = true
lipsumLbl.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
lipsumLbl.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
lipsumLbl.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor).isActive = true
}
}
Output:
My experience is that today a lot of developers use async/await
as a default for controllers.
My suggestion would be, use it only when you know it will help you.
The reason is, as Stephen Cleary and others already mentioned, it can introduce performance issues, rather than resolving them, and it will help you only in a specific scenario:
Usage
git clone <repository>
Clone the repository located at the <repository> onto the local machine. The original repository can be located on the local filesystem or on a remote machine accessible via HTTP or SSH.
git clone <repo> <directory>
Clone the repository located at <repository> into the folder called <directory> on the local machine.
Source: Setting up a repository
data <- data[-which(data[,1] %in% c("b","d","e")),]
Apparently you can do this:
function myFunction() {myFunction:{
console.log('i get executed');
break myFunction;
console.log('i do not get executed');
}}
See block scopes through the use of a label: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label
I can't see any downsides yet. But it doesn't seem like a common use.
Derived this answer: JavaScript equivalent of PHP’s die
I solved it as:
In my Windows 10 Machine (JDK & Android Studio both 64bit), in start menu I was having icon (shortcut) from somewhere else. When I was clicking Android Studio icon
in Start Menu it shows me error.
While going manually to installation folder of Android Studio:
C:\Program Files\Android\Android Studio\bin
When I clicked on studio64.exe
instead of studio.exe
it worked.
Then I just made shortcut of studio64.exe, instead using studio.exe.
Other Settings:
Environment Variable:
JAVA_HOME
C:\Program Files\Java\jdk1.8.0_60
JDK_HOME
C:\Program Files\Java\jdk1.8.0_60
System Variable:
JAVA_HOME
C:\Program Files\Java\jdk1.8.0_60\bin;
JDK_HOME
C:\Program Files\Java\jdk1.8.0_60\bin;
Remember:
double quotes
.\bin
while System
Variable you need to.;
at the end on \bin
in System Variable.Having used both, Twitter's Bootstrap is a superior technology set. Here are some differences,
Other notes,
Have you noticed that in the code you posted, condition2
is never set to False
? This way, your loop body is never executed.
Also, note that in Python, not condition
is preferred to condition == False
; likewise, condition
is preferred to condition == True
.
You should check with SMTP.
That means you have to connect to that email's SMTP server.
After connecting to the SMTP server you should send these commands:
HELO somehostname.com
MAIL FROM: <[email protected]>
RCPT TO: <[email protected]>
If you get "<[email protected]> Relay access denied" that means this email is Invalid.
There is a simple PHP class. You can use it:
http://www.phpclasses.org/package/6650-PHP-Check-if-an-e-mail-is-valid-using-SMTP.html
The original question on this post was: How to get Keras and Tensorflow to run with an AMD GPU.
The answer to this question is as followed:
1.) Keras will work if you can make Tensorflow work correctly (optionally within your virtual/conda environment).
2.) To get Tensorflow to work on an AMD GPU, as others have stated, one way this could work is to compile Tensorflow to use OpenCl. To do so read the link below. But for brevity I will summarize the required steps here:
You will need AMDs proprietary drivers. These are currently only available on Ubuntu 14.04 (the version before Ubuntu decided to change the way the UI is rendered). Support for Ubuntu 16.04 is at the writing of this post limited to a few GPUs through AMDProDrivers. Readers who want to do deep learning on AMD GPUs should be aware of this!
Compiling Tensorflow with OpenCl support also requires you to obtain and install the following prerequisites: OpenCl headers, ComputeCpp.
After the prerequisites are fulfilled, configure your build. Note that there are 3 options for compiling Tensorflow: Std Tensorflow (stable), Benoits Steiner's Tensorflow-opencl (developmental), and Luke Iwanski's Tensorflow-opencl (highly experimental) which you can pull from github. Also note that if you decide to build from any of the opencl versions, the question to use opencl will be missing because it is assumed that you are using it. Conversely, this means that if you configure from the standard tensorflow, you will need to select "Yes" when the configure script asks you to use opencl and "NO" for CUDA.
Then run tests like so:
$ bazel test --config=sycl -k --test_timeout 1600 -- //tensorflow/... -//tensorflow/contrib/... -//tensorflow/java/... -//tensorflow /compiler/...
Update: Doing this on my setup takes exceedingly long on my setup. The part that takes long are all the tests running. I am not sure what this means but a lot of my tests are timeing out at 1600 seconds. The duration can probably be shortened at the expense of more tests timeing out. Alternatively, you can just build tensor flow without tests. At the time of this writing, running the tests has taken 2 days already.
Or just build the pip package like so:
bazel build --local_resources 2048,.5,1.0 -c opt --config=sycl //tensorflow/tools/pip_package:build_pip_package
Please actually read the blog post over at Codeplay: Lukas Iwansky posted a comprehensive tutorial post on how to get Tensorflow to work with OpenCl just on March 30th 2017. So this is a very recent post. There are also some details which I did not write about here.
As indicated in the many posts above, little bits of information are spread throughout the interwebs. What Lukas' post adds in terms of value is that all the information was put together into one place which should make setting up Tensforflow and OpenCl a bit less daunting. I will only provide a link here:
https://www.codeplay.com/portal/03-30-17-setting-up-tensorflow-with-opencl-using-sycl
A slightly more complete walk-through has been posted here:
http://deep-beta.co.uk/setting-up-tensorflow-with-opencl-using-sycl/
It differs mainly by explicitly telling the user that he/she needs to:
Note an alternative approach was mentioned above using tensorflow-cl:
https://github.com/hughperkins/tensorflow-cl
I am unable to discern which approach is better at this time though it appears that this approach is less active. Fewer issues are posted, and fewer conversations to resolve those issues are happening. There was a major push last year. Additional pushes have ebbed off since November 2016 although Hugh seems to have pushed some updates a few days ago as of the writing of this post. (Update: If you read some of the documentation readme, this version of tensorflowo now only relies on community support as the main developer is busy with life.)
UPDATE (2017-04-25): I have some notes based on testing tensorflow-opencl below.
Following are some numbers for calculating 1 epoch using the CIFAR10 data set for MY SETUP (A10-7850 with iGPU). Your mileage will almost certainly vary!
You can see that in this particular case performance is worse. I attribute this to the following factors:
If you are using an AMD GPU with more VRAM and more stream processors, you are certain to get much better performance numbers. I would be interested to read what numbers people are achieving to know what's possible.
I will continue to maintain this answer if/when updates get pushed.
3.) An alternative way is currently being hinted at which is using AMD's RocM initiative, and miOpen (cuDNN equivalent) library. These are/will be open-source libraries that enable deep learning. The caveat is that RocM support currently only exists for Linux, and that miOpen has not been released to the wild yet, but Raja (AMD GPU head) has said in an AMA that using the above, it should be possible to do deep learning on AMD GPUs. In fact, support is planned for not only Tensorflow, but also Cafe2, Cafe, Torch7 and MxNet.
Since Laravel 5.2 you can use File Responses
Basically you can call it like this:
return response()->file($pathToFile);
and it will display files as PDF and images inline in the browser.
If this happend to your XAMPP installation, just copy global_priv.MAD
and global_priv.MAI
files from ./xampp/mysql/backup/mysql/
to ./xampp/mysql/data/mysql/
.
If you cannot use RowCounter
for whatever reason, then a combination of these two filters should be an optimal way to get a count:
FirstKeyOnlyFilter() AND KeyOnlyFilter()
The FirstKeyOnlyFilter
will result in the scanner only returning the first column qualifier it finds, as opposed to the scanner returning all of the column qualifiers in the table, which will minimize the network bandwith. What about simply picking one column qualifier to return? This would work if you could guarentee that column qualifier exists for every row, but if that is not true then you would get an inaccurate count.
The KeyOnlyFilter
will result in the scanner only returning the column family, and will not return any value for the column qualifier. This further reduces the network bandwidth, which in the general case wouldn't account for much of a reduction, but there can be an edge case where the first column picked by the previous filter just happens to be an extremely large value.
I tried playing around with scan.setCaching
but the results were all over the place. Perhaps it could help.
I had 16 million rows in between a start and stop that I did the following pseudo-empirical testing:
With FirstKeyOnlyFilter and KeyOnlyFilter activated: With caching not set (i.e., the default value), it took 188 seconds. With caching set to 1, it took 188 seconds With caching set to 10, it took 200 seconds With caching set to 100, it took 187 seconds With caching set to 1000, it took 183 seconds. With caching set to 10000, it took 199 seconds. With caching set to 100000, it took 199 seconds. With FirstKeyOnlyFilter and KeyOnlyFilter disabled: With caching not set, (i.e., the default value), it took 309 seconds
I didn't bother to do proper testing on this, but it seems clear that the FirstKeyOnlyFilter
and KeyOnlyFilter
are good.
Moreover, the cells in this particular table are very small - so I think the filters would have been even better on a different table.
Here is a Java code sample:
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.filter.RowFilter; import org.apache.hadoop.hbase.filter.KeyOnlyFilter; import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter; import org.apache.hadoop.hbase.filter.FilterList; import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp; import org.apache.hadoop.hbase.filter.RegexStringComparator; public class HBaseCount { public static void main(String[] args) throws IOException { Configuration config = HBaseConfiguration.create(); HTable table = new HTable(config, "my_table"); Scan scan = new Scan( Bytes.toBytes("foo"), Bytes.toBytes("foo~") ); if (args.length == 1) { scan.setCaching(Integer.valueOf(args[0])); } System.out.println("scan's caching is " + scan.getCaching()); FilterList allFilters = new FilterList(); allFilters.addFilter(new FirstKeyOnlyFilter()); allFilters.addFilter(new KeyOnlyFilter()); scan.setFilter(allFilters); ResultScanner scanner = table.getScanner(scan); int count = 0; long start = System.currentTimeMillis(); try { for (Result rr = scanner.next(); rr != null; rr = scanner.next()) { count += 1; if (count % 100000 == 0) System.out.println(count); } } finally { scanner.close(); } long end = System.currentTimeMillis(); long elapsedTime = end - start; System.out.println("Elapsed time was " + (elapsedTime/1000F)); } }
Here is a pychbase code sample:
from pychbase import Connection c = Connection() t = c.table('my_table') # Under the hood this applies the FirstKeyOnlyFilter and KeyOnlyFilter # similar to the happybase example below print t.count(row_prefix="foo")
Here is a Happybase code sample:
from happybase import Connection c = Connection(...) t = c.table('my_table') count = 0 for _ in t.scan(filter='FirstKeyOnlyFilter() AND KeyOnlyFilter()'): count += 1 print count
Thanks to @Tuckr and @KennyCason for the tip.
I had this error aswell.
I am working in mysql workbench. When giving the values they have to be inside "". That solved it for me.
Creating index.php, index.html, index.htm is not secure. Becuse, anyone can get access on your files within specified directory by guessing files name. E.g.: http://yoursite.com/includes/file.dat So, recommended method is creating a .htaccess file to deny all visitors ;). Have fun !!
Why not to use Static Initialization Blocks
? Additional details here:
Static Initialization Blocks
It looks like the one-liner got even simpler along the line (currently using R 3.5.3):
# generate original data.frame
df <- data.frame(a = letters[1:10], b = 1:10, c = LETTERS[1:10])
# use first column for row names
df <- data.frame(df, row.names = 1)
The column used for row names is removed automatically.
I agree with alex about making sure the DOM is loaded. I also think that the submit button will trigger a refresh.
This is what I would do
<html>
<head>
<title>webpage</title>
</head>
<script type="text/javascript">
var myButton;
var myTextfield;
function setup() {
myButton = document.getElementById("myButton");
myTextfield = document.getElementById("myTextfield");
myButton.onclick = function() {
var userName = myTextfield.value;
greetUser(userName);
return false;
}
}
function greetUser(userName) {
var greeting = "Hello " + userName + "!";
document.getElementsByTagName("h2")[0].innerHTML = greeting;
}
</script>
<body onload="setup()">
<h2>Hello World!</h2>
<p id="myParagraph">This is an example website</p>
<form>
<input type="text" id="myTextfield" placeholder="Type your name" />
<input type="button" id="myButton" value="Go" />
</form>
</body>
</html>
have fun!
Give it a chance:
Try getting string via function gets(string) then check condition as if(string[0] == '\0')
If you use Shouldly, you can use ShouldAllBe with Contains.
collection1 = {1, 2, 3, 4};
collection2 = {2, 4, 1, 3};
collection1.ShouldAllBe(item=>collection2.Contains(item)); // true
And finally, you can write an extension.
public static class ShouldlyIEnumerableExtensions
{
public static void ShouldEquivalentTo<T>(this IEnumerable<T> list, IEnumerable<T> equivalent)
{
list.ShouldAllBe(l => equivalent.Contains(l));
}
}
UPDATE
A optional parameter exists on ShouldBe method.
collection1.ShouldBe(collection2, ignoreOrder: true); // true
You also need to be sure that returned bean is not empty (and can be serialized by Jackson). In my particular case I tried to return an instance of an object without getters and setters and without any jackson annotation and with fields equals to null. I got following message:
com.fasterxml.jackson.databind.JsonMappingException:
No serializer found for class com.foo.bar.Baz and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )
I simply declared as below in web.xml file and Its working for me :
<welcome-file-list>
<welcome-file>/WEB-INF/jsps/index.jsp</welcome-file>
</welcome-file-list>
And NO html/jsp pages present in public directory except static resources(css, js, images). Now I can access my index page with URL like : http://localhost:8080/app/ Its calling /WEB-INF/jsps/index.jsp page. When hosted live in production the final URL looks like https://eisdigital.com/
Follow these steps:
Regular expression
option near the bottom of the dialog.To add a word, such as test
, at the beginning of each line:
- Type
^
in theFind what
textbox- Type
test
in theReplace with
textbox- Place cursor in the first line of the file to ensure all lines are affected
- Click
Replace All
button
To add a word, such as test
, at the end of each line:
- Type
$
in theFind what
textbox- Type
test
in theReplace with
textbox- Place cursor in the first line of the file to ensure all lines are affected
- Click
Replace All
button
There is at least one way, but it's not a very good one. You could just poll the element for changes like this:
var previous_style,
poll = window.setInterval(function()
{
var current_style = document.getElementById('target').style.display;
if (previous_style != current_style) {
alert('style changed');
window.clearInterval(poll);
} else {
previous_style = current_style;
}
}, 100);
The DOM standard also specifies mutation events, but I've never had the chance to use them, and I'm not sure how well they're supported. You'd use them like this:
target.addEventListener('DOMAttrModified', function()
{
if (e.attrName == 'style') {
alert('style changed');
}
}, false);
This code is off the top of my head, so I'm not sure if it'd work.
The best and easiest solution would be to have a callback in the function displaying your target.
Go here and find the version you want to install and then download the correct msi file and run the installer. You cannot install node by running this command, also the error you receive is stating that npm is not on your path which suggests machine doesn't currently have node installed on it
Just change it to
var appointmentNoShow = from a in appointments
from p in properties
from c in clients
where a.Id == p.OID &&
(a.Start.Date >= startDate.Date && a.Start.Date <= endDate)
I just used this:
grep -c $'\x0c' filename
To search for and count a page control character in the file..
So to include an offset in the output:
grep -b -o $'\x0c' filename | less
I am just piping the result to less because the character I am greping for does not print well and the less displays the results cleanly. Output example:
21:^L
23:^L
2005:^L
you can use this simple way
<select onchange="location = this.value;">
<option value="/finished">Finished</option>
<option value="/break">Break</option>
<option value="/issue">Issues</option>
<option value="/downtime">Downtime</option>
</select>
will redirect to route url you can direct to .html page or direct to some link just change value
in option.
You have to modify the control template instead of ItemsPanelTemplate:
<ItemsControl >
<ItemsControl.Template>
<ControlTemplate>
<ScrollViewer x:Name="ScrollViewer" Padding="{TemplateBinding Padding}">
<ItemsPresenter />
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
</ItemsControl>
Maybe, your code does not working because StackPanel has own scrolling functionality. Try to use StackPanel.CanVerticallyScroll property.
The exact code will vary for each of the columns you want to do, but it's likely you'll want to use the map
and apply
functions. In some cases you can just compute using the existing columns directly, since the columns are Pandas Series objects, which also work as Numpy arrays, which automatically work element-wise for usual mathematical operations.
>>> d
A B C
0 11 13 5
1 6 7 4
2 8 3 6
3 4 8 7
4 0 1 7
>>> (d.A + d.B) / d.C
0 4.800000
1 3.250000
2 1.833333
3 1.714286
4 0.142857
>>> d.A > d.C
0 True
1 True
2 True
3 False
4 False
If you need to use operations like max and min within a row, you can use apply
with axis=1
to apply any function you like to each row. Here's an example that computes min(A, B)-C
, which seems to be like your "lower wick":
>>> d.apply(lambda row: min([row['A'], row['B']])-row['C'], axis=1)
0 6
1 2
2 -3
3 -3
4 -7
Hopefully that gives you some idea of how to proceed.
Edit: to compare rows against neighboring rows, the simplest approach is to slice the columns you want to compare, leaving off the beginning/end, and then compare the resulting slices. For instance, this will tell you for which rows the element in column A is less than the next row's element in column C:
d['A'][:-1] < d['C'][1:]
and this does it the other way, telling you which rows have A less than the preceding row's C:
d['A'][1:] < d['C'][:-1]
Doing ['A"][:-1]
slices off the last element of column A, and doing ['C'][1:]
slices off the first element of column C, so when you line these two up and compare them, you're comparing each element in A with the C from the following row.
If you know how far back, you can try something like:
# Current branch vs. parent
git diff HEAD^ HEAD
# Current branch, diff between commits 2 and 3 times back
git diff HEAD~3 HEAD~2
Prior commits work something like this:
# Parent of HEAD
git show HEAD^1
# Grandparent
git show HEAD^2
There are a lot of ways you can specify commits:
# Great grandparent
git show HEAD~3
$web_url = 'http://www.writephponline.com?name=shubham&[email protected]';
$query = parse_url($web_url, PHP_URL_QUERY);
parse_str($query, $queryArray);
echo "Name: " . $queryArray['name']; // Result: shubham
echo "EMail: " . $queryArray['email']; // Result:[email protected]
Here's how you do it:
Download and install APK Extractor in your device. It is free, and is compatible in almost all of the Android devices. Another plus point is it does not even require root or anything to work. After you have it installed, launch it. There you will see a list of apps which are in your device, which include the apps you’ve installed later, along with the system apps. Long press any app you want to extract (you can select multiple or all apps at once), and click on the extract option you see in the top. You will also have the option to share via Bluetooth or messaging. You’re done, you will see the extracted apps as AppName_AppPackage_AppVersionName_AppVersionCode.apk, which will be saved in the path /sdcard/ExtractedApks/ by default.
For detailed description for how to extract apk files in android, visit: http://appslova.com/how-to-extract-apk-files-in-android/
This is by far the best method for most situations:
<pre><code>
code here, escape it yourself.
</code></pre>
I would have up voted the first person who suggested it but I don't have reputation. I felt compelled to say something though for the sake of people trying to find answers on the Internet.
Android Device Monitor was deprecated in Android Studio 3.1 and removed from Android Studio 3.2. To start the standalone Device Monitor application in Android Studio 3.1 and lower you can run android-sdk/tools/monitor.bat
You have to use the String method .toLowerCase()
or .toUpperCase()
on both the input and the string you are trying to match it with.
Example:
public static void findPatient() {
System.out.print("Enter part of the patient name: ");
String name = sc.nextLine();
System.out.print(myPatientList.showPatients(name));
}
//the other class
ArrayList<String> patientList;
public void showPatients(String name) {
boolean match = false;
for(String matchingname : patientList) {
if (matchingname.toLowerCase().contains(name.toLowerCase())) {
match = true;
}
}
}
For those who use JSF2.2+ and cannot pass autofocus as an attribute without value to it, use this:
p:autofocus="true"
And add it to the namespace p (Also often used pt. Whatever you like).
<html ... xmlns:p="http://java.sun.com/jsf/passthrough">
public static JSONObject updateJson(JSONObject obj, String keyString, String newValue) throws Exception {
JSONObject json = new JSONObject();
// get the keys of json object
Iterator iterator = obj.keys();
String key = null;
while (iterator.hasNext()) {
key = (String) iterator.next();
// if the key is a string, then update the value
if ((obj.optJSONArray(key) == null) && (obj.optJSONObject(key) == null)) {
if ((key.equals(keyString))) {
// put new value
obj.put(key, newValue);
return obj;
}
}
// if it's jsonobject
if (obj.optJSONObject(key) != null) {
updateJson(obj.getJSONObject(key), keyString, newValue);
}
// if it's jsonarray
if (obj.optJSONArray(key) != null) {
JSONArray jArray = obj.getJSONArray(key);
for (int i = 0; i < jArray.length(); i++) {
updateJson(jArray.getJSONObject(i), keyString, newValue);
}
}
}
return obj;
}
In my case I was running Tensorflow Docker container in Ubuntu 20.04 :Run your docker container in One terminal , I ran it with
docker run -it od
And then started another terminal and ran below docker ps
with sudo:
sudo docker ps
I successfully got container id:
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
e4ca1ad20b84 od "/bin/bash" 18 minutes ago
Up 18 minutes unruffled_stonebraker
With WinForms you can use the ErrorProvider in conjunction with the Validating
event to handle the validation of user input. The Validating
event provides the hook to perform the validation and ErrorProvider gives a nice consistent approach to providing the user with feedback on any error conditions.
http://msdn.microsoft.com/en-us/library/system.windows.forms.errorprovider.aspx
Yes you can create events on objects, here is an example;
public class Foo
{
public delegate void MyEvent(object sender, object param);
event MyEvent OnMyEvent;
public Foo()
{
this.OnMyEvent += new MyEvent(Foo_OnMyEvent);
}
void Foo_OnMyEvent(object sender, object param)
{
if (this.OnMyEvent != null)
{
//do something
}
}
void RaiseEvent()
{
object param = new object();
this.OnMyEvent(this,param);
}
}
Probably due to the fact that I could not explain well you do not really understand my question. In general, I found the solution.
Sorry for my english
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
objWMIService.Create "notepad.exe", null, null, intProcessID
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService.ExecNotificationQuery _
("Select * From __InstanceDeletionEvent Within 1 Where TargetInstance ISA 'Win32_Process'")
Do Until i = 1
Set objLatestProcess = colMonitoredProcesses.NextEvent
If objLatestProcess.TargetInstance.ProcessID = intProcessID Then
i = 1
End If
Loop
Wscript.Echo "Notepad has been terminated."
A frozen array behaves identically to a python tuple:
const tuple = Object.freeze(["Bob", 24]);
let [name, age]; = tuple
console.debug(name); // "Bob"
console.debug(age); // 24
Be fancy and define a class
class Tuple extends Array {
constructor(...items) {
super(...items);
Object.freeze(this);
}
}
let tuple = new Tuple("Jim", 35);
let [name, age] = tuple;
console.debug(name); // Jim
console.debug(age); // 35
tuple = ["Bob", 24]; // no effect
console.debug(name); // Jim
console.debug(age); // 25
Works today in all the latest browsers.
If you're removing a commit and don't want to keep its changes @ferit has a good solution.
If you want to add that commit to the current branch, but doesn't make sense to be part of the current pr, you can do the following instead:
git rebase -i HEAD~n
git reset HEAD^ --soft
to uncommit the changes and get them back in a staged state.git push --force
to update the remote branch without your removed commit.Now you'll have removed the commit from your remote, but will still have the changes locally.
Check your project's properties. On the "Application" tab, select your Program
class as the Startup object:
Add your C:\WinPython-64bit-3.4.4.1\python_***\Scripts folder to your system PATH variable by doing the following:
Click Environment Variables. ...
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. ...
For me creating a python file named template_filters.py
in my App with below content did the job
# coding=utf-8
from django.template.base import Library
register = Library()
@register.filter
def get_item(dictionary, key):
return dictionary.get(key)
usage is like what culebrón said :
{{ mydict|get_item:item.NAME }}
I find it useful to understand the underlying tools. These are cl.exe (compiler) and link.exe (linker). You need to tell the compiler the signatures of the functions you want to call in the dynamic library (by including the library's header) and you need to tell the linker what the library is called and how to call it (by including the "implib" or import library).
This is roughly the same process gcc uses for linking to dynamic libraries on *nix, only the library object file differs.
Knowing the underlying tools means you can more quickly find the appropriate settings in the IDE and allows you to check that the commandlines generated are correct.
Say A.exe depends B.dll. You need to include B's header in A.cpp (#include "B.h"
) then compile and link with B.lib:
cl A.cpp /c /EHsc
link A.obj B.lib
The first line generates A.obj, the second generates A.exe. The /c
flag tells cl not to link and /EHsc
specifies what kind of C++ exception handling the binary should use (there's no default, so you have to specify something).
If you don't specify /c
cl will call link
for you. You can use the /link
flag to specify additional arguments to link
and do it all at once if you like:
cl A.cpp /EHsc /link B.lib
If B.lib is not on the INCLUDE
path you can give a relative or absolute path to it or add its parent directory to your include path with the /I
flag.
If you're calling from cygwin (as I do) replace the forward slashes with dashes.
If you write #pragma comment(lib, "B.lib")
in A.cpp you're just telling the compiler to leave a comment in A.obj telling the linker to link to B.lib. It's equivalent to specifying B.lib on the link commandline.
An Exception
is an Object
like any other in Java. You need to use the new
keyword to create a new Exception
before you can throw
it.
throw new RuntimeException();
Optionally you could also do the following:
RuntimeException e = new RuntimeException();
throw e;
Both code snippets are equivalent.
If there is an issue with sudo/root access we can do
npm install stable Or
npm install 10.15.0
see here
The consumable media types of the mapped request, narrowing the primary mapping.
the producer is used to narrow the primary mapping, you send request should specify the exact header to match it.
Reading quickly through the source it seems that you're not far off. The following link should help (I did something similar but for FTP). For a file send from server to client, you start off with a file instance and an array of bytes. You then read the File into the byte array and write the byte array to the OutputStream which corresponds with the InputStream on the client's side.
http://www.rgagnon.com/javadetails/java-0542.html
Edit: Here's a working ultra-minimalistic file sender and receiver. Make sure you understand what the code is doing on both sides.
package filesendtest;
import java.io.*;
import java.net.*;
class TCPServer {
private final static String fileToSend = "C:\\test1.pdf";
public static void main(String args[]) {
while (true) {
ServerSocket welcomeSocket = null;
Socket connectionSocket = null;
BufferedOutputStream outToClient = null;
try {
welcomeSocket = new ServerSocket(3248);
connectionSocket = welcomeSocket.accept();
outToClient = new BufferedOutputStream(connectionSocket.getOutputStream());
} catch (IOException ex) {
// Do exception handling
}
if (outToClient != null) {
File myFile = new File( fileToSend );
byte[] mybytearray = new byte[(int) myFile.length()];
FileInputStream fis = null;
try {
fis = new FileInputStream(myFile);
} catch (FileNotFoundException ex) {
// Do exception handling
}
BufferedInputStream bis = new BufferedInputStream(fis);
try {
bis.read(mybytearray, 0, mybytearray.length);
outToClient.write(mybytearray, 0, mybytearray.length);
outToClient.flush();
outToClient.close();
connectionSocket.close();
// File sent, exit the main method
return;
} catch (IOException ex) {
// Do exception handling
}
}
}
}
}
package filesendtest;
import java.io.*;
import java.io.ByteArrayOutputStream;
import java.net.*;
class TCPClient {
private final static String serverIP = "127.0.0.1";
private final static int serverPort = 3248;
private final static String fileOutput = "C:\\testout.pdf";
public static void main(String args[]) {
byte[] aByte = new byte[1];
int bytesRead;
Socket clientSocket = null;
InputStream is = null;
try {
clientSocket = new Socket( serverIP , serverPort );
is = clientSocket.getInputStream();
} catch (IOException ex) {
// Do exception handling
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (is != null) {
FileOutputStream fos = null;
BufferedOutputStream bos = null;
try {
fos = new FileOutputStream( fileOutput );
bos = new BufferedOutputStream(fos);
bytesRead = is.read(aByte, 0, aByte.length);
do {
baos.write(aByte);
bytesRead = is.read(aByte);
} while (bytesRead != -1);
bos.write(baos.toByteArray());
bos.flush();
bos.close();
clientSocket.close();
} catch (IOException ex) {
// Do exception handling
}
}
}
}
Related
Byte array of unknown length in java
Edit: The following could be used to fingerprint small files before and after transfer (use SHA if you feel it's necessary):
public static String md5String(File file) {
try {
InputStream fin = new FileInputStream(file);
java.security.MessageDigest md5er = MessageDigest.getInstance("MD5");
byte[] buffer = new byte[1024];
int read;
do {
read = fin.read(buffer);
if (read > 0) {
md5er.update(buffer, 0, read);
}
} while (read != -1);
fin.close();
byte[] digest = md5er.digest();
if (digest == null) {
return null;
}
String strDigest = "0x";
for (int i = 0; i < digest.length; i++) {
strDigest += Integer.toString((digest[i] & 0xff)
+ 0x100, 16).substring(1).toUpperCase();
}
return strDigest;
} catch (Exception e) {
return null;
}
}
When an error occurs, the execution will continue on the next line without interrupting the script.
Here's roughly how C# handles this problem (but expressed as Java code). Something like this could handle almost all your needs:
import static org.util.function.Functions.*;
public class Test {
public static void main(String[] args)
{
Test.invoke((a, b) -> a + b);
}
public static void invoke(Func2<Integer, Integer, Integer> func)
{
System.out.println(func.apply(5, 6));
}
}
package org.util.function;
public interface Functions {
//Actions:
public interface Action {
public void apply();
}
public interface Action1<T1> {
public void apply(T1 arg1);
}
public interface Action2<T1, T2> {
public void apply(T1 arg1, T2 arg2);
}
public interface Action3<T1, T2, T3> {
public void apply(T1 arg1, T2 arg2, T3 arg3);
}
public interface Action4<T1, T2, T3, T4> {
public void apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
}
public interface Action5<T1, T2, T3, T4, T5> {
public void apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
}
public interface Action6<T1, T2, T3, T4, T5, T6> {
public void apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
}
public interface Action7<T1, T2, T3, T4, T5, T6, T7> {
public void apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
}
public interface Action8<T1, T2, T3, T4, T5, T6, T7, T8> {
public void apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
}
//Functions:
public interface Func<TResult> {
public TResult apply();
}
public interface Func1<T1, TResult> {
public TResult apply(T1 arg1);
}
public interface Func2<T1, T2, TResult> {
public TResult apply(T1 arg1, T2 arg2);
}
public interface Func3<T1, T2, T3, TResult> {
public TResult apply(T1 arg1, T2 arg2, T3 arg3);
}
public interface Func4<T1, T2, T3, T4, TResult> {
public TResult apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
}
public interface Func5<T1, T2, T3, T4, T5, TResult> {
public TResult apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
}
public interface Func6<T1, T2, T3, T4, T5, T6, TResult> {
public TResult apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
}
public interface Func7<T1, T2, T3, T4, T5, T6, T7, TResult> {
public TResult apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
}
public interface Func8<T1, T2, T3, T4, T5, T6, T7, T8, TResult> {
public TResult apply(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
}
}
I was looking for something similar and the official answer is no. However, I was able to find an interesting concept by Daniel at ExcelHero.com.
Basically, you need to create worker vbscripts to execute the various things you want and have it report back to excel. For what I am doing, retrieving HTML data from various website, it works great!
Take a look:
http://www.excelhero.com/blog/2010/05/multi-threaded-vba.html
It's not a matter of better, just different.
When you synchronize a method, you are effectively synchronizing to the object itself. In the case of a static method, you're synchronizing to the class of the object. So the following two pieces of code execute the same way:
public synchronized int getCount() {
// ...
}
This is just like you wrote this.
public int getCount() {
synchronized (this) {
// ...
}
}
If you want to control synchronization to a specific object, or you only want part of a method to be synchronized to the object, then specify a synchronized
block. If you use the synchronized
keyword on the method declaration, it will synchronize the whole method to the object or class.
There are several ways to do a cross join or cartesian product:
SELECT column_names FROM table1 CROSS JOIN table2;
SELECT column_names FROM table1, table2;
SELECT column_names FROM table1 JOIN table2;
Neglecting the on condition in the third case is what results in a cross join.
Observe object and array reactivity here:
As long as you name your resource bundle files correctly (with a .properties extension), then this works:
File file = new File("C:\\temp");
URL[] urls = {file.toURI().toURL()};
ClassLoader loader = new URLClassLoader(urls);
ResourceBundle rb = ResourceBundle.getBundle("myResource", Locale.getDefault(), loader);
where "c:\temp" is the external folder (NOT on the classpath) holding the property files, and "myResource" relates to myResource.properties, myResource_fr_FR.properties, etc.
Credit to http://www.coderanch.com/t/432762/java/java/absolute-path-bundle-file
The ':' is a delimiter for key value pairs basically. In your example it is a Javascript Object Literal notation.
In javascript, Objects are defined with the colon delimiting the identifier for the property, and its value so you can have the following:
return {
Property1 : 125,
Property2 : "something",
Method1 : function() { /* do nothing */ },
array: [5, 3, 6, 7]
};
and then use it like:
var o = {
property1 : 125,
property2 : "something",
method1 : function() { /* do nothing */ },
array: [5, 3, 6, 7]
};
alert(o.property1); // Will display "125"
A subset of this is also known as JSON (Javascript Object Notation) which is useful in AJAX calls because it is compact and quick to parse in server-side languages and Javascript can easily de-serialize a JSON string into an object.
// The parenthesis '(' & ')' around the object are important here
var o = eval('(' + "{key: \"value\"}" + ')');
You can also put the key inside quotes if it contains some sort of special character or spaces, but I wouldn't recommend that because it just makes things harder to work with.
Keep in mind that JavaScript Object Literal Notation in the JavaScript language is different from the JSON standard for message passing. The main difference between the 2 is that functions and constructors are not part of the JSON standard, but are allowed in JS object literals.
Update: appears to have stopped working since Chrome 80
Drag & Drop the '.crx' file on to the 'Extensions' page
Settings - icon > Tools > Extensions
( the 'hamburger' icon in the top-right corner )Enable Developer Mode ( toggle button in top-right corner )
Drag and drop the '.crx' extension file onto the Extensions page from step 1
( crx file should likely be in your Downloads directory )Install
Source: Chrome YouTube Downloader - install instructions
This article "How to create PHP based email form with file attachment" presents step-by-step instructions how to achieve your requirement.
Quote:
This article shows you how to create a PHP based email form that supports file attachment. The article will also show you how to validate the type and size of the uploaded file.
It consists of the following steps:
The entire example code can be downloaded here
HTML:
<button onclick="scrollToTop(1000);"></button>
1# JavaScript (linear):
function scrollToTop (duration) {
// cancel if already on top
if (document.scrollingElement.scrollTop === 0) return;
const totalScrollDistance = document.scrollingElement.scrollTop;
let scrollY = totalScrollDistance, oldTimestamp = null;
function step (newTimestamp) {
if (oldTimestamp !== null) {
// if duration is 0 scrollY will be -Infinity
scrollY -= totalScrollDistance * (newTimestamp - oldTimestamp) / duration;
if (scrollY <= 0) return document.scrollingElement.scrollTop = 0;
document.scrollingElement.scrollTop = scrollY;
}
oldTimestamp = newTimestamp;
window.requestAnimationFrame(step);
}
window.requestAnimationFrame(step);
}
2# JavaScript (ease in and out):
function scrollToTop (duration) {
// cancel if already on top
if (document.scrollingElement.scrollTop === 0) return;
const cosParameter = document.scrollingElement.scrollTop / 2;
let scrollCount = 0, oldTimestamp = null;
function step (newTimestamp) {
if (oldTimestamp !== null) {
// if duration is 0 scrollCount will be Infinity
scrollCount += Math.PI * (newTimestamp - oldTimestamp) / duration;
if (scrollCount >= Math.PI) return document.scrollingElement.scrollTop = 0;
document.scrollingElement.scrollTop = cosParameter + cosParameter * Math.cos(scrollCount);
}
oldTimestamp = newTimestamp;
window.requestAnimationFrame(step);
}
window.requestAnimationFrame(step);
}
/*
Explanation:
- pi is the length/end point of the cosinus intervall (see below)
- newTimestamp indicates the current time when callbacks queued by requestAnimationFrame begin to fire.
(for more information see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame)
- newTimestamp - oldTimestamp equals the delta time
a * cos (bx + c) + d | c translates along the x axis = 0
= a * cos (bx) + d | d translates along the y axis = 1 -> only positive y values
= a * cos (bx) + 1 | a stretches along the y axis = cosParameter = window.scrollY / 2
= cosParameter + cosParameter * (cos bx) | b stretches along the x axis = scrollCount = Math.PI / (scrollDuration / (newTimestamp - oldTimestamp))
= cosParameter + cosParameter * (cos scrollCount * x)
*/
Note:
3# Simple scrolling library on Github
this works perfectly in 2019:
date('Y-m-d H:i:s',strtotime($date. ' '.$timezone));
test = data.frame(C=c(0,2,4, 7, 8), A=c(4,2,4, 7, 8), B=c(1, 3, 8,3,2))
Using the simple following function replacement can be performed (but only if data frame does not have many columns):
test <- test[, c("A", "B", "C")]
for others:
test <- test[, c("B", "A", "C")]
Take a look at highlight (jQuery plugin).
You should declare metab as integer and then use arithmetic evaluation
declare -i metab num
...
num+=metab
...
For more information see https://www.gnu.org/software/bash/manual/html_node/Shell-Arithmetic.html#Shell-Arithmetic
You need to use find
instead of grep
in this case.
You can also use find
in combination with grep
or egrep
:
$ find | grep "f[[:alnum:]]\.frm"
Why do people keep confusing php and javascript?
PHP is SERVER SIDE
JAVASCRIPT (like onclick) is CLIENT SIDE
You will have to use just javascript to redirect. Otherwise if you want PHP involved you can use an AJAX call to log a hit or whatever you like to send back a URL or additional detail.
In recent versions of dmesg, you can just call dmesg -T
.
That's the wrong kind of question. The right question would be: "Which one is easier to understand for human readers of my code?"
If speed matters (later), don't ask, but measure. (And before that, measure whether optimizing this actually will make any noticeable difference.) Until then, write the code so that it is easiest to read.
Edit
Just to make this clear (although it already should have been): Breakthrough speedups usually come from things like using better algorithms, improving locality of data, reducing the use of dynamic memory, pre-computing results, etc. They rarely ever come from micro-optimizing single function calls, and where they do, they do so in very few places, which would only be found by careful (and time-consuming) profiling, more often than never they can be sped up by doing very non-intuitive things (like inserting noop
statements), and what's an optimization for one platform is sometimes a pessimization for another (which is why you need to measure, instead of asking, because we don't fully know/have your environment).
Let me underline this again: Even in the few applications where such things matter, they don't matter in most places they're used, and it is very unlikely that you will find the places where they matter by looking at the code. You really do need to identify the hot spots first, because otherwise optimizing code is just a waste of time.
Even if a single operation (like computing the square of some value) takes up 10% of the application's execution time (which IME is quite rare), and even if optimizing it saves 50% of the time necessary for that operation (which IME is even much, much rarer), you still made the application take only 5% less time.
Your users will need a stopwatch to even notice that. (I guess in most cases anything under 20% speedup goes unnoticed for most users. And that is four such spots you need to find.)
That's because req
and res
are two different objects.
You need to look for the property on the same object you added it to.
From http://pmob.co.uk/pob/centred-float.htm:
The premise is simple and basically just involves a widthless float wrapper that is floated to the left and then shifted off screen to the left width position:relative; left:-50%. Next the nested inner element is reversed and a relative position of +50% is applied. This has the effect of placing the element dead in the center. Relative positioning maintains the flow and allows other content to flow underneath.
#buttons{
float:right;
position:relative;
left:-50%;
text-align:left;
}
#buttons ul{
list-style:none;
position:relative;
left:50%;
}
#buttons li{float:left;position:relative;}/* ie needs position:relative here*/
#buttons a{
text-decoration:none;
margin:10px;
background:red;
float:left;
border:2px outset blue;
color:#fff;
padding:2px 5px;
text-align:center;
white-space:nowrap;
}
#buttons a:hover{ border:2px inset blue;color:red;background:#f2f2f2;}
#content{overflow:hidden}/* hide horizontal scrollbar*/
_x000D_
<div id="buttons">
<ul>
<li><a href="#">Button 1</a></li>
<li><a href="#">Button 2's a bit longer</a></li>
<li><a href="#">Butt 3</a></li>
<li><a href="#">Button 4</a></li>
</ul>
</div>
_x000D_
I wanted a simple example of the use of case that I could play with, this doesn't even need a table. This returns odd or even depending whether seconds is odd or even
SELECT CASE MOD(SECOND(NOW()),2) WHEN 0 THEN 'odd' WHEN 1 THEN 'even' END;
<head>
<script type="text/javascript">
<%=YourScript %>
function functionname1(arg1,arg2){content}
</script>
</head>
public string YourScript = "";
public string functionname(arg)
{
if (condition)
{
YourScript = "functionname1(arg1,arg2);";
}
}
JavaScript Date constructor accepts number of milliseconds since Unix epoch (1 January 1970 00:00:00 UTC). Here’s C# extension method that converts .Net DateTime object to JavaScript date:
public static class DateTimeJavaScript
{
private static readonly long DatetimeMinTimeTicks =
(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).Ticks;
public static long ToJavaScriptMilliseconds(this DateTime dt)
{
return (long)((dt.ToUniversalTime().Ticks - DatetimeMinTimeTicks) / 10000);
}
}
JavaScript Usage:
var dt = new Date(<%= DateTime.Today.ToJavaScriptMilliseconds() %>);
alert(dt);
Know this is an old question but recently we came across the same issue, and we solved it from the server side. This is a php specific answer but I am positive that other envs have something similar. instead of using the img tag you render the svg as svg from the get-go.
public static function print_svg($file){
$iconfile = new \DOMDocument();
$iconfile->load($file);
$tag = $iconfile->saveHTML($iconfile->getElementsByTagName('svg')[0]);
return $tag;
}
now when you render the file you will get complete inline svg
And a key point - although TRUNCATE TABLE seems like a DELETE with no WHERE clause, TRUNCATE is not DML, it is DDL. DELETE requires a COMMIT, but TRUNCATE does not.
I tried in vain to find the current location of this file for version 2020. When navigating to Help > Edit Custom Properties
a new (empty) file is created at appData/Roaming/JetBrains/IntelliJIdea2020.1/idea.properties
. There is no /bin directory as some tutorials suggest. However, neither adding the block from the accepted answer to this file nor adding the same file to /bin resulted in an update to my configuration.
I finally discovered that a reference to the same property exists in appData/Roaming/JetBrains/IntelliJIdea2020.1/idea64.exe.vmoptions
. It looks like this:
-Didea.max.intellisense.filesize=3470
I changed it to this, which should be adequate for my needs:
-Didea.max.intellisense.filesize=9999
This strikes me as a bug in this version where the behavior of the menu item doesn't reflect what's needed, but it may also be the case that my particular setup is somehow different than stock. I do have PyCharm and the JDK installed.
You can also try this:
var data= _.reverse(_.sortBy(res.locals.subscriptionList.items, ['type', 'name']));
First of all check error log in the path that your webserver indicates. Then maybe the browser is showing friendly error messages, so disable it.
https://superuser.com/questions/202244/show-http-error-details-in-google-chrome
Model1.belongsTo(Model2, { as: 'alias' })
Model1.findAll({include: [{model: Model2 , as: 'alias' }]},{raw: true}).success(onSuccess).error(onError);
So you want to know if one string contains two other strings?
You could use this extension which also allows to specify the comparison:
public static bool ContainsAll(this string text, StringComparison comparison = StringComparison.CurrentCulture, params string[]parts)
{
return parts.All(p => text.IndexOf(p, comparison) > -1);
}
Use it in this way (you can also omit the StringComparison
):
bool containsAll = d.ContainsAll(StringComparison.OrdinalIgnoreCase, a, b);