I want to write a program in J2ME to turn the Bluetooth on/off automaticly in a certain time without the user permission.
I'v been looking for a while but I couldn't find an answer.
I noticed in Firefox when viewing the cookies that the values I am saving are not encrypted. The CakePHP Book states that values are encrypted by default on write(). I can't seem to find any gotchas in the doc
Anyone else experience this problem? I am sure I am missing something.. Would it matter that the value being set is a integer?
This is code to write hastable to .txt file !
public static void save(String filename, Map<String, String> hashtable) throws IOException {
Properties prop = new Properties();
prop.putAll(hashtable);
FileOutputStream fos = new FileOutputStream(filename);
try {
prop.store(fos, prop);
} finally {
fos.close();
}
}
How we getback the hashtable from that file ?
Thanks
Recently I did a Java programming exercise successfully which was sent by a recruiting firm, The problem statement goes like this 'There are two text files FI(records abt files and directory information) and FS(containing blocks of data) which represent a file Index and file System respectively and I was supposed to write a static read method in a class which will read the file from the FS depending upon the path string provided using FI' My question is where can I get these kind of exercises to solve, the complexity should be above average to tough.
I'm trying to write a program to take the first letter of the user input to generate a username. I'm trying to write it so that if the user leaves the input blank, then the letter that would otherwise be taken to generate the username defaults to the letter 'z'.
Here is my full code:
import java.util.Scanner;
/**
UsernameGenerator.java
Generates a username based on the users inputs.
@author: Evan Fravert
*/
public class UsernameGenerator {
/**
* Generates a username based on the users inputs.
*@param args command line argument
*/
public static void main(String[] args)
{ // abcde
String first;
String middle;
String last;
String password1;
String password2;
int randomNum;
randomNum = (int) (Math.random() * 1000) + 100;
Scanner userInput = new Scanner(System.in);
System.out.println("Please enter your first name:");
first = userInput.nextLine();
String firstLower = first.toLowerCase();
System.out.println("Please enter your middle name:");
middle = userInput.nextLine();
String middleLower = middle.toLowerCase();
System.out.println("Please enter your last name:");
last = userInput.nextLine();
int lastEnd = last.length()-1;
String lastLower = last.toLowerCase();
System.out.println("Please enter your password:");
password1 = userInput.nextLine();
System.out.println("Please enter your password again:");
password2 = userInput.nextLine();
char firstLetter = firstLower.charAt(0);
char middleLetter = middleLower.charAt(0);
char lastLetter = lastLower.charAt(0);
char lastLast = lastLower.charAt(lastEnd);
if first.length() == 0) {
firstLetter = 'z';
}
else {
firstLetter = firstLower.charAt(0);
}
System.out.println("Your username is " + firstLetter + ""
+ middleLetter + "" + lastLetter + "" + "" + lastLast + "" + randomNum);
System.out.println("Your password is " + password1);
System.out.println("Welcome " + first + " " + middle + " " + last + "!");
}
}
Trying to write a deployment script, working on a repo in a different path. The "git-dir" flag seems to work fine for most commands, but not for submodule work. Am I missing a path directive?
Works:
git --git-dir=/tmp/repo_path/.git log
Doesn't work:
git --git-dir=/tmp/repo_path/.git submodule init
Error:
No submodule mapping found in .gitmodules for path 'path_to/submodule'
Much thanks for any help.
I have a page with a GoogleMap with a GoogleBar and I would like to "write something to the GoogleBar and press enter" automatically as soon as the map loads. How can I do this?
edit: By Google Bar, I mean the search bar that appears on the map after using the enableGoogleBar() function.
Could someone tell me the difference between those two. The first one is working on FF and not in IE (6) and second one is working in IE (6) and not in FF (I am using the Jquery 1.4.2). We had to detect the browser and write the script accordingly.
I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for the web? I mean, with a predefined list of widgets that can be defined using a markup language and then control them using code?
I have come across Google's Web Toolkit that does something like this but I'd like to hear what other's think as well.
I'm looking to write a comparator to sort my items in a list.
For items without an end year they should be at the top.
For items with an end year they should be next.
For items with the same end year the one with the lowest start year should be next.
Something I have so far
[item.get('end_year'), item.get('start_year')]
Test sceanrios first is end year second is start year ("" is present)
"", ""
"", 2012
"", 2011
2012, 2005
2012, 2008
2011, 2011
2010, 2005
I want show an information page after success db opartions. And after the info I want to close each pages (information page and main page)
I wrote this in button oncommand event:
//but this code does not work
Response.Write("<script language='javascript'>setTimeout('self.close();',3000);</script>");
at the same time, I want to show an information message. And then I want to close all, after three seconds.I hope I could explain :)
Thanks.
We've got the following repository method
public IList<Foo> GetItems(int fooId, int pageIndex, int pageSize
, string sortField, string sortDir, out int totalItems)
{
// Some code
}
My question is: is it ok to use out in this way. I'm somewhat uncomfortable with out, but can't come up with a better way to write this as a single call.
I'd like to run a script to do a SVN checkin automatically when exiting the VB6 IDE.
Is there any easy way to do that from within the IDE? (I guess I could write a script that launches the vb6 ide, waits for it to exit, then runs the script, but I'm hoping for something simpler).
I'm trying to write a query to give me the total number of users for each customer per day.
Here is what I have so far, which for each customer/day combination is giving the total number of user dimension entries without splitting them up by customer/day.
WITH MEMBER [Measures].[MyUserCount]
AS COUNT(Descendants([User].CurrentMember, [User].[User Name]), INCLUDEEMPTY)
SELECT
NON EMPTY CrossJoin([Date].[Date].Members, [Customer].[Customer Name].Members) ON ROWS,
{[Measures].[MyUserCount]} on COLUMNS
FROM
[Users]
I am new to Haskell and this mixture of Infix and Prefix notation is confusing me.
What is the difference between an operator like '+' and a function like head? How do I write an operator 'c' which does this 1 c 1 = 2?
I found this definition a ! b = True. How does Haskell know that I am defining ! and not a function a?
I have been experimenting HTML5 canvas by coding basic mind-mapping application. I have tried to find out if there is any javascript API used for managing object in canvas like collision detection between images or shapes.
I think it is not a good idea to write my own since there might be some good API around.
Anyone have clue or some information on this. I would very much appreciate.
I would like to add some test annotations (xml file) into an avi file as food for a later program that will process it. Is this done/doable ... ideally like a c# library to help me access and read/write the avis.
?
I have links that are dynamically generated and I need to set the target for all of them. How could I do this with javaScript. I found something that looks like it should work using jQuery..
$("#myDiv a").attr('target', '_top');
but I dont want to use a library for this and I imagine a couple of lines of javaScript would take care of it... I just dont know how to write it.
I am recently working on the open source library openmetaverse which is designed as an open source substitution of second life viewer. I think the problem is that it is not well documented. Sometimes, I just misunderstand the API when I really used it in real program which is very annoying because sometimes you need to write many code. But how to make sure the API just acts the way you expected? So what is your way to learn new API without good documentation?
In Visual Studio 2010 I added Trace to Page_Load as explained here http://www.asp101.com/articles/robert/tracing/default.asp but I can't see any Trace output, why ?
public partial class _Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
Trace.IsEnabled = true;
Trace.Write("Hello World");
}
}
DEAR All
I'm new to the C++, so maybe someone can say what the proper way to write a function that gets a string char (represents number) and converts it to the integer number.
For example : input : Sixty five, output: 65.
Maybe it should use by cin.getline() ?
Well, vice-versa is little bit simlper...
Thanks for advance.
Igal
I have a stored procedure that alters user data in a certain way. I pass it user_id and it does it's thing. I want to run a query on a table and then for each user_id I find run the stored procedure once on that user_id
How would I write query for this?
SQL SERVER
Hi,
as topic says, I don't want to return the first two letters in the return values
just an example:
select companyname from companies
returns companyX
Can I write a query that returns panyX instead?
Thanks in advance
I am writing installation script for my program, which is supposed to run on Linux/Unix OS. What is the default directory for the following files:
Executable files (programs). Program should be executed by typing its name from the command line.
Shared libraries.
Third-party shared libraries (the program is not open source, so I need to redistribute third-party libraries).
Read-only program configuration files for all users.
Configuration data available for read/write access for all users.