w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to run a time consuming task on startup in a web application while deploying it
In general, creating unmanaged threads in a Java EE environment is a bad idea. You will loose container managed transactions, user context and many more Java EE concepts within your unmanaged thread. Additionally unmanaged threads may block the conainer on shutdown if your thread handling isn't appropriate. Which Java EE Version are you using? Perhaps you can use Servlet 3.0's async feature? Or call a asynchronous EJB for doing the heavy stuff at startup (@PostConstruct). The call will then set a flag when its job is done.

Categories : Multithreading

How to open VMDK file
VDMK are image files for a virtual machine, like VMware. See here: http://en.wikipedia.org/wiki/VMDK So you could use that image to run it on a simulated computer instance on your host machine and try it out there.

Categories : Misc

Google Cloud Storage JAVA not storing file to storage space
The local development server runs entirely locally. It simulates the production environment on your local machine for the purpose of testing. In your case, it simulates GCS behavior on your local machine, it doesn't actually save to GCS. If you want to actually save to GCS, you need to deploy your app and run your saving procedure on production App Engine.

Categories : Google App Engine

Java util zip creates "corrupt" zip files
Like most issues with IO streams in Java, your fault is almost certainly that you are not closing the streams properly. You need to add: zos.finish(); // good practice zos.close(); after the for loop.

Categories : Java

Java/Java EE - Deploying application servers from different vendors in a single environment
I'd : put shared resources to a predefined NFS, defined in & accessed from both app servers set caching on and serve static content from apache distribute applications among physical servers based on their memory and cpu requirements

Categories : Java

java.lang.VerifyError when deploying the new version of my Java EE web application
Judging from what I'm seeing in your stack trace, I believe the application is unable to connect to the database or an LDAP. This causes the autowiring of one of the beans to fail which then cascades over into the other beans. Ensure that the application can properly connect to any external resources required by the beans.

Categories : Spring

Java - Deploying RXTX
I found the solution, for those it might help. When running the application from Eclipse or NetBean, the app is running in 64-bit. Hence, I used the 64bit rxtxSerial.dll. It was working properly. But I realized when running the compiled .jar outside of the IDE, the Windows process list was displaying javaw.exe *32 for the application. For some reason I ignore, the compiled .jar was in 32bit. Hence, the driver required was for Windows 32bit, not the 64bit. It works well from now on. Note: in order to be able to work on my MAC, I had to compile the application in Java 1.6 (not 1.7) and to provide the MAC driver of course.

Categories : Java

Java error on startup when try to run .exefile
It works fine for me. Make sure you're running the jar this way java -jar addit.jar Input 1 2 EDIT : (try this with addit.exe) Scanner scanner = new Scanner(System.in); System.out.println("Please enter the first digit: "); x = scanner.nextInt(); scanner.nextLine(); // skips ' ' causing the problem System.out.println("Please enter the second digit: "); y = scanner.nextInt(); z = x + y;

Categories : Java

Starting a Java application at startup
On Windows I have used open source Java Service Wrapper to make our application as window service which you can setup automatic at startup. What you need to do is to download latest wrapper.exe and create wrapper.config file put all the configuration like Main class any VM arument other parameters in defined standards and create a window service by this exe

Categories : Java

Deploying a Java Web Service on a server
Endpoint can also serve requests concurrently, you can enable thread pooling by creating a ThreadPoolExecutor and registering it with the endpoint. See Endpoint.setExecutor(Executor executor) If you want to deploy your Web Service on GlassFish you should change it into a WAR project, see http://docs.oracle.com/javaee/6/tutorial/doc/bnayl.html

Categories : Java

Android java startup loosing focus
I've found a workaround to the problem by changing from using "android.intent.action.boot_completed" to using "android.intent.action.MEDIA_MOUNTED". What I observed was that the boot_completed happened before the full boot was complete. Something, not sure exactly what, stepped all over everything. When I tried to sleep or launch the runnable with a timer, if the sleep or timer crossed over the time things went wrong, the sleep and timer would never return, without ever getting into the runnable. By switching to the media_mounted, whatever was stepping on things had already passed. I had been thinking of using the startup app to execute an init.rc file from the SD, so trigging off the media mount makes sense for that need.

