vendredi 11 septembre 2015

Visual studios c#, trying to add objects every click of a button

I'm trying to add a circle every click on button1. For some reason after adding the first circle, I can't add a second. Please help, it's for a school project... Here's the code: http://ift.tt/1FBNY2q



via Chebli Mohamed

Transfer artifact via SFTP using Maven

I'm attempting to add a build task into a Maven pom file so that I can transfer a jar file as well as some xml files to an SFTP server (it's a VM with Tomcat installed) but I have been unable to so far.

I've had a look at a few links, but they either don't quite match the requirements, have missing steps, or don't work. I'm basically a beginner with Maven so I'm not sure if I'm doing it correctly.

The requirement is that I want to invoke a Maven build, with command line arguments for the hostname, username, and password (which I have working) which then will upload a jar file and the xml files to a VM with Tomcat running in it via SFTP (FTP doesn't work, and I don't think SCP will work as I don't have a passfile). I also don't want to mess with the main Maven settings.xml file to add the connection details in, which some of the links I found seem to be reliant upon.

I have the following profile so far, using FTP, but it doesn't work due to not using SFTP.

<profiles>
    <profile>
        <!-- maven antrun:run -Pdeploy -->
        <id>deploy</id>
        <build>
            <plugins>
                <plugin>
                    <inherited>false</inherited>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.6</version>
                    <configuration>
                        <target>
                            <!-- <loadproperties srcFile="deploy.properties" /> -->

                            <ftp action="send" server="${server-url}"
                                remotedir="/usr/share/myappserver/webapps/myapp/WEB-INF/lib"
                                userid="${user-id}" password="${user-password}" depends="no"
                                verbose="yes" binary="yes">
                                <fileset dir="target">
                                    <include name="artifact.jar" />
                                </fileset>
                            </ftp>

                            <ftp action="send" server="${server-url}"
                                remotedir="/var/lib/myappserver/myapp/spring"
                                userid="${user-id}" password="${user-password}" depends="no"
                                verbose="yes" binary="yes">
                                <fileset dir="src/main/resource/spring">
                                    <include name="*.xml" />
                                </fileset>
                            </ftp>

                            <!-- calls deploy script -->
                            <!-- <sshexec host="host" trust="yes" username="usr" password="pw" 
                                command="sh /my/script.sh" /> -->

                            <!-- SSH -->
                            <taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec" 
                                classpathref="maven.plugin.classpath" />
                            <taskdef name="ftp"
                                classname="org.apache.tools.ant.taskdefs.optional.net.FTP"
                                classpathref="maven.plugin.classpath" />
                        </target>

                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>commons-net</groupId>
                            <artifactId>commons-net</artifactId>
                            <version>1.4.1</version>
                        </dependency>
                        <dependency>
                            <groupId>ant</groupId>
                            <artifactId>ant-commons-net</artifactId>
                            <version>1.6.5</version>
                        </dependency>
                        <dependency>
                            <groupId>ant</groupId>
                            <artifactId>ant-jsch</artifactId>
                            <version>1.6.5</version>
                        </dependency>
                        <dependency>
                            <groupId>jsch</groupId>
                            <artifactId>jsch</artifactId>
                            <version>0.1.29</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

I tried swapping ftp for sftp, and using org.apache.tools.ant.taskdefs.optional.ssh.SFTP instead, but it didn't seem to work.

So to summarize, the SFTP config needs to be self contained within the pom file as much as possible, with stuff like the host url, username and password being passed in when invoked.



via Chebli Mohamed

Call function inside bxslider callback

I am trying to call a custom function inside a bxslider callback but the function doesn't get recorgnized (aka: Uncaught Reference Error: nextSlideCustom() is not a function)

my current code looks like

    var slider=$('#slider1').bxSlider({
         pager: 'true',
         onSlideNext: nextSlideHandle()
    });

and in a different js file I am defining this function:

function nextSlideHandle(){
    console.log("huhu");
}

so what's the problem with my code, or is it mory likely a wrong configuration of the slider or something?

thanks in advance!



via Chebli Mohamed

How to disable browser auto filling username and password

How to disable browser auto filling form username and password fields. I have already tried autocomplete="off". It's not working for me. Please find the form below. And help me to solve this.



via Chebli Mohamed

MySQL - Check if two values are equal or both NULL?

If I want to compare two values, I can write:

SELECT * FROM table1
JOIN table2 ON table1.col = table2.col;

I've noticed that this does not work if both table1.col and table2.col are NULL. So my corrected query looks like this:

SELECT * FROM table1
JOIN table2 ON 
  (table1.col = table2.col)
  OR
  (table1.col IS NULL AND table2.col IS NULL);

Is this the correct way to compare two values? Is there a way to say two values are equal if they are both NULL?



via Chebli Mohamed

Opening a file in C

I looked at many examples before I wrote this, and I know many languages and clearly understand the syntax and what is going on in the code I listed below, however, when I compile my program for example:

gcc -o /sbin/"name" readfile.c

I get the following error:

enter image description here

This makes no since to me since my code clearly includes #include <stdio.h> which defines the FILE as referenced here ---- stdio.h.

//PROGRAM (readfile.c)

#include <stdio.h>

int main(){
    FILE *fp;
    fp = fopen("dummy.txt","w");
    fprint(fp, "testing...\n");
    fclose(fp);
}

//FILE (dummy.txt) *is in the same directory

Hello World



via Chebli Mohamed

Return the row of first non-blank cell in Excel

Let's say I have the array A1:A5 in excel:

    A  
1    
2  
3  'test'  
4  
5  'test2'

How can I return "3"? I'm looking for something in Excel formulas. The blanks are genuine blanks.



via Chebli Mohamed