hi all,
is it possible to write database methods in properties file, like some database queries and can be accessed using servlets which may reduce the code?
please any body help
I would really like to provide the user some scripting capabilities, while not giving it access to the more powerful features, like altering the DOM. That is, all input/output is tunneled thru a given interface. Like a kind of restricted javacsript.
Example:
If the interface is checkanswer(func)
this are allowed:
checkanswer( function (x,y)={
return x+y;
}
but these are not allowed:
alert(1)
document.write("hello world")
eval("alert()")
When I create preference activity I define all preferences in xml file. Every preference has a key defined in this xml. But when I access preference I write:
SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean foo_value = appPreferences.getBoolean("foo_key_defined_in_xml", false);
Is there any way to avoid acessing "foo_key_defined_in_xml" in hard-coded way?
Maybe there is a possibility to access it in R style way?
I want to load third-party jni library in runtime.
I've tried to load directly from sdcard. It expectedly failed.
I've tried to copy library from sdcard to /data/data/app/ and then
System.load(/data/data/libjni.so)
It works on HTC HERO, but fails on HTC Legend with Android 2.1.
it fails during execution of native code and write to log uninformative stack trace
Any other way to do it?
I have a methor to return pagecontent of link
but when it run, alway return "Do not perrmisson ", plesea check it
here is code to return string pagecontent
public static String getPageContent(String targetURL) throws Exception {
Hashtable contentHash = new Hashtable();
URL url;
URLConnection conn;
// The data streams used to read from and write to the URL connection.
DataOutputStream out;
DataInputStream in;
// String returned as the result .
String returnString = "";
// Create the URL object and make a connection to it.
url = new URL(targetURL);
conn = url.openConnection();
// check out permission of acess URL
if (conn.getPermission() != null) {
returnString = "Do not Permission access URL ";
} else {
// Set connection parameters. We need to perform input and output,
// so set both as true.
conn.setDoInput(true);
conn.setDoOutput(true);
// Disable use of caches.
conn.setUseCaches(false);
// Set the content type we are POSTing. We impersonate it as
// encoded form data
conn.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
// get the output stream .
out = new DataOutputStream(conn.getOutputStream());
String content = "";
// Create a single String value pairs for all the keys
// in the Hashtable passed to us.
Enumeration e = contentHash.keys();
boolean first = true;
while (e.hasMoreElements()) {
// For each key and value pair in the hashtable
Object key = e.nextElement();
Object value = contentHash.get(key);
// If this is not the first key-value pair in the hashtable,
// concantenate an "&" sign to the constructed String
if (!first)
content += "&";
// append to a single string. Encode the value portion
content += (String) key + "="
+ URLEncoder.encode((String) value);
first = false;
}
// Write out the bytes of the content string to the stream.
out.writeBytes(content);
out.flush();
out.close();
// check if can't read from URL
// Read input from the input stream.
in = new DataInputStream(conn.getInputStream());
String str;
while (null != ((str = in.readLine()))) {
returnString += str + "\n";
}
in.close();
}
// return the string that was read.
return returnString;
}
Hello,
Is there significant problem, if I write the code for embedded linux system using C++ language programming ?.
Actually, I have intention to port some code to arm linux, with arm-uclibc compiler.
Thanks
Im just wondering how i use xmlencoder to serialize ArrayList where foo is my own made class.
Do i have to do anything in particular, ie define my own xml structure first and then call toString on each value in my list and write it out?
Can anyone point me to a good tutorial? http://java.sun.com/products/jfc/tsc/articles/persistence4/ Thats what i have been looking at but it doesnt seem to mention what to do with non library classes.
Thanks
Hi there,
I am trying to write a sql statement that
I have 2 tables Store & StoreTransactions.
My first select command looks like
SELECT [StoreID],[ParentStoreID]
FROM Store
Very simple stuff. How do I take the returned StoreID's and use them for my 2nd select statement?
SELECT [StoreTransactionID],[TransactionDate],[StoreID]
FROM StoreTransactions
WHERE StoreID = returned values from the above query
Any help would be great!
I have 2 dimensional table in file, which look like this:
11, 12, 13, 14, 15
21, 22, 23, 24, 25
I want it to be imported in 2 dimensional array. I wrote this code:
INTEGER :: SMALL(10)
DO I = 1, 3
READ(UNIT=10, FMT='(5I4)') SMALL
WRITE(UNIT=*, FMT='(6X,5I4)') SMALL
ENDDO
But it imports everything in one dimensional array.
Hi I am having Netezza Database. I am querying the tables through DB visualiser. Since my table creation involves complex, I am interested to use procedures but I am unable to write it in DBvisualiser. I am confused whether the problem is with the tool that I use or in Netezza? Please advice
Write two functions, called countSubStringMatch and countSubStringMatchRecursive that take two arguments, a key string and a target string. These functions iteratively and recursively count the number of instances of the key in the target string. You should complete definitions forthe remaining problems, we are going to explore other substring matching ideas. These problems can be solved with either an iterative function or a recursive one. You are welcome to use either approach, though you may find iterative approaches more intuitive in these cases of matching linear structures
I'm going to write a program that plots data from a sensor connected to the computer. The sensor value is going to be plotted as a function of the time (sensor value on the y-axis, time on the x-axis). I want to be able to add new values to the plot in real time. What would be best to do this with in C++?
Edit: And by the way, the program will be running on a Linux machine
i have two large tables in a database.
table 1 with 2 fields
rank,name
and
table2 with 2 fields
rank,name.
both are of 1 million records.
can you write php sql code to fetch those records which exists in table2 but does not exist in table1.
I have a file which contains several thousand numbers, each on it's own line:
34
42
11
6
2
99
...
I'm looking to write a script which will print the sum of all numbers in the file. I've got a solution, but it's not very efficient. (It takes several minutes to run.) I'm looking for a more efficient solution. Any suggestions?
Hello everyone
I have installed xampp 1.7.3. After starting apache and mysql service when I write http://localhost/ in the internet explorer address bar it shows 'The page cannot be displayed'. But for Firefox it creates no problem and shows Xampp index.php page.
Now how can I solve this problem?
Thanks in advance
Is there a way to have a php-script running, that does the following things:
- log into icq-account
- receive all (if any) messages from an existing contact #12345678 and
- write those messages into an array like e.g. $messages = array();
Hey guys,
I'm just getting started with c++ development and I would like to use emacs to write the code and then compile and run it from within emacs using the visual studio 6 compiler. I have already googled around a bit but just can't seem to find an explanation of how this is done.
Any pointers?
Thanks for your help,
joerg
I'd like to be able to just write a class and get a table generated in my DB along with all the properties of that class. In EJB it's possible to let the container handle the data and "sync" with the DB. I'd like something like this in VS2008 with C# .NET and ASP.NET.
Is there anything remotely like this on the market?
I am attempting to code some plugins to use with MIDI sequencers but have hit a stumbling block. I can't use global-scope variables to store information because multiple instances of the .dll can exist which share memory.
How do I create a class (for re-usability purposes in other plugins) containing 2 dimensional array and other variables the content of which is to be shared between functions? If that is possible, how would I read and write the data from the function in the framework where I do the processing?
I'm trying to write a query that returns the same result from three different events, but I think I am doing it wrong. I can run my query against one event ID and it works. How can I select all three? Here's what I have so far:
SELECT * FROM `Registrations`
WHERE `Role` = "Attendee" AND `RegistrationStatus_ID` = "1" AND `DigSignature` IS NULL
AND `Event_ID` = "147" OR `Event_ID` = "155" OR `Event_ID` = "160"
I've seen questions to prefix zeros here in SO. But not the other way !!
Can you guys suggest me how to remove the leading zeros in alphanumeric text. Are there any built-in APIs or do I need to write a method to trim the leading zero's?
Example:
01234 converts to 1234
0001234a converts to 1234a
001234-a converts to 1234-a
101234 remains as 101234
2509398 remains as 2509398
123z remains as 123z
000002829839 converts to 2829839
Hi
I want to write a simple client that downloads a file from a server using only bsd sockets.
I searched the web but couldn't find anything helpful. Can you give me a direction?
Thanks
Alex
I am attempting to write a LaTeX package which leverages the minted package's \inputminted command. My \mycommand command takes two parameters, the first being a path to a file, and I want to pass the file's extension to the \inputminted command:
\newcommand\mycommand[2]{
\inputminted{#1}{...}
}
Note that the above won't work since the full path is passed to \inputminted.
Example:
\mycommand{/path/to/Test.java}{blah}
should invoke
\inputminted{java}{...}
I want to write a map/reduce job to select a number of random samples from a large dataset based on a row level condition. I want to minimize the number of intermediate keys.
Pseudocode:
for each row
if row matches condition
put the row.id in the bucket if the bucket is not already large enough
Have you done something like this? Is there any well known algorithm?
A sample containing sequential rows is also good enough.
Thanks.