You had thead
in your selector, but there is no thead
in your table. Also you had your selectors backwards. As you mentioned above, you wanted to be adding the tr
class to the th
, not vice-versa (although your comment seems to contradict what you wrote up above).
$('tr th').each(function(index){ if($('tr td').eq(index).attr('class') != ''){ // get the class of the td var tdClass = $('tr td').eq(index).attr('class'); // add it to this th $(this).addClass(tdClass ); } });
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');
You can use Jquery's on method and listen for the scroll
event.
I have run into this issue When I recently upgraded my IntelliJ version to 2020.3
. I had to disable a plugin to solve this issue. The name of the plugin is Thrift Support
.
Steps to disable the plugin is following:
Command + ,
in mac.plugins
.Thrift Support
plugin in the search window. Click on the tick box icon to deselect it.For more detail please refer to this link java.lang.UnsupportedClassVersionError 2020.3 version intellij. I found this comment in the above link which has worked for me.
bin zhao commented 31 Dec 2020 08:00 @Lejia Chen @Tobias Schulmann Workflow My IDEA3.X didn't installed Erlang plugin, I disabled Thrift Support 1.4.0 and it worked. Both IDEA 3.0 and 3.1 have the same problem.
flutter doctor --android-licenses
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
yes | ~/Library/Android/sdk/tools/bin/sdkmanager --licenses
For others who have the same problem in IntelliJ:
upgrading to the latest IDE version should resolve the issue.
In my case going from 2018.1 -> 2018.3.3
As the error says your router link should match the existing routes configured
It should be just routerLink="/about
"
I was facing issue. The tools
folder was also missing from the Android SDK
folder. I believe tools
folder appears only after installing Android SDL tools(obsolete
). This option was not available for me.
Solution:
I upgraded the Java
from version 8 to version 12 and I was able to install the tools. You may still get the error Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
while giving the command flutter doctor -v
. Run the command flutter doctor --android-licenses
, the licences will be reviewed when you click yes
every time this question appears Accept? (y/N):
Hopefully it will help someone.
This worked for me!
App/build.gradle
//Add this....Keep both version same
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
I had a tough time figuring out this solution just adding the working sdkmanager.bat
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem sdkmanager startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%..
@rem Add default JVM options here. You can also use JAVA_OPTS and SDKMANAGER_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Dcom.android.sdklib.toolsdir=%~dp0\.."
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\lib\sdklib-25.3.1.jar;%APP_HOME%\lib\layoutlib-api-25.3.1.jar;%APP_HOME%\lib\dvlib-25.3.1.jar;%APP_HOME%\lib\repository-25.3.1.jar;%APP_HOME%\lib\gson-2.2.4.jar;%APP_HOME%\lib\commons-compress-1.8.1.jar;%APP_HOME%\lib\httpclient-4.1.1.jar;%APP_HOME%\lib\httpmime-4.1.jar;%APP_HOME%\lib\common-25.3.1.jar;%APP_HOME%\lib\kxml2-2.3.0.jar;%APP_HOME%\lib\annotations-25.3.1.jar;%APP_HOME%\lib\annotations-12.0.jar;%APP_HOME%\lib\jimfs-1.1.jar;%APP_HOME%\lib\httpcore-4.1.jar;%APP_HOME%\lib\commons-logging-1.1.1.jar;%APP_HOME%\lib\commons-codec-1.4.jar;%APP_HOME%\lib\guava-18.0.jar
@rem Execute sdkmanager
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% -XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee %JAVA_OPTS% %SDKMANAGER_OPTS% -classpath "%CLASSPATH%" com.android.sdklib.tool.SdkManagerCli %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable SDKMANAGER_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%SDKMANAGER_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
For me, I had ~6 different Nuget packages to update and when I selected Microsoft.AspNetCore.All first, I got the referenced error.
I started at the bottom and updated others first (EF Core, EF Design Tools, etc), then when the only one that was left was Microsoft.AspNetCore.All it worked fine.
you should know that :
@Before from junit4 goes with @Test : "import org.junit.Test"
AND
@BeforeEach from Junit5 goes with : "import org.junit.jupiter.api.Test"
so make sure you are using the imports from the same version of Junit , otherwise it w'ont Work I guess.
Best way is to use below command
$ wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip
$ unzip \platform-tools-latest-linux.zip
$ sudo cp platform-tools/adb /usr/bin/adb
$ sudo cp platform-tools/fastboot /usr/bin/fastboot
Now run adb version to verify it’s been updated.
Here is a plunker showing how you can use it with the ngClass
directive.
I'm demonstrating with div
s instead of img
s though.
Template:
<ul>
<li><div [ngClass]="{'this-is-a-class': selectedIndex == 1}" (click)="setSelected(1)"> </div></li>
<li><div [ngClass]="{'this-is-a-class': selectedIndex == 2}" (click)="setSelected(2)"> </div></li>
<li><div [ngClass]="{'this-is-a-class': selectedIndex == 3}" (click)="setSelected(3)"> </div></li>
</ul>
TS:
export class App {
selectedIndex = -1;
setSelected(id: number) {
this.selectedIndex = id;
}
}
Replace the dependency in the POM.xml file
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.2.3</version>
</dependency>
By the dependency
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
</dependency>
This error shows up when there is Kotlin Compilation Error.
Run the below command to find where there is Kotlin Compilation Error,
gradlew clean assembleDebug (for Windows)
./gradlew clean assembleDebug (for Linux and Mac)
It will show you the exact location on which line there is Kotlin Compilation Error.
When you first read the body, you have to store it so once you're done with it, you can set a new io.ReadCloser
as the request body constructed from the original data. So when you advance in the chain, the next handler can read the same body.
One option is to read the whole body using ioutil.ReadAll()
, which gives you the body as a byte slice.
You may use bytes.NewBuffer()
to obtain an io.Reader
from a byte slice.
The last missing piece is to make the io.Reader
an io.ReadCloser
, because bytes.Buffer
does not have a Close()
method. For this you may use ioutil.NopCloser()
which wraps an io.Reader
, and returns an io.ReadCloser
, whose added Close()
method will be a no-op (does nothing).
Note that you may even modify the contents of the byte slice you use to create the "new" body. You have full control over it.
Care must be taken though, as there might be other HTTP fields like content-length and checksums which may become invalid if you modify only the data. If subsequent handlers check those, you would also need to modify those too!
If you also want to read the response body, then you have to wrap the http.ResponseWriter
you get, and pass the wrapper on the chain. This wrapper may cache the data sent out, which you can inspect either after, on on-the-fly (as the subsequent handlers write to it).
Here's a simple ResponseWriter
wrapper, which just caches the data, so it'll be available after the subsequent handler returns:
type MyResponseWriter struct {
http.ResponseWriter
buf *bytes.Buffer
}
func (mrw *MyResponseWriter) Write(p []byte) (int, error) {
return mrw.buf.Write(p)
}
Note that MyResponseWriter.Write()
just writes the data to a buffer. You may also choose to inspect it on-the-fly (in the Write()
method) and write the data immediately to the wrapped / embedded ResponseWriter
. You may even modify the data. You have full control.
Care must be taken again though, as the subsequent handlers may also send HTTP response headers related to the response data –such as length or checksums– which may also become invalid if you alter the response data.
Putting the pieces together, here's a full working example:
func loginmw(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
log.Printf("Error reading body: %v", err)
http.Error(w, "can't read body", http.StatusBadRequest)
return
}
// Work / inspect body. You may even modify it!
// And now set a new body, which will simulate the same data we read:
r.Body = ioutil.NopCloser(bytes.NewBuffer(body))
// Create a response wrapper:
mrw := &MyResponseWriter{
ResponseWriter: w,
buf: &bytes.Buffer{},
}
// Call next handler, passing the response wrapper:
handler.ServeHTTP(mrw, r)
// Now inspect response, and finally send it out:
// (You can also modify it before sending it out!)
if _, err := io.Copy(w, mrw.buf); err != nil {
log.Printf("Failed to send out response: %v", err)
}
})
}
According to documentation you should set XML configuration:
<jpa:repositories base-package="com.kopylov.repository" />
I had the same issue and solved just add a piece of code, If you are getting this issue means you had already completed all the steps that need to use Firebase. You just need to create a class that extends the Application (public class Application_CrashReport extends Application ) and add this class in mainifest file and In that class just override the below method
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
}
and add MultiDex.install(this); in that method means
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Note :- Don't forget to follow above steps
Hurrah! Adding commons-collections jar files to my project resolved this problem. Two thumbs up to Lucky Sharma.
Solution: Add commons-collections4-4.1.jar file in your build path and try it again. It will work.
You can download it from https://mvnrepository.com/artifact/org.apache.commons/commons-collections4/4.1
If you want to due this in component.ts
HTML:
<button class="class1 class2" (click)="clicked($event)">Click me</button>
Component:
clicked(event) {
event.target.classList.add('class3'); // To ADD
event.target.classList.remove('class1'); // To Remove
event.target.classList.contains('class2'); // To check
event.target.classList.toggle('class4'); // To toggle
}
For more options, examples and browser compatibility visit this link.
Your code was compiled with Java 8.
Either compile your code with an older JDK (compliance level) or run it on a Java 8 JRE.
Hope this helps...
In my case, the table's id column was not set as an Identity column.
Just add those below line in pom.xml file on the top of <modelversion>
tag:
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
I am on cordova, here's what I've done:
- rename your android project, so that there's space for new one
- update JAVA Development Kit to 1.8 (latest one in time of writing this)
- run cordova platform add android
Should work without problems now. Your app hash will change, so if you are using it f.e. for facbeook login, you will need to update it
For me, the problem was solved after I removed jar
file from my project. it seems that one of the jar
files inside my project was using an older version of google play services
.
Even though this answer was too late, I'm adding it because I also went through a horrible time finding answer for the same matter. Only different was, I was struggling with AWS Comprehend Medical API.
At the moment I'm writing this answer, if anyone come across the same issue with any AWS SDKs please downgrade jackson-annotaions or any jackson dependencies to 2.8.* versions. The latest 2.9.* versions does not working properly with AWS SDK for some reason. Anyone have any idea about the reason behind that feel free to comment below.
Just in case if anyone is lazy to google maven repos, I have linked down necessary repos.Check them out!
The issue as previously mentioned is the ngIf
which is causing the view to be undefined. The answer is to use ViewChildren
instead of ViewChild
. I had similar issue where I didn't want a grid to be shown until all the reference data had been loaded.
html:
<section class="well" *ngIf="LookupData != null">
<h4 class="ra-well-title">Results</h4>
<kendo-grid #searchGrid> </kendo-grid>
</section>
Component Code
import { Component, ViewChildren, OnInit, AfterViewInit, QueryList } from '@angular/core';
import { GridComponent } from '@progress/kendo-angular-grid';
export class SearchComponent implements OnInit, AfterViewInit
{
//other code emitted for clarity
@ViewChildren("searchGrid")
public Grids: QueryList<GridComponent>
private SearchGrid: GridComponent
public ngAfterViewInit(): void
{
this.Grids.changes.subscribe((comps: QueryList <GridComponent>) =>
{
this.SearchGrid = comps.first;
});
}
}
Here we are using ViewChildren
on which you can listen for changes. In this case any children with the reference #searchGrid
. Hope this helps.
also try to increase gradle version in your project's build.gradle. It helped me
Try to go to the security credentials on your account page: Click on your name in the top right corner -> My security credentials
Then generate access keys over there and use those access keys in your credentials file (aws configure)
This is an edge case, but you can also get this error if you are building an MFC application with CMake.
In that case, you need to add the following definitions:
ADD_DEFINITIONS(-D_AFXDLL)
SET(CMAKE_MFC_FLAG 2) # or 1 if you are looking for the static library
If you are compiling with unicode, the following properties also need to be added:
set_target_properties(MyApp PROPERTIES
COMPILE_DEFINITIONS
_AFXDLL,_UNICODE,UNICODE,_BIND_TO_CURRENT_CRT_VERSION,_BIND_TO_CURRENT_MFC_VERSION
LINK_FLAGS "/ENTRY:\"wWinMainCRTStartup\""
)
The important part is this:
Cannot find class [com.rakuten.points.persistence.manager.MemberPointSummaryDAOImpl] for bean with name 'MemberPointSummaryDAOImpl' defined in ServletContext resource [/WEB-INF/context/PersistenceManagerContext.xml];
due to:
nested exception is java.lang.ClassNotFoundException: com.rakuten.points.persistence.manager.MemberPointSummaryDAOImpl
According to this log, Spring could not find your MemberPointSummaryDAOImpl
class.
Wrong syntax. Here you are:
insert into user_by_category (game_category,customer_id) VALUES ('Goku','12');
or:
insert into user_by_category ("game_category","customer_id") VALUES ('Kakarot','12');
The second one is normally used for case-sensitive column names.
That version number (51.0) indicates that you are trying to run classes compiled for Java 7. You will need to recompile them for Java 6.
Note, however, that some features may no longer be compatible with Java 6, which is very old, and no longer (publicly) supported by Oracle.
As in Internet Explorer, the javascript method "includes" doesn't support which is leading to the error as below
dijit.form.FilteringSelect TypeError: Object doesn't support property or method 'includes'
So I have changed the JavaScript string method from "includes" to "indexOf" as below
//str1 doesn't match str2 w.r.t index, so it will try to add object
var str1="acd", str2="b";
if(str1.indexOf(str2) == -1)
{
alert("add object");
}
else
{
alert("object not added");
}
For those who are getting Error Unknown URI: content://downloads/public_downloads
.
I managed to solve this by getting a hint given by @Commonsware in this answer. I found out the class FileUtils on GitHub.
Here InputStream
methods are used to fetch file from Download
directory.
// DownloadsProvider
else if (isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
if (id != null && id.startsWith("raw:")) {
return id.substring(4);
}
String[] contentUriPrefixesToTry = new String[]{
"content://downloads/public_downloads",
"content://downloads/my_downloads",
"content://downloads/all_downloads"
};
for (String contentUriPrefix : contentUriPrefixesToTry) {
Uri contentUri = ContentUris.withAppendedId(Uri.parse(contentUriPrefix), Long.valueOf(id));
try {
String path = getDataColumn(context, contentUri, null, null);
if (path != null) {
return path;
}
} catch (Exception e) {}
}
// path could not be retrieved using ContentResolver, therefore copy file to accessible cache using streams
String fileName = getFileName(context, uri);
File cacheDir = getDocumentCacheDir(context);
File file = generateFileName(fileName, cacheDir);
String destinationPath = null;
if (file != null) {
destinationPath = file.getAbsolutePath();
saveFileFromUri(context, uri, destinationPath);
}
return destinationPath;
}
For me, the cause of the error message
No tests found for given includes
was having inadvertently added a .java
test file under my src/test/kotlin
test directory. Upon moving the file to the correct directory, src/test/java
, the test executed as expected again.
AngularJS has some methods called JQlite so we can use it. see link
Select the element in DOM is
angular.element( document.querySelector( '#div1' ) );
add the class like .addClass('alpha');
So finally
var myEl = angular.element( document.querySelector( '#div1' ) );
myEl.addClass('alpha');
For Jar
Add pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
You have to add one jar : jackson-annotations-2.1.2.jar
You can download it from here and add it to the class path
If you are using the gradle then add the following dependency.
compile 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.5.2'
You might need to change your object to an array first. I dont know what export
does, but I assume its expecting an array.
You can either use
Or if its a simple object, you can just typecast it.
$arr = (array) $Object;
for latest Jquery. Simply:
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
See example here: Input and Output binary streams using JERSEY?
Pseudo code would be something like this (there are a few other similar options in above mentioned post):
@Path("file/")
@GET
@Produces({"application/pdf"})
public StreamingOutput getFileContent() throws Exception {
public void write(OutputStream output) throws IOException, WebApplicationException {
try {
//
// 1. Get Stream to file from first server
//
while(<read stream from first server>) {
output.write(<bytes read from first server>)
}
} catch (Exception e) {
throw new WebApplicationException(e);
} finally {
// close input stream
}
}
}
Well, you're getting a java.lang.NoClassDefFoundError
. In your pom.xml
, hibernate-core
version is 3.3.2.GA
and declared after hibernate-entitymanager
, so it prevails. You can remove that dependency, since will be inherited version 3.6.7.Final
from hibernate-entitymanager
.
You're using spring-boot
as parent, so no need to declare version of some dependencies, since they are managed by spring-boot
.
Also, hibernate-commons-annotations
is inherited from hibernate-entitymanager
and hibernate-annotations
is an old version of hibernate-commons-annotations
, you can remove both.
Finally, your pom.xml
can look like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.elsys.internetprogramming.trafficspy.server</groupId>
<artifactId>TrafficSpyService</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
</parent>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cloud-connectors</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
<!-- MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
<properties>
<java.version>1.7</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
<repository>
<id>codehaus</id>
<url>http://repository.codehaus.org/org/codehaus</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
Let me know if you have a problem.
localhost:55828/token
(not localhost:55828/API/token
)[email protected]&password=Test123$&grant_type=password
When you use JavaScript to make post request, you may use following:
$http.post("localhost:55828/token",
"userName=" + encodeURIComponent(email) +
"&password=" + encodeURIComponent(password) +
"&grant_type=password",
{headers: { 'Content-Type': 'application/x-www-form-urlencoded' }}
).success(function (data) {//...
See screenshots below from Postman:
A dynamic $HOME/.zshrc
solution, if you're like me ie. Linux @ work; MBP/A @ home
if [[ $(uname) == "Darwin" ]]; then export OSX=1; fi
if [[ $(uname) == "Linux" ]]; then export LINUX=1; fi
if [[ -n $OSX ]]; then
export JAVA_HOME=$(/usr/libexec/java_home)
else
export JAVA_HOME=/usr/lib/jvm/default-java
fi
I had same issue using different dependancy what helped me is to set scope to compile.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>compile</scope>
</dependency>
I experienced the same issue, same version of Chrome though it's unrelated to the issue. With the developer console I captured an instance of the request that spawned this, and it is an API call served by ad.doubleclick.net
. Specifically, this resource returns a response with Content-Disposition: attachment; filename="f.txt"
.
The URL I happened to capture was https://ad.doubleclick.net/adj/N7412.226578.VEVO/B8463950.115078190;sz=300x60...
Per curl:
$ curl -I 'https://ad.doubleclick.net/adj/N7412.226578.VEVO/B8463950.115078190;sz=300x60;click=https://2975c.v.fwmrm.net/ad/l/1?s=b035&n=10613%3B40185%3B375600%3B383270&t=1424475157058697012&f=&r=40185&adid=9201685&reid=3674011&arid=0&auid=&cn=defaultClick&et=c&_cc=&tpos=&sr=0&cr=;ord=435266097?'
HTTP/1.1 200 OK
P3P: policyref="https://googleads.g.doubleclick.net/pagead/gcn_p3p_.xml", CP="CURa ADMa DEVa TAIo PSAo PSDo OUR IND UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"
Date: Fri, 20 Feb 2015 23:35:38 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, must-revalidate
Content-Type: text/javascript; charset=ISO-8859-1
X-Content-Type-Options: nosniff
Content-Disposition: attachment; filename="f.txt"
Server: cafe
X-XSS-Protection: 1; mode=block
Set-Cookie: test_cookie=CheckForPermission; expires=Fri, 20-Feb-2015 23:50:38 GMT; path=/; domain=.doubleclick.net
Alternate-Protocol: 443:quic,p=0.08
Transfer-Encoding: chunked
Accept-Ranges: none
Vary: Accept-Encoding
"Allocation Failure" is a cause of GC cycle to kick in.
"Allocation Failure" means that no more space left in Eden to allocate object. So, it is normal cause of young GC.
Older JVM were not printing GC cause for minor GC cycles.
"Allocation Failure" is almost only possible cause for minor GC. Another reason for minor GC to kick could be CMS remark phase (if +XX:+ScavengeBeforeRemark
is enabled).
This is what worked for me:
1) add commons-logging.jar to the WEB-INF/lib folder
2) Add this jar as a maven dependency, e.g. add this to the pom.xml:
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
3) Maven install
4) Run the server.
Hope it helps.
The error is:
Can not deserialize instance of java.lang.String out of START_ARRAY token at [Source: line: 1, column: 1095] (through reference chain: JsonGen["platforms"])
In JSON, platforms
look like this:
"platforms": [
{
"platform": "iphone"
},
{
"platform": "ipad"
},
{
"platform": "android_phone"
},
{
"platform": "android_tablet"
}
]
So try change your pojo to something like this:
private List platforms;
public List getPlatforms(){
return this.platforms;
}
public void setPlatforms(List platforms){
this.platforms = platforms;
}
EDIT: you will need change mobile_networks
too. Will look like this:
private List mobile_networks;
public List getMobile_networks() {
return mobile_networks;
}
public void setMobile_networks(List mobile_networks) {
this.mobile_networks = mobile_networks;
}
The Exception it self says it all java.lang.ClassNotFoundException: org.json.JSONObject
You have not added the necessary jar file which will be having org.json.JSONObject
class to your classpath
.
You can Download it From Here
You can also get all the result always as array by changing
// application/config/database.php
'fetch' => PDO::FETCH_CLASS,
// to
'fetch' => PDO::FETCH_ASSOC,
Hope this will help.
If you use IntelliJ IDEA, try the following:
In my case, I was getting value of <input type="text">
with JQuery and I did it like this:
var newUserInfo = { "lastName": inputLastName[0].value, "userName": inputUsername[0].value,
"firstName": inputFirstName[0] , "email": inputEmail[0].value}
And I was constantly getting this exception
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: java.io.PushbackInputStream@39cb6c98; line: 1, column: 54] (through reference chain: com.springboot.domain.User["firstName"]).
And I banged my head for like an hour until I realised that I forgot to write .value
after this"firstName": inputFirstName[0]
.
So, the correct solution was:
var newUserInfo = { "lastName": inputLastName[0].value, "userName": inputUsername[0].value,
"firstName": inputFirstName[0].value , "email": inputEmail[0].value}
I came here because I had this problem and I hope I save someone else hours of misery.
Cheers :)
Multiple Cookies,Multiple Claims
public class ClaimsCookie
{
private readonly ClaimsPrincipal _user;
private readonly HttpContext _httpContext;
public ClaimsCookie(ClaimsPrincipal user, HttpContext httpContext = null)
{
_user = user;
_httpContext = httpContext;
}
public string GetValue(CookieName cookieName, KeyName keyName)
{
var principal = _user as ClaimsPrincipal;
var cp = principal.Identities.First(i => i.AuthenticationType == ((CookieName)cookieName).ToString());
return cp.FindFirst(((KeyName)keyName).ToString()).Value;
}
public async void SetValue(CookieName cookieName, KeyName[] keyName, string[] value)
{
if (keyName.Length != value.Length)
{
return;
}
var principal = _user as ClaimsPrincipal;
var cp = principal.Identities.First(i => i.AuthenticationType == ((CookieName)cookieName).ToString());
for (int i = 0; i < keyName.Length; i++)
{
if (cp.FindFirst(((KeyName)keyName[i]).ToString()) != null)
{
cp.RemoveClaim(cp.FindFirst(((KeyName)keyName[i]).ToString()));
cp.AddClaim(new Claim(((KeyName)keyName[i]).ToString(), value[i]));
}
}
await _httpContext.SignOutAsync(CookieName.UserProfilCookie.ToString());
await _httpContext.SignInAsync(CookieName.UserProfilCookie.ToString(), new ClaimsPrincipal(cp),
new AuthenticationProperties
{
IsPersistent = bool.Parse(cp.FindFirst(KeyName.IsPersistent.ToString()).Value),
AllowRefresh = true
});
}
public enum CookieName
{
CompanyUserProfilCookie = 0, UserProfilCookie = 1, AdminPanelCookie = 2
}
public enum KeyName
{
Id, Name, Surname, Image, IsPersistent
}
}
Add the jar files on class path NOT modulepath.
I had a broken virtual env due to a Homebrew reinstall of python (thereby broken symlinks) and also a few "sudo pip install"s I had done earlier. Weizhong's tips were very helpful in fixing the issues without having to reinstall packages. I also had to do the following for the mixed permissions problem.
sudo chown -R my_username lib/python2.7/site-packages
@Balamanigandan your Original Post :- PHP Notice: Trying to get property of non-object error
Your are trying to access the Null Object. From AngularJS your are not passing any Objects instead you are passing the $_GET element. Try by using $_GET['uid']
instead of $objData->token
Try this
$(document).ready(function() {
$(".tab").click(function () {
$(".tab").removeClass("active");
// $(".tab").addClass("active"); // instead of this do the below
$(this).addClass("active");
});
});
when you are using $(".tab").addClass("active");
, it targets all the elements with class name .tab
. Instead when you use this
it looks for the element which has an event, in your case the element which is clicked.
Hope this helps you.
Below code work for me in web.xml file
<servlet>
<servlet-name>WebService</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.example.demo.webservice</param-value>
//Package
</init-param>
<init-param>
<param-name>unit:WidgetPU</param-name>
<param-value>persistence/widget</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WebService</servlet-name>
<url-pattern>/webservices/*</url-pattern>
</servlet-mapping>
you can also use andSelf()
method to get wrapper DOM contain then find()
can be work around as your idea
$(function() {_x000D_
$('.slide-link').andSelf().find('[data-slide="0"]').addClass('active');_x000D_
})
_x000D_
.active {_x000D_
background: green;_x000D_
}
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>_x000D_
<a class="slide-link" href="#" data-slide="0">1</a>_x000D_
<a class="slide-link" href="#" data-slide="1">2</a>_x000D_
<a class="slide-link" href="#" data-slide="2">3</a>
_x000D_
Maybe you can try the following :
var i = 0;
function AjaxSendForm(url, placeholder, form, append) {
var data = $(form).serialize();
append = (append === undefined ? false : true); // whatever, it will evaluate to true or false only
$.ajax({
type: 'POST',
url: url,
data: data,
beforeSend: function() {
// setting a timeout
$(placeholder).addClass('loading');
i++;
},
success: function(data) {
if (append) {
$(placeholder).append(data);
} else {
$(placeholder).html(data);
}
},
error: function(xhr) { // if error occured
alert("Error occured.please try again");
$(placeholder).append(xhr.statusText + xhr.responseText);
$(placeholder).removeClass('loading');
},
complete: function() {
i--;
if (i <= 0) {
$(placeholder).removeClass('loading');
}
},
dataType: 'html'
});
}
This way, if the beforeSend
statement is called before the complete
statement i
will be greater than 0 so it will not remove the class. Then only the last call will be able to remove it.
I cannot test it, let me know if it works or not.
Hibernate queries are case sensitive with property names (because they end up relying on getter/setter methods on the @Entity
).
Make sure you refer to the property as fileName
in the Criteria query, not filename
.
Specifically, Hibernate will call the getter method of the filename
property when executing that Criteria query, so it will look for a method called getFilename()
. But the property is called FileName
and the getter getFileName()
.
So, change the projection like so:
criteria.setProjection(Projections.property("fileName"));
shortest and simplified version of @Rosdi Kasim'd answer is
string claimvalue = ((System.Security.Claims.ClaimsIdentity)User.Identity).
FindFirst("claimname").Value;
Claimname
is the claim you want to retrieve i.e if you are looking for "StreedAddress" claim then the above answer will be like this
string claimvalue = ((System.Security.Claims.ClaimsIdentity)User.Identity).
FindFirst("StreedAddress").Value;
My solution: Input: 11381 (in ms) Output: 00 : 00 : 11.381
timeformatter(time) {
console.log(time);
let miliSec = String(time%1000);
time = (time - miliSec)/1000;
let seconds = String(time%60);
time = (time - seconds)/60;
let minutes = String(time%60);
time = (time-minutes)/60;
let hours = String(time)
while(miliSec.length != 3 && miliSec.length<3 && miliSec.length >=0) {
miliSec = '0'+miliSec;
}
while(seconds.length != 2 && seconds.length<3 && seconds.length >=0) {
seconds = '0'+seconds;
}
while(minutes.length != 2 && minutes.length<3 && minutes.length >=0) {
minutes = '0'+minutes;
}
while(hours.length != 2 && hours.length<3 && hours.length >=0) {
hours = '0'+hours;
}
return `${hours} : ${minutes} : ${seconds}.${miliSec}`
}
Try this:
echo $array[0]->id;
You specified both jQuery and Javascript in the tags so here's both approaches.
jQuery
var selector = '.nav li';
$(selector).on('click', function(){
$(selector).removeClass('active');
$(this).addClass('active');
});
Fiddle: http://jsfiddle.net/bvf9u/
Pure Javascript:
var selector, elems, makeActive;
selector = '.nav li';
elems = document.querySelectorAll(selector);
makeActive = function () {
for (var i = 0; i < elems.length; i++)
elems[i].classList.remove('active');
this.classList.add('active');
};
for (var i = 0; i < elems.length; i++)
elems[i].addEventListener('mousedown', makeActive);
Fiddle: http://jsfiddle.net/rn3nc/1
jQuery with event delegation:
Please note that in approach 1, the handler is directly bound to that element. If you're expecting the DOM to update and new li
s to be injected, it's better to use event delegation and delegate to the next element that will remain static, in this case the .nav
:
$('.nav').on('click', 'li', function(){
$('.nav li').removeClass('active');
$(this).addClass('active');
});
Fiddle: http://jsfiddle.net/bvf9u/1/
The subtle difference is that the handler is bound to the .nav
now, so when you click the li
the event bubbles up the DOM to the .nav
which invokes the handler if the element clicked matches your selector
argument. This means new elements won't need a new handler bound to them, because it's already bound to an ancestor.
It's really quite interesting. Read more about it here: http://api.jquery.com/on/
I'm not sure what happened in your case that fixed the issue, but your issue was on this line:
Caused by: java.lang.NoClassDefFoundError: javax/xml/rpc/handler/soap/SOAPMessageContext
You need to add jaxrpc-api.jar
to your /lib
s or add
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc-api</artifactId>
<version>x.x.x</version>
</dependency>
to your maven dependencies.
Check in Deployment Assembly,
I have the same error, when i generate the war file with the "maven clean install" way and deploy manualy, it works fine, but when i use the runtime enviroment (eclipse) the problems come.
The solution for me (for eclipse IDE) go to: "proyect properties" --> "Deployment Assembly" --> "Add" --> "the jar you need", in my case java "build path entries". Maybe can help a litle!
Almost all of the answers here are either unnecessarily complex (glob pattern matching) or rely on additional 3rd party libraries. You can do this in 2 lines using everything Pandas and python (all versions) already have built in.
For a few files - 1 liner:
df = pd.concat(map(pd.read_csv, ['data/d1.csv', 'data/d2.csv','data/d3.csv']))
For many files:
from os import listdir
filepaths = [f for f in listdir("./data") if f.endswith('.csv')]
df = pd.concat(map(pd.read_csv, filepaths))
This pandas line which sets the df utilizes 3 things:
pd.read_csv()
) the iterable (our list) which is every csv element
in filepaths).When you use mysql_fetch_object
, you get an object (of class stdClass) with all fields for the row inside of it.
Use mysql_fetch_field
instead of mysql_fetch_object
, that will give you the first field of the result set (id
in your case). The docs are here
If you are running spring cloud application, make sure your boot version matches cloud version. You can check the version compatibility matrix at the bottom of this page : https://spring.io/projects/spring-cloud.
Error: java.lang.NoSuchMethodError: javax.persistence.JoinTable.indexes()[Ljavax/persistence/Index;
The only thing that solved my problem was removing the following dependency in pom.xml:
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
And replace it for:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
Hope it helps someone.
This is because of a higher JDK during compile time and lower JDK during runtime. So you just need to update your JDK version, possible to JDK 7
You may also check Unsupported major.minor version 51.0
Solution by Mosh Hamedani
Creating a StopWatch function constructor.
if you want to access the duration local variable you need to define a property using Object.defineProperty. It's useful when you want to create a read-only property.
the value of the key property.
We want to create a Read-only property so we pass an object as a value. The object contain a get method that return the duration local variable. in this way we cannot change the property only get it.
The trick is to use Date() object to calculate the time.
Reference the code below
function StopWatch() {
let startTime,
endTime,
isRunning,
duration = 0;
this.start = function () {
if (isRunning) throw new Error("StopWatch has already been started.");
isRunning = true;
startTime = new Date();
};
this.stop = function () {
if (!isRunning) throw new Error("StopWatch has already been stop.");
isRunning = false;
endTime = new Date();
const seconds = (endTime.getTime() - startTime.getTime()) / 1000;
duration += seconds;
};
this.reset = function () {
duration = 0;
startTime = null;
endTime = null;
isRunning = false;
};
Object.defineProperty(this, "duration", {
get: function () {
return duration;
},
});
}
const sw = new StopWatch();
Try this,
$('.nav-list li').click(function() {
$('.nav-list li.active').removeClass('active');
$(this).addClass('active');
});
In your context $(this)
will points to the UL
element not the Li
. Hence you are not getting the expected results.
I know this is extremely old, but I understand that this error type is a common mistake for beginners to make since most beginners will call their functions upon their header element being loaded. Seeing as this solution is not addressed at all in this thread, I'll add it. It is very likely that this javascript function was placed before the actual html was loaded. Remember, if you immediately call your javascript before the document is ready then elements requiring an element from the document might find an undefined value.
Try like
<script>
function Data(string)
{
$('.filter').removeClass('active');
$(this).parent('.filter').addClass('active') ;
}
</script>
For the class selector you need to use .
before the classname.And you need to add the class for the parent. Bec you are clicking on anchor tag not the filter
.
I have had the same problem in my project. I used an IntelliJ Idea 14 and Maven 8. And what I've noticed is that when I added a tomcat destination to to IDE it automaticly linked two jars from tomcat lib directory, they were servlet-api and jsp-api. Also I had them in my pom.xml. I killed a whole day trying to figure out why I'm getting java.lang.ClassNotFoundException: org.apache.jsp.index_jsp. And kewpiedoll99 is right. That is because there are dependency conflicts. When I added provided to those two jars in my pom.xml I found a happiness :)
If you have simple dropdown like:
<select name="status" id="status">
<option value="1">Active</option>
<option value="0">Inactive</option>
</select>
Then you can use this code for getting value:
$(function(){
$("#status").change(function(){
var status = this.value;
alert(status);
if(status=="1")
$("#icon_class, #background_class").hide();// hide multiple sections
});
});
Didn't work with ODBC-Bridge for me too. I got the way around to initialize ODBC connection using ODBC driver.
import java.sql.*;
public class UserLogin
{
public static void main(String[] args)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// C:\\databaseFileName.accdb" - location of your database
String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + "C:\\emp.accdb";
// specify url, username, pasword - make sure these are valid
Connection conn = DriverManager.getConnection(url, "username", "password");
System.out.println("Connection Succesfull");
}
catch (Exception e)
{
System.err.println("Got an exception! ");
System.err.println(e.getMessage());
}
}
}
I feel a bit stupid on this but let this be a lesson to everyone...Make sure you target the right selector!
Basically the console wasn't logging anything because this particular code snippet was attempting to grab the scrolling area of my window, when in fact my code was setup differently to scroll an entire DIV instead. As soon as I changed:
$(window).scroll(function() {
to this:
$('#scroller').scroll(function() {
The console started logging the correct messages.
If you are using Eclipse try Project -> Clean
var selector = '.classname';
$(selector).on('click', function(){
$(selector).removeClass('classname');
$(this).addClass('classname');
});
You can also use
$('#myModal').hasClass('show');
For one-dimensional arrays:
$array = (array)$class;
For multi-dimensional array:
function stdToArray($obj){
$reaged = (array)$obj;
foreach($reaged as $key => &$field){
if(is_object($field))$field = stdToArray($field);
}
return $reaged;
}
Personally I like to validate the form on submit and if there are errors, just return false.
$('form').submit(function() {
var error;
if ( !$('input').val() ) {
error = true
}
if (error) {
alert('there are errors')
return false
}
});
You can override bean definitions with mocks with spring-reinject https://github.com/sgri/spring-reinject/
use this Tutorial
<?php
function objectToArray($d) {
if (is_object($d)) {
// Gets the properties of the given object
// with get_object_vars function
$d = get_object_vars($d);
}
if (is_array($d)) {
/*
* Return array converted to object
* Using __FUNCTION__ (Magic constant)
* for recursive call
*/
return array_map(__FUNCTION__, $d);
}
else {
// Return array
return $d;
}
}
function arrayToObject($d) {
if (is_array($d)) {
/*
* Return array converted to object
* Using __FUNCTION__ (Magic constant)
* for recursive call
*/
return (object) array_map(__FUNCTION__, $d);
}
else {
// Return object
return $d;
}
}
// Create new stdClass Object
$init = new stdClass;
// Add some test data
$init->foo = "Test data";
$init->bar = new stdClass;
$init->bar->baaz = "Testing";
$init->bar->fooz = new stdClass;
$init->bar->fooz->baz = "Testing again";
$init->foox = "Just test";
// Convert array to object and then object back to array
$array = objectToArray($init);
$object = arrayToObject($array);
// Print objects and array
print_r($init);
echo "\n";
print_r($array);
echo "\n";
print_r($object);
//OUTPUT
stdClass Object
(
[foo] => Test data
[bar] => stdClass Object
(
[baaz] => Testing
[fooz] => stdClass Object
(
[baz] => Testing again
)
)
[foox] => Just test
)
Array
(
[foo] => Test data
[bar] => Array
(
[baaz] => Testing
[fooz] => Array
(
[baz] => Testing again
)
)
[foox] => Just test
)
stdClass Object
(
[foo] => Test data
[bar] => stdClass Object
(
[baaz] => Testing
[fooz] => stdClass Object
(
[baz] => Testing again
)
)
[foox] => Just test
)
If you are using Python 3, it is recommended to simply call super() without any argument:
class Car(object):
condition = "new"
def __init__(self, model, color, mpg):
self.model = model
self.color = color
self.mpg = mpg
class ElectricCar(Car):
def __init__(self, battery_type, model, color, mpg):
self.battery_type=battery_type
super().__init__(model, color, mpg)
car = ElectricCar('battery', 'ford', 'golden', 10)
print car.__dict__
Do not call super with class as it may lead to infinite recursion exceptions as per this answer.
Use parseJSON jquery method to covert string into object
var objData = jQuery.parseJSON(data);
Now you can write code
$('#result').html(objData .status +':' + objData .message);
This is my solution
var error=0;
var test = [" ", " "];
if(test[0].match(/^\s*$/g)) {
$("#output").html("MATCH!");
error+=1;
} else {
$("#output").html("no_match");
}
you forgotten to add the sqlserver.jar
in eclipse external library
follow the process to add jar files
The issue is caused because of event bubbling. The first part of your code to add .grown
works fine.
The second part "removing grown class" on clicking the link doesn't work as expected as both the handler for .close_button
and .clickable
are executed. So it removes and readd the grown
class to the div
.
You can avoid this by using e.stopPropagation()
inside .close_button
click handler to avoid the event from bubbling.
DEMO: http://jsfiddle.net/vL8DP/
Full Code
$(document).on('click', '.clickable', function () {
$(this).addClass('grown').removeClass('spot');
}).on('click', '.close_button', function (e) {
e.stopPropagation();
$(this).closest('.clickable').removeClass('grown').addClass('spot');
});
Are you looking something like this short and effective:
$('div').on('click',function(){
$('div').removeClass('active');
$(this).addClass('active');
});
you can simply add a general class 'active' for selected div. when a div is clicked, remove the 'active' class, and add it to the clicked div.
I know this question is for Bootstrap 3, but as some Bootstrap 4 related question are redirected to this one as duplicates, here's the snippet Bootstrap 4-compatible:
$.validator.setDefaults({
highlight: function(element) {
$(element).closest('.form-group').addClass('has-danger');
},
unhighlight: function(element) {
$(element).closest('.form-group').removeClass('has-danger');
},
errorElement: 'small',
errorClass: 'form-control-feedback d-block',
errorPlacement: function(error, element) {
if(element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else if(element.prop('type') === 'checkbox') {
error.appendTo(element.parent().parent().parent());
} else if(element.prop('type') === 'radio') {
error.appendTo(element.parent().parent().parent());
} else {
error.insertAfter(element);
}
},
});
The few differences are:
has-danger
instead of has-error
After Struggling a bit with Arzoo International flight API, I've finally found the solution and the code simply works absolutely great with me. Here are the complete working code:
//Store your XML Request in a variable
$input_xml = '<AvailRequest>
<Trip>ONE</Trip>
<Origin>BOM</Origin>
<Destination>JFK</Destination>
<DepartDate>2013-09-15</DepartDate>
<ReturnDate>2013-09-16</ReturnDate>
<AdultPax>1</AdultPax>
<ChildPax>0</ChildPax>
<InfantPax>0</InfantPax>
<Currency>INR</Currency>
<PreferredClass>E</PreferredClass>
<Eticket>true</Eticket>
<Clientid>777ClientID</Clientid>
<Clientpassword>*Your API Password</Clientpassword>
<Clienttype>ArzooINTLWS1.0</Clienttype>
<PreferredAirline></PreferredAirline>
</AvailRequest>';
Now I've made a little changes in the above curl_setopt declaration as follows:
$url = "http://59.162.33.102:9301/Avalability";
//setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// Following line is compulsary to add as it is:
curl_setopt($ch, CURLOPT_POSTFIELDS,
"xmlRequest=" . $input_xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
$data = curl_exec($ch);
curl_close($ch);
//convert the XML result into array
$array_data = json_decode(json_encode(simplexml_load_string($data)), true);
print_r('<pre>');
print_r($array_data);
print_r('</pre>');
That's it the code works absolutely fine for me. I really appreciate @hakre & @Lucas For their wonderful support.
More recently, I have found that other factors will also cause this error. I had an AES.h, AES.cpp containing a AES class and it gave this same unhelpful error. Only when I renamed to Encryption.h, Encryption.cpp and Encryption as the class name did it suddenly start working. There were no other code changes.
jQuery doesnt have a method to provide the md5 of a string. So you need to use some external script. There is a plugin called jQuery MD5. and it gives you number of methods to achieve md5. Few of those are
Create (hex-encoded) MD5 hash of a given string value:
var md5 = $.md5('value');
Create (hex-encoded) HMAC-MD5 hash of a given string value and key:
var md5 = $.md5('value', 'key');
Create raw MD5 hash of a given string value:
var md5 = $.md5('value', null, true);
Create raw HMAC-MD5 hash of a given string value and key:
var md5 = $.md5('value', 'key', true);
This might do what you want... Check the snippet here. jQuery MD5
Please use following php function to convert php stdClass to array
get_object_vars($data)
The error SyntaxError: Unexpected token <
likely means the API endpoint didn't return JSON in its document body, such as due to a 404.
In this case, it expects to find a {
(start of JSON); instead it finds a <
(start of a heading element).
Successful response:
<html>
<head></head>
<body>
{"foo": "bar", "baz": "qux"}
</body>
</html>
Not-found response:
<html>
<head></head>
<body>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p>
</body>
</html>
Try visiting the data endpoint's URL in your browser to see what's returned.
From version 4.x, only Android SDK 24+ is supported by default, and androidx is required.
Add the following to your build.gradle file:
repositories {
jcenter()
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.1.0'
implementation 'androidx.appcompat:appcompat:1.0.2'
}
android {
buildToolsVersion '28.0.3' // Older versions may give compile errors
}
Older SDK versions
For Android SDK versions < 24, you can downgrade zxing:core to 3.3.0 or earlier for Android 14+ support:
repositories {
jcenter()
}
dependencies {
implementation('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.zxing:core:3.3.0'
}
android {
buildToolsVersion '28.0.3'
}
You'll also need this in your Android manifest:
<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
Source : https://github.com/journeyapps/zxing-android-embedded
This should fix the error
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</plugin>
I had met a similar problem, after i add a scope property of servlet dependency in pom.xml
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
Then it was ok . maybe that will help you.
I wanted a pure html approach as I wanted to collapse and expand html that was added on the fly via a template! I came up with this...
https://jsfiddle.net/3mguht2y/1/
var noJavascript = ":)";
Which might be of use to someone :)
Please try after removing divs from formor try to use onclick method on submit button.
Be careful with your tests. If you in your form you put the same email as the email address which must receive it will be directly in spam :)
Here are few pointers/suggestions for investigation
vote
method which creates a fresh HTTP connection.HttpClient
instance to post to the server. This way it wont create too many connections from the client side. HttpClient
needs to be shut and hence call httpclient.getConnectionManager().shutdown();
to release the resources used by the connections. I am using bootstrap navigation
This did the job for me including active main dropdown's and the active children
$(document).ready(function () {
var url = window.location;
// Will only work if string in href matches with location
$('ul.nav a[href="' + url + '"]').parent().addClass('active');
// Will also work for relative and absolute hrefs
$('ul.nav a').filter(function () {
return this.href == url;
}).parent().addClass('active').parent().parent().addClass('active');
});
This error means you didn't add some of dependencies.
You can use uploadify this is the best multiupload jquery plugin i have used.
The implementation is easy, the browser support is perfect.
For sync calls you can use the method below:
function sleep(milliseconds) {
var start = new Date().getTime();
for (var i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
}
}
The headers only remain fixed when the UITableViewStyle
property of the table is set to UITableViewStylePlain
. If you have it set to UITableViewStyleGrouped
, the headers will scroll up with the cells.
Building off jeroenk's answer, here's the rundown:
$('button').addClass('disabled'); // Disables visually
$('button').prop('disabled', true); // Disables visually + functionally
$('input[type=button]').addClass('disabled'); // Disables visually
$('input[type=button]').prop('disabled', true); // Disables visually + functionally
$('a').addClass('disabled'); // Disables visually
$('a').prop('disabled', true); // Does nothing
$('a').attr('disabled', 'disabled'); // Disables visually
See fiddle
Either remove the below code from the pom.xml or correct your java version to make it work.
<plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.0</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin>
If you are having this issue and you are performing a populate somewhere along the lines, see this Mongoose issue.
Update to Mongoose 4.0 and the issue has been fixed.
As others have noted, embedding function pointers directly inside your structure is usually reserved for special purposes, like a callback function.
What you probably want is something more like a virtual method table.
typedef struct client_ops_t client_ops_t;
typedef struct client_t client_t, *pno;
struct client_t {
/* ... */
client_ops_t *ops;
};
struct client_ops_t {
pno (*AddClient)(client_t *);
pno (*RemoveClient)(client_t *);
};
pno AddClient (client_t *client) { return client->ops->AddClient(client); }
pno RemoveClient (client_t *client) { return client->ops->RemoveClient(client); }
Now, adding more operations does not change the size of the client_t
structure. Now, this kind of flexibility is only useful if you need to define many kinds of clients, or want to allow users of your client_t
interface to be able to augment how the operations behave.
This kind of structure does appear in real code. The OpenSSL BIO layer looks similar to this, and also UNIX device driver interfaces have a layer like this.
Try this HTML
<a href="#" data-toggle="popover" data-popover-target="#popover-content-1">Do Popover 1</a>
<a href="#" data-toggle="popover" data-popover-target="#popover-content-2">Do Popover</a>
<div id="popover-content-1" style="display: none">Content 1</div>
<div id="popover-content-2" style="display: none">Content 2</div>
jQuery:
$(function() {
$('[data-toggle="popover"]').each(function(i, obj) {
var popover_target = $(this).data('popover-target');
$(this).popover({
html: true,
trigger: 'focus',
placement: 'right',
content: function(obj) {
return $(popover_target).html();
}
});
});
});
I have run into problems in the past with IE and the css:hover selector so the approach that I have taken, is to use a custom directive.
.directive('hoverClass', function () {
return {
restrict: 'A',
scope: {
hoverClass: '@'
},
link: function (scope, element) {
element.on('mouseenter', function() {
element.addClass(scope.hoverClass);
});
element.on('mouseleave', function() {
element.removeClass(scope.hoverClass);
});
}
};
})
then on the element itself you can add the directive with the class names that you want enabled when the mouse is over the the element for example:
<li data-ng-repeat="item in social" hover-class="hover tint" class="social-{{item.name}}" ng-mouseover="hoverItem(true);" ng-mouseout="hoverItem(false);"
index="{{$index}}"><i class="{{item.icon}}"
box="course-{{$index}}"></i></li>
This should add the class hover and tint when the mouse is over the element and doesn't run the risk of a scope variable name collision. I haven't tested but the mouseenter and mouseleave events should still bubble up to the containing element so in the given scenario the following should still work
<div hover-class="hover" data-courseoverview data-ng-repeat="course in courses | orderBy:sortOrder | filter:search"
data-ng-controller ="CourseItemController"
data-ng-class="{ selected: isSelected }">
providing of course that the li's are infact children of the parent div
Use above annotation if someone is facing :--org.hibernate.jpa.HibernatePersistenceProvider persistence provider when it attempted to create the container entity manager factory for the paymentenginePU persistence unit. The following error occurred: [PersistenceUnit: paymentenginePU] Unable to build Hibernate SessionFactory ** This is a solution if you are using Audit table.@Audit
Use:- @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) on superclass.
You should use the following:
$('#gentab').on('click', 'a.tabclick', function(event) {
event.preventDefault();
var liId = $(this).closest("li").attr("id");
alert(liId);
});
This will attach your event to any anchors within the #gentab
element,
reducing the scope of having to check the whole document
element tree and increasing efficiency.
Your selector is missing a .
and though you say you want to change the border-color
- you're adding and removing a class that sets the background-color
The javax.mail-api
artifact is only good for compiling against.
You actually need to run code, so you need a complete implementation of JavaMail API. Use this:
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
NOTE: The version number will probably differ. Check the latest version here.
Your calls are made recursively which pushes functions on to the stack infinitely that causes max call stack exceeded error due to recursive behavior. Instead try using setTimeout which is a callback.
Also based on your markup your selector is wrong. it should be #advisersDiv
function fadeIn() {
$('#pulseDiv').find('div#advisersDiv').delay(400).addClass("pulse");
setTimeout(fadeOut,1); //<-- Provide any delay here
};
function fadeOut() {
$('#pulseDiv').find('div#advisersDiv').delay(400).removeClass("pulse");
setTimeout(fadeIn,1);//<-- Provide any delay here
};
fadeIn();
$blog is an object not an array
try using $blog->id
instead of $blog['id']
It seems that you dont have any problem with the environmental variables.
Compile your file from src with
javac a/A.java
Then, run your program as
java a.A
Try this: (For Preview)
<script type="text/javascript">
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
</script>
<body>
<form id="form1" runat="server">
<input type="file" onchange="readURL(this);" />
<img id="blah" src="#" alt="your image" />
</form>
</body>
Working Demo here>
In Java 8 you can use Files.write() method with two arguments: Path
and List<String>
, something like this:
List<String> clubNames = clubs.stream()
.map(Club::getName)
.collect(Collectors.toList())
try {
Files.write(Paths.get(fileName), clubNames);
} catch (IOException e) {
log.error("Unable to write out names", e);
}
Because the second element is null after you clear the list.
Use:
String s = myList.get(0);
And remember, index 0 is the first element.
check your Bundle identifier for your project and you give Bundle identifier for your app which create on developer.facebook.com that they are same or not.
The Problem is related to MySql Driver
Class.forName("com.mysql.jdbc.Driver");
Add the MySQL jdbc driver jar file in to your classpath.
Also i have this error on JDK. I build the ClassPath Properly then I put the "mysql-connector-java-5.1.25-bin" in dir "C:\Program Files\Java\jre7\lib\ext" in this dir i have my JDK. then compile and Run again then it's working fine.
It can even be made dependent to another attribute changes. like this:
$('.classA').toggleClass('classB', $('input').prop('disabled'));
In this case, classB
are added each time the input is disabled
try to add ojdbc6.jar or other version through the server lib "C:\apache-tomcat-7.0.47\lib",
Then restart the server in eclipse.
Just had the similar error when installing java 8 (jdk & jre) on a system already running Java 7.
Error: Registry key 'Software\JavaSoft\Java Runtime
Environment'\CurrentVersion' has value '1.8', but '1.7' is required.
Error: could not find java.dll Error: Could not find Java SE Runtime Environment.
My environment was set up correctly (Path & java_home correctly defined), but the problem arises from the way pre-8 Java installers worked, which is that they used to copy the three executables (java.exe, javaw.exe & javaws.exe) to the Windows system directory. These remain unless overwritten by a new pre-8 installation.
However the Java 8 installer instead creates symbolic links in a new directory, C:\ProgramData\Oracle\Java\javapath, pointing to the actual JRE 8 location.
This means that you'll actually run the old 7 exes but use the new 8 DLLs.
So, the solution is simply to delete the 3 Java exes, as above, from the windows system directory.
If you are running 32-bit Java on a 64-bit Windows, the exes would be in Windows\SysWOW64, otherwise in Windows\System32.
intellij idea 2019
or ub Gradle set "compile" compile group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '7.2.2.jre11'
My problem was that my parent class had no @Test
methodes. I used there only some utilities. When I declared it abstract
it works.
The error is telling you it cannot find the class because it is not available in your application.
If you are using Maven, make sure you have the dependency for jstl
artifact:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
If you are not using it, just make sure you include the JAR in your classpath. See this answer for download links.
I am using Flask Bootstrap. My solution is a little bit simpler because my template already receives the option or choice as a parameter from Flask.
var choice = document.getElementById("{{ item_kind }}");_x000D_
choice.className += "active";
_x000D_
First line, js code gets the element. So, you should identify each of the elements with a id. I'll show an example below. Second line, you add the class active. You can see html ids below.
<div class="navbar-collapse collapse">_x000D_
<ul class="nav navbar-nav"> _x000D_
<li>_x000D_
<a id="speed" href="{{ url_for('list_gold_per_item',item_kind='speed',level='2') }}">_x000D_
<h2>Speed</h2>_x000D_
</a>_x000D_
</li>_x000D_
<li>_x000D_
<a id="life" href="{{ url_for('list_gold_per_item',item_kind='life',level='3') }}">_x000D_
<h2>Life</h2>_x000D_
</a>_x000D_
</li>_x000D_
</ul>_x000D_
</div>
_x000D_
Since about version 1.2, you can use $location.replace():
$location.path('/items');
$location.replace();
If you find that .off() .unbind() or .stopPropagation() still doesn't fix your specific issue, try using .stopImmediatePropagation() Works great in situations when you just want your event to be handled without any bubbling and without effecting any other events already being handled. Something like:
$(".bet").click(function(event) {
event.stopImmediatePropagation();
//Do Stuff
});
does the trick!
You should also make sure you have set appropriate Project Facets Java version. Module Properties -> Project Facets -> Java 1.6 should be checked
Why do you all suggest heavy scope operations? I don't see why this is not an "angular" solution:
.directive('changeClassOnScroll', function ($window) {
return {
restrict: 'A',
scope: {
offset: "@",
scrollClass: "@"
},
link: function(scope, element) {
angular.element($window).bind("scroll", function() {
if (this.pageYOffset >= parseInt(scope.offset)) {
element.addClass(scope.scrollClass);
} else {
element.removeClass(scope.scrollClass);
}
});
}
};
})
So you can use it like this:
<navbar change-class-on-scroll offset="500" scroll-class="you-have-scrolled-down"></navbar>
or
<div change-class-on-scroll offset="500" scroll-class="you-have-scrolled-down"></div>
You can easily solve that in 2 steps:
1- Reach the child element using querySelector like that:
var target = element[0].querySelector('tbody tr:first-child td')
2- Transform it to an angular.element
object again by doing:
var targetElement = angular.element(target)
You will then have access to all expected methods on the targetElement
variable.
To make the solution by @flion look really great, you could adjust the center point for that icon so it doesn't wobble up and down. This looks right for me at a small font size:
.glyphicon-refresh.spinning {
transform-origin: 48% 50%;
}
Use prop() instead of attr() to set the value of checked
. Also use :checkbox
in find method instead of input
and be specific.
$("#news_list tr").click(function() {
var ele = $(this).find('input');
if(ele.is(':checked')){
ele.prop('checked', false);
$(this).removeClass('admin_checked');
}else{
ele.prop('checked', true);
$(this).addClass('admin_checked');
}
});
Use prop instead of attr for properties like checked
As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method
This error happens because of your Jre version of Eclipse and Tomcat are mismatched ..either change eclipse one to tomcat one or ViceVersa..
Both should be same ..Java version
mismatched ..Check it
To check if the property exists and if it's null too, you can use the function property_exists()
.
Docs: http://php.net/manual/en/function.property-exists.php
As opposed with isset(), property_exists() returns TRUE even if the property has the value NULL.
bool property_exists ( mixed $class , string $property )
Example:
if (property_exists($testObject, $property)) {
//do something
}
in my case, it happened because of .net framework version miss match with MySQL connector library. when I updated my .NET version, every thing worked smooth. http://net-informations.com/q/faq/mysql.html#:~:text=Add%20Reference,Library%20in%20your%20C%23%20project.
Sometime we need to compile one single file out of thousand files to fix the problem. In such a case, One can create same folder structure like class path, decompile the file into java or copy java file from source code. Make required changes, compile one particular file into class with all dependency/classes in place and finally replace the class file. Finally restart the container. Once war is exploded file will not be replaced.
Make sure that in case your image is not in the dom, and you get it from local directory or server, you should wait for the image to load and just after that to draw it on the canvas.
something like that:
function drawBgImg() {
let bgImg = new Image();
bgImg.src = '/images/1.jpg';
bgImg.onload = () => {
gCtx.drawImage(bgImg, 0, 0, gElCanvas.width, gElCanvas.height);
}
}
You need this code wrap in tags and put on the end of page. Or create JS file (for example test.js), write this code on it and put on the end of page this tag
I used this extension method a lot in my project. Hope it will help one of you guys.
public static bool HasClass(this HtmlNode node, params string[] classValueArray)
{
var classValue = node.GetAttributeValue("class", "");
var classValues = classValue.Split(' ');
return classValueArray.All(c => classValues.Contains(c));
}
One way to do this would be to pass the instance of ParentClass
to the ChildClass
on construction
public ChildClass
{
private ParentClass parent;
public ChildClass(ParentClass parent)
{
this.parent = parent;
}
public void LoadData(DateTable dt)
{
// do something
parent.CurrentRow++; // or whatever.
parent.UpdateProgressBar(); // Call the method
}
}
Make sure to pass the reference to this
when constructing ChildClass
inside parent:
if(loadData){
ChildClass childClass = new ChildClass(this); // here
childClass.LoadData(this.Datatable);
}
Caveat: This is probably not the best way to organise your classes, but it directly answers your question.
EDIT: In the comments you mention that more than 1 parent class wants to use ChildClass
. This is possible with the introduction of an interface, eg:
public interface IParentClass
{
void UpdateProgressBar();
int CurrentRow{get; set;}
}
Now, make sure to implement that interface on both (all?) Parent Classes and change child class to this:
public ChildClass
{
private IParentClass parent;
public ChildClass(IParentClass parent)
{
this.parent = parent;
}
public void LoadData(DateTable dt)
{
// do something
parent.CurrentRow++; // or whatever.
parent.UpdateProgressBar(); // Call the method
}
}
Now anything that implements IParentClass
can construct an instance of ChildClass
and pass this
to its constructor.
Please read carefully
If everything is woking same as google code then please check manifest file in my case i added geo key and map key that's why exception occurs,
Note - do not add two keys in manifest file remove map key
meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>
add this code.
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/auto_location"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
Assuming your sm_id
and c_id
properties are public, you can access them by using a foreach
on the array:
$array = array(/* objects in an array here */);
foreach ($array as $obj) {
echo $obj->sm_id . '<br />' . $obj->c_id . '<br />';
}
function getSuffix(n) {return n < 11 || n > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((n - 1) % 10, 3)] : 'th'}
Merging two array will not remove the duplicate you can try the below example to get unique from two array
$a1=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow");
$a2=array("e"=>"red","f"=>"green","g"=>"blue");
$result=array_diff($a1,$a2);
print_r($result);
I know this is an oldie, but thought I might add some value. For those of us running Server Core outside of a domain (domain members can just run Server Manager remotely to add/remove features/roles), you have to resort to command lines.
Powershell users can type "Install-WindowsFeature Web-Asp-Net45"
That should be equivalent to using server manager.
Let maven generate a batch file to start your application. This is the simplest way to this.
You can use the appassembler-maven-plugin for such purposes.
I believe the answer is outlined on the slf4j web-site (Failed to load class org.slf4j.impl.StaticLoggerBinder)
For a very quick solution I suggest adding no-operation (NOP) logger implementation (slf4j-nop.jar)
For example, if using maven:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>${slf4j-nop-version}</version>
</dependency>
Using CSS only, no. You need to use jQuery to add it.
You should just use "+" before $(this)
. That's going to convert the string to number, so:
var votevalue = +$(this).data('votevalue');
Oh and I recommend to use closest()
method just in case :)
var votevalue = +$(this).closest('.btn-group').data('votevalue');
This class was compiled with a JDK more recent than the one used for execution.
The easiest is to install a more recent JRE on the computer where you execute the program. If you think you installed a recent one, check the JAVA_HOME and PATH environment variables.
Version 49 is java 1.5. That means the class was compiled with (or for) a JDK which is yet old. You probably tried to execute the class with JDK 1.4. You really should use one more recent (1.6 or 1.7, see java version history).
I got this error fatal error lnk1104: cannot open file 'kernel32.lib'. this error is getting because there is no path in VC++ directories. To solve this problem
Open Visual Studio 2008
In my case It is C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib
No, there's no built-in way to convert a class like you say. The simplest way to do this would be to do what you suggested: create a DerivedClass(BaseClass)
constructor. Other options would basically come out to automate the copying of properties from the base to the derived instance, e.g. using reflection.
The code you posted using as
will compile, as I'm sure you've seen, but will throw a null reference exception when you run it, because myBaseObject as DerivedClass
will evaluate to null
, since it's not an instance of DerivedClass
.
$(window).scroll(function() {
var scroll = $(window).scrollTop();
//>=, not <=
if (scroll >= 500) {
//clearHeader, not clearheader - caps H
$(".clearHeader").addClass("darkHeader");
}
}); //missing );
Also, by removing the clearHeader
class, you're removing the position:fixed;
from the element as well as the ability of re-selecting it through the $(".clearHeader")
selector. I'd suggest not removing that class and adding a new CSS class on top of it for styling purposes.
And if you want to "reset" the class addition when the users scrolls back up:
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 500) {
$(".clearHeader").addClass("darkHeader");
} else {
$(".clearHeader").removeClass("darkHeader");
}
});
edit: Here's version caching the header selector - better performance as it won't query the DOM every time you scroll and you can safely remove/add any class to the header element without losing the reference:
$(function() {
//caches a jQuery object containing the header element
var header = $(".clearHeader");
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 500) {
header.removeClass('clearHeader').addClass("darkHeader");
} else {
header.removeClass("darkHeader").addClass('clearHeader');
}
});
});
If all you want is a simple excel worksheet try this:
header('Content-type: application/excel');
$filename = 'filename.xls';
header('Content-Disposition: attachment; filename='.$filename);
$data = '<html xmlns:x="urn:schemas-microsoft-com:office:excel">
<head>
<!--[if gte mso 9]>
<xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sheet 1</x:Name>
<x:WorksheetOptions>
<x:Print>
<x:ValidPrinterInfo/>
</x:Print>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml>
<![endif]-->
</head>
<body>
<table><tr><td>Cell 1</td><td>Cell 2</td></tr></table>
</body></html>';
echo $data;
The key here is the xml data. This will keep excel from complaining about the file.
While AngularJS allows you to get a hand on a click event (and thus a target of it) with the following syntax (note the $event
argument to the setMaster
function; documentation here: http://docs.angularjs.org/api/ng.directive:ngClick):
function AdminController($scope) {
$scope.setMaster = function(obj, $event){
console.log($event.target);
}
}
this is not very angular-way of solving this problem. With AngularJS the focus is on the model manipulation. One would mutate a model and let AngularJS figure out rendering.
The AngularJS-way of solving this problem (without using jQuery and without the need to pass the $event
argument) would be:
<div ng-controller="AdminController">
<ul class="list-holder">
<li ng-repeat="section in sections" ng-class="{active : isSelected(section)}">
<a ng-click="setMaster(section)">{{section.name}}</a>
</li>
</ul>
<hr>
{{selected | json}}
</div>
where methods in the controller would look like this:
$scope.setMaster = function(section) {
$scope.selected = section;
}
$scope.isSelected = function(section) {
return $scope.selected === section;
}
Here is the complete jsFiddle: http://jsfiddle.net/pkozlowski_opensource/WXJ3p/15/
If u r using eclipse then delete tomcat server and Server folder then reconfigure those two..
If any of other solution doesn't fix it, try to override the styles to hide the sort togglers:
.sorting_asc:after, .sorting_desc:after {
content: "";
}
Within an event handler function or object method, one way to access the properties of "the containing element" is to use the special this keyword. The this keyword represents the owner of the function or method currently being processed. So:
For a global function, this represents the window.
For an object method, this represents the object instance.
And in an event handler, this represents the element that received the event.
For example:
<!DOCTYPE html>
<html>
<head>
<script>
function mouseDown() {
alert(this);
}
</script>
</head>
<body>
<p onmouseup="mouseDown();alert(this);">Hi</p>
</body>
</html>
The content of alert windows after rendering this html respectively are:
object Window
object HTMLParagraphElement
An Event object is associated with all events. It has properties that provide information "about the event", such as the location of a mouse click in the web page.
For example:
<!DOCTYPE html>
<html>
<head>
<script>
function mouseDown(event) {
var theEvent = event ? event : window.event;
var locString = "X = " + theEvent.screenX + " Y = " + theEvent.screenY;
alert(event);
alert(locString);
}
</script>
</head>
<body>
<p onmouseup="mouseDown(event);">Hi</p>
</body>
</html>
The content of alert windows after rendering this html respectively are:
object MouseEvent
X = 982 Y = 329
What is your output when you do java -version
? This will tell you what version the running JVM is.
The Unsupported major.minor version 51.0 error could mean:
Either way, uninstall all JVM runtimes including JDK and download latest and re-install. That should fix any Unsupported major.minor
error as you will have the lastest JRE and JDK (Maybe even newer then the one used to compile the Servlet)
See: http://www.java.com/en/download/manual.jsp (7 Update 25 )
and here: http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform (JDK) 7u25)
for the latest version of the JRE and JDK respectively.
EDIT:
Most likely your code was written in Java7 however maybe it was done using Java7update4 and your system is running Java7update3. Thus they both are effectively the same major version but the minor versions differ. Only the larger minor version is backward compatible with the lower minor version.
Edit 2 : If you have more than one jdk installed on your pc. you should check that Apache Tomcat is using the same one (jre) you are compiling your programs with. If you installed a new jdk after installing apache it normally won't select the new version.
You can use the data attribute data-orderable="false"
.
<th data-orderable="false">Salary</th>
$(document).ready(function() {_x000D_
$('#example').DataTable()_x000D_
});
_x000D_
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap4.min.css" />_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>_x000D_
<script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap4.min.js"></script>_x000D_
_x000D_
<table id="example" class="display" style="width:100%">_x000D_
<thead>_x000D_
<tr>_x000D_
<th>Name</th>_x000D_
<th>Position</th>_x000D_
<th>Office</th>_x000D_
<th>Age</th>_x000D_
<th>Start date</th>_x000D_
<th data-orderable="false">Salary</th>_x000D_
</tr>_x000D_
</thead>_x000D_
<tbody>_x000D_
<tr>_x000D_
<td>Tiger Nixon</td>_x000D_
<td>System Architect</td>_x000D_
<td>Edinburgh</td>_x000D_
<td>61</td>_x000D_
<td>2011/04/25</td>_x000D_
<td>$320,800</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Garrett Winters</td>_x000D_
<td>Accountant</td>_x000D_
<td>Tokyo</td>_x000D_
<td>63</td>_x000D_
<td>2011/07/25</td>_x000D_
<td>$170,750</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Ashton Cox</td>_x000D_
<td>Junior Technical Author</td>_x000D_
<td>San Francisco</td>_x000D_
<td>66</td>_x000D_
<td>2009/01/12</td>_x000D_
<td>$86,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Cedric Kelly</td>_x000D_
<td>Senior Javascript Developer</td>_x000D_
<td>Edinburgh</td>_x000D_
<td>22</td>_x000D_
<td>2012/03/29</td>_x000D_
<td>$433,060</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Airi Satou</td>_x000D_
<td>Accountant</td>_x000D_
<td>Tokyo</td>_x000D_
<td>33</td>_x000D_
<td>2008/11/28</td>_x000D_
<td>$162,700</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Brielle Williamson</td>_x000D_
<td>Integration Specialist</td>_x000D_
<td>New York</td>_x000D_
<td>61</td>_x000D_
<td>2012/12/02</td>_x000D_
<td>$372,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Herrod Chandler</td>_x000D_
<td>Sales Assistant</td>_x000D_
<td>San Francisco</td>_x000D_
<td>59</td>_x000D_
<td>2012/08/06</td>_x000D_
<td>$137,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Rhona Davidson</td>_x000D_
<td>Integration Specialist</td>_x000D_
<td>Tokyo</td>_x000D_
<td>55</td>_x000D_
<td>2010/10/14</td>_x000D_
<td>$327,900</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Colleen Hurst</td>_x000D_
<td>Javascript Developer</td>_x000D_
<td>San Francisco</td>_x000D_
<td>39</td>_x000D_
<td>2009/09/15</td>_x000D_
<td>$205,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Sonya Frost</td>_x000D_
<td>Software Engineer</td>_x000D_
<td>Edinburgh</td>_x000D_
<td>23</td>_x000D_
<td>2008/12/13</td>_x000D_
<td>$103,600</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Jena Gaines</td>_x000D_
<td>Office Manager</td>_x000D_
<td>London</td>_x000D_
<td>30</td>_x000D_
<td>2008/12/19</td>_x000D_
<td>$90,560</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Quinn Flynn</td>_x000D_
<td>Support Lead</td>_x000D_
<td>Edinburgh</td>_x000D_
<td>22</td>_x000D_
<td>2013/03/03</td>_x000D_
<td>$342,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Charde Marshall</td>_x000D_
<td>Regional Director</td>_x000D_
<td>San Francisco</td>_x000D_
<td>36</td>_x000D_
<td>2008/10/16</td>_x000D_
<td>$470,600</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Haley Kennedy</td>_x000D_
<td>Senior Marketing Designer</td>_x000D_
<td>London</td>_x000D_
<td>43</td>_x000D_
<td>2012/12/18</td>_x000D_
<td>$313,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Tatyana Fitzpatrick</td>_x000D_
<td>Regional Director</td>_x000D_
<td>London</td>_x000D_
<td>19</td>_x000D_
<td>2010/03/17</td>_x000D_
<td>$385,750</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Michael Silva</td>_x000D_
<td>Marketing Designer</td>_x000D_
<td>London</td>_x000D_
<td>66</td>_x000D_
<td>2012/11/27</td>_x000D_
<td>$198,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Paul Byrd</td>_x000D_
<td>Chief Financial Officer (CFO)</td>_x000D_
<td>New York</td>_x000D_
<td>64</td>_x000D_
<td>2010/06/09</td>_x000D_
<td>$725,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Gloria Little</td>_x000D_
<td>Systems Administrator</td>_x000D_
<td>New York</td>_x000D_
<td>59</td>_x000D_
<td>2009/04/10</td>_x000D_
<td>$237,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Bradley Greer</td>_x000D_
<td>Software Engineer</td>_x000D_
<td>London</td>_x000D_
<td>41</td>_x000D_
<td>2012/10/13</td>_x000D_
<td>$132,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Dai Rios</td>_x000D_
<td>Personnel Lead</td>_x000D_
<td>Edinburgh</td>_x000D_
<td>35</td>_x000D_
<td>2012/09/26</td>_x000D_
<td>$217,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Jenette Caldwell</td>_x000D_
<td>Development Lead</td>_x000D_
<td>New York</td>_x000D_
<td>30</td>_x000D_
<td>2011/09/03</td>_x000D_
<td>$345,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Yuri Berry</td>_x000D_
<td>Chief Marketing Officer (CMO)</td>_x000D_
<td>New York</td>_x000D_
<td>40</td>_x000D_
<td>2009/06/25</td>_x000D_
<td>$675,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Caesar Vance</td>_x000D_
<td>Pre-Sales Support</td>_x000D_
<td>New York</td>_x000D_
<td>21</td>_x000D_
<td>2011/12/12</td>_x000D_
<td>$106,450</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Doris Wilder</td>_x000D_
<td>Sales Assistant</td>_x000D_
<td>Sidney</td>_x000D_
<td>23</td>_x000D_
<td>2010/09/20</td>_x000D_
<td>$85,600</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Angelica Ramos</td>_x000D_
<td>Chief Executive Officer (CEO)</td>_x000D_
<td>London</td>_x000D_
<td>47</td>_x000D_
<td>2009/10/09</td>_x000D_
<td>$1,200,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Gavin Joyce</td>_x000D_
<td>Developer</td>_x000D_
<td>Edinburgh</td>_x000D_
<td>42</td>_x000D_
<td>2010/12/22</td>_x000D_
<td>$92,575</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Jennifer Chang</td>_x000D_
<td>Regional Director</td>_x000D_
<td>Singapore</td>_x000D_
<td>28</td>_x000D_
<td>2010/11/14</td>_x000D_
<td>$357,650</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Brenden Wagner</td>_x000D_
<td>Software Engineer</td>_x000D_
<td>San Francisco</td>_x000D_
<td>28</td>_x000D_
<td>2011/06/07</td>_x000D_
<td>$206,850</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Fiona Green</td>_x000D_
<td>Chief Operating Officer (COO)</td>_x000D_
<td>San Francisco</td>_x000D_
<td>48</td>_x000D_
<td>2010/03/11</td>_x000D_
<td>$850,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Shou Itou</td>_x000D_
<td>Regional Marketing</td>_x000D_
<td>Tokyo</td>_x000D_
<td>20</td>_x000D_
<td>2011/08/14</td>_x000D_
<td>$163,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Michelle House</td>_x000D_
<td>Integration Specialist</td>_x000D_
<td>Sidney</td>_x000D_
<td>37</td>_x000D_
<td>2011/06/02</td>_x000D_
<td>$95,400</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Suki Burks</td>_x000D_
<td>Developer</td>_x000D_
<td>London</td>_x000D_
<td>53</td>_x000D_
<td>2009/10/22</td>_x000D_
<td>$114,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Prescott Bartlett</td>_x000D_
<td>Technical Author</td>_x000D_
<td>London</td>_x000D_
<td>27</td>_x000D_
<td>2011/05/07</td>_x000D_
<td>$145,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Gavin Cortez</td>_x000D_
<td>Team Leader</td>_x000D_
<td>San Francisco</td>_x000D_
<td>22</td>_x000D_
<td>2008/10/26</td>_x000D_
<td>$235,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Martena Mccray</td>_x000D_
<td>Post-Sales support</td>_x000D_
<td>Edinburgh</td>_x000D_
<td>46</td>_x000D_
<td>2011/03/09</td>_x000D_
<td>$324,050</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Unity Butler</td>_x000D_
<td>Marketing Designer</td>_x000D_
<td>San Francisco</td>_x000D_
<td>47</td>_x000D_
<td>2009/12/09</td>_x000D_
<td>$85,675</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Howard Hatfield</td>_x000D_
<td>Office Manager</td>_x000D_
<td>San Francisco</td>_x000D_
<td>51</td>_x000D_
<td>2008/12/16</td>_x000D_
<td>$164,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Hope Fuentes</td>_x000D_
<td>Secretary</td>_x000D_
<td>San Francisco</td>_x000D_
<td>41</td>_x000D_
<td>2010/02/12</td>_x000D_
<td>$109,850</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Vivian Harrell</td>_x000D_
<td>Financial Controller</td>_x000D_
<td>San Francisco</td>_x000D_
<td>62</td>_x000D_
<td>2009/02/14</td>_x000D_
<td>$452,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Timothy Mooney</td>_x000D_
<td>Office Manager</td>_x000D_
<td>London</td>_x000D_
<td>37</td>_x000D_
<td>2008/12/11</td>_x000D_
<td>$136,200</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Jackson Bradshaw</td>_x000D_
<td>Director</td>_x000D_
<td>New York</td>_x000D_
<td>65</td>_x000D_
<td>2008/09/26</td>_x000D_
<td>$645,750</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Olivia Liang</td>_x000D_
<td>Support Engineer</td>_x000D_
<td>Singapore</td>_x000D_
<td>64</td>_x000D_
<td>2011/02/03</td>_x000D_
<td>$234,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Bruno Nash</td>_x000D_
<td>Software Engineer</td>_x000D_
<td>London</td>_x000D_
<td>38</td>_x000D_
<td>2011/05/03</td>_x000D_
<td>$163,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Sakura Yamamoto</td>_x000D_
<td>Support Engineer</td>_x000D_
<td>Tokyo</td>_x000D_
<td>37</td>_x000D_
<td>2009/08/19</td>_x000D_
<td>$139,575</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Thor Walton</td>_x000D_
<td>Developer</td>_x000D_
<td>New York</td>_x000D_
<td>61</td>_x000D_
<td>2013/08/11</td>_x000D_
<td>$98,540</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Finn Camacho</td>_x000D_
<td>Support Engineer</td>_x000D_
<td>San Francisco</td>_x000D_
<td>47</td>_x000D_
<td>2009/07/07</td>_x000D_
<td>$87,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Serge Baldwin</td>_x000D_
<td>Data Coordinator</td>_x000D_
<td>Singapore</td>_x000D_
<td>64</td>_x000D_
<td>2012/04/09</td>_x000D_
<td>$138,575</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Zenaida Frank</td>_x000D_
<td>Software Engineer</td>_x000D_
<td>New York</td>_x000D_
<td>63</td>_x000D_
<td>2010/01/04</td>_x000D_
<td>$125,250</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Zorita Serrano</td>_x000D_
<td>Software Engineer</td>_x000D_
<td>San Francisco</td>_x000D_
<td>56</td>_x000D_
<td>2012/06/01</td>_x000D_
<td>$115,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Jennifer Acosta</td>_x000D_
<td>Junior Javascript Developer</td>_x000D_
<td>Edinburgh</td>_x000D_
<td>43</td>_x000D_
<td>2013/02/01</td>_x000D_
<td>$75,650</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Cara Stevens</td>_x000D_
<td>Sales Assistant</td>_x000D_
<td>New York</td>_x000D_
<td>46</td>_x000D_
<td>2011/12/06</td>_x000D_
<td>$145,600</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Hermione Butler</td>_x000D_
<td>Regional Director</td>_x000D_
<td>London</td>_x000D_
<td>47</td>_x000D_
<td>2011/03/21</td>_x000D_
<td>$356,250</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Lael Greer</td>_x000D_
<td>Systems Administrator</td>_x000D_
<td>London</td>_x000D_
<td>21</td>_x000D_
<td>2009/02/27</td>_x000D_
<td>$103,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Jonas Alexander</td>_x000D_
<td>Developer</td>_x000D_
<td>San Francisco</td>_x000D_
<td>30</td>_x000D_
<td>2010/07/14</td>_x000D_
<td>$86,500</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Shad Decker</td>_x000D_
<td>Regional Director</td>_x000D_
<td>Edinburgh</td>_x000D_
<td>51</td>_x000D_
<td>2008/11/13</td>_x000D_
<td>$183,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Michael Bruce</td>_x000D_
<td>Javascript Developer</td>_x000D_
<td>Singapore</td>_x000D_
<td>29</td>_x000D_
<td>2011/06/27</td>_x000D_
<td>$183,000</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>Donna Snider</td>_x000D_
<td>Customer Support</td>_x000D_
<td>New York</td>_x000D_
<td>27</td>_x000D_
<td>2011/01/25</td>_x000D_
<td>$112,000</td>_x000D_
</tr>_x000D_
</tbody>_x000D_
<tfoot>_x000D_
<tr>_x000D_
<th>Name</th>_x000D_
<th>Position</th>_x000D_
<th>Office</th>_x000D_
<th>Age</th>_x000D_
<th>Start date</th>_x000D_
<th>Salary</th>_x000D_
</tr>_x000D_
</tfoot>_x000D_
</table>
_x000D_
As of v1.10.5 DataTables can also use initialization options read from HTML5 data-* attributes. This provides a mechanism for setting options directly in your HTML, rather than using Javascript.
In java config,make sure you have import your config in RootConfig like this @Import(PersistenceJPAConfig.class)
See section Attributes from documentation on directives.
observing interpolated attributes: Use $observe to observe the value changes of attributes that contain interpolation (e.g. src="{{bar}}"). Not only is this very efficient but it's also the only way to easily get the actual value because during the linking phase the interpolation hasn't been evaluated yet and so the value is at this time set to undefined.
Below command works for me. Provided that all required jars including testng jar kept inside lib.
java -cp "lib/*" org.testng.TestNG testng.xml
This is the way I've been doing this sort of stuff. Angular tends to favor declarative manipulation of the dom rather than a imperative one(at least that's the way I've been playing with it).
The markup
<table class="table">
<thead>
<tr>
<th>
<input type="checkbox"
ng-click="selectAll($event)"
ng-checked="isSelectedAll()">
</th>
<th>Title</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="e in entities" ng-class="getSelectedClass(e)">
<td>
<input type="checkbox" name="selected"
ng-checked="isSelected(e.id)"
ng-click="updateSelection($event, e.id)">
</td>
<td>{{e.title}}</td>
</tr>
</tbody>
</table>
And in the controller
var updateSelected = function(action, id) {
if (action === 'add' && $scope.selected.indexOf(id) === -1) {
$scope.selected.push(id);
}
if (action === 'remove' && $scope.selected.indexOf(id) !== -1) {
$scope.selected.splice($scope.selected.indexOf(id), 1);
}
};
$scope.updateSelection = function($event, id) {
var checkbox = $event.target;
var action = (checkbox.checked ? 'add' : 'remove');
updateSelected(action, id);
};
$scope.selectAll = function($event) {
var checkbox = $event.target;
var action = (checkbox.checked ? 'add' : 'remove');
for ( var i = 0; i < $scope.entities.length; i++) {
var entity = $scope.entities[i];
updateSelected(action, entity.id);
}
};
$scope.getSelectedClass = function(entity) {
return $scope.isSelected(entity.id) ? 'selected' : '';
};
$scope.isSelected = function(id) {
return $scope.selected.indexOf(id) >= 0;
};
//something extra I couldn't resist adding :)
$scope.isSelectedAll = function() {
return $scope.selected.length === $scope.entities.length;
};
EDIT: getSelectedClass()
expects the entire entity but it was being called with the id of the entity only, which is now corrected
I found this answer to the question:
http://padcom13.blogspot.co.uk/2011/10/creating-standalone-applications-with.html
Not only do you get the dependent lib files in a lib folder, you also get a bin director with both a unix and a dos executable.
The executable ultimately calls java with a -cp argument that lists all of your dependent libs too.
The whole lot sits in an appasembly folder inside the target folder. Epic.
============= Yes I know this is an old thread, but it's still coming high on search results so I thought it might help someone like me.
Turns out I will missing a class called mysql-connector-java-5.1.2.jar, I added it this folder (C:\Program Files\pentaho\design-tools\data-integration\lib) and it worked with a MySQL connection and my data and tables appear.
If you absolutely have to add the property to the object, I believe you could cast it as an array, add your property (as a new array key), then cast it back as an object. The only time you run into stdClass
objects (I believe) is when you cast an array as an object or when you create a new stdClass
object from scratch (and of course when you json_decode()
something - silly me for forgetting!).
Instead of:
$foo = new StdClass();
$foo->bar = '1234';
You'd do:
$foo = array('bar' => '1234');
$foo = (object)$foo;
Or if you already had an existing stdClass object:
$foo = (array)$foo;
$foo['bar'] = '1234';
$foo = (object)$foo;
Also as a 1 liner:
$foo = (object) array_merge( (array)$foo, array( 'bar' => '1234' ) );
Here is complete Twitter bootstrap example and applied active class based on query string.
Few steps to follow to achieve correct solution:
1) Include latest jquery.js and bootstrap.js javascript file.
2) Include latest bootstrap.css file
3) Include querystring-0.9.0.js for getting query string variable value in js.
4) HTML:
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<ul class="nav">
<li class="active">
<a href="#?page=0">
Home
</a>
</li>
<li>
<a href="#?page=1">
Forums
</a>
</li>
<li>
<a href="#?page=2">
Blog
</a>
</li>
<li>
<a href="#?page=3">
FAQ's
</a>
</li>
<li>
<a href="#?page=4">
Item
</a>
</li>
<li>
<a href="#?page=5">
Create
</a>
</li>
</ul>
</div>
</div>
</div>
JQuery in Script Tag:
$(function() {
$(".nav li").click(function() {
$(".nav li").removeClass('active');
setTimeout(function() {
var page = $.QueryString("page");
$(".nav li:eq(" + page + ")").addClass("active");
}, 300);
});
});
I have done complete bin, so please click here http://codebins.com/bin/4ldqpaf
NoClassDefFoundError really means it can't initilize the class. It has nothing to do with finding the class. I got this error when calling trim() on a null String.
JUnit won't show NullPointerException. The string isn't null when running normally because I'm fetching the string from a properties file which is not availible for tests.
My advice is to remove pieces from the class until your tests start passing. Then you can determine which line is giving the error.
It means that you compiled your classes under a specific JDK, but then try to run them under older version of JDK.
I solved by following these steps:
This fixes the "Deployment Assembly" settings of the project.
$(document).ready(function () {
$("#tbl_Customer tbody tr .companyname").click(function () {
var comapnyname = $(this).closest(".trclass").find(".companyname").text();
var CompanyAddress = $(this).closest(".trclass").find(".CompanyAddress").text();
var CompanyEmail = $(this).closest(".trclass").find(".CompanyEmail").text();
var CompanyContactNumber = $(this).closest(".trclass").find(".CompanyContactNumber").text();
var CompanyContactPerson = $(this).closest(".trclass").find(".CompanyContactPerson").text();
// var clickedCell = $(this);
alert(comapnyname);
alert(CompanyAddress);
alert(CompanyEmail);
alert(CompanyContactNumber);
alert(CompanyContactPerson);
//alert(clickedCell.text());
});
});
JavaScript has Function-Level variable scope which means you will have to declare your variable outside $(document).ready()
function.
Or alternatively to make your variable to have global scope, simply dont use var
keyword before it like shown below. However generally this is considered bad practice because it pollutes the global scope but it is up to you to decide.
$(document).ready(function() {
intro = null; // it is in global scope now
To learn more about it, check out:
You can do like below
Add
elem.classList.add("first", "second", "third");
Remove
elem.classList.remove("first", "second", "third");
TLDR;
In straight forward case above removal should work. But in case of removal, you should make sure class exists before you remove them
const classes = ["first","second","third"];
classes.forEach(c => {
if (elem.classList.contains(c)) {
element.classList.remove(c);
}
})
Here are different method of doing this. And i found your code is even working fine.
Your code: http://jsfiddle.net/NKC2j/
Jquery toggle class demo: http://jsfiddle.net/NKC2j/2/
Jquery fade toggle: http://jsfiddle.net/NKC2j/3/
Jquery slide toggle: http://jsfiddle.net/NKC2j/4/
And you can do this with CSS as answered by Sandeep
You can add multiple classes by separating classes names by spaces
$('.page-address-edit').addClass('test1 test2 test3');
jQuery .on method is used to bind events even without the presence of element on page load. Here is the link It is used in this way:
$("#dataTable tbody tr").on("click", function(event){
alert($(this).text());
});
Before jquery 1.7, .live() method was used, but it is deprecated now.
First, give all your links a unique id and make a css class called active:
<ul>
<li><a id="link1" href="#/...">link 1</a></li>
<li><a id="link2" href="#/...">link 2</a></li>
</ul>
CSS:
.active {
font-weight: bold;
}
Jquery version:
function setActiveLink(setActive){
if ($("a").hasClass('active'))
$("a").removeClass('active');
if (setActive)
$("#"+setActive).addClass('active');
}
$(function() {
$("a").click(function() {
setActiveLink(this.id);
});
});
Vanilla javascript version:
In order to prevent selecting too many links with document.querySelectorAll
, give the parent element an id called menuLinks. Add an onClick handler on the links.
<ul id="menuLinks">
<li><a id="link1" href="#/..." onClick="setActiveLink(this.id);">link 1</a></li>
<li><a id="link2" href="#/..." onClick="setActiveLink(this.id);">link 2</a></li>
</ul>
Code:
function setActiveLink(setActive){
var links = document.querySelectorAll("#menuLinks a");
Array.prototype.map.call(links, function(e) {
e.className = "";
if (e.id == setActive)
e.className = "active";
})
}
You need to download log4j and add in your classpath.
I was able to work around it by running mvn install:install-file with -Dpackaging=class. Then adding entry to POM as described here:
I came across the same problem when using eclipse-jee. I found the reason of this problem is that I had two or more duplicate @WebServlet("/yourServlet") definition in my web-app,so solution is to eliminate duplicates
This error occures when you try to refer to a null object instance. I can`t tell you what causes this error by your given information, but you can debug it easily in your IDE. I strongly recommend you that use exception handling to avoid unexpected program behavior.
First let's get some basics right...
JRE is a component in NetBeans/Eclipse/standalone that is going to provide you with libraries, JVM, Java plugins & Java web start. Note that it does not provide compliers or debuggers.
JDK is the superset of JRE along with compliers and debuggers.
So when you have your default library as a JRE instead of JDK, you are going to have a nice time importing stuff, but it won't compile.
Instead, set your path to JDK (I use NetBeans, and I set them using netbeans.conf in netbeans/etc/netbeans.conf and change the path).
The exception message clearly speaks that the class versions, which would include the class meta data as well, has changed over time. In other words, the class structure during serialization is not the same during de-serialization. This is what is most probably "going on".
I think it comes from this line in your XML file:
<context:component-scan base-package="org.assessme.com.controller." />
Replace it by:
<context:component-scan base-package="org.assessme.com." />
It is because your Autowired service is not scanned by Spring since it is not in the right package.
In more modern browsers (including IE 10+) you can now use calc()
:
.moveto {
top: 0px;
left: calc(100% - 50px);
}
DateTime.remove({}, callback)
The empty object will match all of them.
The traditional for loop in Objective-C is inherited from standard C and takes the following form:
for (/* Instantiate local variables*/ ; /* Condition to keep looping. */ ; /* End of loop expressions */)
{
// Do something.
}
For example, to print the numbers from 1 to 10, you could use the for loop:
for (int i = 1; i <= 10; i++)
{
NSLog(@"%d", i);
}
On the other hand, the for in loop was introduced in Objective-C 2.0, and is used to loop through objects in a collection, such as an NSArray instance. For example, to loop through a collection of NSString objects in an NSArray and print them all out, you could use the following format.
for (NSString* currentString in myArrayOfStrings)
{
NSLog(@"%@", currentString);
}
This is logically equivilant to the following traditional for loop:
for (int i = 0; i < [myArrayOfStrings count]; i++)
{
NSLog(@"%@", [myArrayOfStrings objectAtIndex:i]);
}
The advantage of using the for in loop is firstly that it's a lot cleaner code to look at. Secondly, the Objective-C compiler can optimize the for in loop so as the code runs faster than doing the same thing with a traditional for loop.
Hope this helps.
You can use Apache Subversion. It is owner of subversion . You can download from here . After install it, you have to restart pc to use svn from command line.
An instance variable is a variable that is a member of an instance of a class (i.e., associated with something created with a new
), whereas a class variable is a member of the class itself.
Every instance of a class will have its own copy of an instance variable, whereas there is only one of each static (or class) variable, associated with the class itself.
What’s the difference between a class variable and an instance variable?
This test class illustrates the difference:
public class Test {
public static String classVariable = "I am associated with the class";
public String instanceVariable = "I am associated with the instance";
public void setText(String string){
this.instanceVariable = string;
}
public static void setClassText(String string){
classVariable = string;
}
public static void main(String[] args) {
Test test1 = new Test();
Test test2 = new Test();
// Change test1's instance variable
test1.setText("Changed");
System.out.println(test1.instanceVariable); // Prints "Changed"
// test2 is unaffected
System.out.println(test2.instanceVariable); // Prints "I am associated with the instance"
// Change class variable (associated with the class itself)
Test.setClassText("Changed class text");
System.out.println(Test.classVariable); // Prints "Changed class text"
// Can access static fields through an instance, but there still is only one
// (not best practice to access static variables through instance)
System.out.println(test1.classVariable); // Prints "Changed class text"
System.out.println(test2.classVariable); // Prints "Changed class text"
}
}
For PHP >= 5.3.0 try
PHP magic constants.
__DIR__
And make your path relative.
For PHP < 5.3.0 try
dirname(__FILE__)
Specifying full path for all additional jars works.
./bin/spark-submit --class "SparkTest" --master local[*] --jars /fullpath/first.jar,/fullpath/second.jar /fullpath/your-program.jar
Or add jars in conf/spark-defaults.conf by adding lines like:
spark.driver.extraClassPath /fullpath/firs.jar:/fullpath/second.jar
spark.executor.extraClassPath /fullpath/firs.jar:/fullpath/second.jar
I had a related issue when migrating from a CE db over to Sql Server on Azure. Just wasted 4 hrs trying to solve this. Hopefully this may save someone a similar fate. For me, I had a reference to SqlCE in my packages.config file. Removing it solved my entire issue and allowed me to use migrations. Yay Microsoft for another tech with unnecessarily complex setup and config issues.
-is and -as operators requires a type you can compare against. If you're not sure what the type might be, try to evaluate the content (partial type list):
(Invoke-Expression '1.5').GetType().Name -match 'byte|short|int32|long|sbyte|ushort|uint32|ulong|float|double|decimal'
Good or bad, it can work against hex values as well (Invoke-Expression '0xA' ...)
set myPATH="C:\Users\DEB\Downloads\10.1.1.0.4"
cd %myPATH%
The single quotes do not indicate a string, they make it starts: 'C:\
instead of C:\
so
%name%
is the usual syntax for expanding a variable, the !name!
syntax needs to be enabled using the command setlocal ENABLEDELAYEDEXPANSION
first, or by running the command prompt with CMD /V:ON
.
Don't use PATH as your name, it is a system name that contains all the locations of executable programs. If you overwrite it, random bits of your script will stop working. If you intend to change it, you need to do set PATH=%PATH%;C:\Users\DEB\Downloads\10.1.1.0.4
to keep the current PATH content, and add something to the end.
require
loads a file from the $LOAD_PATH
. If you want to require a file relative to the currently executing file instead of from the $LOAD_PATH
, use require_relative
.
hope this would help:
window.location.href = '/url_after_domain';
For Eclipse in Macbook it is just 2 click process:
Are you sure, that specified database and table exists? Did you try to look at your database using any database client? For example command-line MySQL client bundled with MySQL server. Or if you a developer newbie, there are dozens of a GUI and web interface clients (HeidiSQL, MySQL Workbench, phpMyAdmin and many more). So first check, if your table creation script was successful and had created what it have to.
BTW why do you have a script for creating the database structure? It's usualy a nonrecurring operation, so write the script to do this is unneeded. It's useful only in case of need of repeatedly creating and manipulating the database structure on the fly.
You actually don't need any jQuery to check if there is an overflow happening or not. Using element.offsetHeight
, element.offsetWidth
, element.scrollHeight
and element.scrollWidth
you can determine if your element have content bigger than it's size:
if (element.offsetHeight < element.scrollHeight ||
element.offsetWidth < element.scrollWidth) {
// your element have overflow
} else {
// your element doesn't have overflow
}
See example in action: Fiddle
But if you want to know what element inside your element is visible or not then you need to do more calculation. There is three states for a child element in terms of visibility:
If you want to count semi-visible items it would be the script you need:
var invisibleItems = [];
for(var i=0; i<element.childElementCount; i++){
if (element.children[i].offsetTop + element.children[i].offsetHeight >
element.offsetTop + element.offsetHeight ||
element.children[i].offsetLeft + element.children[i].offsetWidth >
element.offsetLeft + element.offsetWidth ){
invisibleItems.push(element.children[i]);
}
}
And if you don't want to count semi-visible you can calculate with a little difference.
Check the MySQL Datetime Functions:
Try this:
SELECT *
FROM tableA
WHERE YEAR(columnName) = YEAR(CURRENT_DATE()) AND
MONTH(columnName) = MONTH(CURRENT_DATE());
Yes, you can!
$str = 'One';
$class = 'Class'.$str;
$object = new $class();
When using namespaces, supply the fully qualified name:
$class = '\Foo\Bar\MyClass';
$instance = new $class();
Other cool stuff you can do in php are:
Variable variables:
$personCount = 123;
$varname = 'personCount';
echo $$varname; // echo's 123
And variable functions & methods.
$func = 'my_function';
$func('param1'); // calls my_function('param1');
$method = 'doStuff';
$object = new MyClass();
$object->$method(); // calls the MyClass->doStuff() method.
For PHP, Java, C++, C, Perl, JavaScript, CSS you can try:
Here is another solution from http://web-profile.com.ua/
<script type="text/javascript">
$.fn.is_on_screen = function(){
var win = $(window);
var viewport = {
top : win.scrollTop(),
left : win.scrollLeft()
};
viewport.right = viewport.left + win.width();
viewport.bottom = viewport.top + win.height();
var bounds = this.offset();
bounds.right = bounds.left + this.outerWidth();
bounds.bottom = bounds.top + this.outerHeight();
return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
};
if( $('.target').length > 0 ) { // if target element exists in DOM
if( $('.target').is_on_screen() ) { // if target element is visible on screen after DOM loaded
$('.log').html('<div class="alert alert-success">target element is visible on screen</div>'); // log info
} else {
$('.log').html('<div class="alert">target element is not visible on screen</div>'); // log info
}
}
$(window).scroll(function(){ // bind window scroll event
if( $('.target').length > 0 ) { // if target element exists in DOM
if( $('.target').is_on_screen() ) { // if target element is visible on screen after DOM loaded
$('.log').html('<div class="alert alert-success">target element is visible on screen</div>'); // log info
} else {
$('.log').html('<div class="alert">target element is not visible on screen</div>'); // log info
}
}
});
</script>
See it in JSFiddle
It's possible to make the multiple transitions set with different values for duration, delay and timing function. To split different transitions use ,
button{
transition: background 1s ease-in-out 2s, width 2s linear;
-webkit-transition: background 1s ease-in-out 2s, width 2s linear; /* Safari */
}
Reference: https://kolosek.com/css-transition/
The user that is configured to run this scheduled task must have "Log on as a batch job" rights on the computer that hosts the exe you are launching. This can be configured on the local security policy of the computer that hosts the exe. You can change the policy (on the server hosting the exe) under
Administrative Tools -> Local Security Policy -> Local Policies -> User Rights Assignment -> Log On As Batch Job
Add your user to this list (you could also make the user account a local admin on the machine hosting the exe).
Finally, you could also simply copy your exe from the network location to your local computer and run it from there instead.
Note also that a domain policy could be restricting "Log on as a batch job" rights at your organization.
Despite this being against the general SO policy on these matters, this seems to be what the OP genuinely wants:
http://www.google.com/search?btnG=1&pws=0&q=java+executable+wrapper
If you'd like, you could also try creating the appropriate batch or script file containing the single line:
java -jar MyJar.jar
Or in many cases on windows just double clicking the executable jar.
You can use std::set
instead of std::map
.
You can store both key and value in std::pair
and the type of container will look like this:
std::set< std::pair<int, std::string> > items;
std::set
will sort it's values both by original keys and values that were stored in std::map
.
I use a "do while" loop to read the output of the find command. In this example, I am matching (rather than excluding) certain patterns since there are a more limited number of pattern matches that I want than that I don't want. You could reverse the logic with a -not in front of the -iname flags:
find . -type f -iname "*.flac" -o -print0 -iname "*.mp3" -print0 -o -iname "*.wav" -print0 -o -iname "*.aac" -print0 -o -iname "*.wma" -print0 | while read -d $'\0' file; do cp -ruv "$file" "/media/wd/network_sync/music/$file"; done
I use the above to copy all music type files that are newer on my server than the files on a Western Digital TV Live Hub that I have mounted at /media/wd. I use the above because I have a lot of DVD files, mpegs, etc. that I want to exclude AND because for some reason rsync looks like it is copying, but after I look at the wd device, the files are not there despite no errors during the rsync with this command:
rsync -av --progress --exclude=*.VOB --exclude=*.avi --exclude=*.mkv --exclude=*.ts --exclude=*.mpg --exclude=*.iso --exclude=*ar --exclude=*.vob --exclude=*.BUP --exclude=*.cdi --exclude=*.ISO --exclude=*.shn --exclude=*.MPG --exclude=*.AVI --exclude=*.DAT --exclude=*.img --exclude=*.nrg --exclude=*.cdr --exclude=*.bin --exclude=*.MOV --exclude=*.goutputs* --exclude=*.flv --exclude=*.mov --exclude=*.m2ts --exclude=*.cdg --exclude=*.IFO --exclude=*.asf --exclude=*.ite /media/2TB\ Data/data/music/* /media/wd/network_sync/music/
As mentioned by Adam you have to take your system limitations into consideration before you can decide on approach whether you have enough memory to read it all into memory replace parts of it and re-write it.
If you're dealing with a small file or have no memory issues this might help:
Option 1) Read entire file into memory, do a regex substitution on the entire or part of the line and replace it with that line plus the extra line. You will need to make sure that the 'middle line' is unique in the file or if you have timestamps on each line this should be pretty reliable.
# open file with r+b (allow write and binary mode)
f = open("file.log", 'r+b')
# read entire content of file into memory
f_content = f.read()
# basically match middle line and replace it with itself and the extra line
f_content = re.sub(r'(middle line)', r'\1\nnew line', f_content)
# return pointer to top of file so we can re-write the content with replaced string
f.seek(0)
# clear file content
f.truncate()
# re-write the content with the updated content
f.write(f_content)
# close file
f.close()
Option 2) Figure out middle line, and replace it with that line plus the extra line.
# open file with r+b (allow write and binary mode)
f = open("file.log" , 'r+b')
# get array of lines
f_content = f.readlines()
# get middle line
middle_line = len(f_content)/2
# overwrite middle line
f_content[middle_line] += "\nnew line"
# return pointer to top of file so we can re-write the content with replaced string
f.seek(0)
# clear file content
f.truncate()
# re-write the content with the updated content
f.write(''.join(f_content))
# close file
f.close()
I would pick a table size of n * 1.5 or n + (n >> 1), this would give a load factor of .66666~ without division, which is slow on most systems, especially on portable systems where there is no division in the hardware.
You can use the System.Diagnostics.Process.Start method to start a process. You can even pass a URL as a string and it'll kick off the default browser.
I came here with the same Error, though one with a different origin.
It is caused by unsupported float index in 1.12.0 and newer numpy versions even if the code should be considered as valid.
An int
type is expected, not a np.float64
Solution: Try to install numpy 1.11.0
sudo pip install -U numpy==1.11.0.
On some earlier iOS versions(like iOS 9, 10), scrollViewDidEndDecelerating
won't be triggered if the scrollView is suddenly stopped by touching.
But in the current version (iOS 13), scrollViewDidEndDecelerating
will be triggered for sure (As far as I know).
So, if your App targeted earlier versions as well, you might need a workaround like the one mentioned by Ashley Smart, or you can the following one.
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
if !scrollView.isTracking, !scrollView.isDragging, !scrollView.isDecelerating { // 1
scrollViewDidEndScrolling(scrollView)
}
}
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
if !decelerate, scrollView.isTracking, !scrollView.isDragging, !scrollView.isDecelerating { // 2
scrollViewDidEndScrolling(scrollView)
}
}
func scrollViewDidEndScrolling(_ scrollView: UIScrollView) {
// Do something here
}
UIScrollView will be stoped in three ways:
- quickly scrolled and stopped by itself
- quickly scrolled and stopped by finger touch (like Emergency brake)
- slowly scrolled and stopped
The first one can be detected by scrollViewDidEndDecelerating
and other similar methods while the other two can't.
Luckily, UIScrollView
has three statuses we can use to identify them, which is used in the two lines commented by "//1" and "//2".
NSNotificationCenter add observer syntax in Swift 4.0 for iOS 11
NotificationCenter.default.addObserver(self, selector: #selector(keyboardShow), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
This is for keyboardWillShow notification name type. Other type can be selected from the available option
the Selector is of type @objc func which handle how the keyboard will show ( this is your user function )
Sample Html:
<section id="parent">
<article class="child"></article>
<article class="child"></article>
</section>
Js:
jQuery.fn.redraw = function() {
return this.hide(0,function() {$(this).show(100);});
// hide immediately and show with 100ms duration
};
call function:
//<==bad idea$('article.child').redraw();
$('#parent').redraw();
Or maybe and that is prob it
<img src="path" onclick="this.src='path'">
_x000D_
Just looking at the message it sounds like one or more of the components that you reference, or one or more of their dependencies is not registered properly.
If you know which component it is you can use regsvr32.exe to register it, just open a command prompt, go to the directory where the component is and type regsvr32 filename.dll
(assuming it's a dll), if it works, try to run the code again otherwise come back here with the error.
If you don't know which component it is, try re-installing/repairing the GIS software (I assume you've installed some GIS software that includes the component you're trying to use).
Post data to backend using retrofit
implementation 'com.squareup.retrofit2:retrofit:2.8.1'
implementation 'com.squareup.retrofit2:converter-gson:2.8.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.okhttp3:logging-interceptor:4.5.0'
public interface UserService {
@POST("users/")
Call<UserResponse> userRegistration(@Body UserRegistration
userRegistration);
}
public class ApiClient {
private static Retrofit getRetrofit(){
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor();
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient okHttpClient = new OkHttpClient
.Builder()
.addInterceptor(httpLoggingInterceptor)
.build();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://api.larntech.net/")
.addConverterFactory(GsonConverterFactory.create())
.client(okHttpClient)
.build();
return retrofit;
}
public static UserService getService(){
UserService userService = getRetrofit().create(UserService.class);
return userService;
}
}
display: table;
h1 {_x000D_
display: table; /* keep the background color wrapped tight */_x000D_
margin: 0px auto 0px auto; /* keep the table centered */_x000D_
padding:5px;font-size:20px;background-color:green;color:#ffffff;_x000D_
}
_x000D_
<h1>The Last Will and Testament of Eric Jones</h1>
_x000D_
fiddle
http://jsfiddle.net/J7VBV/293/
more
display: table
tells the element to behave as a normal HTML table would.
More about it at w3schools, CSS Tricks and here
display: inline-flex;
text-align: center;
on parent.container {_x000D_
text-align: center; /* center the child */_x000D_
}_x000D_
h1 {_x000D_
display: inline-flex; /* keep the background color wrapped tight */_x000D_
padding:5px;font-size:20px;background-color:green;color:#ffffff;_x000D_
}
_x000D_
<div class="container">_x000D_
<h1>The Last Will and Testament of Eric Jones</h1>_x000D_
</div>
_x000D_
display: flex;
.container {_x000D_
display: flex;_x000D_
justify-content: center; /* center the child */_x000D_
}_x000D_
h1 {_x000D_
display: flex;_x000D_
/* margin: 0 auto; or use auto left/right margin instead of justify-content center */_x000D_
padding:5px;font-size:20px;background-color:green;color:#ffffff;_x000D_
}
_x000D_
<div class="container">_x000D_
<h1>The Last Will and Testament of Eric Jones</h1>_x000D_
</div>
_x000D_
about
Probably the most popular guide to Flexbox and one I reference constantly is at CSS Tricks
display: block;
.container {_x000D_
display: flex;_x000D_
justify-content: center; /* centers child */_x000D_
}_x000D_
h1 {_x000D_
display: block;_x000D_
padding:5px;font-size:20px;background-color:green;color:#ffffff;_x000D_
}
_x000D_
<div class="container">_x000D_
<h1>The Last Will and Testament of Eric Jones</h1>_x000D_
</div>
_x000D_
::before
h1 {_x000D_
display: flex; /* set a flex box */_x000D_
justify-content: center; /* so you can center the content like this */_x000D_
}_x000D_
_x000D_
h1::before {_x000D_
content:'The Last Will and Testament of Eric Jones'; /* the content */_x000D_
padding: 5px;font-size: 20px;background-color: green;color: #ffffff;_x000D_
}
_x000D_
<h1></h1>
_x000D_
fiddle
http://jsfiddle.net/J7VBV/457/
about
More about css pseudo elements ::before and ::after at CSS Tricks and pseudo elements in general at w3schools
display: inline-block;
centering with position: absolute
and translateX
requires a position: relative
parent
.container {_x000D_
position: relative; /* required for absolute positioned child */_x000D_
}_x000D_
h1 {_x000D_
display: inline-block; /* keeps container wrapped tight to content */_x000D_
position: absolute; /* to absolutely position element */_x000D_
top: 0;_x000D_
left: 50%; /* part1 of centering with translateX/Y */_x000D_
transform: translateX(-50%); /* part2 of centering with translateX/Y */_x000D_
white-space: nowrap; /* text lines will collapse without this */_x000D_
padding:5px;font-size:20px;background-color:green;color:#ffffff;_x000D_
}
_x000D_
<h1>The Last Will and Testament of Eric Jones</h1>
_x000D_
about
More on centering with transform: translate();
(and centering in general) in this CSS tricks article
text-shadow:
and box-shadow:
h1, h2, h3, h4, h5 {display: table;margin: 10px auto;padding: 5px;font-size: 20px;color: #ffffff;overflow:hidden;}_x000D_
h1 {_x000D_
text-shadow: 0 0 5px green,0 0 5px green,_x000D_
0 0 5px green,0 0 5px green,_x000D_
0 0 5px green,0 0 5px green,_x000D_
0 0 5px green,0 0 5px green;_x000D_
}_x000D_
h2 {_x000D_
text-shadow: -5px -5px 5px green,-5px 5px 5px green,_x000D_
5px -5px 5px green,5px 5px 5px green;_x000D_
}_x000D_
h3 {_x000D_
color: hsla(0, 0%, 100%, 0.8);_x000D_
text-shadow: 0 0 10px hsla(120, 100%, 25%, 0.5),_x000D_
0 0 10px hsla(120, 100%, 25%, 0.5),_x000D_
0 0 10px hsla(120, 100%, 25%, 0.5),_x000D_
0 0 5px hsla(120, 100%, 25%, 1),_x000D_
0 0 5px hsla(120, 100%, 25%, 1),_x000D_
0 0 5px hsla(120, 100%, 25%, 1);_x000D_
}_x000D_
h4 { /* overflow:hidden is the key to this one */_x000D_
text-shadow: 0px 0px 35px green,0px 0px 35px green,_x000D_
0px 0px 35px green,0px 0px 35px green;_x000D_
}_x000D_
h5 { /* set the spread value to something larger than you'll need to use as I don't believe percentage values are accepted */_x000D_
box-shadow: inset 0px 0px 0px 1000px green;_x000D_
}
_x000D_
<h1>The First Will and Testament of Eric Jones</h1>_x000D_
<h2>The 2nd Will and Testament of Eric Jones</h2>_x000D_
<h3>The 3rd Will and Testament of Eric Jones</h3>_x000D_
<h4>The Last Will and Testament of Eric Jones</h4>_x000D_
<h5>The Last Box and Shadow of Eric Jones</h5>
_x000D_
fiddle
https://jsfiddle.net/Hastig/t8L9Ly8o/
There are a few other ways to go about this by combining the different display options and centering methods above.
There is a good class that does what you want. It can be downloaded at: http://sourceforge.net/projects/snoopy/
I would like to add this, I used this in laravel to just index my table:
My Code:
@foreach($resultsPerCountry->first()->studies as $result)
<tr>
<td>{{ ++$loop->index}}</td>
</tr>
@endforeach
For those of you who got here looking for the server-side OnClick
handler it is OnCheckedChanged
I have found the answer to my question myself:)
So what I didn't understand was how the glibc could differentiate between a Segfault and a corrupted double-linked list, because according to my understanding, from perspective of glibc they should look like the same thing. Because if I implement a double-linked list inside my program, how could the glibc possibly know that this is a double-linked list, instead of any other struct? It probably can't, so thats why i was confused.
Now I've looked at malloc/malloc.c inside the glibc's code, and I see the following:
1543 /* Take a chunk off a bin list */
1544 #define unlink(P, BK, FD) { \
1545 FD = P->fd; \
1546 BK = P->bk; \
1547 if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) \
1548 malloc_printerr (check_action, "corrupted double-linked list", P); \
1549 else { \
1550 FD->bk = BK; \
1551 BK->fd = FD; \
So now this suddenly makes sense. The reason why glibc can know that this is a double-linked list is because the list is part of glibc itself. I've been confused because I thought glibc can somehow detect that some programming is building a double-linked list, which I wouldn't understand how that works. But if this double-linked list that it is talking about, is part of glibc itself, of course it can know it's a double-linked list.
I still don't know what has triggered this error. But at least I understand the difference between corrupted double-linked list and a Segfault, and how the glibc can know this struct is supposed to be a double-linked list:)
@Entity(name = "someThing")
=> this name will be used to identify the domain ..this name will only be identified by hql
queries ..ie ..name of the domain object
@Table(name = "someThing")
=> this name will be used to which table referred by domain object..ie ..name of the table
You might be able to make use of sql.js.
sql.js is a port of SQLite to JavaScript, by compiling the SQLite C code with Emscripten. no C bindings or node-gyp compilation here.
<script src='js/sql.js'></script>
<script>
//Create the database
var db = new SQL.Database();
// Run a query without reading the results
db.run("CREATE TABLE test (col1, col2);");
// Insert two rows: (1,111) and (2,222)
db.run("INSERT INTO test VALUES (?,?), (?,?)", [1,111,2,222]);
// Prepare a statement
var stmt = db.prepare("SELECT * FROM test WHERE col1 BETWEEN $start AND $end");
stmt.getAsObject({$start:1, $end:1}); // {col1:1, col2:111}
// Bind new values
stmt.bind({$start:1, $end:2});
while(stmt.step()) { //
var row = stmt.getAsObject();
// [...] do something with the row of result
}
</script>
sql.js
is a single JavaScript file and is about 1.5MiB in size currently. While this could be a problem in a web-page, the size is probably acceptable for an extension.
C++11 (Source: Iterator Invalidation Rules (C++0x))
Sequence containers
vector
: all iterators and references before the point of insertion are unaffected, unless the new container size is greater than the previous capacity (in which case all iterators and references are invalidated) [23.3.6.5/1]deque
: all iterators and references are invalidated, unless the inserted member is at an end (front or back) of the deque (in which case all iterators are invalidated, but references to elements are unaffected) [23.3.3.4/1]list
: all iterators and references unaffected [23.3.5.4/1]forward_list
: all iterators and references unaffected (applies to insert_after
) [23.3.4.5/1]array
: (n/a)Associative containers
[multi]{set,map}
: all iterators and references unaffected [23.2.4/9]Unsorted associative containers
unordered_[multi]{set,map}
: all iterators invalidated when rehashing occurs, but references unaffected [23.2.5/8]. Rehashing does not occur if the insertion does not cause the container's size to exceed z * B
where z
is the maximum load factor and B
the current number of buckets. [23.2.5/14]Container adaptors
stack
: inherited from underlying containerqueue
: inherited from underlying containerpriority_queue
: inherited from underlying containerSequence containers
vector
: every iterator and reference at or after the point of erase is invalidated [23.3.6.5/3]deque
: erasing the last element invalidates only iterators and references to the erased elements and the past-the-end iterator; erasing the first element invalidates only iterators and references to the erased elements; erasing any other elements invalidates all iterators and references (including the past-the-end iterator) [23.3.3.4/4]list
: only the iterators and references to the erased element is invalidated [23.3.5.4/3]forward_list
: only the iterators and references to the erased element is invalidated (applies to erase_after
) [23.3.4.5/1]array
: (n/a)Associative containers
[multi]{set,map}
: only iterators and references to the erased elements are invalidated [23.2.4/9]Unordered associative containers
unordered_[multi]{set,map}
: only iterators and references to the erased elements are invalidated [23.2.5/13]Container adaptors
stack
: inherited from underlying containerqueue
: inherited from underlying containerpriority_queue
: inherited from underlying containervector
: as per insert/erase [23.3.6.5/12]deque
: as per insert/erase [23.3.3.3/3]list
: as per insert/erase [23.3.5.3/1]forward_list
: as per insert/erase [23.3.4.5/25]array
: (n/a)Unless otherwise specified (either explicitly or by defining a function in terms of other functions), invoking a container member function or passing a container as an argument to a library function shall not invalidate iterators to, or change the values of, objects within that container. [23.2.1/11]
no swap() function invalidates any references, pointers, or iterators referring to the elements of the containers being swapped. [ Note: The end() iterator does not refer to any element, so it may be invalidated. —end note ] [23.2.1/10]
Other than the above caveat regarding swap()
, it's not clear whether "end" iterators are subject to the above listed per-container rules; you should assume, anyway, that they are.
vector
and all unordered associative containers support reserve(n)
which guarantees that no automatic resizing will occur at least until the size of the container grows to n
. Caution should be taken with unordered associative containers because a future proposal will allow the specification of a minimum load factor, which would allow rehashing to occur on insert
after enough erase
operations reduce the container size below the minimum; the guarantee should be considered potentially void after an erase
.
When i upgraded i just moved my SDK to my user folder C:\Users\Nick\Android-SDK and updated my path in Android Studio. Worked like a charm.
EDIT: (More detail) - My SDK was originally inside C:\Program Files (x86)\Android\android-studio\sdk, I just Cut and Paste the entire \sdk folder into C:\Users\Nick\Android-SDK, then set it inside Android Studio to the new location.
valgrind --log-file="filename"
Python
element.text
Java
element.getText()
C#
element.Text
Ruby
element.text
You should bind the tap event, the click does not exist on mobile safari or in the UIWbview. You can also use this polyfill ,to avoid the 300ms delay when a link is touched.
You may have also put your console.log
after an expectation that fails and is uncaught, so your log line never gets executed.
Well this is not listed but a combo of some that is already posted:
if (Build.VERSION.SDK_INT >= 11) {
recreate();
} else {
Intent intent = getIntent();
finish();
startActivity(intent);
}
If you are only looking to point to a different location for you identity file, the you can modify your ~/.ssh/config file with the following entry:
IdentityFile ~/.foo/identity
man ssh_config
to find other config options.
The problem for me was that I had .rnd in my home directory but it was owned by root. Deleting it and reissuing the openssl command fixed this.
BTW, if anyone want to get coordinates of element on screen without jQuery, please try this:
function getOffsetTop (el) {
if (el.offsetParent) return el.offsetTop + getOffsetTop(el.offsetParent)
return el.offsetTop || 0
}
function getOffsetLeft (el) {
if (el.offsetParent) return el.offsetLeft + getOffsetLeft(el.offsetParent)
return el.offsetleft || 0
}
function coordinates(el) {
var y1 = getOffsetTop(el) - window.scrollY;
var x1 = getOffsetLeft(el) - window.scrollX;
var y2 = y1 + el.offsetHeight;
var x2 = x1 + el.offsetWidth;
return {
x1: x1, x2: x2, y1: y1, y2: y2
}
}
If your code is prepared to deal with overflow errors, you can throw an exception if data
is too large.
size_t data = 99999999;
if ( data > INT_MAX )
{
throw std::overflow_error("data is larger than INT_MAX");
}
int convertData = static_cast<int>(data);
You need to create a set of escaped (with \
) parentheses (that match the parentheses) and a group of regular parentheses that create your capturing group:
var regExp = /\(([^)]+)\)/;_x000D_
var matches = regExp.exec("I expect five hundred dollars ($500).");_x000D_
_x000D_
//matches[1] contains the value between the parentheses_x000D_
console.log(matches[1]);
_x000D_
Breakdown:
\(
: match an opening parentheses(
: begin capturing group[^)]+
: match one or more non )
characters)
: end capturing group\)
: match closing parenthesesHere is a visual explanation on RegExplained
In my case, I was trying the same import in manage.py shell
. The shell was messed up with the updated db. I mean, I forgot to restart my shell after updating the DB.
To resolve the issue, I had to stop the shell by the following command:
>>> exit()
then restart the shell by the following command:
$ python3 manage.py shell
Hope this will help somebody like me.
This should do it:
[entry for tag in tags for entry in entries if tag in entry]
A view helps us in get rid of utilizing database space all the time. If you create a table it is stored in database and holds some space throughout its existence. Instead view is utilized when a query runs hence saving the db space. And we cannot create big tables all the time joining different tables though we could but its depends how big the table is to save the space. So view just temporarily create a table with joining different table at the run time. Experts,Please correct me if I am wrong.
I had your code setup on jsFiddle to try diagnose the problem.
However, I don't seem to encounter your issue. Could you take a look and let us know?
HTML
<div class="hero-unit">
<h1>Contact Form</h1>
</br>
<form method="POST" action="contact-form-submission.php" class="form-horizontal" id="contact-form">
<div class="control-group">
<label class="control-label" for="name">Name</label>
<div class="controls">
<input type="text" name="name" id="name" placeholder="Your name">
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">Email Address</label>
<div class="controls">
<input type="text" name="email" id="email" placeholder="Your email address">
</div>
</div>
<div class="control-group">
<label class="control-label" for="subject">Subject</label>
<div class="controls">
<select id="subject" name="subject">
<option value="na" selected="">Choose One:</option>
<option value="service">Feedback</option>
<option value="suggestions">Suggestion</option>
<option value="support">Question</option>
<option value="other">Other</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="message">Message</label>
<div class="controls">
<textarea name="message" id="message" rows="8" class="span5" placeholder="The message you want to send to us."></textarea>
</div>
</div>
<div class="form-actions">
<input type="hidden" name="save" value="contact">
<button type="submit" class="btn btn-success">Submit Message</button>
<button type="reset" class="btn">Cancel</button>
</div>
</form>
Javascript
$(document).ready(function () {
$('#contact-form').validate({
rules: {
name: {
minlength: 2,
required: true
},
email: {
required: true,
email: true
},
message: {
minlength: 2,
required: true
}
},
highlight: function (element) {
$(element).closest('.control-group').removeClass('success').addClass('error');
},
success: function (element) {
element.text('OK!').addClass('valid')
.closest('.control-group').removeClass('error').addClass('success');
}
});
});
Your task declaration is incorrectly combining the Copy
task type and project.copy
method, resulting in a task that has nothing to copy and thus never runs. Besides, Copy
isn't the right choice for renaming a directory. There is no Gradle API for renaming, but a bit of Groovy code (leveraging Java's File
API) will do. Assuming Project1
is the project directory:
task renABCToXYZ { doLast { file("ABC").renameTo(file("XYZ")) } }
Looking at the bigger picture, it's probably better to add the renaming logic (i.e. the doLast
task action) to the task that produces ABC
.
DecimalFormat form = new DecimalFormat("#.##", new DecimalFormatSymbols(Locale.US));
EditText et;
et.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
double a = Double.parseDouble(et.getText().toString());
et.setText(form.format(a));
}
return false;
}
});
What this does is when you exit editing phase it formats the field to the right format. At them moment it has only 2 decimal charachters. I think this is pretty easy way to do this.
This alternative also provides a back function.
The template:
<a ng-click='back()'>Back</a>
The module:
myModule.run(function ($rootScope, $location) {
var history = [];
$rootScope.$on('$routeChangeSuccess', function() {
history.push($location.$$path);
});
$rootScope.back = function () {
var prevUrl = history.length > 1 ? history.splice(-2)[0] : "/";
$location.path(prevUrl);
};
});
In my case the sql server version on my localhost is higher than that on the production server and hence some new variables were added to the generated script from the localhost. This caused errors in creating the table in the first place. Since the creation of the table failed, subsequent query on the "NON EXISITING" table also failed. Luckily, in among the long list of the sql errors, I found this "OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF" to be the new varialbe in the script causing my issue. I did a search and replace and the error went away. Hope it helps someone.
if you are using jupyter notebook like:
MODEL_NAME = os.path.basename(file)[:-3]
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-10-f391bbbab00d> in <module>
----> 1 MODEL_NAME = os.path.basename(__file__)[:-3]
NameError: name '__file__' is not defined
you should place a ' ! ' in front like this
!MODEL_NAME = os.path.basename(__file__)[:-3]
/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `MODEL_NAME = os.path.basename(__file__)[:-3]'
done.....
It may not be appropriate... but it helped me.
<input placeholder="Date" class="textbox-n" type="text" onfocus="(this.type='date')" id="date">
_x000D_
Update 2018-02-03 with Spring Boot 1.5.8.RELEASE.
In pom.xml, you need to tell Spring plugin when it is building that it is a war file by change package to war, like this:
<packaging>war</packaging>
Also, you have to excluded the embedded tomcat while building the package by adding this:
<!-- to deploy as a war in tomcat -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
The full runable example is in here https://www.surasint.com/spring-boot-create-war-for-tomcat/
Screen resolution is total no of pixel in screen. Following program will extract the screen resolution of the device. It will print screen width and height. Those values are in pixel.
public static Point getScreenResolution(Context context) {
// get window managers
WindowManager manager = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
Point point = new Point();
display.getSize(point);
// get width and height
int width = point.x;
int height = point.y;
return point;
}
If you already have a list and want to add values from a delimited string, you can use AddRange
or InsertRange
. For example:
existingList.AddRange(names.Split(','));
In my case, I had 2 forms in differents views and differents router files. The first router used the name field with view one and its file name was "inputGroupFile02". The second view had another name for file input. For some reason Multer not allows you set differents name in different views, so I dicided to use same name for the file input in both views.
if you set NULL for all records try this:
UPDATE `table_name` SET `column_you_want_set_null`= NULL
OR just set NULL for special records use WHERE
UPDATE `table_name` SET `column_you_want_set_null`= NULL WHERE `column_name` = 'column_value'
Open the VBA Editor of Excel and type this in the Immediate Window (See Screenshot)
Application.AskToUpdateLinks = False
Close Excel and then open your File. It will not prompt you again. Remember to reset it when you close the workbook else it will not work for other workbooks as well.
ScreenShot:
EDIT
So applying it to your code, your code will look like this
Function getWorkbook(bkPath As String) As Workbook
Application.AskToUpdateLinks = False
Set getWorkbook = Workbooks.Open(bkPath, False)
Application.AskToUpdateLinks = True
End Function
FOLLOWUP
Sigil, The code below works on files with broken links as well. Here is my test code.
Test Conditions
Sample1.xlsx
and Sample2.xlsx
and save them on C:\
A1
of Sample1.xlsx
, type this formula ='C:\[Sample2.xlsx]Sheet1'!$A$1
Sample
. You will notice that you will not get a prompt.Code
Option Explicit
Sub Sample()
getWorkbook "c:\Sample1.xlsx"
End Sub
Function getWorkbook(bkPath As String) As Workbook
Application.AskToUpdateLinks = False
Set getWorkbook = Workbooks.Open(bkPath, False)
Application.AskToUpdateLinks = True
End Function
You can just clone it and replace it with itself, with all events still attached:
<input type="file" id="control">
and
var input = $("#control");
function something_happens() {
input.replaceWith(input.val('').clone(true));
};
Thanks : Css-tricks.com
I agree with Mutanos and Alecio. Further, one can check as many identical method calls as possible (verifying the subsequent calls in the production code, the order of the verify's does not matter). Here is the code:
import static org.mockito.AdditionalMatchers.*;
verify(mockObject).myMethod(aryEq(new byte[] { 0 }));
verify(mockObject).myMethod(aryEq(new byte[] { 1, 2 }));
i solved this issue after more Study...
for Api21 and more use
<item name="android:textColorPrimary">@color/white</item>
for Lower versions use
<item name="actionMenuTextColor">@color/white</item>
Reinstalling CMake worked for me. The new copy of CMake figured out that it should use Visual Studio 11 instead of 10.
For Juno: (With Source in E:\workspace and destination in C:\workspace)
Copy project directory in its entirety to the workspace directory. (e.g. Copy E:\workspace\HelloWorld C:\workspace\helloWorld)
Start Eclipse.
Perform: File --> Import
Select: General -- > "Existing Project into Workspace"
"Next >"
Check "Select root Directory"
Select with "Browse Button"
Select "C:\workspace"
A list of existing projects will appear. Just check the ones that are in Bold (To Be Imported) then press the "Finish" button.
Review the Package Explorer and your copied projects should now be there.
There seems to be a lot of bad practice being thrown around Event Handler Attributes. Bad practice is not knowing and using available features where it is most appropriate. The Event Attributes are fully W3C Documented standards and there is nothing bad practice about them. It's no different than placing inline styles, which is also W3C Documented and can be useful in times. Whether you place it wrapped in script tags or not, it's gonna be interpreted the same way.
https://www.w3.org/TR/html5/webappapis.html#event-handler-idl-attributes
@Espo: I just have to say that regex is incredible. I'd hate to have to write the code that did something useful with the matches, such as if you wanted to actually find out what date and time the user typed.
It seems like Tom's solution would be more tenable, as it is about a zillion times simpler and with the addition of some parentheses you can easily get at the values the user typed:
(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})
If you're using perl, then you can get the values out with something like this:
$year = $1;
$month = $2;
$day = $3;
$hour = $4;
$minute = $5;
$second = $6;
Other languages will have a similar capability. Note that you will need to make some minor mods to the regex if you want to accept values such as single-digit months.
The Global.asax can be used to handle events arising from the application. This link provides a good explanation: http://aspalliance.com/1114
just add componentDidUpdate(){}
method in your code, and it will work.
you can check the life cycle of react native here:
I found this PHP 7.2 count() - SYNTAX error in sql.lib.php
That perfectly works on my config:
Debian 9,
PHP 7.2.3-1+0~20180306120016.19+stretch~1.gbp81bf3b (cli) (built: Mar 6 2018 12:00:19) ( NTS )
Open /usr/share/phpmyadmin/libraries/sql.lib.php
Change line: Move parenthesis before ==
|| ((count($analyzed_sql_results['select_expr'] ) == 1) && ($analyzed_sql_results['select_expr'][0] == '*')))
in
function PMA_isRememberSortingOrder($analyzed_sql_results){
return $GLOBALS['cfg']['RememberSorting']
&& ! ($analyzed_sql_results['is_count']
|| $analyzed_sql_results['is_export']
|| $analyzed_sql_results['is_func']
|| $analyzed_sql_results['is_analyse'])
&& $analyzed_sql_results['select_from']
&& ((empty($analyzed_sql_results['select_expr']))
|| ((count($analyzed_sql_results['select_expr'] ) == 1)
&& ($analyzed_sql_results['select_expr'][0] == '*')))
&& count($analyzed_sql_results['select_tables']) == 1;
}
It does work in Firefox (including 2.0.0.20
). See http://jsbin.com/akili (add /edit
to the url to edit):
<p id="one">One</p>
<a href="#" onclick="document.getElementById('one').id = 'two'; return false">Link2</a>
The first click changes the id
to "two"
, the second click errors because the element with id="one"
now can't be found!
Perhaps you have another element already with id="two"
(FYI you can't have more than one element with the same id
).
Simply add a class (on any element) and check inside the interval if it's there. This is more reliable, customisable and cross-language than any other way, I believe.
var i = 0;_x000D_
this.setInterval(function() {_x000D_
if(!$('#counter').hasClass('pauseInterval')) { //only run if it hasn't got this class 'pauseInterval'_x000D_
console.log('Counting...');_x000D_
$('#counter').html(i++); //just for explaining and showing_x000D_
} else {_x000D_
console.log('Stopped counting');_x000D_
}_x000D_
}, 500);_x000D_
_x000D_
/* In this example, I'm adding a class on mouseover and remove it again on mouseleave. You can of course do pretty much whatever you like */_x000D_
$('#counter').hover(function() { //mouse enter_x000D_
$(this).addClass('pauseInterval');_x000D_
},function() { //mouse leave_x000D_
$(this).removeClass('pauseInterval');_x000D_
}_x000D_
);_x000D_
_x000D_
/* Other example */_x000D_
$('#pauseInterval').click(function() {_x000D_
$('#counter').toggleClass('pauseInterval');_x000D_
});
_x000D_
body {_x000D_
background-color: #eee;_x000D_
font-family: Calibri, Arial, sans-serif;_x000D_
}_x000D_
#counter {_x000D_
width: 50%;_x000D_
background: #ddd;_x000D_
border: 2px solid #009afd;_x000D_
border-radius: 5px;_x000D_
padding: 5px;_x000D_
text-align: center;_x000D_
transition: .3s;_x000D_
margin: 0 auto;_x000D_
}_x000D_
#counter.pauseInterval {_x000D_
border-color: red; _x000D_
}
_x000D_
<!-- you'll need jQuery for this. If you really want a vanilla version, ask -->_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
_x000D_
_x000D_
<p id="counter"> </p>_x000D_
<button id="pauseInterval">Pause/unpause</button></p>
_x000D_
I have also come across the same issue and figuredout the issue here is the solution.
Lot of people assumes Eclipse and maven intergration is tough but its very eassy.
1) download the maven and unzip it in to your favorite directory.
Ex : C:\satyam\DEV_TOOLS\apache-maven-3.1.1
2) Set the environment variable for Maven(Hope every one knows where to go to set this)
In the system variable: Variable_name = M2_HOME Variable_Value =C:\satyam\DEV_TOOLS\apache-maven-3.1.1
Next in the same System Variable you will find the variable name called Path: just edit the path variable and add M2_HOME details like with the existing values.
%M2_HOME%/bin;
so in the second step now you are done setting the Maven stuff to your system.you need to cross check it whether your setting is correct or not, go to command prompt and type mvn--version it should disply the path of your Maven
3) Open the eclipse and go to Install new software and type M2E Plugin install and restart the Eclipse
with the above 3 steps you are done with Maven and Maven Plugin with eclipse
4) Maven is used .m2 folder to download all the jars, it will find in Ex: C:\Users\tempsakat.m2
under this folder one settings.xml file and one repository folder will be there
5) go to Windwo - preferences of your Eclipse and type Maven then select UserSettings from left menu then give the path of the settings.xml here .
now you are done...
SQlite3 has a method named row_factory. This method would allow you to access the values by column name.
https://www.kite.com/python/examples/3884/sqlite3-use-a-row-factory-to-access-values-by-column-name
You could overlay one element above the blurred element like so
div {
position: absolute;
left:0;
top: 0;
}
p {
position: absolute;
left:0;
top: 0;
}
You can try with textContent.
var productId = val[key].textContent;
One of Androids powerful feature is the AsyncTask class.
To work with it, you have to first extend it and override doInBackground
(...).
doInBackground
automatically executes on a worker thread, and you can add some
listeners on the UI Thread to get notified about status update, those functions are
called: onPreExecute()
, onPostExecute()
and onProgressUpdate()
You can find a example here.
Refer to below post for other alternatives:
Not my answer :
I wasn't too happy with the answers above and some additional searching yielded this :
SELECT SYSDATE AS current_date,
SYSDATE + 1 AS plus_1_day,
SYSDATE + 1/24 AS plus_1_hours,
SYSDATE + 1/24/60 AS plus_1_minutes,
SYSDATE + 1/24/60/60 AS plus_1_seconds
FROM dual;
which I found very helpful. From http://sqlbisam.blogspot.com/2014/01/add-date-interval-to-date-or-dateadd.html
For very large spreadsheets, this solution is very fast:
function GoLastRow() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('A:AC').createFilter();
var criteria = SpreadsheetApp.newFilterCriteria().whenCellNotEmpty().build();
var rg = spreadsheet.getActiveSheet().getFilter().setColumnFilterCriteria(1, criteria).getRange();
var row = rg.getNextDataCell (SpreadsheetApp.Direction.DOWN);
LastRow = row.getRow();
spreadsheet.getActiveSheet().getFilter().remove();
spreadsheet.getActiveSheet().getRange(LastRow+1, 1).activate();
};
By default, the runserver command starts the development server on the internal IP at port 8000.
If you want to change the server’s port, pass it as a command-line argument. For instance, this command starts the server on port 8080:
python manage.py runserver 8080
Open git view :
1- select your project and choose merge 2- Select remote tracking 3- click ok
Git will merge the remote branch with local repository
4- then push
I believe your problem is this: in your while loop, n is divided by 2, but never cast as an integer again, so it becomes a float at some point. It is then added onto y, which is then a float too, and that gives you the warning.
Here is a comparison of the 3 ways you can watch a scope variable with examples:
$watch() is triggered by:
$scope.myArray = [];
$scope.myArray = null;
$scope.myArray = someOtherArray;
$watchCollection() is triggered by everything above AND:
$scope.myArray.push({}); // add element
$scope.myArray.splice(0, 1); // remove element
$scope.myArray[0] = {}; // assign index to different value
$watch(..., true) is triggered by EVERYTHING above AND:
$scope.myArray[0].someProperty = "someValue";
JUST ONE MORE THING...
$watch() is the only one that triggers when an array is replaced with another array even if that other array has the same exact content.
For example where $watch()
would fire and $watchCollection()
would not:
$scope.myArray = ["Apples", "Bananas", "Orange" ];
var newArray = [];
newArray.push("Apples");
newArray.push("Bananas");
newArray.push("Orange");
$scope.myArray = newArray;
Below is a link to an example JSFiddle that uses all the different watch combinations and outputs log messages to indicate which "watches" were triggered:
This class method can search in array by multiple conditions:
class Stdlib_Array
{
public static function multiSearch(array $array, array $pairs)
{
$found = array();
foreach ($array as $aKey => $aVal) {
$coincidences = 0;
foreach ($pairs as $pKey => $pVal) {
if (array_key_exists($pKey, $aVal) && $aVal[$pKey] == $pVal) {
$coincidences++;
}
}
if ($coincidences == count($pairs)) {
$found[$aKey] = $aVal;
}
}
return $found;
}
}
// Example:
$data = array(
array('foo' => 'test4', 'bar' => 'baz'),
array('foo' => 'test', 'bar' => 'baz'),
array('foo' => 'test1', 'bar' => 'baz3'),
array('foo' => 'test', 'bar' => 'baz'),
array('foo' => 'test', 'bar' => 'baz4'),
array('foo' => 'test4', 'bar' => 'baz1'),
array('foo' => 'test', 'bar' => 'baz1'),
array('foo' => 'test3', 'bar' => 'baz2'),
array('foo' => 'test', 'bar' => 'baz'),
array('foo' => 'test', 'bar' => 'baz'),
array('foo' => 'test4', 'bar' => 'baz1')
);
$result = Stdlib_Array::multiSearch($data, array('foo' => 'test4', 'bar' => 'baz1'));
var_dump($result);
Will produce:
array(2) {
[5]=>
array(2) {
["foo"]=>
string(5) "test4"
["bar"]=>
string(4) "baz1"
}
[10]=>
array(2) {
["foo"]=>
string(5) "test4"
["bar"]=>
string(4) "baz1"
}
}
This was probably a casting issue
. Casting syntax
happens when you try to combine two different types of variables
. Since we cannot convert a string
to an integer
or float
always, we have to convert our integers
into a string
. This is how you do it.: str(x)
. To convert to a integer, it's: int(x)
, and a float is float(x)
. Our code will be:
print('Total score for ' + str(name) + ' is ' + str(score))
Also! Run this snippet
to see a table of how to convert different types of variables
!
<table style="border-collapse: collapse; width: 100%;background-color:maroon; color: #00b2b2;">
<tbody>
<tr>
<td style="width: 50%;font-family: serif; padding: 3px;">Booleans</td>
<td style="width: 50%;font-family: serif; padding: 3px;"><code>bool()</code></td>
</tr>
<tr>
<td style="width: 50%;font-family: serif;padding: 3px">Dictionaries</td>
<td style="width: 50%;font-family: serif;padding: 3px"><code>dict()</code></td>
</tr>
<tr>
<td style="width: 50%;font-family: serif;padding: 3px">Floats</td>
<td style="width: 50%;font-family: serif;padding: 3px"><code>float()</code></td>
</tr>
<tr>
<td style="width: 50%;font-family: serif;padding:3px">Integers</td>
<td style="width: 50%;font-family: serif;padding:3px;"><code>int()</code></td>
</tr>
<tr>
<td style="width: 50%;font-family: serif;padding: 3px">Lists</td>
<td style="width: 50%font-family: serif;padding: 3px;"><code>list()</code></td>
</tr>
</tbody>
</table>
_x000D_
Again I suggest Simple and Easy
Its Working Perfect with ajax when user search and select it saves the selected information via ajax
$("#vendor-brands").select2({
ajax: {
url:site_url('general/get_brand_ajax_json'),
dataType: 'json',
delay: 250,
data: function (params) {
return {
q: params.term, // search term
page: params.page
};
},
processResults: function (data, params) {
// parse the results into the format expected by Select2
// since we are using custom formatting functions we do not need to
// alter the remote JSON data, except to indicate that infinite
// scrolling can be used
params.page = params.page || 1;
return {
results: data,
pagination: {
more: (params.page * 30) < data.total_count
}
};
},
cache: true
},
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
minimumInputLength: 1,
}).on("change", function(e) {
var lastValue = $("#vendor-brands option:last-child").val();
var lastText = $("#vendor-brands option:last-child").text();
alert(lastValue+' '+lastText);
});
Accepted answer of Kapil is flawed, it will update more than one record if there are 2 or more than one records available with same timestamps, not a true top 1 query.
;With cte as (
SELECT TOP(1) email_fk FROM abc WHERE id= 177 ORDER BY created DESC
)
UPDATE cte SET email_fk = 10
Ref Remus Rusanu Ans:- SQL update top1 row query
I have edited the given above example...
public class YourActivity extends implements OnMarkerClickListener
{
......
private void setMarker()
{
.......
googleMap.setOnMarkerClickListener(this);
myMarker = googleMap.addMarker(new MarkerOptions()
.position(latLng)
.title("My Spot")
.snippet("This is my spot!")
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
......
}
@Override
public boolean onMarkerClick(Marker marker) {
Toast.makeText(this,marker.getTitle(),Toast.LENGTH_LONG).show();
}
}
Solutions above are good but they require ~/.bash_profile. /usr/local/bin
is already in the $PATH and it can be confirmed by doing echo $PATH
. Download maven and run the following commands -
$ cd ~/Downloads
$ tar xvf apache-maven-3.5.3-bin.tar.gz
$ mv apache-maven-3.5.3 /usr/local/
$ cd /usr/local/bin
$ sudo ln -s ../apache-maven-3.5.3/bin/mvn mvn
$ mvn -version
$ which mvn
Note: The version of apache maven would be the one you will download.
Replace var appDelegate : AppDelegate?
with
let appDelegate = UIApplication.sharedApplication().delegate
as hinted on the second commented line in viewDidLoad()
.
The keyword "optional" refers exactly to the use of ?
, see this for more details.
A portable solution could use getc
.
#include <stdio.h>
char buffer[MAX_FILE_SIZE];
size_t i;
for (i = 0; i < MAX_FILE_SIZE; ++i)
{
int c = getc(fp);
if (c == EOF)
{
buffer[i] = 0x00;
break;
}
buffer[i] = c;
}
If you don't want to have a MAX_FILE_SIZE
macro or if it is a big number (such that buffer
would be to big to fit on the stack), use dynamic allocation.
In python
3.6.3 with pandas
0.22.0 you can also use concat
as long as you set as index the columns you want to use for the joining
pd.concat(
(iDF.set_index('name') for iDF in [df1, df2, df3]),
axis=1, join='inner'
).reset_index()
where df1
, df2
, and df3
are defined as in John Galt's answer
import pandas as pd
df1 = pd.DataFrame(np.array([
['a', 5, 9],
['b', 4, 61],
['c', 24, 9]]),
columns=['name', 'attr11', 'attr12']
)
df2 = pd.DataFrame(np.array([
['a', 5, 19],
['b', 14, 16],
['c', 4, 9]]),
columns=['name', 'attr21', 'attr22']
)
df3 = pd.DataFrame(np.array([
['a', 15, 49],
['b', 4, 36],
['c', 14, 9]]),
columns=['name', 'attr31', 'attr32']
)
The XLSB format is also dedicated to the macros embeded in an hidden workbook file located in excel startup folder (XLSTART).
A quick & dirty test with a xlsm or xlsb in XLSTART folder:
Measure-Command { $x = New-Object -com Excel.Application ;$x.Visible = $True ; $x.Quit() }
0,89s with a xlsb (binary) versus 1,3s with the same content in xlsm format (xml in a zip file) ... :)
As you comment in your question, awk
is really the way to go. To use cut
is possible together with tr -s
to squeeze spaces, as kev's answer shows.
Let me however go through all the possible combinations for future readers. Explanations are at the Test section.
tr -s ' ' < file | cut -d' ' -f4
awk '{print $4}' file
while read -r _ _ _ myfield _
do
echo "forth field: $myfield"
done < file
sed -r 's/^([^ ]*[ ]*){3}([^ ]*).*/\2/' file
Given this file, let's test the commands:
$ cat a
this is line 1 more text
this is line 2 more text
this is line 3 more text
this is line 4 more text
$ cut -d' ' -f4 a
is
# it does not show what we want!
$ tr -s ' ' < a | cut -d' ' -f4
1
2 # this makes it!
3
4
$
$ awk '{print $4}' a
1
2
3
4
This reads the fields sequentially. By using _
we indicate that this is a throwaway variable as a "junk variable" to ignore these fields. This way, we store $myfield
as the 4th field in the file, no matter the spaces in between them.
$ while read -r _ _ _ a _; do echo "4th field: $a"; done < a
4th field: 1
4th field: 2
4th field: 3
4th field: 4
This catches three groups of spaces and no spaces with ([^ ]*[ ]*){3}
. Then, it catches whatever coming until a space as the 4th field, that it is finally printed with \1
.
$ sed -r 's/^([^ ]*[ ]*){3}([^ ]*).*/\2/' a
1
2
3
4
you are almost there; you just need to give the reference to master; since you want to get the file from the master branch:
git checkout master -- filename
Note that the differences will be cached; so if you want to see the differences you obtained; use
git diff --cached
Actually you can only style few CSS properties on :modified option elements.
color
does not work, background-color
either, but you can set a background-image
.
You can couple this with gradients to do the trick.
option:hover,_x000D_
option:focus,_x000D_
option:active,_x000D_
option:checked {_x000D_
background: linear-gradient(#5A2569, #5A2569);_x000D_
}
_x000D_
<select>_x000D_
<option>A</option>_x000D_
<option>B</option>_x000D_
<option>C</option>_x000D_
</select>
_x000D_
Works on gecko/webkit.
First make sure the PHP files themselves are UTF-8 encoded.
The meta tag is ignored by some browser. If you only use ASCII-characters, it doesn't matter anyway.
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields
header('Content-Type: text/html; charset=utf-8');
Converting to double can be done by casting an int to a double:
You can convert an int to a double by using this mechnism like so:
int i = 3; // i is 3
double d = (double) i; // d = 3.0
Alternative (using Java's automatic type recognition):
double d = 1.0 * i; // d = 3.0
Implementing this in your code would be something like:
double firstSolution = ((double)(b1 * a22 - b2 * a12) / (double)(a11 * a22 - a12 * a21));
double secondSolution = ((double)(b2 * a11 - b1 * a21) / (double)(a11 * a22 - a12 * a21));
Alternatively you can use a hard-parameter of type double (1.0) to have java to the work for you, like so:
double firstSolution = ((1.0 * (b1 * a22 - b2 * a12)) / (1.0 * (a11 * a22 - a12 * a21)));
double secondSolution = ((1.0 * (b2 * a11 - b1 * a21)) / (1.0 * (a11 * a22 - a12 * a21)));
Good luck.
each
passes into your function index
and element
. Check index
against the length of the set and you're good to go:
var set = $('.requiredText');
var length = set.length;
set.each(function(index, element) {
thisVal = $(this).val();
if(parseInt(thisVal) !== 0) {
console.log('Valid Field: ' + thisVal);
if (index === (length - 1)) {
console.log('Last field, submit form here');
}
}
});
In short: It is not possible, and as it seems won't ever be supported (see here https://github.com/npm/npm/issues/775).
There are some hacky work-arrounds with using the CLI or ENV-Variables (see the current selected answer), .npmrc-Config-Files or npm link
- what they all have in common: They are never just project-specific, but always some kind of global
Solutions.
For me, none of those solutions are really clean because contributors to your project always need to create some special configuration or have some special knowledge - they can't just npm install
and it works.
So: Either you will have to put your package.json in the same directory where you want your node_modules installed, or live with the fact that they will always be in the root-dir of your project.
This was a case of one of the sub-installers getting stuck during the install and never completing. Unfortunately when this happens, it looks like the master installer never times out the operation. The trick is to open up the Task Manager in detail mode, and look for a sub-installer process that is showing 0% CPU usage and 0% disk usage, indicating it has died. Then just kill that process and the master installation will resume. In my case, the name of the sub-installer was SecondaryInstaller.exe and according to the installation log it happened while it was trying to install some Android SDK components for the cross platform development modules. It had frozen permanently. I killed it and the master installer completed. When I ran Visual Studio it was fine, although I'm guessing I'll have to do some digging on the Android components install problem.
If you're using Tortoise SVN, you should be able to revert changes from just that revision into your working copy (effectively performing a reverse-merge), then do another commit to re-add the file. Steps to follow are:
The issue turned out to be certificate-related. The WCF service called by the console app uses an X509 cert for authentication, which is installed on the servers that this script is hosted and run from.
On other servers, where the same services are consumed, the certificates were configured as follows:
winhttpcertcfg.exe -g -c LOCAL_MACHINE\My -s "certificate-name" -a "NETWORK SERVICE"
As they ran within the context of IIS. However, when the script was being run as it would in production, it's under the context of the user themselves. So, the script needed to be modified to the following:
winhttpcertcfg.exe -g -c LOCAL_MACHINE\My -s "certificate-name" -a "USERS"
Once that change was made, all was well. Thanks to everyone who offered assistance.
When I were trying install librosa
package with pip
(pip install librosa
), this error were appeared:
ERROR: Cannot uninstall 'llvmlite'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
I tried to remove llvmlite
, but pip uninstall
could not remove it. So, I used capability of ignore
of pip
by this code:
pip install librosa --ignore-installed llvmlite
Indeed, you can use this rule for ignoring a package you don't want to consider:
pip install {package you want to install} --ignore-installed {installed package you don't want to consider}
//Format 24H use HH:mm_x000D_
let currentDate = moment().format('YYYY-MM-DD HH:mm')_x000D_
console.log(currentDate)_x000D_
_x000D_
//example of current time with defined Time zone +1_x000D_
let currentDateTm = moment().utcOffset('+0100').format('YYYY-MM-DD HH:mm')_x000D_
console.log(currentDateTm)
_x000D_
<script src="https://momentjs.com/downloads/moment.js"></script>
_x000D_
In Swift, appending strings is as easy as:
let stringA = "this is a string"
let stringB = "this is also a string"
let stringC = stringA + stringB
Or you can use string interpolation.
let stringC = "\(stringA) \(stringB)"
Notice there will now be whitespace between them.
Note: I see the other answers are using var
a lot. The strings aren't changing and therefore should be declared using let
. I know this is a small exercise, but it's good to get into the habit of best practices. Especially because that's a big feature of Swift.
I arraged the jQuery in this
.directive('numbersCommaOnly', function(){
return {
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
element.on('keydown', function(event) {
// Allow: backspace, delete, tab, escape, enter and .
var array2 = [46, 8, 9, 27, 13, 110, 190]
if (array2.indexOf(event.which) !== -1 ||
// Allow: Ctrl+A
(event.which == 65 && event.ctrlKey === true) ||
// Allow: Ctrl+C
(event.which == 67 && event.ctrlKey === true) ||
// Allow: Ctrl+X
(event.which == 88 && event.ctrlKey === true) ||
// Allow: home, end, left, right
(event.which >= 35 && event.which <= 39)) {
// let it happen, don't do anything
return;
}
// Ensure that it is a number and stop the keypress
if ((event.shiftKey || (event.which < 48 || event.which > 57)) && (event.which < 96 || event.which > 105)) {
event.preventDefault();
}
});
}
};
})
+---------------------------------------------------------+
¦ Action ¦ orphanRemoval=true ¦ CascadeType.ALL ¦
¦-------------+---------------------+---------------------¦
¦ delete ¦ deletes parent ¦ deletes parent ¦
¦ parent ¦ and orphans ¦ and orphans ¦
¦-------------+---------------------+---------------------¦
¦ change ¦ ¦ ¦
¦ children ¦ deletes orphans ¦ nothing ¦
¦ list ¦ ¦ ¦
+---------------------------------------------------------+
You should not use ftp
. Like telnet
it is not using secure protocols, and passwords are transmitted in clear text. This makes it very easy for third parties to capture your username and password.
To copy remote directories remotely, these options are better:
rsync
is the best-suited tool if you can login via ssh
, because it copies only the differences, and can easily restart in the middle in case the connection breaks.
ssh -r
is the second-best option to recursively copy directory structures.
See:
Before you call setContentView()
, call setTheme(android.R.style...)
and just replace the ... with the theme that you want(Theme, Theme_NoTitleBar, etc.).
Or if your theme is a custom theme, then replace the entire thing, so you get setTheme(yourThemesResouceId)
Finally got the issue resolved today. The issue was with the .htaccess
file.
Learning to myself: MUST READ THE CODEIGNITER DOCUMENTATION more thoroughly.
You can use this, it works fine:
<input type="date" class="form1"
value="{{date | date:MM/dd/yyyy}}"
ng-model="date"
name="id"
validatedateformat
data-date-format="mm/dd/yyyy"
maxlength="10"
id="id"
calendar
maxdate="todays"
ng-click="openCalendar('id')">
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar" ng-click="openCalendar('id')"></span>
</span>
</input>
Simple way to access the Url Try this Code
$.ajax({
type: "POST",
url: '/Controller/Search',
data: "{queryString:'" + searchVal + "'}",
contentType: "application/json; charset=utf-8",
dataType: "html",
success: function (data) {
alert("here" + data.d.toString());
});
You were on the right track. IrfanView sets the background for transparency the same as the viewing color around the image.
You just need to re-open the image with IrfanView after changing the view color to white.
To change the viewing color in Irfanview go to:
Options > Properties/Settings > Viewing > Main window color
Initially, the result set object (rs) points to the BFR (before first record). Once we use rs.next(), the cursor points to the first record and the rs holds "true". Using the while loop you can print all the records of the table. After all the records are retrieved, the cursor moves to ALR (After last record) and it will be set to null. Let us consider that there are 2 records in the table.
if(rs.next()==false){
// there are no records found
}
while (rs.next()==true){
// print all the records of the table
}
In short hand, we can also write the condition as while (rs.next()).
I was able to fix this issue by changing the mail settings in the system.net portion of my web.config:
<mailSettings>
<smtp deliveryMethod="Network">
<network host="yourserver" defaultCredentials="true"/>
</smtp>
</mailSettings>
I used the previous answers and combine them to create:
Css for highlight found texts:
em {
background-color: yellow
}
Js:
function removeHighlighting(highlightedElements) {
highlightedElements.each(function() {
var element = $(this);
element.replaceWith(element.html());
})
}
function addHighlighting(element, textToHighlight) {
var text = element.text();
var highlightedText = '<em>' + textToHighlight + '</em>';
var newText = text.replace(textToHighlight, highlightedText);
element.html(newText);
}
$("#search").keyup(function() {
var value = this.value.toLowerCase().trim();
removeHighlighting($("table tr em"));
$("table tr").each(function(index) {
if (!index) return;
$(this).find("td").each(function() {
var id = $(this).text().toLowerCase().trim();
var matchedIndex = id.indexOf(value);
if (matchedIndex === 0) {
addHighlighting($(this), value);
}
var not_found = (matchedIndex == -1);
$(this).closest('tr').toggle(!not_found);
return not_found;
});
});
});
Demo here
@JoshAdel covered a lot of it, but if you just want to time the execution of an entire script, you can run it under time
on a unix-like system.
kotai:~ chmullig$ cat sleep.py
import time
print "presleep"
time.sleep(10)
print "post sleep"
kotai:~ chmullig$ python sleep.py
presleep
post sleep
kotai:~ chmullig$ time python sleep.py
presleep
post sleep
real 0m10.035s
user 0m0.017s
sys 0m0.016s
kotai:~ chmullig$
Along the same lines as @Eric's answer, but without using a 'NULL'
symbol.
(Field1 = Field2) OR (ISNULL(Field1, Field2) IS NULL)
This will be true only if both values are non-NULL
, and equal each other, or both values are NULL
It's an iterator returned by the filter function.
If you want a list, just do
list(filter(f, range(2, 25)))
Nonetheless, you can just iterate over this object with a for
loop.
for e in filter(f, range(2, 25)):
do_stuff(e)
int? is Nullable.
Take a look at the help page for merge. The all
parameter lets you specify different types of merges. Here we want to set all = TRUE
. This will make merge return NA
for the values that don't match, which we can update to 0 with is.na()
:
zz <- merge(df1, df2, all = TRUE)
zz[is.na(zz)] <- 0
> zz
x y
1 a 0
2 b 1
3 c 0
4 d 0
5 e 0
Updated many years later to address follow up question
You need to identify the variable names in the second data table that you aren't merging on - I use setdiff()
for this. Check out the following:
df1 = data.frame(x=c('a', 'b', 'c', 'd', 'e', NA))
df2 = data.frame(x=c('a', 'b', 'c'),y1 = c(0,1,0), y2 = c(0,1,0))
#merge as before
df3 <- merge(df1, df2, all = TRUE)
#columns in df2 not in df1
unique_df2_names <- setdiff(names(df2), names(df1))
df3[unique_df2_names][is.na(df3[, unique_df2_names])] <- 0
Created on 2019-01-03 by the reprex package (v0.2.1)
Scanning object for first intance of a determinated prop:
var obj = {a:'Saludos',
b:{b_1:{b_1_1:'Como estas?',b_1_2:'Un gusto conocerte'}},
d:'Hasta luego'
}
function scan (element,list){
var res;
if (typeof(list) != 'undefined'){
if (typeof(list) == 'object'){
for(key in list){
if (typeof(res) == 'undefined'){
res = (key == element)?list[key]:scan(element,list[key]);
}
});
}
}
return res;
}
console.log(scan('a',obj));
Other that the differences in the default access (public/private), there is no difference.
However, some shops that code in C and C++ will use "class/struct" to indicate that which can be used in C and C++ (struct) and which are C++ only (class). In other words, in this style all structs must work with C and C++. This is kind of why there was a difference in the first place long ago, back when C++ was still known as "C with Classes."
Note that C unions work with C++, but not the other way around. For example
union WorksWithCppOnly{
WorksWithCppOnly():a(0){}
friend class FloatAccessor;
int a;
private:
float b;
};
And likewise
typedef union friend{
int a;
float b;
} class;
only works in C
Easiest way to reuse a common Navigation drawer among a group of activities
app_base_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<FrameLayout
android:id="@+id/view_stub"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/menu_test"
/>
</android.support.v4.widget.DrawerLayout>
AppBaseActivity.java
/*
* This is a simple and easy approach to reuse the same
* navigation drawer on your other activities. Just create
* a base layout that conains a DrawerLayout, the
* navigation drawer and a FrameLayout to hold your
* content view. All you have to do is to extend your
* activities from this class to set that navigation
* drawer. Happy hacking :)
* P.S: You don't need to declare this Activity in the
* AndroidManifest.xml. This is just a base class.
*/
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
public abstract class AppBaseActivity extends AppCompatActivity implements MenuItem.OnMenuItemClickListener {
private FrameLayout view_stub; //This is the framelayout to keep your content view
private NavigationView navigation_view; // The new navigation view from Android Design Library. Can inflate menu resources. Easy
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mDrawerToggle;
private Menu drawerMenu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.app_base_layout);// The base layout that contains your navigation drawer.
view_stub = (FrameLayout) findViewById(R.id.view_stub);
navigation_view = (NavigationView) findViewById(R.id.navigation_view);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, 0, 0);
mDrawerLayout.setDrawerListener(mDrawerToggle);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
drawerMenu = navigation_view.getMenu();
for(int i = 0; i < drawerMenu.size(); i++) {
drawerMenu.getItem(i).setOnMenuItemClickListener(this);
}
// and so on...
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
/* Override all setContentView methods to put the content view to the FrameLayout view_stub
* so that, we can make other activity implementations looks like normal activity subclasses.
*/
@Override
public void setContentView(int layoutResID) {
if (view_stub != null) {
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
View stubView = inflater.inflate(layoutResID, view_stub, false);
view_stub.addView(stubView, lp);
}
}
@Override
public void setContentView(View view) {
if (view_stub != null) {
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
view_stub.addView(view, lp);
}
}
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
if (view_stub != null) {
view_stub.addView(view, params);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Pass the event to ActionBarDrawerToggle, if it returns
// true, then it has handled the app icon touch event
if (mDrawerToggle.onOptionsItemSelected(item)) {
return true;
}
// Handle your other action bar items...
return super.onOptionsItemSelected(item);
}
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.item1:
// handle it
break;
case R.id.item2:
// do whatever
break;
// and so on...
}
return false;
}
}
ALTER TABLE tbl_Country DROP COLUMN IsDeleted;
Here's a working example.
Note that the COLUMN
keyword is optional, as MySQL will accept just DROP IsDeleted
. Also, to drop multiple columns, you have to separate them by commas and include the DROP
for each one.
ALTER TABLE tbl_Country
DROP COLUMN IsDeleted,
DROP COLUMN CountryName;
This allows you to DROP
, ADD
and ALTER
multiple columns on the same table in the one statement. From the MySQL reference manual:
You can issue multiple
ADD
,ALTER
,DROP
, andCHANGE
clauses in a singleALTER TABLE
statement, separated by commas. This is a MySQL extension to standard SQL, which permits only one of each clause perALTER TABLE
statement.
With async functions and promises, it now can work as simply as this:
async function foobar() {
await $("#example").fadeOut().promise();
doSomethingElse();
await $("#example").fadeIn().promise();
}
This worked for me:
nltk.set_proxy('http://user:[email protected]:8080')
nltk.download()
We just have to use @
in front of the deprecated function. No need to change anything as mentioned in above posts. For example: if(!@session_is_registered("username")){ }
. Just put @
and problem is solved.
// GET DATE & TIME IN ANY FORMAT
import java.util.Calendar;
import java.text.SimpleDateFormat;
public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
public static String now() {
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
return sdf.format(cal.getTime());
}
Taken from here
You are trying to set int value to TextView
so you are getting this issue.
To solve this try below one option
option 1:
tv.setText(no+"");
Option2:
tv.setText(String.valueOf(no));
Load data infile query is much better option but some servers like godaddy restrict this option on shared hosting so , only two options left then one is insert record on every iteration or batch insert , but batch insert has its limitaion of characters if your query exceeds this number of characters set in mysql then your query will crash , So I suggest insert data in chunks withs batch insert , this will minimize number of connections established with database.best of luck guys
You repository is bare, i.e. it does not have a working tree attached to it. You can clone it locally to create a working tree for it, or you could use one of several other options to tell Git where the working tree is, e.g. the --work-tree
option for single commands, or the GIT_WORK_TREE
environment variable. There is also the core.worktree
configuration option but it will not work in a bare repository (check the man page for what it does).
# git --work-tree=/path/to/work/tree checkout master
# GIT_WORK_TREE=/path/to/work/tree git status
If you know what value to delete, here's a simple way (as simple as I can think of, anyway):
a = [0, 1, 1, 0, 1, 2, 1, 3, 1, 4]
while a.count(1) > 0:
a.remove(1)
You'll get
[0, 0, 2, 3, 4]
Check and try below things. Issue should be resolved.
First of all check your log from bottom of the build window whether any error related to project showing or not. If error showing then fix all of those. Now build and run again fix all of the error comes up. It will eliminate aapt2 issue without changing android gradle plugin to 3.2.0.
Secondly if there is not any project related error showing in the build log but still showing aapt2 error then you can fix it by following below steps.
Update your android gradle plugin in your project level build.gradle
file like below:
classpath 'com.android.tools.build:gradle:3.2.0-alpha13'
Now update android.enableAapt2=true
. Then check and build your project.
Any of these steps should work to fix aapt related issues.
What is webpack & webpack-dev-server? Official documentation says it's a module bundler but for me it's just a task runner. What's the difference?
webpack-dev-server is a live reloading web server that Webpack developers use to get immediate feedback what they do. It should only be used during development.
This project is heavily inspired by the nof5 unit test tool.
Webpack as the name implies will create a SINGLE package for the web. The package will be minimized, and combined into a single file (we still live in HTTP 1.1 age). Webpack does the magic of combining the resources (JavaScript, CSS, images) and injecting them like this: <script src="assets/bundle.js"></script>
.
It can also be called module bundler because it must understand module dependencies, and how to grab the dependencies and to bundle them together.
Where would you use browserify? Can't we do the same with node/ES6 imports?
You could use Browserify on the exact same tasks where you would use Webpack. – Webpack is more compact, though.
Note that the ES6 module loader features in Webpack2 are using System.import, which not a single browser supports natively.
When would you use gulp/grunt over npm + plugins?
You can forget Gulp, Grunt, Brokoli, Brunch and Bower. Directly use npm command line scripts instead and you can eliminate extra packages like these here for Gulp:
var gulp = require('gulp'),
minifyCSS = require('gulp-minify-css'),
sass = require('gulp-sass'),
browserify = require('gulp-browserify'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
jshint = require('gulp-jshint'),
jshintStyle = require('jshint-stylish'),
replace = require('gulp-replace'),
notify = require('gulp-notify'),
You can probably use Gulp and Grunt config file generators when creating config files for your project. This way you don't need to install Yeoman or similar tools.
I don't think there's a jQuery-way to directly access the pseudoclass' rules, but you could always append a new style
element to the document's head like:
$('head').append('<style>.column:before{width:800px !important;}</style>');
See a live demo here
I also remember having seen a plugin that tackles this issue once but I couldn't find it on first googling unfortunately.
I've had success using this in response to a button click, so I guess that you can use it too after updating your contents:
myListView.smoothScrollToPosition(theListAdapter.getCount() -1);
<a href="newsletter_01.pdf" target="_blank">Read more</a>
Target _blank will force the browser to open it in a new window
If your need is to modify an existing workbook, the safest way would be to use pyoo. You need to have some libraries installed and it takes a few hoops to jump through but once its set up, this would be bulletproof as you are leveraging the wide and solid API's of LibreOffice / OpenOffice.
Please see my Gist on how to set up a linux system and do some basic coding using pyoo.
Here is an example of the code:
#!/usr/local/bin/python3
import pyoo
# Connect to LibreOffice using a named pipe
# (named in the soffice process startup)
desktop = pyoo.Desktop(pipe='oo_pyuno')
wkbk = desktop.open_spreadsheet("<xls_file_name>")
sheet = wkbk.sheets['Sheet1']
# Write value 'foo' to cell E5 on Sheet1
sheet[4,4].value='foo'
wkbk.save()
wkbk.close()
Check out pyftpdlib from Giampaolo Rodola. It is one of the very best ftp servers out there for python. It's used in google's chromium (their browser) and bazaar (a version control system). It is the most complete implementation on Python for RFC-959 (aka: FTP server implementation spec).
To install:
pip3 install pyftpdlib
From the commandline:
python3 -m pyftpdlib
Alternatively 'my_server.py':
#!/usr/bin/env python3
from pyftpdlib import servers
from pyftpdlib.handlers import FTPHandler
address = ("0.0.0.0", 21) # listen on every IP on my machine on port 21
server = servers.FTPServer(address, FTPHandler)
server.serve_forever()
There's more examples on the website if you want something more complicated.
To get a list of command line options:
python3 -m pyftpdlib --help
Note, if you want to override or use a standard ftp port, you'll need admin privileges (e.g. sudo).
I had the same problem, then I found out that I had duplicate api controller class names in other project and despite the fact that the "routePrefix" and namespace and project name were different but still they returned 404, I changed the class names and it worked.
You can use Google Page Speed API to achieve your task easily. In my current project, I have used Google Page Speed API`s query written in Python to capture screenshots of any Web URL provided and save it to a location. Have a look.
import urllib2
import json
import base64
import sys
import requests
import os
import errno
# The website's URL as an Input
site = sys.argv[1]
imagePath = sys.argv[2]
# The Google API. Remove "&strategy=mobile" for a desktop screenshot
api = "https://www.googleapis.com/pagespeedonline/v1/runPagespeed?screenshot=true&strategy=mobile&url=" + urllib2.quote(site)
# Get the results from Google
try:
site_data = json.load(urllib2.urlopen(api))
except urllib2.URLError:
print "Unable to retreive data"
sys.exit()
try:
screenshot_encoded = site_data['screenshot']['data']
except ValueError:
print "Invalid JSON encountered."
sys.exit()
# Google has a weird way of encoding the Base64 data
screenshot_encoded = screenshot_encoded.replace("_", "/")
screenshot_encoded = screenshot_encoded.replace("-", "+")
# Decode the Base64 data
screenshot_decoded = base64.b64decode(screenshot_encoded)
if not os.path.exists(os.path.dirname(impagepath)):
try:
os.makedirs(os.path.dirname(impagepath))
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
# Save the file
with open(imagePath, 'w') as file_:
file_.write(screenshot_decoded)
Unfortunately, following are the drawbacks. If these do not matter, you can proceed with Google Page Speed API. It works well.
The event must be cancelable
. Adding an if
statement solves this issue.
if (e.cancelable) {
e.preventDefault();
}
In your code you should put it here:
if (this.isSwipe(swipeThreshold) && e.cancelable) {
e.preventDefault();
e.stopPropagation();
swiping = true;
}
MYISAM:
INNODB:
This might help? :)
Just search for the character at index 0 and compare it against the value you're looking for!
Remove these two lines:
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
XMLHttpRequest isn't allowed to set these headers, they are being set automatically by the browser. The reason is that by manipulating these headers you might be able to trick the server into accepting a second request through the same connection, one that wouldn't go through the usual security checks - that would be a security vulnerability in the browser.
@philipobenito's answer worked best for me.
I first created a hidden input that contain the user's HTTP referer
<input type="hidden" name="referer" value="<?= $_SERVER['HTTP_REFERER'] ?>" />
and after a successful login i redirected the users to whatever value was stored in that hidden input
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
if(!empty($_POST['referer'])){
header('Location: '.$_POST['referer']);
}
else{
header('Location: members.php'); //members.php is a page used to send a user to their profile page.
}
exit;
You can use filter_var
filter_var(
$yourInteger,
FILTER_VALIDATE_INT,
array(
'options' => array(
'min_range' => $min,
'max_range' => $max
)
)
);
This will also allow you to specify whether you want to allow octal and hex notation of integers. Note that the function is type-safe. 5.5
is not an integer but a float and will not validate.
Detailed tutorial about filtering data with PHP:
Function.prototype.extends=function(ParentClass) {
this.prototype = new ParentClass();
this.prototype.constructor = this;
}
Then:
function Person() {
this.name = "anonym"
this.skills = ["abc"];
}
Person.prototype.profile = function() {
return this.skills.length // 1
};
function Student() {} //well extends fom Person Class
Student.extends(Person)
var s1 = new Student();
s1.skills.push("")
s1.profile() // 2
Please, Ignore my answer of 2015 since Javascript is now supports extends
keyword since ES6 (Ecmasctipt6 )
class Person {
constructor() {
this.name = "anonym"
this.skills = ["abc"];
}
profile() {
return this.skills.length // 1
}
}
Person.MAX_SKILLS = 10;
class Student extends Person {
} //well extends from Person Class
//-----------------
var s1 = new Student();
s1.skills.push("")
s1.profile() // 2
class Person {
static MAX_SKILLS = 10;
name = "anonym"
skills = ["abc"];
profile() {
return this.skills.length // 1
}
}
class Student extends Person {
} //well extends from Person Class
//-----------------
var s1 = new Student();
s1.skills.push("")
s1.profile() // 2
You can stringify the JSON Object with JSON.stringify(jsonObject) and receive it on controller as String.
In the Controller, you can use the javax.json to convert and manipulate this.
Download and add the .jar to the project libs and import the JsonObject.
To create an json object, you can use
JsonObjectBuilder job = Json.createObjectBuilder();
job.add("header1", foo1);
job.add("header2", foo2);
JsonObject json = job.build();
To read it from String, you can use
JsonReader jr = Json.createReader(new StringReader(jsonString));
JsonObject json = jsonReader.readObject();
jsonReader.close();
To print any amount of lines between printed text use:
print("Hello" + '\n' *
insert number of whitespace lines+ "World!")
'\n' can be used to make whitespace, multiplied, it will make multiple whitespace lines.
AllowOverride AuthConfig
try this. Authentication may be the problem. I was working with a CGI script written in C++, and faced some authentication issues when passed DELETE. The above solution helped me. It may help in your case too.
Also even if you don't get the solution for your problem of PUT and DELETE, do not stop working rather use "CORS". It is a google chrome app, which will help you bypass the problem, but remember it is a temporary solution, so that your work or experiments doesn't remain freeze for long. Obviously, you cannot ask your client to have "CORS" enabled to run your solution, as it may compromise systems security.
The standard colormaps also all have reversed versions. They have the same names with _r
tacked on to the end. (Documentation here.)
If you want to add dynamically buttons try this:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
for (int i = 1; i <= 5; i++) {
LinearLayout layout = (LinearLayout) findViewById(R.id.myLinearLayout);
layout.setOrientation(LinearLayout.VERTICAL);
Button btn = new Button(this);
btn.setText(" ");
layout.addView(btn);
}
}
No, you can use only some escape sequences - \n for example (maybe only this one).
Your JRE_HOME does not need to point to the "bin" directory. Just set it to C:\Program Files\Java\jre1.8.0_25
just add C:\Program Files\Java\jdk1.7.0_80\bin as the path in environmental variables. no need to add java.exe and javac.exe to that path. IT WORKS
Got the same problem, non of the answers worked for me. After a lot of debugging I found out that the size of one image was smaller than 32
. This leads to a broken array with wrong dimensions and the above mentioned error.
To solve the problem, make sure that all images have the correct dimensions.
In Android simply edit your styles.xml file under Resources\values adding this:
<resources>
<style name="MyTheme" parent="android:style/Theme.Material.Light.DarkActionBar">
<item name="android:colorPressedHighlight">@color/ListViewSelected</item>
<item name="android:colorLongPressedHighlight">@color/ListViewHighlighted</item>
<item name="android:colorFocusedHighlight">@color/ListViewSelected</item>
<item name="android:colorActivatedHighlight">@color/ListViewSelected</item>
<item name="android:activatedBackgroundIndicator">@color/ListViewSelected</item>
</style>
<color name="ListViewSelected">#96BCE3</color>
<color name="ListViewHighlighted">#E39696</color>
</resources>
In our case, the Windows service account that SQL Server and SQL Agent were running under were locked out in Active Directory.
Expanding on your comment to SquareCog's reply, you could do:
INSERT INTO X VALUES(Y,Z) WHERE Y NOT IN (SELECT Y FROM X)
INSERT INTO X2 VALUES(Y2,Z2) WHERE Y2 NOT IN (SELECT Y FROM X2)
INSERT INTO X3 VALUES(Y3,Z3) WHERE Y3 NOT IN (SELECT Y FROM X3)
Here, I assume that column Y is present in all three tables. Note that performance will be poor if the tables are not indexed on Y.
Oh yeah, Y has a unique constraint on it--so they're indexed, and this should perform optimally.
you can check pm2 here is, http://pm2.keymetrics.io/
create a ssh file, such as worker.sh put into your php script that you will deal with.
worker.sh
php /path/myscript.php
daemon start
pm2 start worker.sh
Cheers, that is it.
Two suggestions:
std::deque
instead of std::vector
for better performance in your specific case and use the method std::deque::pop_front()
.&
in std::vector<ScanRule>& topPriorityRules;
The pylab examples page is a very useful source. The example relevant for your question:
http://matplotlib.sourceforge.net/mpl_examples/pylab_examples/scatter_demo2.py http://matplotlib.sourceforge.net/users/screenshots.html#scatter-demo
The condition below:
//Element[@attribute1="abc" and @attribute2="xyz" and Data]
checks for the existence of the element Data within Element and not for element value Data.
Instead you can use
//Element[@attribute1="abc" and @attribute2="xyz" and text()="Data"]
https://github.com/spf13/viper and https://github.com/zpatrick/go-config are a pretty good libraries for configuration files.
//HashSet allows only the unique values to the list
HashSet<int> uniqueList = new HashSet<int>();
var a = uniqueList.Add(1);
var b = uniqueList.Add(2);
var c = uniqueList.Add(3);
var d = uniqueList.Add(2); // should not be added to the list but will not crash the app
//Dictionary allows only the unique Keys to the list, Values can be repeated
Dictionary<int, string> dict = new Dictionary<int, string>();
dict.Add(1,"Happy");
dict.Add(2, "Smile");
dict.Add(3, "Happy");
dict.Add(2, "Sad"); // should be failed // Run time error "An item with the same key has already been added." App will crash
//Dictionary allows only the unique Keys to the list, Values can be repeated
Dictionary<string, int> dictRev = new Dictionary<string, int>();
dictRev.Add("Happy", 1);
dictRev.Add("Smile", 2);
dictRev.Add("Happy", 3); // should be failed // Run time error "An item with the same key has already been added." App will crash
dictRev.Add("Sad", 2);
SELECT
FROM
JOINs
WHERE
GROUP By
HAVING
ORDER BY
I just wanted to comment (I have not enough reps) on xenadu's implementation, because CChar
in OS X is Int8
, and Swift does not like at all when you add to the array when getchar()
returns parts of UTF-8, or anything else above 7 bit.
I am using an array of UInt8
instead, and it works great and String.fromCString
converts the UInt8
into UTF-8 just fine.
However this is how I done it
func readln() -> (str: String?, hadError: Bool) {
var cstr: [UInt8] = []
var c: Int32 = 0
while c != EOF {
c = getchar()
if (c == 10 || c == 13) || c > 255 { break }
cstr.append(UInt8(c))
}
cstr.append(0)
return String.fromCStringRepairingIllFormedUTF8(UnsafePointer<CChar>(cstr))
}
while true {
if let mystring = readln().str {
println(" > \(mystring)")
}
}
The dword ptr
part is called a size directive. This page explains them, but it wasn't possible to direct-link to the correct section.
Basically, it means "the size of the target operand is 32 bits", so this will bitwise-AND the 32-bit value at the address computed by taking the contents of the ebp
register and subtracting four with 0.
So much simpler with regexes:
Pattern spaces=Pattern.compile("\\s+[a-z]");
Matcher m=spaces.matcher(word);
StringBuilder capitalWordBuilder=new StringBuilder(word.substring(0,1).toUpperCase());
int prevStart=1;
while(m.find()) {
capitalWordBuilder.append(word.substring(prevStart,m.end()-1));
capitalWordBuilder.append(word.substring(m.end()-1,m.end()).toUpperCase());
prevStart=m.end();
}
capitalWordBuilder.append(word.substring(prevStart,word.length()));
Output for input: "this sentence Has Weird caps"
This Sentence Has Weird Caps
To escape a character in sql you can use !
:
EXAMPLE - USING ESCAPE CHARACTERS
It is important to understand how to "Escape Characters" when pattern matching. These examples deal specifically with escaping characters in Oracle.
Let's say you wanted to search for a % or a _ character in the SQL LIKE condition. You can do this using an Escape character.
Please note that you can only define an escape character as a single character (length of 1).
For example:
SELECT *
FROM suppliers
WHERE supplier_name LIKE '!%' escape '!';
This SQL LIKE condition example identifies the ! character as an escape character. This statement will return all suppliers whose name is %.
Here is another more complicated example using escape characters in the SQL LIKE condition.
SELECT *
FROM suppliers
WHERE supplier_name LIKE 'H%!%' escape '!';
This SQL LIKE condition example returns all suppliers whose name starts with H and ends in %. For example, it would return a value such as 'Hello%'.
You can also use the escape character with the _ character in the SQL LIKE condition.
For example:
SELECT *
FROM suppliers
WHERE supplier_name LIKE 'H%!_' escape '!';
This SQL LIKE condition example returns all suppliers whose name starts with H and ends in _ . For example, it would return a value such as 'Hello_'.
Reference: sql/like
I found out that single quote > double quote > wrapped in ampersands did work. So, for me it looks like this:
=QUERY('Youth Conference Registration'!C:Y,"select C where Y = '"&A1&"'", 0)
Try this test:
any(substring in string for substring in substring_list)
It will return True
if any of the substrings in substring_list
is contained in string
.
Note that there is a Python analogue of Marc Gravell's answer in the linked question:
from itertools import imap
any(imap(string.__contains__, substring_list))
In Python 3, you can use map
directly instead:
any(map(string.__contains__, substring_list))
Probably the above version using a generator expression is more clear though.
Assuming the underlying data types are date/time/datetime types:
SELECT CONVERT(DATETIME, CONVERT(CHAR(8), CollectionDate, 112)
+ ' ' + CONVERT(CHAR(8), CollectionTime, 108))
FROM dbo.whatever;
This will convert CollectionDate
and CollectionTime
to char sequences, combine them, and then convert them to a datetime
.
The parameters to CONVERT
are data_type
, expression
and the optional style
(see syntax documentation).
The date and time style
value 112
converts to an ISO yyyymmdd
format. The style
value 108
converts to hh:mi:ss
format. Evidently both are 8 characters long which is why the data_type
is CHAR(8)
for both.
The resulting combined char sequence is in format yyyymmdd hh:mi:ss
and then converted to a datetime
.
Simple. In the print, do:
print(foobar.__dict__)
as long as the constructor is
__init__
There is a sample of the way I do programmatically:
public partial class UserControlWithComboBoxColumnDataGrid : UserControl
{
private Dictionary<int, string> _Dictionary;
private ObservableCollection<MyItem> _MyItems;
public UserControlWithComboBoxColumnDataGrid() {
_Dictionary = new Dictionary<int, string>();
_Dictionary.Add(1,"A");
_Dictionary.Add(2,"B");
_MyItems = new ObservableCollection<MyItem>();
dataGridMyItems.AutoGeneratingColumn += DataGridMyItems_AutoGeneratingColumn;
dataGridMyItems.ItemsSource = _MyItems;
}
private void DataGridMyItems_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
var desc = e.PropertyDescriptor as PropertyDescriptor;
var att = desc.Attributes[typeof(ColumnNameAttribute)] as ColumnNameAttribute;
if (att != null)
{
if (att.Name == "My Combobox Item") {
var comboBoxColumn = new DataGridComboBoxColumn {
DisplayMemberPath = "Value",
SelectedValuePath = "Key",
ItemsSource = _ApprovalTypes,
SelectedValueBinding = new Binding( "Bazinga"),
};
e.Column = comboBoxColumn;
}
}
}
}
public class MyItem {
public string Name{get;set;}
[ColumnName("My Combobox Item")]
public int Bazinga {get;set;}
}
public class ColumnNameAttribute : Attribute
{
public string Name { get; set; }
public ColumnNameAttribute(string name) { Name = name; }
}
Agreed, code readability is very important for others, but more importantly yourself. Imagine how difficult it would be to understand the first example in comparison to the second.
If code takes more than a few seconds to read (understand), perhaps there is a better way to write it. In this case, the second way.
You can stash your local changes first, then pull, then pop the stash.
git stash
git pull origin master
git stash pop
Anything that overrides changes from remote will have conflicts which you will have to manually resolve.
This worked for me on iOS Safari and Chrome. For the input selector could be set the class or id to enclose the current.
@supports (-webkit-overflow-scrolling: touch) {
input {
font-size: 16px;
}
}
For elements with dynamic width it's possible to use transform: translateX(-100%);
to counter the horizontal percentage value. This leads to two possible solutions:
Transition from:
transform: translateX(0);
to
transform: translateX(calc(100vw - 100%));
#viewportPendulum {_x000D_
position: fixed;_x000D_
left: 0;_x000D_
top: 0;_x000D_
animation: 2s ease-in-out infinite alternate swingViewport;_x000D_
/* just for styling purposes */_x000D_
background: #c70039;_x000D_
padding: 1rem;_x000D_
color: #fff;_x000D_
font-family: sans-serif;_x000D_
}_x000D_
_x000D_
@keyframes swingViewport {_x000D_
from {_x000D_
transform: translateX(0);_x000D_
}_x000D_
to {_x000D_
transform: translateX(calc(100vw - 100%));_x000D_
}_x000D_
}
_x000D_
<div id="viewportPendulum">Viewport</div>
_x000D_
Transition from:
transform: translateX(0);
left: 0;
to
left: 100%;
transform: translateX(-100%);
#parentPendulum {_x000D_
position: relative;_x000D_
display: inline-block;_x000D_
animation: 2s ease-in-out infinite alternate swingParent;_x000D_
/* just for styling purposes */_x000D_
background: #c70039;_x000D_
padding: 1rem;_x000D_
color: #fff;_x000D_
font-family: sans-serif;_x000D_
}_x000D_
_x000D_
@keyframes swingParent {_x000D_
from {_x000D_
transform: translateX(0);_x000D_
left: 0;_x000D_
}_x000D_
to {_x000D_
left: 100%;_x000D_
transform: translateX(-100%);_x000D_
}_x000D_
}_x000D_
_x000D_
.wrapper {_x000D_
padding: 2rem 0;_x000D_
margin: 2rem 15%;_x000D_
background: #eee;_x000D_
}
_x000D_
<div class="wrapper">_x000D_
<div id="parentPendulum">Parent</div>_x000D_
</div>
_x000D_
Note: This approach can easily be extended to work for vertical positioning. Visit example here.
Because a 32-bit floating-point number - such as 1.024 - is not 1.024. In a computer, 1.024 is an interval: from (1.024-e) to (1.024+e), where "e" represents an error. Some people fail to realize this and also believe that * in a*a stands for multiplication of arbitrary-precision numbers without there being any errors attached to those numbers. The reason why some people fail to realize this is perhaps the math computations they exercised in elementary schools: working only with ideal numbers without errors attached, and believing that it is OK to simply ignore "e" while performing multiplication. They do not see the "e" implicit in "float a=1.2", "a*a*a" and similar C codes.
Should majority of programmers recognize (and be able to execute on) the idea that C expression a*a*a*a*a*a is not actually working with ideal numbers, the GCC compiler would then be FREE to optimize "a*a*a*a*a*a" into say "t=(a*a); t*t*t" which requires a smaller number of multiplications. But unfortunately, the GCC compiler does not know whether the programmer writing the code thinks that "a" is a number with or without an error. And so GCC will only do what the source code looks like - because that is what GCC sees with its "naked eye".
... once you know what kind of programmer you are, you can use the "-ffast-math" switch to tell GCC that "Hey, GCC, I know what I am doing!". This will allow GCC to convert a*a*a*a*a*a into a different piece of text - it looks different from a*a*a*a*a*a - but still computes a number within the error interval of a*a*a*a*a*a. This is OK, since you already know you are working with intervals, not ideal numbers.
I think you're looking for continue
None of these answers is particularly clear or simple.
Here is a clear, simple method that is guaranteed to work.
accumulate_normalize_probabilities takes a dictionary p
that maps symbols to probabilities OR frequencies. It outputs usable list of tuples from which to do selection.
def accumulate_normalize_values(p):
pi = p.items() if isinstance(p,dict) else p
accum_pi = []
accum = 0
for i in pi:
accum_pi.append((i[0],i[1]+accum))
accum += i[1]
if accum == 0:
raise Exception( "You are about to explode the universe. Continue ? Y/N " )
normed_a = []
for a in accum_pi:
normed_a.append((a[0],a[1]*1.0/accum))
return normed_a
Yields:
>>> accumulate_normalize_values( { 'a': 100, 'b' : 300, 'c' : 400, 'd' : 200 } )
[('a', 0.1), ('c', 0.5), ('b', 0.8), ('d', 1.0)]
Why it works
The accumulation step turns each symbol into an interval between itself and the previous symbols probability or frequency (or 0 in the case of the first symbol). These intervals can be used to select from (and thus sample the provided distribution) by simply stepping through the list until the random number in interval 0.0 -> 1.0 (prepared earlier) is less or equal to the current symbol's interval end-point.
The normalization releases us from the need to make sure everything sums to some value. After normalization the "vector" of probabilities sums to 1.0.
The rest of the code for selection and generating a arbitrarily long sample from the distribution is below :
def select(symbol_intervals,random):
print symbol_intervals,random
i = 0
while random > symbol_intervals[i][1]:
i += 1
if i >= len(symbol_intervals):
raise Exception( "What did you DO to that poor list?" )
return symbol_intervals[i][0]
def gen_random(alphabet,length,probabilities=None):
from random import random
from itertools import repeat
if probabilities is None:
probabilities = dict(zip(alphabet,repeat(1.0)))
elif len(probabilities) > 0 and isinstance(probabilities[0],(int,long,float)):
probabilities = dict(zip(alphabet,probabilities)) #ordered
usable_probabilities = accumulate_normalize_values(probabilities)
gen = []
while len(gen) < length:
gen.append(select(usable_probabilities,random()))
return gen
Usage :
>>> gen_random (['a','b','c','d'],10,[100,300,400,200])
['d', 'b', 'b', 'a', 'c', 'c', 'b', 'c', 'c', 'c'] #<--- some of the time
You can't change the enumerable collection while it is being enumerated, so you will have to make your changes before or after enumerating.
The for
loop is a nice alternative, but if your IEnumerable
collection does not implement ICollection
, it is not possible.
Either:
1) Copy collection first. Enumerate the copied collection and change the original collection during the enumeration. (@tvanfosson)
or
2) Keep a list of changes and commit them after the enumeration.
It has been assumed that the second date reference in the BETWEEN
syntax is magically considered to be the "end of the day" but this is untrue.
i.e. this was expected:
SELECT * FROM Cases WHERE created_at BETWEEN the beginning of '2013-05-01' AND the end of '2013-05-01'
but what really happen is this:
SELECT * FROM Cases WHERE created_at BETWEEN '2013-05-01 00:00:00+00000' AND '2013-05-01 00:00:00+00000'
Which becomes the equivalent of:
SELECT * FROM Cases WHERE created_at = '2013-05-01 00:00:00+00000'
The problem is one of perceptions/expectations about BETWEEN
which does include BOTH the lower value and the upper values in the range, but does not magically make a date the "beginning of" or "the end of".
BETWEEN
should be avoided when filtering by date ranges.
Always use the >= AND <
instead
SELECT * FROM Cases WHERE (created_at >= '20130501' AND created_at < '20130502')
the parentheses are optional here but can be important in more complex queries.