Categories : Java

Deploying example Java Web Start application fails .
Ok so I was able to fix this problem . I realised that the easiest way to get started is to use Netbeans IDE . The advantage of using Netbeans is that it offers great support for making Java Web applications . For example signing of jars and getting the .jnlp file configuration correct can be a real pain . Netbeans on the other hand auto-generates both these files and hence saves the pain of making mistakes . Initially i also tried using eclipse for the same but i found eclipse to be very tedious and error prone . I would recommend using Netbeans if making Java Web Start applications . This tutorial should get you started in no time . Enabling Java Web Start in the NetBeans IDE

Categories : Java

Choose the Startup Form in a Java Application in Netbeans
In netBeans you can easily select your main class for your project. In order to do this, right click on the project name, then select properties. Now click on "Run" and where it says "Main class" browse for your desired class. If I understood your question, this is the solution.

Categories : Java

Java game crash twice on startup without error message
Just copy dlls used in jar to the folder that jar is in.(just put them near jar file) Worked for my jmonkey-jocl benchmark http://forums.guru3d.com/showthread.php?t=379276 you may need an extra .bat file to start jvm with more RAM resource. In the bat file: java -mx2048M -XX:MaxGCPauseMillis=1 -XX:GCPauseIntervalMillis=60000 -XX:ConcGCThreads=2 -XX:ParallelGCThreads=2 -jar physics.jar makes 2GB space for jvm, makes a custom garbage-collection way, runs physics.jar %~p0physics.jar %* rather than just physics.jar makes the addressing more flexible.

Categories : Java

How do you run a Java Web Start program at startup/logon using launchd on Mac OS?
Use vi to create a file at a path like this: ~/Library/LaunchAgents/com.mycompany.myprogram.plist The file should contain this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd > <plist version="1.0"> <dict> <key>Label</key> <string>com.docuvantage.dvdesktop</string> <key>ProgramArguments</key> <array> <string>/usr/bin/javaws</string> <string>-Xnosplash</string> <string>http://www.mycompany.com/pub/myprogram.jnlp</string> </array> <key>RunAtLoad</key> <

Categories : Java

java.util.zip.ZipException: invalid LOC header (bad signature) while deploying war in tomcat
Large zip files were not supported until Java 7: http://blogs.oracle.com/xuemingshen/entry/zip64_support_for_4g_zipfile via an extension called ZIP64. This is why you cannot deploy the war.

Categories : Tomcat

Jetty Startup issue: WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/,null}
It seems that your eclipse STS workspace is out of sync with the content published in the server. Try to clean the server, clean the working directory, clean all projects and Republish the project into the server. If this does not work, try these steps to regenerate your eclipse workspace: close eclipse and do a maven clean install from the command line delete all eclipse related files: .project, .classpath and .settings reopen eclipse, and configure maven to use the same maven as the command line import the project using 'Import as Maven Project' scrap your Jetty and redownload a clean one Create a new Jetty server, point it to the new Jetty and add your application to it Republish the application and start the server

Categories : Eclipse

Deploying PrimeFaces app to GlassFish4 causes java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItem
Download file .jar in http://www.primefaces.org/downloads.html. (Example primefaces-3.5.jar). Add file .jar in project Add this text xmlns:p="http://primefaces.org/ui" in tag <html> on file .xhtml Write code for create calendar use primefaces: <p:calendar value="#{dateBean.date}" />

Categories : JSF

Will deploying Rails using Torquebox on Openshift present any advantages over deploying Rails directly?
Yes, TorqueBox is much faster than the original Ruby. Not only the interpreter (JRuby) is faster, simply because it runs on JVM and uses JIT and JVM's fine-tuned garbage collector, but also it uses additional features available in JVM, like parallel threading etc. More, with TorqueBox, you have JBoss AS services at hand when you decide to use them, which I guess you will, if your app grows. Reference: http://torquebox.org/news/2011/10/06/torquebox-2x-performance/

Categories : Ruby On Rails

