K I am looking at a primarily single thread windows forms application in 3.0. Recently my boss had a progress dialogue added on a separate thread so the user would see some activity when the main thread went away and did some heavy duty work and locked out the GUI.
The above works fine unless the user switches applications or minimizes as the progress form sits top most and will not disappear with the main application. This is not so bad if there are lots of little operations as the event structure of the main form catches up with its events when it gets time so minimized and active flags can be checked and thus the dialog thread can hide or show itself accordingly.
But if a long running sql operation kicks off then no events fire. I have tried intercepting the WndProc command but this also appears queued when a long running sql operation is executing. I have also tried picking up the processes, finding the current app and checking various memory values isiconic and the like inside the progress thread but until the sql operation finishes none of these get updated. Removing the topmost causes the dialog to disappear when another app activates but if the main app is then brought back it does not appear again.
So I need a way to find out if the other thread is minimized or no longer active that does not involve querying the actual thread as that locks until the sql operation finishes.
Now I know that this is not the best way to write this and it would be better to have all the heavy processing on separate threads leaving the GUI free but as this is a huge ancient legacy app the time to re-write in that fashion will not be provided so I have to work with what I have got.
Any help is appreciated
I have a Windows service that's running all the time, and takes some action every 15 minutes. I also have a client WinForms app that displays some information about what the service is doing. I'd like the forms application to keep itself updated with a recent status, but I'm not sure if polling every second is a good move performance-wise.
When it starts, my Windows Service opens a WCF named pipe to receive queries (from my client form)
Every second, a timer on the winform sends a query to the pipe, and then displays the results. If the pipe isn't there, the form displays that the service isn't running.
Is that the best way to do this? If my service opens the pipe when it starts, will it always stay open (until I close it or my service stops)? In addition to polling the service, maybe there's some way for the service to notify any watching applications of certain events, like starting and stopping processing? That way, I could poll less, since I'd presumably know about big events already, and would only be polling for progress.
Anything that I'm missing?
I have written and deployed an ASP.NET application that is pretty complex. It uses XSL transformations to create web forms for a large variety of data objects. The data comes from the database as XML via a web service.
Now, I need to create a Windows desktop application that will provide a small subset of the web applications functionality to a user who may not have access to the web (working in remote areas). I will provide the data syncing using the MS Sync Framework. And I will have the desktop use a local data store.
I would like to use the same xslt files in the desktop app that I use in the web app for the form creation so that, if changes are made, the desktop app can update itself when it connects and syncs its data.
But, I am wondering how to replicate the asp.net codebehind logic of my web app in the windows forms. If I use a browser control to render the XSLTransformation result, then how could I handle click events, etc, in the form? Also, can I launch other windows as "dialog boxes" from my windows forms (I do this in my web app using RadControls functionality)?
Thanks for any advice you can give.
Hi Folks
I am trying to use a Main () function in a class to control the program flow in my vb .net Windows Forms application. I have added a splash screen component and a login screen, and customised my main sdi form. I have set the startup form to be my main function in the Application Page of the Project Designer, and everything seems to work fine(ish).
However, I would like to use:
Me.MinimumSplashScreenDisplayTime = 5000
to ensure that the splash screen is visible, but it is not recognised by the system unless I tick the Enable Application Framework check box on the Project Designer. If I do this, on startup the program ignores the login and splash screens and all my customisation and just displays a default Form1, even though I have also specified my splash screen in the AF dropdown list.
Of course, there are alternative ways to delay a splash screen, such as putting the thread temporarily to sleep (which didn't seem to work), but I suspect that there are other things in the AF that I may want to use.
Any suggestions on how I can get round this please, and get a sensible means of controlling program flow? Any thoughts on the best overall structure for organising program flow would also be helpful too. I am concerned both about going down a Microsoft or an alternative custom route that may cause me problems later, as the application becomes more complex.
Thankses.
I have this code that has one "outerDIV" that contains an "innerDIV". On chrome the "innerDIV" size is 491px, whereas on IE it is 425px (same as outerDIV). Hence, on Chrome I can see the first two children of "innerdiv": "My test string #1" and "test2". But for IE I can only see the first child.
I am not quite sure what the "right" behavior should be, as firefox does the same as IE. However I would like to have IE do the same as Chrome.
I have been experimenting with some css styles (mainly overflow and display), but still can't make it right: IE will expand its height instead of its width to make the elements fit.
Can you guys help me figure out a way to change the css so that IE will wraps the div elements inline? As a restriction though, I cannot change the width on the HTML. As a benefit, I am using a css that only loads for IE to patch these kind of IE inconsistencies. The same css will NOT load for chrome, so I don't need to worry about messing with chrome when changing the IE CSS. Thanks in advance!
<html>
<head>
<style type="text/css">
<!--
body {
font-family: helvetica;
}
.myContainer {
overflow: hidden;
border: 1px solid rgba(0, 0, 0, .5);
font-size: 14pt;
height: 49px;
line-height: 49px;
overflow: hidden;
display: block;
}
.myContainer > DIV {
float: left;
white-space: nowrap;
display: block;
}
.myContainer .item:first-child {
padding-left: 10px;
}
.myContainer .item {
float: left;
padding-right: 32px;
}
-->
</style>
</head>
<body>
<div id="outerDIV" class="myContainer" style="display: block; width: 425px;">
<div id="innerDIV">
<div class="item">
--------My test string #1--------
</div>
<div class="item">
------test2-------
</div>
<div class="item">
test
</div>
</div>
</div>
</body>
</html>
I'm developing a touchscreen application that, aside from everything else, records the amount of times the screen is used so that the user can be reminded to clean the screen after a predefined number of clicks.
I've got the click functions written nicely, all I need now is make sure the function is called on a click.
I imagine $('*').click(function() { //do something }); would accomplish my goal, but is that the best way? Also, would that overwrite other click functions assigned to the elements?
Hello, I'm having an issue with changing the attribute for an id and can't seem to figure out what I'm doing wrong. I guess it doesn't help that I'm new to this also.
I have a function that tests to make sure that I am pulling the correct id from the row in my form that I have dynamically created. It goes something like this:
myFunction() {
var id = $(id).attr("id");
alert("This is my id " + id);
}
This works with no problem and when I click the button assigned to alert me of my id it will give give me the id of the dynamic row in my form. The issue is now when I try to change the id with this:
changeId() {
var newId = $(id).attr("id", "x");
alert("This is my new id " + newId);
}
What happens in this case is that it will alert saying "This is my new id [object Object]" instead of giving me the new id. Any suggestions? I'd really appreciate any help with this.
I'm building a system that displays a list of user, and on selection of a user requests some form of password. These values are saved in a hidden field on the page, and need to be sent with every request as a form of authentication. (I'm aware of the MITM-vulnerability that lies herein, but it's a very low-key system, so security is not a large concern).
Now I need to send these values with each and every request, to auth the currently 'logged in' user. I'd like to automate this, via ajaxSetup, however i'm running into some issues.
My first try was:
init_user_auth: function(){
$.ajaxSetup({
data: {
'user' : site_user.selected_user_id(),
'passcode': site_user.selected_user_pc(),
'barcode' : site_user.selected_user_bc()
}
});
},
However, as I should have known, this reads the values once, at the time of the call to ajaxSetup, and never rereads them. What I need is a way to actually call the functions every time an ajax-call is made.
I'm currently trying to understand what is happening here: https://groups.google.com/forum/?fromgroups=#!topic/jquery-dev/OBcEfgvTJ9I, however through the flamewar and very low-level stuff going on there, I'm not exactly sure I get what is going on.
Is this the way to proceed, or should I just face facts and manually add login-info to each ajax-call?
question: how can i bind the same vector, lets say o=c(1,2,3,4) mutiple times to get a matrix like
o=array(c(1,2,3,4,1,2,3,4,1,2,3,4), dim(c(4,3))
o
[,1] [,2] [,3]
[1,] 1 1 1
[2,] 2 2 2
[3,] 3 3 3
[4,] 4 4 4
in a nicer way then: o=cbind(o,o,o) and maybe more generalized (dublicate()??
I need this to specifiy colors for elements in textplot()
thx a lot
Hi, I'm now using AxWebBrowser component to get DOM from web page and find used styles on each element. Unfortunatelly this is not working perfectly and some elements doesn't return correct data.
I'm thinking about if it's possible to use engine from firefox? Is there some dll library I can use, navigate to the page and go throw DOM of the page?
Hi,
I need to control some script elements, that's why I want to add class attribute to do it.
But, w3c says that it's invalid. Some effect, if I add rel or id attribute.
Any other ideas how I can access appropriate script tag?
Doctype: XHTML 1.0 Strict
Thanks,
I have a dynamic array of strings, the elements of which I would like to localize. Is there a way to localize the strings without iteration e.g. something like using "makeObjectsPerformSelector". Thank you
I realize this question has been answered before but couldn't find an answer that deals with my specific case.
I want to create a class called "InternetConnectionChecks" that will handle checking a network state and http timeouts. I'll call the methods twice in the app (once at the beginning to get data from a server, and once at the end to send user orders to the server).
For good form I'd like to put all these methods in a single class rather than copy/paste at different points in my code.
To check the network state, I'm using ConnectivityManager; thing is, getSystemService requires a class that extends Activity.
package arbuckle.app;
import android.app.Activity;
import android.app.Service;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
public class InternetConnectionChecks extends Activity {
public boolean isNetworkAvailable(){
ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if ((activeNetworkInfo != null)&&(activeNetworkInfo.isConnected())){
return true;
}else{
return false;
}
}
}
QUESTION: if I call the method isNetworkAvailable from another activity, am I:
- going to hit up serious errors.
- violating good coding form?
*If this isn't the right way to do things, can you point me in the right direction to set up a separate class I can call on to check internet connection?
Thanks everyone!
I tried this but does not display the message only redirects
login.jsp
<form method="post" action="Login_Servlet" >
<input name="idUsuario" type="text"/>
<input name="password" type="password" />
<button type="submit">Entrar</button>
</form>
Login_Servlet
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String userid= request.getParameter("idUser");
String password = request.getParameter("password");
Login_Service login_Service = new Login_Service();
boolean result = login_Servicio.aut(userid, password);
Usuario user = login_Servicio.getUsuariosByUsuario(userid);
if(result == true){
request.getSession().setAttribute("user", user);
response.sendRedirect("vistas/Inicio.jsp");
}
else{
out.println("<script type=\"text/javascript\">");
out.println("alert('User or password incorrect');");
out.println("</script>");
response.sendRedirect("index.jsp");
}
Is it possible to display a message like this? if so I'm doing wrong?
I am currently working on trying to get a dropdown box to display the most recently saved field each time I open a page for editing an item in an inventory. For example, let's say that my dropdown box selections are Iron, Copper, Gold, Silver, Titanium. The first time the dropdown box loads, I would like it to load in that order (the default order that I set it to). However, once a user submits a form that specifies a selection, I would like that selection to appear as the new default for the dropdown box (for example, if the user picks Gold, Gold will now display as the default). However - the new default that is selected and submitted can only appear for those fields which it is saved under (for example, since the user selected Gold, their preference is now saved as Gold and will appear as such under the field Necklace - however, Gold should not be the default for the fields Ring, Bracelet, and Earring when I open a page to view them).
Basically, I need a dropdown box that can save the option of the latest selection on a page after the form is submitted, while at the same time making sure not to affect the default order of the dropdown box across other pages. Your help is much appreciated.
I am attempting to automate the entry of data into form fields. The problem is that this data (user/pass) is not known by the user. I'm not expressly hiding it from them, but they also don't need to know it.
This is used to automate logins on several of our outside partner websites, who do not want our agents knowing their passwords. Sadly, most of these sites do not have any APIs I can work with... so I have to get the user logged in.
I tried using an iframe and javascript, but I ran into the issue of security permissions denying it access. And sadly, our clients do not have access to add our domain to their sites(they seem to be 3rd party).
Requirements:
- Display webpage
- Automatically enter data into fields
Would be nice:
- Automate signin similar to form.submit()
- Flash/AJAX support. These seem to give the VB app issues.
Is there a way to do this via javascript/html, and if not, do you have any recommendations for C#/php/asp.net options?
PS: I am not sure what this techinque is called, so google isn't helping me it seems. Please set me straight on the terminology of what I am actually trying to accomplish.
Why Textarea and textfield not taking font-family and font-size from body?
See live example here http://jsbin.com/ucano4
Code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>texearea font</title>
<style type="text/css">
body {
font-family: Verdana, Geneva, sans-serif;
font-size:16px
}
</style>
</head>
<body>
<form action="" method="get">
<textarea name="" cols="20" rows="4"></textarea>
<input name="" type="text" />
</form>
<p>some text here</p>
</body>
</html>
If it's a usual behavior then should i write in css like this. i need same style in all
body,textarea,input {
font-family: Verdana, Geneva, sans-serif;
font-size:16px
}
And how many other elements in XHTML which will not take font styling from body {....}?
So I get a set of formelements that I want to extract the values from, by using
var inputs = $("input.row_2");
inputs[0].val()
When I run this, I get told that val is not a valid method.
What am I doing wrong?
Should be an easy one..
Thanks!
I am trying to manipulate a string so that any quotes (") within <a href> and <\a> get taken out... Sorry if its been asked before but I just can't get it to work! By the way, I am POSTing the data from a form and then manipulating the string. This is basically html but its in the form of a string, and I want to take out quotes on things like images and links... Another thing is, I do not want to escape the quotes because that would break the link... And the whole point is that the html can be used and work fine... But now, something is automatically creating a second set of quotes inside the normal quotes, like this: <a href="\"http://www.example.com/\""></a>
Example input would be: <p><a href="http://www.example.com">example</a></p>
Heres how it appears when I echo it however: <p><a href=\"http://www.example.com\">example</a></p>
Heres how I want it to look: <p><a href="http://www.example.com">example</a></p>
So I would actually be trying to get rid of the (/) my bad...
I have a ListActivity and I want to implement context menu for each of the list elements. I know that the common way to do this is to show the context menu on long click/tap. I want to know if there is a way to show the context menu for each element on a key press(preferably the menu key).
To rephrase my question, how can I trigger the context menu and not the options menu by pressing the menu key(or any other key).
I need to determine if I'm on a particular view. My use case is that I'd like to decorate navigation elements with an "on" class for the current view. Is there a built in way of doing this?
Given the following javascript (jquery)
$("#username").keyup(function () {
selected.username = $("#username").val();
var url = selected.protocol +
(selected.prepend == true ? selected.username : selected.url) + "/" +
(selected.prepend == true ? selected.url : selected.username);
$("#identifier").val(url);
});
This code basically reads a textbox (username), and when it is typed into, it reconstructs the url that is being displayed in another textbox (identifier).
This works fine - there are no problems with its functionality. However it feels 'slow' and 'sluggish'. Is there a cleaner/faster way to accomplish this task?
Here is the HTML as requested.
<fieldset class="identifier delta">
<form action="/authenticate/openid" method="post" target="_top" >
<input type="text" class="openid" id="identifier" name="identifier" readonly="readonly" />
<input type='text' id='username' name='username' class="left" style='display: none;'/>
<input type="submit" value="Login" style="height: 32px; padding-top: 1px; margin-right: 0px;" class="login right" />
</form>
</fieldset>
The identifier textbox just has a value set based on the hyperlink anchor of a button.
How can I find the dimensions of a matrix in Python. Len(A) returns only one variable.
Edit:
Hi Thanks.
close = dataobj.get_data(timestamps, symbols, closefield)
Is (I assume) generating a matrix of integers (less likely strings). I need to find the size of that matrix, so I can run some tests without having to iterate through all of the elements. As far as the data type goes, I assume it's an array of arrays (or list of lists).
Design an algorithm with min time and space
here is my solution -
assume a array of N elements with 32 bit integers
use a bit array to set the appropriate bits
the array is sorted now
assign even numbers to the first half of the array in ascending order
assign odd numbers to the second half of the array in descending order
any better solution ?