What is GUI anchor? All i have heard is that a person can hold a lock on the GUI for some lenght of time , say 2 hours, and in that peiord no otherr person can access that GUI, beacause if allowed access there can be discrepancy.....
To save both client download time and network usage, is it possible to use the localStorage feature of HTML5 to store contents of linked stylesheets, javascript files and binary data (e.g. images), rather than hitting the server each time?
Would that just complicate things - since I assume you would have to add the linked asset via JavaScript rather than just a script or link element, breaking the page for those without JavaScript enabled)? Unless you can parse the content (using HEAD requested to check last modified date and other headers) before the browser downloads it.
Or best just to stick with 304 Not Modified and eTag headers?
I'm trying to print out debug statements when some third party code changes a variable. For example, consider the following:
public final class MysteryClass {
private int secretCounter;
public synchronized int getCounter() {
return secretCounter;
}
public synchronized void incrementCounter() {
secretCounter++;
}
}
public class MyClass {
public static void main(String[] args) {
MysteryClass mysteryClass = new MysteryClass();
// add code here to detect calls to incrementCounter and print a debug message
}
I don't have the ability to change the 3rd party MysteryClass, so I thought that I could use PropertyChangeSupport and PropertyChangeListener to detect changes to the secretCounter:
public class MyClass implements PropertyChangeListener {
private PropertyChangeSupport propertySupport = new PropertyChangeSupport(this);
public MyClass() {
propertySupport.addPropertyChangeListener(this);
}
public void propertyChange(PropertyChangeEvent evt) {
System.out.println("property changing: " + evt.getPropertyName());
}
public static void main(String[] args) {
MysteryClass mysteryClass = new MysteryClass();
// do logic which involves increment and getting the value of MysteryClass
}
}
Unfortunately, this did not work and I have no debug messages printed out. Does anyone see what is wrong with my implementation of the PropertyChangeSupport and Listener interfaces? I want to print a debug statement whenever incrementCounter is called or the value of secretCounter changes.
I have a before filter than calculates a percentage that needs to include the object that is being updated. Is there a one liner in rails that takes care of this?
for example and this is totaly made up:
Object.find(:all, :include = :updated_object)
Currently I'm sending the object that is getting updated to the definition that calculates the percentage and that works but its making things messy.
Object.update_attribute(:only_one_field, "Some Value")
Object.update_attributes(:field1 => "value", :field2 => "value2", :field3 => "value3")
Both of these will update an object without having to explicitly tell AR to update.
Rails API says:
for update_attribute
Updates a single attribute and saves the record without going through the normal validation procedure. This is especially useful for boolean flags on existing records. The regular update_attribute method in Base is replaced with this when the validations module is mixed in, which it is by default.
for update_attributes
Updates all the attributes from the passed-in Hash and saves the record. If the object is invalid, the saving will fail and false will be returned.
So if I don't want to have the object validated I should use update_attribute. What if I have this update on a before_save, will it stackoverflow?
My question is does update_attribute also bypass the before save or just the validation.
Also, what is the correct syntax to pass a hash to update_attributes... check out my example at the top.
I am trying to parse this array data that way generated from JQuery and JSON.
Array
(
[d] = Array
(
[0] = Array
(
[order] = 1
)
[1] => Array
(
[order] => 2
)
[2] => Array
(
[order] => 3
)
[3] => Array
(
[order] => 4
)
[4] => Array
(
[order] => 5
)
)
)
I am trying to save the above date into a mysql table, but cannot seem to parse the data properly to be inserted into the database.
Can anyone help?
Hi folks,
I have a translucent toolbar over the bottom of my UIWebView. The trouble is, if there is a link at the bottom of the page, I can't press it because the webview will always bounce back down to the bottom.
I don't want to shrink the webview and use a solid colour toolbar, and UIWebViews interface doesn't open much up.
What I would like to do, ideally, is to actually increase the size of the web page by one toolbar height, so that I can scroll that extra bit and have all the content above the toolbar, but when scrolling down I will be able to see the page content through the toolbar. I could use the stringByEvaluatingJavaScriptFromString: function of UIWebView.
I'm very rusty on JavaScript- is it possible for me to do this? Increase the window height or something?
I tried:
[webView stringByEvaluatingJavaScriptFromString: [NSString stringWithFormat:@"window.resizeBy(0,%d);", TOOLBAR_HEIGHT] ];
but it didn't do anything.
Any pointers welcome.
Thanks.
$(document).ready(function () {
//create the div
var div = $("<div></div>").css("position", "absolute").text("a short message").appendTo("body");
//attach the mousemove event
$("body").bind('mousemove', function(evt) {
div.css({
"left": evt.pageX + "px",
"top": evt.pageY + "px"
});
});
});
what im trying to do is replace a short message with an iframe, what do i do?
I'd like the program to exit if the input number is less than 0, but sys.exit() isn't doing the trick. This is what I have now:
if len( sys.argv ) > 1:
number = sys.argv[1]
if number <= 0:
print "Invalid number! Must be greater than 0"
sys.exit()
I would like to create a time counter in my app that shows the user how many minutes the app has been running the current session and total. How do I create such time counter and how do I save the value to the phone? I'm new to app developement.
I have a windows application,sometimes in windows 7(also ultimate with administrator user) and vista to run it i need to right click and run it as administrator,I know the reason is attempt to access to system directories from my program,how i can solve this problem,is
net user administrator /active:yes that using for enabling the real aministrator account solve the problem? if no what should i do ! Thx
Hey all,
why is this code throwing an out of memory error, when there is only 1 row in the database..
$request_db = mysql_query("SELECT * FROM requests
WHERE haveplayed='0'") or die(mysql_error());
$request = mysql_fetch_array( $request_db );
echo "<table border=\"1\" align=\"center\">";
while ( $request['haveplayed'] == "0" ) {
echo "<tr><td>";
echo $request['SongName'];
echo "</td><td>";
echo "<tr><td>";
echo $request['Artist'];
echo "</td><td>";
echo "<tr><td>";
echo $request['DedicatedTo'];
echo "</td><td>";
}
echo "</table>";
Thanks.
I am trying to compare two vector objects, and return a single vector containing all the chars which appear in both vectors.
How would I go about this without writing some horribly complex manual method which compares every char in the first vector to every char in the second vector and using an if to add it to a third vector (which would be returned) if they match.
Maybe my lack of real experience with vectors is making me imagine this will be harder than it really is, but I suspect there is some simplier way which I have been unable to find through searching.
how does one use code to do this:
produce 15 random numbers that are not in any order, and that only occur once
eg.
1 4, 2, 5, 3, 6, 8, 7, 9, 10, 13, 12, 15, 14, 11
rand() or arc4rand() can repeat some, which is not what im after.
Thanks
*we release and the acquire the pointer with the Linked_ptr in parameter
*/
Linked_ptr& operator=(const Linked_ptr& r)
{
if (this != &r) {
release();
acquire(r);
}
return *this;
}
In SharePoint 2010 when you hover over a column heading (i.e. to sort) in a list table, you get a hover effect, how can you supress / change this? I can see it uses OnChildColumn(this), so is there a way to modify this - either preventing the effect (e.g. when sorting can't be done on a column), or using a different background image?
Also want to do the same when you hover over a cell in any of the list table's contents.
As a simplified example I am executing the following
IEnumerable<string> files = Directory.EnumerateFiles(path, @"2010*.xml",
SearchOption.TopDirectoryOnly).ToList();
In my results set I am getting a few files which do no match the file pattern. According to msdn searchPattern wildcard is "Zero or more characters" and not a reg ex. An example is that I am getting a file name back as "2004_someothername.xml".
For information there are in excess of 25,000 files in the folder.
Does anyone have any idea what is going on?
Hello everyone!
I've been looking around here on SO and Googling, however I can't find anything that fits my description.
What I want to do is update the database if the page has not been refreshed after 30 seconds. I want to email a person with the contents of a form {submitted by a different user} (I can do that) IF the person has NOT visited the page (I can do that) within the last 30 seconds.
What I've tried to do is make the page that should be visited refresh every 30 seconds, and so I figured if I did something like after 31 seconds, edit the database (so if the refreshed page was not refreshed, the database editing would run).
I'm sorry if this sounds complicated, there's probably a better way to do this, but I'm not sure how.
The bigger picture is I'm trying to make a 'on-duty' sort of thing, so that if the person is not actively looking at the page, they will get emailed with whatever the contents of the form is. The page will contain a table of all the entered form results.
I've been assigned the project of creating a simple console app. that models brownian motion in a 2D plane. I wasn't given much information on how to do so (and I'm hoping that it's a pretty popular assignment so that I could get some insight) just that it relies on random number generation. I researched brownian motion for a little bit and saw some formulas that looked complicated, but by the description is just seems to have to move randomly within a certain number interval. Can anyone clarify? Am I to create a program that continually creates a random number in an interval and then modify the particles "x" and "y" coordinate or is there more to it?
Thanks for any help.
hi all,i have a desktop application that install and start a service,i know a process can get the explorer.exe token and lunch another process with the tkoen,it means the second process will run us logged on account, my question is this that can i start my service by explorer.exe token too ? is there is an example in delphi?
thx for ur time
Is it possible to call a c(++) static function pointer like this
typedef int (*MyCppFunc)(void* SomeObject);
from c#?
void CallFromCSharp(MyCppFunc funcptr, IntPtr param)
{
funcptr(param);
}
I need to be able to callback from c# into some old c++ classes. C++ is managed, but the classes are not ref classes (yet).
So far I got no idea how to call a c++ function pointer from c#, is it possible?
I have this regular expression: [^\\s\"']+|\"([^\"]*)\"|'([^']*)'
which works for splitting a string by white spaces, and anything within a quotation is not delimited. However, I notice that if I put in a string that starts with "" no matches are found. How would I correct this?
For example, if I enter " test 2".
I want it to match to [, test, 2]
Note: using java to compile the regex, here is some code
Pattern pattern = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'");
Matcher matcher = pattern.matcher(SomeString);
while (matcher.find()){
String temp = matcher.group();
//... Do something ...
}
Thanks.
We have a current eCommerce Site that runs on ASP.NET and we hired a consultant to develop an new site bases on SOA. The new site architecture is as follows
Web Application : Single Page Web Application (built on javascript/jquery templates - do not use any MVVM frameworks) that uses some javascript thrown all over the place.
Service Layer : Very very light Service Layer that does not do anything other than calling a single stored procedure and pass in the entire http request.
Database : The entire site content is in the database. The database does the heavy lifting of parsing the request and based on the HTTP method and some input parameter calls the appropriate Store Procedures or views and renders the result in JSON/XML.
We have been told by them that this is built on latest and greatest technologies. I have a lot of concerns and of them given are the few
Load on the Database
SEO concerns for single page application as this is a public facing website
Scalablity?
Is this SOA?
Cross Browser compatability (Site does not work in < IE9)
Realistic implementaion of Single page application
I know something is not right but I just need to validate my concerns here. Please help me.
I have an app that builds a slideshow from user images. They can grab from their library or take a picture. I have found that repeated use of grabbing an image from the library is fine. But repeated use of taking a picture causes erratic behavior. I have been getting crashes but mostly what happens seems to be a reloading of the view after "didFinishPickingMediaWithInfo", which messes things up.
I have no leaks and it seems to be releasing properly after each picture is taken. I am resizing the image and saving it in a data base. Is anyone else running into this situation? Was the camera not designed to be called this often?