As the question says, is it possible to play an overlay video over the camera and record it.
Also, would it be possible to play an audio file while in camera mode.
Hello!
I'm trying to delete some files with unicode characters in them with batch script (it's a requirement). So I run cmd and execute:
> chcp 65001
Effectively setting codepage to UTF-8. And it works:
D:\temp\1>dir
Volume in drive D has no label.
Volume Serial Number is 8C33-61BF
Directory of D:\temp\1
02.02.2010 09:31 <DIR> .
02.02.2010 09:31 <DIR> ..
02.02.2010 09:32 508 1.txt
02.02.2010 09:28 12 delete.bat
02.02.2010 09:20 95 delete.cmd
02.02.2010 09:13 <DIR> Rún
02.02.2010 09:13 <DIR> ????? ???????
3 File(s) 615 bytes
4 Dir(s) 11 576 438 784 bytes free
D:\temp\1>rmdir Rún
D:\temp\1>dir
Volume in drive D has no label.
Volume Serial Number is 8C33-61BF
Directory of D:\temp\1
02.02.2010 09:56 <DIR> .
02.02.2010 09:56 <DIR> ..
02.02.2010 09:32 508 1.txt
02.02.2010 09:28 12 delete.bat
02.02.2010 09:20 95 delete.cmd
02.02.2010 09:13 <DIR> ????? ???????
3 File(s) 615 bytes
3 Dir(s) 11 576 438 784 bytes free
Then I put the same rmdir commands in batch script and save it in UTF-8 encoding. But when I run nothing happens, literally nothing: not even echo works from batch script in this case. Even saving script in OEM encoding does not help.
So it seems that when I change codepage to UTF-8 in console, scripts just stop working. Does somebody know how to fix that?
I don't have a cell phone, but Google App Engine needs an SMS message to verify the account. Is there another way to complete the registration?
I'm surprised they don't use a Gmail account to do this.
Hello,
I'm trying to prevent a record that has a relationship to another record from being deleted. I can stop the deletion but not send a flash message as I had hoped!
class Purchaseitem < ActiveRecord::Base
before_destroy :check_if_ingredient
...
def check_if_ingredient
i = Ingredient.find(:all, :conditions => "purchaseitem_id = #{self.id}")
if i.length > 0
self.errors.add(:name)
flash.now[:notice] =
"#{self.name} is in use as an ingredient and cannot be deleted"
return false
end
end
This will prevent a the delete wihthout the flash line, and when I add it I get:
undefined local variable or method `flash' for #
Any help would be much appreciated!
Hi,
I have a data source ('SampleAppearanceDefinitions'), which holds a single collection ('Definitions'). Each item in the collection has several properties, including Color, which is what I'm interested in here.
I want, in XAML, to display the Color of a particular item in the collection as text. I can do this just fine using this code below...
Text="{Binding Source={StaticResource SampleAppearanceDefinitions}, Path=Definitions[0].Color}"
The only problem is, this requires me to hard-code the index of the item in the Definitions collection (I've used 0 in the example above). What I want to do in fact is to get that value from a property in my current DataContext ('AppearanceID'). One might imagine the correct code to look like this....
Text="{Binding Source={StaticResource SampleAppearanceDefinitions}, Path=Definitions[{Binding AppearanceID}].Color}"
...but of course, this is wrong.
Can anyone tell me what the correct way to do this is? Is it possible in XAML only? It feels like it ought to be, but I can't work out or find how to do it.
Any help would be greatly appreciated!
Thanks!
AT
while (curr_data[1] != (unsigned int)NULL &&
((curr_ptr = (void*)curr_data[1]) || 1))
Two part question.
What will (curr_ptr = (void*)curr_data[1]) evaluate to, logically. TRUE?
Also, I know its rather hack-ish, but is the while statement legal C? I would have to go through great contortions to put the assignment elsewhere in the code, so I'd be really nice if I could leave it there, but if it's so egregious that it makes everyone's eyeballs burst into flames, I'll change it.
Edit: I think the answer to my question lies in the ability to set user defined variables in MySQL through PHP - the answer by Multifarious has pointed me in this direction
Currently I have a script to cycle over 10M records, it's very slow and it goes like this:
I first get a block of 1000 results in an array similar to this:
$matches[] = array('quality_rank'=>46732, 'db_id'=>5532);
$matches[] = array('quality_rank'=>12324, 'db_id'=>1234);
$matches[] = array('quality_rank'=>45235, 'db_id'=>8345);
$matches[] = array('quality_rank'=>75543, 'db_id'=>2562);
I then cycle through them one by one and update the record
$mult = count($matches)*2;
foreach($matches as $m)
{
$rank++;
$score = (($m[quality_rank] + $rank)/($mult))*100;
$s = "UPDATE `packages_sorted` SET
`price_rank` = '".$rank."',
`deal_score` = '".$score."'
WHERE `db_id` = '".$m[db_id]."' LIMIT 1";
}
It seems like this is a very slow way of doing it but I can't find another way to increment the field price_rank by one each time. Can anyone suggest a better method.
Note: Although I wouldn't usually store this kind of value in a database I really do need on this occasion for comparison search queries later on in the project.
Any help would be kindly appreciated :)
I did an install of PHP5.3.5 on Windows 7 Home Premium using the MSI installer download. I got it to overwrite a previous version of PHP5 in C:\php5\
When first testing it, the server failed to start. I fixed this by adding the path to PHP in the Apache2.2 httpd file where the installer had inserted 2 lines of coded pointing to the ini file directory and the PHP DLL but had left out the directory path. After doing this, the server starts ok and I can run phpinfo to view the PHP settings in my web browser on local host.
In the phpinfo it states that the loaded configuration file is C:\php5\php.ini as expected. But if I make any changes to the settings, and reboot the server, none of the changes are reflected in phpinfo. Yes, I do refresh the browser window.
If I rename the php.ini to something else to make it invisible phpinfo then correctly identifies that there is no php.ini file loaded.
So the settings in php.ini are being ignored and some default settings are being used (but I have no idea where these are derived from). As far as I can tell, there are no other php.ini files on my computer.
In phpinfo it states that the Configuration File (php.ini) Path is C:\Windows but this is the same as on a Windows XP computer that I work on. And in the windows folder I don't see any php.ini file.
In the windows registry, there is no mention of PHP5, and the PATH environment variable starts with C:\php5\;
So hopefully someone can suggest how I can get PHP5 to take notice of the C:\php5\php.ini settings. :)
How can i strip <h1>including this content</h1>
I know you can use strip tags to remove the tags, but i want everything in between gone as well.
Any help would be appreciated.
Hey guys,
I'm working on some legacy code for a client, involving Microsoft Content Management System (MCMS).
Currently, everything is local, the code, MCMS, SQLServer, and IIS (5.x).
I copied the project folder, and then opened the new copied solution in VS2005, and let it do it's conversion thing.
But now nothing works. I've nnotice there have been some changes to IIS profile. What are the extent of these changes...??
Also, my VS2003 fails to recognize the Web Project??
Anyone have any idea what's going on?
cheers!
I'm learning about design patterns and because of that I've ended using a lot of interfaces. One of my "goals" is to program to an interface, not an implementation.
What I've found is that I'm doing a lot of casting or object type conversion. What I'd like to know is if there is a difference between these two methods of conversion:
public interface IMyInterface
{
void AMethod();
}
public class MyClass : IMyInterface
{
public void AMethod()
{
//Do work
}
// other helper methods....
}
public class Implementation
{
IMyInterface _MyObj;
MyClass _myCls1;
MyClass _myCls2;
public Implementation()
{
_MyObj = new MyClass();
// What is the difference here:
_myCls1 = (MyClass)_MyObj;
_myCls2 = (_MyObj as MyClass);
}
}
If there is a difference, is there a cost difference or how does this affect my program?
Hopefully this makes sense. Sorry for the bad example; it is all I could think of...
Update: What is "in general" the preferred method? (I had a question similar to this posted in the 'answers'. I moved it up here at the suggestion of Michael Haren. Also, I want to thank everyone who's provided insight and perspective on my question.
I'm writing reports on SQL Server Reporting Server that have a number of hours grouped by, say, user, and a total calculated based on the sum of the values.
Currently my query runs a stored proc that returns the hours as in HH:MM format, rather than decimal hours, as our users find that more intuitive. The problem occurs when I try and add up the column using an SSRS expression, because the SUM function isn't smart enough to handle adding up times in this format.
Is there any way to:
Display a time interval (in minutes or hours) in HH:MM format while having it calculated in decimal form?
Or split up and calculate the total of the HH:MM text values to arrive at a total as an expression?
I'd like to avoid having to write/run a second query just to get the total.
I've got an Excel add-in project that was created a couple years back in Visual Studio 2008. It's got some changes to be made so I've upgraded to Visual Studio 2010 (the only IDE I am able to use). Not sure if this is causing the problem but it's background information.
When I check out the code and compile it I get the error, "Error 1 Unable to find manifest signing certificate in the certificate store."
Can anyone tell me what this means and how to fix it?
I have a maven (multi-module) project creating some WAR and EAR files for JBoss AS 7.1.x.
For one purpose, I need to deploy one generated EAR file of one module to a fresh JBoss instance and run it, call some REST web service calls against it and stop JBoss. Then I need to package the results of these calls that were written to the database.
Currently, I am trying to use CARGO and the maven ant run plugin to perform this task.
Unfortunately, I cannot get the three (maven, ant run and CARGO) to play together. I don't have the uberjar that is used in the ant examples of cargo. How can I configure the ant run task so that the cargo ant task can create, start, deploy my JBoss? Ideally the one unpacked and configured by the cargo-maven2-plugin in another phase?
Or, is there a better way to achieve my goal of creating the database?
I cannot really use the integration-test phase, as it is executed after the package phase. So, I plan to do it all in compile phase using antrun.
I'm trying to debug an iPhone app I'm working on, and the idea of adding fifty NSLog statements to the various source files gives me the willies.
What I'd like to do is write a pair of statements, say
NSString *methodName = [self methodName];
NSLog(@"%@", methodName);
that I can just paste into each method I need to. Is there a way to do this? Is there some Objective-C construct for asking a method for its name? Or am I gonna have to do this the hard way?
using namespace std;
int addition (int a, int b)
{
return (a+b);
}
int subtraction (int a, int b)
{
return (a-b);
}
int operation (int x, int y, int (*functocall)(int,int))
{
int g;
g = (*functocall)(x,y);
return(g);
}
int main()
{
int m,n;
int (*minus)(int,int) = subtraction;
m = operation (7,5,addition);
n = operation (20,m,minus);
cout << n;
return 0;
}
Can anybody explain this line for me
int (*minus)(int,int) = subtraction;
Thanks a lot!
I am looking at this piece of code. This constructor delegates to the native method "System.arraycopy"
Is it Thread safe? And by that I mean can it ever throw a ConcurrentModificationException?
public Collection<Object> getConnections(Collection<Object> someCollection) {
return new ArrayList<Object>(someCollection);
}
Does it make any difference if the collection being copied is ThreadSafe eg a CopyOnWriteArrayList?
public Collection<Object> getConnections(CopyOnWriteArrayList<Object> someCollection) {
return new ArrayList<Object>(someCollection);
}
I run into this frequently enough that I thought I'd see what others had to say about it.
Using the StyleCop conventions, I find that I often have a property name that is hard to make different than the class name it is accessing. For example:
public class ProjectManager
{
// Stuff here
}
public class OtherClass
{
private ProjectManager ProjectManager { get; set; }
}
It compiles and runs, but seems like it would be an easy way to confuse things, even with the use of "this".
I'm hoping this is a simple goof I did on my end ...
I have a table in my database set up like so:
column name: widget_guid
data type: uniqueidentifier
allow nulls: false
default value: newid()
identity: false
row guid: true
When records are created (via LINQ to SQL) that the values in this field are formatted as a GUID but contain all 0's
My assumption was that when a new record was created, that a guid would be autogenerated for that column, much like an auto-incrementing row id. Is this not true? Any help would be greatly appreciated.
Thanks.
I am developing a C# WinForms app on my XP dev machine with Visual C# Express 2008.
I set the form to have a size of my liking with Width and Height on the designer and all looks good. I also set these dimensions to the MaximumSize property.
Deploying the app to another XP machine, and the app looks like it does on my dev.
However, in testing the app on a Win7 machine, the form has both horizontal and vertical scrollbars applied. I assume that this is due to the changed non-client size of the form, as determined by Win7. I can resize the window, but I would like it to be displayed correctly to begin with.
So, my question is: What is the best way to correctly maintain a form size client area across OS'es?
Thanks all.
Blockquote
Here is an extract from item 56 of the book "C++ Gotchas":
It's not uncommon to see a simple
initialization of a Y object written
any of three different ways, as if
they were equivalent.
Y a( 1066 );
Y b = Y(1066);
Y c = 1066;
In point of fact, all three of these
initializations will probably result
in the same object code being
generated, but they're not equivalent.
The initialization of a is known as a
direct initialization, and it does
precisely what one might expect. The
initialization is accomplished through
a direct invocation of Y::Y(int).
The initializations of b and c are
more complex. In fact, they're too
complex. These are both copy
initializations. In the case of the
initialization of b, we're requesting
the creation of an anonymous temporary
of type Y, initialized with the value
1066. We then use this anonymous temporary as a parameter to the copy
constructor for class Y to initialize
b. Finally, we call the destructor for
the anonymous temporary.
To test this, I did a simple class with a data member (program attached at the end) and the results were surprising. It seems that for the case of b, the object was constructed by the copy constructor rather than as suggested in the book.
Does anybody know if the language standard has changed or is this simply an optimisation feature of the compiler? I was using Visual Studio 2008.
Code sample:
#include <iostream>
class Widget
{
std::string name;
public:
// Constructor
Widget(std::string n) { name=n; std::cout << "Constructing Widget " << this->name << std::endl; }
// Copy constructor
Widget (const Widget& rhs) { std::cout << "Copy constructing Widget from " << rhs.name << std::endl; }
// Assignment operator
Widget& operator=(const Widget& rhs) { std::cout << "Assigning Widget from " << rhs.name << " to " << this->name << std::endl; return *this; }
};
int main(void)
{
// construct
Widget a("a");
// copy construct
Widget b(a);
// construct and assign
Widget c("c");
c = a;
// copy construct!
Widget d = a;
// construct!
Widget e = "e";
// construct and assign
Widget f = Widget("f");
return 0;
}
Output:
Constructing Widget a
Copy constructing Widget from a
Constructing Widget c
Assigning Widget from a to c
Copy constructing Widget from a
Constructing Widget e
Constructing Widget f
Copy constructing Widget from f
I was most surprised by the results of constructing d and e.
I have a User class in my web app that represents a user currently logged in.
Every time a user vists a page, a User instance is populated based on authentication data supplied in cookies.
A User instance is created even if an anonymous user logs in - and a corresponding new record is created in the User table in the database.
This approach allows me to save some state info for the current user regardless of its type.
The problem however with this approach is the Google bot, and other non-human web organisms crawling my pages. Every time a bot starts to walk around the site, thousands of useless records will be created in the database, each of them only to be used for a single page.
Question: what is the best trade off? How to support anonymous users, save their state, and don't get too much overhead because of cookieless bots?