Why is powershell telling me I need . before pip
Unlike the old command shell, PowerShell will not run programs or scripts in the current directory by default. You should modify your path to include the specific directory or directories that you need to include. I would advise against adding . to your path (which would make PowerShell behave more similarly to DOS) as this introduces a possible attack vector.

Categories : Powershell

Off-heap storage in .NET like in Java?
This is a decent explanation on unsafe code. C# Unsafe Code I think this is what you were looking for, especially "stackalloc". This allows you to allocate objects on the stack. However, be careful the pointers in C# are different than in C,C++.

Categories : Dotnet

Telling git to use credential-osxkeychain
As long as git-credential-osxkeychain is on your path, you really don't need to move it. The issue is you have a > on the command-line... that's wrong. You want: $ sudo mv git-credential-osxkeychain "$(dirname $(which git))/git-credential-osxkeychain" Better yet might be: $ sudo mv git-credential-osxkeychain "$(git --exec-path)" After that, it should work.

Categories : GIT

scrolling position keeps going to top without me telling it to
Replace your scroll function with this scripts and see. DEMO http://jsfiddle.net/yeyene/ajjaz/7/ $(window).scroll(function(){ if ($('#posts').outerHeight() - $('body').scrollTop() - 420 <= 0) { loader(site); $('html, body').animate({ scrollTop: $(this).scrollTop() }, 'fast'); page += 1; } });

Categories : Javascript

Telling sed where exactly to append a string
It easier to do with awk. When first field matches Numbers, print that line, read next one (getline), print it and then print your line (000). The last print is the default for every other line of the input file: awk '$1 ~ /Numbers/ { print; getline; print; print "000"; next } { print }' infile It yields: Separator line of dashes Letters Separator line of dashes aaa bbb Separator line of dashes Numbers Separator line of dashes 000 111 222

Categories : Bash

how to connect to google storage API with java
Your secret key is empty: String secret_key = URLEncoder.encode("","UTF-8"); So signing key is also wrong SecretKeySpec signingKey = new SecretKeySpec(secret_key.getBytes(),HMAC_SHA1_ALGORITHM);

Categories : Java

