I am recording audio in iPhone ..
This is my Audio Queue object
AudioQueueNewInput(
&audioDescription,
recordingCallback, self,
CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, 0,
&mInputQueue
);
But i want to run this in a seperate RunLoop..How to create custom CFRunLoop ?
Please help me..Thanks in advance.
I have an asp.net page with a code-behind class definition as follows:
public partial class examplepage : System.Web.UI.Page
I'd like to set a public property within the page that I can reference from other classes. My understanding is that if I cast to examplepage then I should be able to get at the public property that is specific to example page, as in:
string test=((examplepage)HttpContext.Current.Handler).propertyX;
However, when I try casting as above the compiler does not recognise examplepage. Can anyone tell me how I can cast? I have no specific namespaces defined.
Thanks
How can I implement tail calls in a custom virtual machine?
I know that I need to pop off the original function's local stack, then it's arguments, then push on the new arguments. But, if I pop off the function's local stack, how am I supposed to push on the new arguments? They've just been popped off the stack.
I want to do a class that have properties like font, which will have other properties, such as name, size, unit,bold.I had tried a solution but it isn't working for me.(http://stackoverflow.com/questions/755391/group-properties-in-a-custom-control)
Anyone can help? Any help will be appreciated.
<TypeConverter(GetType(ExpandableObjectConverter))> _
Class TestingClass
'Some property here
End Class
Hello.
I have the following stored procedure
ALTER PROCEDURE [dbo].Test
AS
BEGIN
CREATE TABLE ##table
(
ID1 int,
ID2 int
)
DECLARE @query varchar(MAX);
INSERT INTO ##table VALUES(1, 1);
SELECT * FROM ##table;
END
And I try to use it from C# code. I use LINQ to SQL as an O/RM. When I add the procedure to DataBaseContext it says that it can't figure out the return value of this procedure. How to modify the stored procedure so that I can use it with LINQ to SQL.
Note: I need to have global template table!
Is it possible to delete data from a read only standby database that imports shipped log files?
At least in my theory this shouldn't be possible because the deletion would change the LSN and the log shipping should break.
What I need is a smaller sized database than the database that ships the logs. So basically I need a way to have the (readonly) standby server storing only the most recent data. Any ideas or recommendations on this?
I am coding in Visual Basic. I am using a checkbox control. Now depending on its checked property I need to set/unset a bit column in a SQL Server database. Here's the code:
Try
conSQL.Open()
Dim cmd As New SqlCommand("update Student set send_mail = " + _
sendemailCheckBox.Checked.ToString + " where student_id = '" _
+ sidnolabel.Text + "'", conSQL)
cmd.ExecuteNonQuery()
Finally
conSQL.Close()
End Try
The send_mail attribute is of bit datatype. This code is not working.
How do I go about it?
I'm writing a data driven WPF client. The client will typically pull data from a WCF service, which queries a SQL db, but I'd like the option to pull the data directly from SQL or other arbitrary data sources.
I've come up with this design and would like to hear your opinion on whether it is the best design.
First, we have some data object we'd like to extract from SQL.
// The Data Object with a single property
public class Customer
{
private string m_Name = string.Empty;
public string Name
{
get { return m_Name; }
set { m_Name = value;}
}
}
Then I plan on using an interface which all data access layers should implement. Suppose one could also use an abstract class. Thoughts?
// The interface with a single method
interface ICustomerFacade
{
List<Customer> GetAll();
}
One can create a SQL implementation.
// Sql Implementation
public class SqlCustomrFacade : ICustomerFacade
{
public List<Customer> GetAll()
{
// Query SQL db and return something useful
// ...
return new List<Customer>();
}
}
We can also create a WCF implementation. The problem with WCF is is that it doesn't use the same data object. It creates its own local version, so we would have to copy the details over somehow. I suppose one could use reflection to copy the values of similar fields across. Thoughts?
// Wcf Implementation
public class WcfCustomrFacade : ICustomerFacade
{
public List<Customer> GetAll()
{
// Get date from the Wcf Service (not defined here)
List<WcfService.Customer> wcfCustomers = wcfService.GetAllCustomers();
// The list we're going to return
List<Customer> customers = new List<Customer>();
// This is horrible
foreach(WcfService.Customer wcfCustomer in wcfCustomers)
{
Customer customer = new Customer();
customer.Name = wcfCustomer.Name;
customers.Add(customer);
}
return customers;
}
}
I also plan on using a factory to decide which facade to use.
// Factory pattern
public class FacadeFactory()
{
public static ICustomerFacade CreateCustomerFacade()
{
// Determine the facade to use
if (ConfigurationManager.AppSettings["DAL"] == "Sql")
return new SqlCustomrFacade();
else
return new WcfCustomrFacade();
}
}
This is how the DAL would typically be used.
// Test application
public class MyApp
{
public static void Main()
{
ICustomerFacade cf = FacadeFactory.CreateCustomerFacade();
cf.GetAll();
}
}
I appreciate your thoughts and time.
Title probably doesn't make a lot of sense, so I'll start with some code:
class Foo : public std::vector<Foo>
{
};
...
Foo f;
f.push_back( Foo() );
Why is this allowed by the compiler? My brain is melting at this stage, so can anyone explain whether there are any reasons you would want to do this? Unfortunately I've just seen a similar pattern in some production C# code and wondered why anyone would use this pattern.
Suppose I have the following three classes:
class Animal {};
class Human : public Animal {};
class Dog : public Animal
{
public:
void setOwner(Animal* owner) { this->owner = owner; }
private:
Animal* owner;
};
Why is the following allowed, and what exactly is happening?
Dog d;
Human h;
d.setOwner(&h); // ?
At first, I tried to cast it like this d.setOwner(&(Animal)h), but the compiler gave me a warning, and I hit a run-time error.
Edit: the warning the compiler gave me was "taking address of temporary". Why is this so?
How do I pass an argument to my custom save method, preserving proper *args, **kwargs for passing to te super method? I was trying something like:
form.save(my_value)
and
def save(self, my_value=None, *args, **kwargs):
super(MyModel, self).save(*args, **kwargs)
print my_value
But this doesn't seem to work. What am I doing wrong?
I have set the cell to the maximum size (column width of 255 and row height of 409.5). In order to view all of the data in the cell, I have to use up/down arrows. I don't need to necessarily view all of the data in the cell at one time, however I do need it to print, and it's only printing what's viewable (not what you can scroll through).....any suggestions on how to get the entire cell to print?
Thanks!
I don't know how to copy table data from
one server - database - table
TO
other sever - database - table.
If it is with in the same server and different databases, i have used the following
SELECT * INTO DB1..TBL1 FROM DB2..TBL1 (to copy with table structure and data)
INSERT INTO DB1..TBL1(F1, F2) SELECT F1, F2 FROM DB2..TBL1 (copy only data)
Now my question is copy the data from SERVER1 -- DB1-- TBL1 to SERVER2 -- DB2 --TBL2
I've written a custom plugin for CKEditor--successful on all fronts, save one currently: I can't, for the life of me, figure out how to customize the image on the button in the toolbar of the editor. As I'm a new user, you'll have to click through to see attached image; the highlighted square in the top left should have a pretty picture (like most of the other toolbar items).
Thanks much for thoughts/advice/help.
Isaac
Screenshot: http://imgur.com/ZNNKe.jpg
I am integrating LDAP authentication in my web enterprise application. I would like to show listing of people name and email. Instead of querying the LDAP server for the name and email each time a listing containing several users I thought about caching the data locally in the database.
Do you guys know about caching LDAP data best practices?
Should I cache LDAP user data?
When should I insert and refresh the data?
I'm trying to set up a proxy model in django admin. It will represent a subset of the original model. The code from models.py:
class MyManager(models.Manager):
def get_query_set(self):
return super(MyManager, self).get_query_set().filter(some_column='value')
class MyModel(OrigModel):
objects = MyManager()
class Meta:
proxy = True
Now instead of filter() I need to use a complex SELECT statement with JOINS. What's the proper way to inject it wholly to the custom manager?
Instead of changing my host file I'd like Firefox to think my domain is on my own server while my other browser uses the real IP address. I used to edit my host files but that forces both browsers to change the IP address.
I found change host, but it doesn't appear to use the alternative host file. I also saw a comment asking when it will work on Firefox 6+.
I tried Host Admin and it fails. It works but the alternative IP address must be in your host file already (which I don't want) and it lets you deselect a domain so the host file is ignored which is not what I want.
I am trying cache for my website use Nginx Proxy module and has following requirements:
If request has cookie (in request header)
The response will use cache of Nginx
Hide Set-Cookie header line
If request has no cookie (in request header)
Foward request to backend
Don't hide h Set-Cookie header line
I use If (of rewrite module) and any directive:
if (!-e $http_cookie)
{
set $not_cache_rq 0;
set $not_cache_rp 0;
}
if ($http_cookie) {
set $not_cache_rq 1;
set $not_cache_rp 1;
}
proxy_cache_bypass $not_cache_rq;
proxy_no_cache $not_cache_rp;
proxy_hide_header Set-Cookie;
I do not know how to call cookie proxy_hide_header option when has cookie and no cookie on header line.
Please help me. Many thanks.
I am trying to post data from my form to a jquery dialog that loads external content.
I am serializing the form data which works (appears in the url) but the dialog won't open:
$("#wavajax button").click(function() {
$.post({url: 'player/index.php', data: $("#wavajax").serialize(),
success: function (data) {
$("#recordingdialog").load("player/index.php", [], function(){
$("#recordingdialog").dialog("open");
}
});
return false;
});
What am I doing wrong, am I going about it the right way???
for something like www.9gag.com , which open source mvc framework can be used? in particular the main page, with highly rated content is what i am looking for.. along with an option for users to thumbs up/heart every article/post/blog/vlog/podcast/link.
I have this to add a class to the main table that the report is in if there is no data returned.
$('#report-area table td:contains("Sorry, your search did not return any data")').parents('#reportArea').addClass('no-report-data')
However, I have another div area "#report-footer" but it's not inside #report-area. I'd like to also add the .no-report-data class to "#report-footer" as well but in this case I don't think the .parents selector will work. Is there another selector I can use to do this?
Just something I'd like to play with, I would like to create a "virtual" file/directory in the File System of Linux or Mac OS X (Not sure if I can share the same code - does POSIX help?), for example /foo and then perform custom code when something is read or written to it.
Similar how /dev/null allows for stuff like
echo "Hello!" > /dev/null
I don't care if it's in /dev, /proc or anywhere else, as said it's mainly something to play with...