I'm accessing the minimum element of a binary tree lots of times. What implementations allow me to access the minimum element in constant time, rather than O(log n)?
i have created an application with the help of webrequest and webresponse . when i try to log in to yahoo i succeed. after that i open the next page and i get the login page again by the response. How can I fix this?
Hi all,
I am using a VideoView to display a video. I am using setOnPreparedListener and setOnCompletionListener to do stuff before and after the video starts and ends.
I was wondering how I could go about detecting some point of time in the video. For eg, say I want to write log to a file when the video has played for 10s. How can I detect the 10s mark?
Thanks
Chris
I'm getting a crash with the following encoding fix I'm trying to implement:
// encoding fix
NSString *correctStringTitle = [NSString stringWithCString:[[item objectForKey:@"main_tag"] cStringUsingEncoding:NSISOLatin1StringEncoding] encoding:NSUTF8StringEncoding];
cell.titleLabel.text = [correctStringTitle capitalizedString];
my crash log output states:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithCString:encoding:]: NULL cString'
thanks for any help
Is there a way to force sharepoint 2010 to popup the dialog to ask the user for a username and password and not use the computers logged in user, if that user doesn't have access.
We need an internal sharepoint website to not use the windows credentials, since these are computers used by many people. The windows user doesn't have access to the site, so currently it shows an access denied, click here to log in as another user. We would prefer if it just asked for credentials in a more graceful manner.
Consider the log in page on NerdDinner.com: http://www.nerddinner.com/Account/LogOn
Some nice features:
jQuery effects on the OpenID choice
popups for the other major providers
Is this revision of the NerdDinner AccountController and its View available for public download? How would you reinvent this implementation? Any code you can post would be fine.
Calling Jon Galloway!
Below is my entire code from a User control that contains the YUI Uploader. Is there something I'm missing. Right now, when I step through the javascript code in Firebug, it hangs on the first line of the upload() function. I have a breakpoint on the first line of the ashx that handles the file, but it is never called. So, it doesn't get that far. I figure I'm just missing something stupid. I've used this control many times before with no issues. I'm using all the css files and graphics provided by the samples folder in the YUI download.
If I'm not missing anything, is there a more comprehensive way of debuging this issue then through stepping through the javascript with FireBug. I've tried turning the logging for YUI on and off, and never get any logs anywhere. I'm not sure where to go now.
<style type="text/css">
#divFile
{
background-color:White;
border:2px inset Ivory;
height:21px;
margin-left:-2px;
margin-right:9px;
width:125px;
}
</style>
<ajaxToolkit:RoundedCornersExtender runat="server" Corners="All" Radius="6" ID="rceContainer" TargetControlID="pnlMMAdmin" />
<asp:Panel ID="pnlMMAdmin" runat="server"
Width="100%" BackColor="Silver" ForeColor="#ffffff" Font-Bold="true" Font-Size="16px">
<div style="padding: 5px; text-align:center; width: 100%;">
<table style="width: 100% ; border: none; text-align: left;">
<tr>
<td style="width: 460px; vertical-align: top;">
<!-- information panel -->
<ajaxToolkit:RoundedCornersExtender runat="server" Corners="All" Radius="6" ID="RoundedCornersExtender1" TargetControlID="pnlInfo" />
<asp:Panel ID="pnlInfo" runat="server"
Width="100%" BackColor="Silver" ForeColor="#ffffff" Font-Bold="true" Font-Size="16px">
<div id="infoPanel" style="padding: 5px; text-align:left; width: 100%;">
<table>
<tr><td>Chart</td><td>
<table><tr><td><div id="divFile" ></div></td><td><div id="uploaderContainer" style="width:60px; height:25px"></div></td></tr>
<tr><td colspan="2"><div id="progressBar"></div></td></tr></table>
</td></tr>
</table>
</div></asp:Panel>
<script type="text/javascript" language="javascript">
WYSIWYG.attach('<%= txtComment.ClientID %>', full);
var uploader = new YAHOO.widget.Uploader("uploaderContainer", "assets/buttonSkin.jpg");
uploader.addListener('contentReady', handleContentReady);
uploader.addListener('fileSelect', onFileSelect)
uploader.addListener('uploadStart', onUploadStart);
uploader.addListener('uploadProgress', onUploadProgress);
uploader.addListener('uploadCancel', onUploadCancel);
uploader.addListener('uploadComplete', onUploadComplete);
uploader.addListener('uploadCompleteData', onUploadResponse);
uploader.addListener('uploadError', onUploadError);
function handleContentReady() {
// Allows the uploader to send log messages to trace, as well as to YAHOO.log
uploader.setAllowLogging(false);
// Restrict selection to a single file (that's what it is by default,
// just demonstrating how).
uploader.setAllowMultipleFiles(false);
// New set of file filters.
var ff = new Array({ description: "Images", extensions: "*.jpg;*.png;*.gif" });
// Apply new set of file filters to the uploader.
uploader.setFileFilters(ff);
}
var fileID;
function onFileSelect(event) {
for (var item in event.fileList) {
if (YAHOO.lang.hasOwnProperty(event.fileList, item)) {
YAHOO.log(event.fileList[item].id);
fileID = event.fileList[item].id;
}
}
uploader.disable();
var filename = document.getElementById("divFile");
filename.innerHTML = event.fileList[fileID].name;
var progressbar = document.getElementById("progressBar");
progressbar.innerHTML = "Please wait... Starting upload.... ";
upload(fileID);
}
function upload(idFile) {
// file hangs right here. **************************
progressBar.innerHTML = "Upload starting... ";
if (idFile != null) {
uploader.upload(idFile, "AdminFileUploader.ashx", "POST");
fileID = null;
}
}
function handleClearFiles() {
uploader.clearFileList();
uploader.enable();
fileID = null;
var filename = document.getElementById("divFile");
filename.innerHTML = "";
var progressbar = document.getElementById("progressBar");
progressbar.innerHTML = "";
}
function onUploadProgress(event) {
prog = Math.round(300 * (event["bytesLoaded"] / event["bytesTotal"]));
progbar = "<div style=\"background-color: #f00; height: 5px; width: " + prog + "px\"/>";
var progressbar = document.getElementById("progressBar");
progressbar.innerHTML = progbar;
}
function onUploadComplete(event) {
uploader.clearFileList();
uploader.enable();
progbar = "<div style=\"background-color: #f00; height: 5px; width: 300px\"/>";
var progressbar = document.getElementById("progressBar");
progressbar.innerHTML = progbar;
alert('File Uploaded');
}
function onUploadStart(event) {
alert('upload start');
}
function onUploadError(event) {
alert('upload error');
}
function onUploadCancel(event) {
alert('upload cancel');
}
function onUploadResponse(event) {
alert('upload response');
}
</script>
After creating a db using Database Configuration Assistant, I go to Enterprise Manager, log into it, and it tells me, that java.lang.Exception: Exception in sending Request :: null. OracleDBConsole for this db, and iSQLPlus services are started. When I run %ORACLE_HOME%\bin\emctl status dbconsole, it says, EM Daemon is not running. How do I deal with this?
I'm using cucumber with webrat, and I am just starting to integrate culerity/celerity. My webrat login steps have been working great, and I have them as a Background for many of my scenarios. The problem is that although I can log in successfully via webrat, my celerity specific step definitions don't seem to recognize that. I can check the session from the step def and it confirms that I have a valid user that is logged in. Any advice would be greatly appreciated!
Thanks
i have installed successfully codeblock on my pc but when i try to run "hello world" or even another code, i get this messege of bluild log "name-Debug uses an invalid compiler. Skipping... nothing to be done" so please help me!
Sherlog is an OSGi-based log analyzer, if I import this project as an workspace snapshot I receive lot's of projects in my workspace, but I would prefere to have them as subprojects in a project.
The other option would be to checkout from svn, but then I face other problems (I don't know how to setup the dependencies for automatically build)
Does anyone have an idea or good links on this topic? Thanks
I created an application using the method described in the "http://
book.cakephp.org/view/641/Simple-Acl-controlled-Application" but after
I try to log in there is an error which says, "DbAcl::allow() -
Invalid node [CORE\cake\libs\controller\components\acl.php, line 325]"
I did exactly same as mentioned in the website but after loggin in I
am given this error msg.. Please help me rectify this. Any help is
greatly appreciated.....
thanks
gaurav sharma
Related to this question. It appears that Glassfish is exporting slf4j into my application and overriding my logging solution. Is it possible for me to override Glassfish's logging and have my own logging solution take precedence? After searching, I have only found ways to modify the log using logging.properties.
I am not married to my current implementation, but I am interested in making it work.
thanks.
Hi, I have to connect to a https url with username and password to read a file. I am not able to connect to the server (see the error log below). I do not have much java experience so I need help with this code. I would really appreciate some help to solve this! Thank you.
Raquel
CODE:
import lotus.domino.;
import java.net.;
import java.io.*;
import javax.net.ssl.HttpsURLConnection;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
String username = "123";
String password = "456";
String input = username + ":" + password;
String encoding = new sun.misc.BASE64Encoder().encode (input.getBytes());
//Open the URL and read the text into a Buffer
String urlName = "https://server.org/Export.mvc/GetMeetings?modifiedSince=4/9/2010";
URL url = new URL(urlName);
HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("Content-Length", String.valueOf (encoding.length()));
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setAllowUserInteraction(true);
connection.setRequestProperty("Authorization", "Basic " + encoding);
connection.setRequestProperty("Cookie", "LocationCode=Geneva");
connection.connect();
BufferedReader rd = null;
try{
rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));
} catch (IOException e) {
System.out.println("Read failed");
System.exit(-1);
}
String line;
while((line = rd.readLine()) != null) {
System.out.println(line.toString());
}
rd.close();
connection.disconnect();
} catch(Exception e) {
e.printStackTrace();
}
}
}
LOG:
java.security.AccessControlException: Access denied (java.lang.RuntimePermission exitVM.-1)
at java.security.AccessController.checkPermission(AccessController.java:108)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at COM.ibm.JEmpower.applet.AppletSecurity.superDotCheckPermission(AppletSecurity.java:1449)
at COM.ibm.JEmpower.applet.AppletSecurity.checkRuntimePermission(AppletSecurity.java:1311)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1611)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1464)
at java.lang.SecurityManager.checkExit(SecurityManager.java:744)
at java.lang.Runtime.exit(Runtime.java:99)
at java.lang.System.exit(System.java:275)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
I have run into a strange problem using SQL Server 2000 and two linked server. For two years now our solution has run without a hitch, but suddenly yesterday a query synchronizing data from one of the databases to the other started timing out.
I connect to a server in the production network, which is linked to a server containing orders I need data from.
The query contains a few joins, but basically this summarizes what is done:
INSERT INTO ProductionDataCache
(column1, column2, ...)
SELECT tab1.column1, tab1.column2, tab2.column1, tab3.column1 ...
FROM linkedserver.database.dbo.Table1 AS tab1
JOIN linkedserver.database.dbo.Table2 AS tab2 ON (...)
JOIN linkedserver.database.dbo.Tabl32 AS tab3 ON (...)
...
WHERE tab1.productionOrderId = @id
ORDER BY ...
Obviously my first attempt to fix the problem was to increase the timeout limit from the original 5 minutes. But when I arrived at 30 minutes and still got a timeout, I started to suspect something else was going on. A query just does not go from executing in less than 5 minutes to over 30 minutes over night.
I outputted the SQL query (which was originally in the C# code) to my logs, and decided to execute the query in the Query Analyzer directly on the database server. To my big surprise, the query executed correctly in less than 10 seconds.
So I isolated the SQL execution in a simple test program, and observed the same query time out both on the server originally running this solution AND when running it locally on the database server. Also I have tried to create a Stored Procedure and execute this from the program, but this also times out. Running it in Query Analyzer works fine in less than a few seconds.
It seems that the problem only occurs when I execute this query from the C# program. Has anyone seen such behavior before, and found a solution for it?
UPDATE:
I have now used SQL Profiler on the server. The obvious difference is that when executing the query from the .NET program, it shows up in the log as "exec sp_executesql N'INSERT INTO ...'", but when executing from Query Analyzer it occurs as a normal query in the log.
Further I tried to connect the SQL Query Analyzer using the same SQL user as the program, and this triggered the problem in Query Analyzer as well. So it seems the problem only occurs when connecting via TCP/IP using a sql user.
I am trying to pass back an image through a content provider in a separate app. I have two apps, one with the activity in (app a), the other with content provider (app b)
I have app a reading an image off my SD card via app b using the following code.
App a:
public void but_update(View view)
{
ContentResolver resolver = getContentResolver();
Uri uri = Uri.parse("content://com.jash.cp_source_two.provider/note/1");
InputStream inStream = null;
try
{
inStream = resolver.openInputStream(uri);
Bitmap bitmap = BitmapFactory.decodeStream(inStream);
image = (ImageView) findViewById(R.id.imageView1);
image.setImageBitmap(bitmap);
}
catch(FileNotFoundException e)
{
Toast.makeText(getBaseContext(), "error = "+e, Toast.LENGTH_LONG).show();
}
finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException e) {
Log.e("test", "could not close stream", e);
}
}
}
};
App b:
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode)
throws FileNotFoundException {
try
{
File path = new File(Environment.getExternalStorageDirectory().getAbsolutePath(),"pic2.png");
return ParcelFileDescriptor.open(path,ParcelFileDescriptor.MODE_READ_ONLY);
}
catch (FileNotFoundException e)
{
Log.i("r", "File not found");
throw new FileNotFoundException();
}
}
In app a I am able to display an image from app a's resources folder, using setImageURi and constructing a URI using the following code.
int id = R.drawable.a2;
Resources resources = getBaseContext().getResources();
Uri uri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" +
resources.getResourcePackageName(id) + '/' +
resources.getResourceTypeName(id) + '/' +
resources.getResourceEntryName(id) );
image = (ImageView) findViewById(R.id.imageView1);
image.setImageURI(uri);
However, if I try to do the same in app b (read from app b's resources folder rather than the image on the SD card) it doesn't work, saying it can't find the file, even though I am creating the path of the file from the resource, so it is definitely there.
Any ideas? Does it restrict sending resources over the content provider somehow?
P.S. I also got an error when I tried to create the file with
File path = new File(uri); saying 'there is no applicable constructor to '(android.net.Uri)' though http://developer.android.com/reference/java/io/File.html#File(java.net.URI) Seems to think it's possible...unless java.net.URI is different to android.net.URI, in which case can I convert them?
Thanks
Russ
Hi All,
I have to show the time taken for a service call in Perfmon from my ASP.Net application. For this, I have added a stopwatch which starts at the service call start and stops at service call stop. Now I have a custom counter which user AverageTimer32 to log the stopwatch values to Perfmon. My question is, how can I show the service names on the Perfmon graph. I am using windows XP (I know windows server perfmon has some fancy stuff).
I wish to pass to Hibernate's SessionFactory
hibernate.hbm2ddl.auto=update
and see in log file generated sql statements. Is it possible w/o java coding (know how to achieve the result with SchemaExport, but hope that hibernate has "in box" solution)
Suppose - User has selected & copied some text in textField/textView/webView.
Now I want to Log the copied text, But don't know how?
How is it possible?
Sagar
I'm using the following config:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true,
:user_name => "[email protected]",
:password => "sap"
}
When I send the mail, log shows mail is sent. I can see the mail in logger.
But, mail is not delivered to recipient email.
I have an MPI program which compiles and runs, but I would like to step through it to make sure nothing bizarre is happening. Ideally, I would like a simple way to attach GDB to any particular process, but I'm not really sure whether that's possible or how to do it. An alternative would be having each process write debug output to a separate log file, but this doesn't really give the same freedom as a debugger.
Are there better approaches? How do you debug MPI programs?
Hello,
I'm new with programing and my question is now, how i can close some specific explorer.exe windows. My Problem is, i have a program that call some windows:
Option Explicit
Dim shell, expl1, expl2, expl3, Terminate
Dim uprgExplorer
set shell = WScript.CreateObject("WScript.Shell")
set expl1 = shell.exec("C:\WINDOWS\explorer.exe c:\Documents and Settings")
set expl2 = shell.exec("C:\WINDOWS\explorer.exe C:\WINDOWS\system32\CCM\Cache")
set expl3 = shell.exec("C:\WINDOWS\explorer.exe c:\SCRIPTS\LOG")
Now i will kill only this 3 windows NOT the explorer.exe.
Can some one help me?
Greetings,
matthias
All,
I have a website that is in use and has several users, using the MySqlMembershipProvider.
We have had a few users that have been locked out (for some reason) and recently I unlocked them and reset the passwords, using the MembershipUser.UnlockUser and MembershipUser.ResetPassword methods.
Now they are definitely marked in the database as Unlocked and the password has been reset, but they still cannot log in.
Does anyone have any ideas why this might happen?
Hi,
I need to know if it is possible the current execution node?
Example:
..html
<script id="x">
console.log(document.currentNode.id); // << this must return "x"
</script>
..html
Thanks!
I develop a program which connect to a web-server through network every thing works fine until I try to use some dongle to protect my software. the dongle has network feature too and it's API work under network infrastructure. when I added the Dongle checking code to my program I got this error:
"Either the application has not called WSAStartup, or WSAStartup failed"
I don't have any idea what is going on?
I put the block of code which encounter exception here. the scenario I got the exception is I log in to the program (everything works fine) the plug out the dongle then the program stop and ask for dongle and I plug in the dongle again and try to log in bu I got exception on line
response = (HttpWebResponse)request.GetResponse();
DongleService unikey = new DongleService();
checkDongle = unikey.isConnectedNow();
if (checkDongle)
{
isPass = true;
this.username = txtbxUser.Text;
this.pass = txtbxPass.Text;
this.IP = combobxServer.Text;
string uri = @"https://" + combobxServer.Text + ":5002num_events=1";
request = (HttpWebRequest)WebRequest.Create(uri);
request.Proxy = null;
request.Credentials = new NetworkCredential(this.username, this.pass);
ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
response = (HttpWebResponse)request.GetResponse();
Properties.Settings.Default.User = txtbxUser.Text;
int index = _servers.FindIndex(p => p == combobxServer.Text);
if (index == -1)
{
_servers.Add(combobxServer.Text);
Config_Save.SaveServers(_servers);
_servers = Config_Save.LoadServers();
}
Properties.Settings.Default.Server = combobxServer.Text;
// also save the password
if (checkBox1.CheckState.ToString() == "Checked")
Properties.Settings.Default.Pass = txtbxPass.Text;
Properties.Settings.Default.settingLoginUsername = this.username;
Properties.Settings.Default.settingLoginPassword = this.pass;
Properties.Settings.Default.settingLoginPort = "5002";
Properties.Settings.Default.settingLoginIP = this.IP;
Properties.Settings.Default.isLogin = "guest";
Properties.Settings.Default.Save();
response.Close();
request.Abort();
this.isPass = true;
this.Close();
}
else
{
MessageBox.Show("Please Insert Correct Dongle!", "Dongle Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}