CakePHP dies instead of telling me the error
Check app/tmp/logs/error.log Check the web server error and access logs! Check the Network tab in chrome and check the response and request there Or use something like Charles (http://www.charlesproxy.com/) to monitor the request and response Check what headers the application is returning

Categories : Cakephp

Telling When Couchbase Query Times Out
The StatusCode property is set only when a response from the server is sent. A timeout would result in no response from the server, therefore a null StatusCode. A connection timeout should result in the Exception value being populated on the GetOperationResult... https://github.com/couchbase/couchbase-net-client/blob/2dc8a63208dfa8b991290d128b14002ad4c43f53/src/Enyim.Caching/Memcached/PooledSocket.cs#L68 However, it is quite possible that somewhere further up the Enyim stack, the original timeout exception is being swallowed and rewrapped in another exception. When you experience timeouts, are you seeing any value for the Exception property?

Categories : C#

Cannot retrieve Storage Gateway snapshots using Java API
Figured it out. Turns out you have to explicitly define the EC2 endpoint. Somehow I missed that step. Here is the list of endpoints: http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region AmazonEC2Client.setEndpoint("<Endpoint URL>");

Categories : Java

Telling the caller of a function 'nicely' that a promise can't be met
Add an error handler and call it when the Promise would be in an error state. function searchAsync(searchText) { return new WinJS.Promise(function (complete, error) { if (searchText.length > 2) { // Asynchronously query the API with the search text complete(results); } else { // Can't return a promise, since 'searchText' is too short error(); } }); }

Categories : Javascript

Telling Angular Js to ignore a specific route
specify target="_self" in your anchors, so that angularjs does not rewrite URLs. See the discussion here: http://docs.angularjs.org/guide/$location

Categories : Angularjs

Telling the CsvProvider which line contains the column headers
This is not currently supported, but it sounds like something that could be added. Feel free to submit a feature request, or even better a pull request :-). It would be useful to know more details (it is not exactly standard format of CSV files). Is there something on the first line, or is it blank (we could just skip all blank lines at the beginning....) or is there some sort of "comment"?

Categories : Misc

Java applet can't access Firefox certificate storage
Maybe your security setup has changed? Check out these links: http://docs.oracle.com/javase/tutorial/deployment/applet/security.html http://docs.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/security.html Can you access the store location using a simple FileReader?

Categories : Java

Java---Proper use and storage of global settings for a project
You have at least two possible ways of doing this in Android. The use of SharedPreferences. This way you can save all the information you need in memory. Another The resource files that are created in your Android project (such as Strings.xml) could help you aswell to keep a some information in a static way in your app.

Categories : Java

Saving file to blob storage and associated metadata to table storage using one HTTP Post
First of all its technically impossible to achieve this as the URIs are different and so are the APIs dealing with Azure blobs and table storage. You do have a few options though. First the blob API allows associating metadata with the blob. The Put Blob REST API call has the option x-ms-meta name:value. This way you could do a single HTTP request to store both blob contents and metadata. If you want to strictly store the metadata to the table storage AND do it in one-shot, then you can route your HTTP request through your web-server, post the content and metadata to the server-side app, which then handles storing to the blob and table storage the relevant content.

Categories : Http

storage class, storage duration, file scope, lifetime, linkage confusion
Storage class specifiers are a part of the decl-specifier-seq of a declaration syntax. They control two independent properties of the names introduced by the declaration: their storage duration and their linkage. Storage class specifiers: auto - automatic storage duration (until C++11) register - automatic storage duration. Also hints to the compiler to place the variable in the processor's register (deprecated) static - static or thread storage duration and internal linkage extern - static or thread storage duration and external linkage thread_local - thread storage duration (since C++11) Storage durations: automatic storage duration. The variable is allocated at the beginning of the enclosing code block and deallocated on end. All non-global variables h

Categories : C++

is there any kind of Web storage viable for storage of video game save data?
The storage type relies on the characteristics of the data. If you want to store small amount of data in key-value standards, you can use Key-Value Sets. If you want to store structured data, you should consider to use a SQLite Database. You can also use the Internal Storage to keep files. Since you want an approach more user-proof, I prefer the SQLite approach. Be aware that no method is 100% guaranteed, since rooted phones can grant access to physical data. At least, consider to encrypt sensitive data before sending to the database. You also have the option of hosting a web service that is consumed by the app to gather information. It can be a lot safer, it is easier to be accessed by all instances of the application, but introduces internet dependecy. Hope it helps.

Categories : HTML

Can you share Azure storage account for NServiceBus Sub Storage, DataBus and Saga?
NSB has been designed so that every construct has it's own connection string to a storage account, that said, I typically start out with the same account for everything and haven't noticed any 'stepping on each others toe' so far. If you do let me know! Kind regards, Yves

Categories : Azure

How to set HDInsight's input/output paths to point to Azure Storage Vault (ASV) in local storage emulator?
You can use one of the following paths to access local storage emulator. wasb://testcontainer@storageemulator/input wasb:///input (when storage emulator is set as the default File System) asv:///input (when storage emulator is set as the default File System, asv is obsolete, not recommended)

Categories : C#

Is it OK to use Android's built-in SQLite storage for concurrent data storage?
by using the SQLiteOpenHelper as a singleton, you are thread-safe. SQLiteOpenHelper handles the locking of the sqlite database (which is the sqlite mechanism to handle concurrent reads/writes). This is something to test. but, generally speaking, do you need to write to the database that often?. you can cache the data in memory and flush them to the database at a slower rate. the short answer is 'yes it supports concurrent access'. for details, review this sqlite document, android sqlite is just a wrapper on this. you can configure it to behave the way you find suitable after reading this document.

Categories : Android

Input Selection (Not Telling/Male/Female) in Rails4
Add a new migration to set default value Or rollback your migration, change it to add_column :listings, :gender, :integer, :default => 1 And migrate again EDIT In model you can add def gender_txt ["Not Telling", "Male", "Female"][self.gender - 1] end In your views, you can display using @user1.gender_txt @user2.gender_txt

Categories : Ruby On Rails

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.