Daily Archives

Articles indexed Sunday March 14 2010

Page 2/89 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How do you control the playback levels (decibles?) using the iPhone AVAudioPlayer? Or do I need to u

    - by Joshua
    My audio clips sound perfect when I upload them to the iPhone via iTunes. And I am pretty sure it is because the iPod has a maximum playback level, so the audio doesn't sound overdriven. In my app, I include the same audio files, and when I play them [myAudio play]; the levels are so high that the audio becomes indiscernible. I found in the library http://developer.apple.com/iphone/library/documentation/AVFoundation/Reference/AVAudioPlayerClassReference/Reference/Reference.html#//apple_ref/doc/uid/TP40008067-CH1-SW2 that it says that you can "Control relative playback level for each sound you are playing" but I've been searching this issue out for hours and I haven't gotten anywhere. Any help would be wonderful!

    Read the article

  • Show a window from 32-bit NPAPI Plugin in 64-bit Safari

    - by Glenn Howes
    I have an old NPAPI plugin for OS X that I'm trying to refit for use with Snow Leopard's version of Safari. My problem is that when I switch Safari to 64-bit mode, it changes the plugin environment to out of process mode (where plugins are hosted by a 32-bit WebKitPluginHost process). And now my toolbar palettes are not visible on screen, even though the NSPanels on which they are based think they are visible. The documentation says that bringing up windows is not recommended, but doesn't say its prohibited; is there something I can do to bring up my Windows?

    Read the article

  • how can we check filetypes (formats such as jpg) without using file extensions before _-uploading t

    - by LostLord
    hi my dear friends: how can we check filetypes (formats such as jpg) without using file extensions before -uploading them- in asp.net with c# ? i am using vs 2008 + asp.net + c# + TELERIK Controls (RadUpload) ========================================================================================= imagine that some body change the text file extension to jpg and select in in a upload conrol such as radupload ... how can we recognize this file is truly jpg or not? thanks a lot

    Read the article

  • Const operator overloading problems in C++

    - by steigers
    Hello everybody, I'm having trouble with overloading operator() with a const version: #include <iostream> #include <vector> using namespace std; class Matrix { public: Matrix(int m, int n) { vector<double> tmp(m, 0.0); data.resize(n, tmp); } ~Matrix() { } const double & operator()(int ii, int jj) const { cout << " - const-version was called - "; return data[ii][jj]; } double & operator()(int ii, int jj) { cout << " - NONconst-version was called - "; if (ii!=1) { throw "Error: you may only alter the first row of the matrix."; } return data[ii][jj]; } protected: vector< vector<double> > data; }; int main() { try { Matrix A(10,10); A(1,1) = 8.8; cout << "A(1,1)=" << A(1,1) << endl; cout << "A(2,2)=" << A(2,2) << endl; double tmp = A(3,3); } catch (const char* c) { cout << c << endl; } } This gives me the following output: NONconst-version was called - - NONconst-version was called - A(1,1)=8.8 NONconst-version was called - Error: you may only alter the first row of the matrix. How can I achieve that C++ call the const-version of operator()? I am using GCC 4.4.0. Thanks for your help! Sebastian

    Read the article

  • Reordering arrays

    - by Wurlitzer
    Hi, Say, I have an array that looks like this: var playlist = [ {artist:"Herbie Hancock", title:"Thrust"}, {artist:"Lalo Schifrin", title:"Shifting Gears"}, {artist:"Faze-O", title:"Riding High"} ]; How can move an element to another position? I want to move for example, {artist:"Lalo Schifrin", title:"Shifting Gears"} to the end. I tried using splice, like this: var tmp = playlist.splice(2,1); playlist.splice(2,0,tmp); But it doesn't work. Any help would be appreciated.

    Read the article

  • Unable to stretch TableLayout to screen width

    - by Rendrik
    I've tried unsuccessfully for quite a few hours now to simply get a TableLayout to scale to the full screen. I've tried stretchColumns, shrinkColumns, (specifying the column index or using *) you name it. It's almost as if the parent element (TableLayout) is completely ignoring 'android:layout_width="fill_parent"'. I've read through similar questions here, though they haven't solved it for me. The XML below has 3 rows, and the table always shrink wraps to the size of the content. Apparently I'm too new to post pictures(?) Here is the XML rendered into the project i'm working on. http://www.dashiva.com/images/Capture.png What am I missing here, it's quite frustrating! <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="*"> <TableRow> <TextView android:id="@+id/AmountText" android:text="@string/general_amount" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:id="@+id/CardText" android:text="@string/general_card" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:text="@string/general_date" android:id="@+id/DateText" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:id="@+id/ErrorText" android:text="@string/general_error" android:paddingRight="8dip" android:layout_gravity="center"></TextView> </TableRow> <TableRow> <TextView android:text="Amount here..." android:id="@+id/AmountNum" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:id="@+id/CardNum" android:text="Num here..." android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:text="date here..." android:id="@+id/DateDate" android:paddingRight="8dip" android:layout_gravity="center"></TextView> <TextView android:text="Code here..." android:id="@+id/ErrorCode" android:paddingRight="8dip" android:layout_gravity="center"></TextView> </TableRow> <TableRow> <ImageView android:id="@+id/cc_image" android:src="@drawable/mastercard" android:background="@drawable/row_bg2" android:layout_gravity="center" android:layout_weight="1"></ImageView> <TextView android:id="@+id/ResponseText" android:layout_span="4" android:text="Response text here..." android:textSize="18dip" android:layout_weight="1"></TextView> </TableRow> <ImageView android:layout_gravity="center_vertical" android:background="@drawable/gradient_bg" android:layout_height="3dip" android:layout_width="fill_parent"></ImageView> </TableLayout>

    Read the article

  • Django Admin: OneToOne Relation as an Inline?

    - by Jim Robert
    I am putting together the admin for a satchmo application. Satchmo uses OneToOne relations to extend the base Product model, and I'd like to edit it all on one page. It is possible to have a OneToOne relation as an Inline? If not, what is the best way to add a few fields to a given page of my admin that will eventually be saved into the OneToOne relation? for example: class Product(models.Model): name = models.CharField(max_length=100) ... class MyProduct(models.Model): product = models.OneToOne(Product) ... I tried this for my admin but it does not work, and seems to expect a Foreign Key: class ProductInline(admin.StackedInline): model = Product fields = ('name',) class MyProductAdmin(admin.ModelAdmin): inlines = (AlbumProductInline,) admin.site.register(MyProduct, MyProductAdmin) Which throws this error: <class 'satchmo.product.models.Product'> has no ForeignKey to <class 'my_app.models.MyProduct'> Is the only way to do this a Custom Form? edit: Just tried the following code to add the fields directly... also does not work: class AlbumAdmin(admin.ModelAdmin): fields = ('product__name',)

    Read the article

  • CLR via C# 3rd Edition is out

    - by Abhijeet Patel
    Time for some book news update. CLR via C#, 3rd Edition seems to have been out for a little while now. The book was released in early Feb this year, and needless to say my copy is on it’s way. I can barely wait to dig in and chew on the goodies that one of the best technical authors and software professionals I respect has in store. The 2nd edition of the book was an absolute treat and this edition promises to be no less. Here is a brief description of what’s new and updated from the 2nd edition. Part I – CLR Basics Chapter 1-The CLR’s Execution Model Added about discussion about C#’s /optimize and /debug switches and how they relate to each other. Chapter 2-Building, Packaging, Deploying, and Administering Applications and Types Improved discussion about Win32 manifest information and version resource information. Chapter 3-Shared Assemblies and Strongly Named Assemblies Added discussion of TypeForwardedToAttribute and TypeForwardedFromAttribute. Part II – Designing Types Chapter 4-Type Fundamentals No new topics. Chapter 5-Primitive, Reference, and Value Types Enhanced discussion of checked and unchecked code and added discussion of new BigInteger type. Also added discussion of C# 4.0’s dynamic primitive type. Chapter 6-Type and Member Basics No new topics. Chapter 7-Constants and Fields No new topics. Chapter 8-Methods Added discussion of extension methods and partial methods. Chapter 9-Parameters Added discussion of optional/named parameters and implicitly-typed local variables. Chapter 10-Properties Added discussion of automatically-implemented properties, properties and the Visual Studio debugger, object and collection initializers, anonymous types, the System.Tuple type and the ExpandoObject type. Chapter 11-Events Added discussion of events and thread-safety as well as showing a cool extension method to simplify the raising of an event. Chapter 12-Generics Added discussion of delegate and interface generic type argument variance. Chapter 13-Interfaces No new topics. Part III – Essential Types Chapter 14-Chars, Strings, and Working with Text No new topics. Chapter 15-Enums Added coverage of new Enum and Type methods to access enumerated type instances. Chapter 16-Arrays Added new section on initializing array elements. Chapter 17-Delegates Added discussion of using generic delegates to avoid defining new delegate types. Also added discussion of lambda expressions. Chapter 18-Attributes No new topics. Chapter 19-Nullable Value Types Added discussion on performance. Part IV – CLR Facilities Chapter 20-Exception Handling and State Management This chapter has been completely rewritten. It is now about exception handling and state management. It includes discussions of code contracts and constrained execution regions (CERs). It also includes a new section on trade-offs between writing productive code and reliable code. Chapter 21-Automatic Memory Management Added discussion of C#’s fixed state and how it works to pin objects in the heap. Rewrote the code for weak delegates so you can use them with any class that exposes an event (the class doesn’t have to support weak delegates itself). Added discussion on the new ConditionalWeakTable class, GC Collection modes, Full GC notifications, garbage collection modes and latency modes. I also include a new sample showing how your application can receive notifications whenever Generation 0 or 2 collections occur. Chapter 22-CLR Hosting and AppDomains Added discussion of side-by-side support allowing multiple CLRs to be loaded in a single process. Added section on the performance of using MarshalByRefObject-derived types. Substantially rewrote the section on cross-AppDomain communication. Added section on AppDomain Monitoring and first chance exception notifications. Updated the section on the AppDomainManager class. Chapter 23-Assembly Loading and Reflection Added section on how to deploy a single file with dependent assemblies embedded inside it. Added section comparing reflection invoke vs bind/invoke vs bind/create delegate/invoke vs C#’s dynamic type. Chapter 24-Runtime Serialization This is a whole new chapter that was not in the 2nd Edition. Part V – Threading Chapter 25-Threading Basics Whole new chapter motivating why Windows supports threads, thread overhead, CPU trends, NUMA Architectures, the relationship between CLR threads and Windows threads, the Thread class, reasons to use threads, thread scheduling and priorities, foreground thread vs background threads. Chapter 26-Performing Compute-Bound Asynchronous Operations Whole new chapter explaining the CLR’s thread pool. This chapter covers all the new .NET 4.0 constructs including cooperative cancelation, Tasks, the aralle class, parallel language integrated query, timers, how the thread pool manages its threads, cache lines and false sharing. Chapter 27-Performing I/O-Bound Asynchronous Operations Whole new chapter explaining how Windows performs synchronous and asynchronous I/O operations. Then, I go into the CLR’s Asynchronous Programming Model, my AsyncEnumerator class, the APM and exceptions, Applications and their threading models, implementing a service asynchronously, the APM and Compute-bound operations, APM considerations, I/O request priorities, converting the APM to a Task, the event-based Asynchronous Pattern, programming model soup. Chapter 28-Primitive Thread Synchronization Constructs Whole new chapter discusses class libraries and thread safety, primitive user-mode, kernel-mode constructs, and data alignment. Chapter 29-Hybrid Thread Synchronization Constructs Whole new chapter discussion various hybrid constructs such as ManualResetEventSlim, SemaphoreSlim, CountdownEvent, Barrier, ReaderWriterLock(Slim), OneManyResourceLock, Monitor, 3 ways to solve the double-check locking technique, .NET 4.0’s Lazy and LazyInitializer classes, the condition variable pattern, .NET 4.0’s concurrent collection classes, the ReaderWriterGate and SyncGate classes.

    Read the article

  • How to make an IDisposable object a class variable?

    - by Ben Aston
    I am working with Active Directory using C#. Instantiating the PrincipalContext object seems to be expensive, so I'd like to store one in a class variable. When using PrincipalContext as a local variable, I can use the convenient using syntax. When storing an IDisposable object in a static variable, how do I ensure the object is properly disposed of?

    Read the article

  • What's the best way to select max over multiple fields in SQL?

    - by allyourcode
    The I kind of want to do is select max(f1, f2, f3). I know this doesn't work, but I think what I want should be pretty clear (see update 1). I was thinking of doing select max(concat(f1, '--', f2 ...)), but this has various disadvantages. In particular, doing concat will probably slow things down. What's the best way to get what I want? update 1: The answers I've gotten so far aren't what I'm after. max works over a set of records, but it compares them using only one value; I want max to consider several values, just like the way order by can consider several values. update 2: Suppose I have the following table: id class_name order_by1 order_by_2 1 a 0 0 2 a 0 1 3 b 1 0 4 b 0 9 I want a query that will group the records by class_name. Then, within each "class", select the record that would come first if you ordered by order_by1 ascending then order_by2 ascending. The result set would consist of records 2 and 3. In my magical query language, it would look something like this: select max(* order by order_by1 ASC, order_by2 ASC) from table group by class_name

    Read the article

  • iPhone - didPopItem ? Is this supposed to work?

    - by Chris
    I have a simple UITableView setup. I am trying to use - (void)navigationBar:(UINavigationBar *)navigationBar didPopItem:(UINavigationItem *)item I put a NSLog inside this method, but it is apparently not getting called when I "pop" back to the screen. I am not finding much information about this function, has it been replaced?

    Read the article

  • Use web interface to modify htaccess file

    - by justinl
    The solution to a previous question (How to implement “Maintenance Mode” on already established website), was to use a modified .htaccess to deny IP addresses. What is the best way to use a web interface to modify an .htaccess file? What I want is a way for an admin to log in to the admin area and switch Maintenance Mode on and off using a basic html form. I'm using PHP and I'm already using an .htaccess file for a handful of ReWriting.

    Read the article

  • php curl: how can i emulate a get request exactly like a web browser?

    - by ufk
    Hi. there are websites that when i open specific ajax request on browser i get the resulted page, but when i try to load them with curl, i receive an error from the server. how can i properly emulate a get request to the server that will simulate a browser ? that's what i'm doing: $url="https://new.aol.com/productsweb/subflows/ScreenNameFlow/AjaxSNAction.do?s=username&f=firstname&l=lastname"; ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); $result=curl_exec($ch); print $result;

    Read the article

  • Which testing method to go with? [Rails]

    - by yuval
    I am starting a new project for a client today. I have done some rails projects before but never bothered writing tests for them. I'd like to change that starting with this new project. I am aware there are several testing tools, but am a bit confused as to which I should be using. I heard of RSpec, Mocha, Webrat, and Cucamber. Please keep in mind I never really wrote any regular tests, so my knowledge of testing in general is quite limited. How would you suggest I get started? Thanks!

    Read the article

  • How to modify web page elements loaded in a browser

    - by Trilok
    I want to associate some actions with keys (of a keyboard) and then modify the contents of a webpage loaded in the browser. For example, I'll write a firefox plugin and that would be listening to some keyboard events. Based on a key press (or something like that) I want to modify the html code of the page. For example, I would like to change the color of a link. Any suggestions on how can I go about doing this?

    Read the article

  • jQuery inconsistent .remove by class on element with multiple classes

    - by pedalpete
    I've got a page where messages and associated elements (responses, forwards, etc) all share a class based on the database id of the parent. For example this is a message this is another message this is a comment this is another comment tim posted a new message sara forwarded a message to john at times I need to remove all elements with the same id, so I originally had jQuery('div#'+id).remove(); but that would sometimes not remove all the ids because ids are supposed to be unique. So I added the id as a class. now I use jQuery('div.'+id).remove(); but this seems to be about 80% effective, and sometimes the divs aren't being removed. I'm not sure if the issue is because the div has more than one class, but I need the classes because that is how I refer to the elements when somebody clicks. For instance, jQuery('div.message').click(function(){ get the id, send it to the server and get the message }); is there something wrong I'm doing here? or is there a better way to do this?

    Read the article

  • simscan's regex

    - by alexus
    -bash-3.2# cat /var/qmail/control/simcontrol :clam=yes,spam=yes,spam_hits=7.0,regex=^Subject\072.*(7.|8.)\%.*:(?m)\.ru\/\n{21} -bash-3.2# cat ./cur/msg.1268526916.764928.8759:2,S | pcregrep -M '(?m)\.ru\/\n{21}' Party's over for Clinton http://260.noonwife.ru/ of because Abraham is large Confessional murdered the for -bash-3.2# grep -c REGEX /var/log/qmail/smtpd/@* /var/log/qmail/smtpd/@400000004b9c134f0095ecdc.s:25 /var/log/qmail/smtpd/@400000004b9c144c2748a9dc.s:6 /var/log/qmail/smtpd/@400000004b9c16eb2ac491fc.s:12 /var/log/qmail/smtpd/@400000004b9c1c61239185ac.s:28 /var/log/qmail/smtpd/@400000004b9c216a3013fdb4.s:29 /var/log/qmail/smtpd/@400000004b9c26b11fb5263c.s:22 /var/log/qmail/smtpd/@400000004b9c2b2505d2035c.s:25 /var/log/qmail/smtpd/@400000004b9c2ec3139530f4.s:12 /var/log/qmail/smtpd/@400000004b9c312c160d7454.s:4 -bash-3.2# first regex works, yet i can't get it to match second, even though pcregrep matches it using same regex just fine any ideas?

    Read the article

  • what's the port number of mysql

    - by user28233
    I'm trying to connect mysql with vb.net, I've already downloaded the mysql connector-net. And installed it. But I don't know what is the port number , server address of mysql. Its needed in the connection string. Please help, Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

    Read the article

  • Setup GIT Server with Msysgit on Windows

    - by Tom
    Hi Guys, My friends and I are trying to setup GIT for windows using this tutorial but we just keep running into problems. I know many of you guys on this site are GIT gurus - so I was wondering whether anyone would be able to help us (and I am sure 100s of other Windows Devs who want to use GIT) write a "Setup GIT Server" guide for windows using Msysgit ? There is a comment on the guide above suggesting it cant be done with Msysgit because gitosis requires the use of an SSH Server and Bash ? Would really appreciate it if someone could do a step by step guide as there is not one available (we've search for hours)? Install Mysisgit ? Thx

    Read the article

  • trying to connect mysql with vb.net

    - by user225269
    I've found this at connection strings.com http://connectionstrings.com/mysql Do I need to download connector-net from this site: http://dev.mysql.com/downloads/connector/net/ I recycled the code that I used in connecting vb.net with ms sql: Imports system.data.sqlclient idnum = TextBox1.Text lname = TextBox2.Text fname = TextBox3.Text skul = TextBox4.Text Using sqlcon As New SqlConnection("Server=localhost;Port=3306;Database=testing;Uid=root;Pwd=nitoryolai123$%^;") sqlcon.Open() Dim sqlcom As New SqlCommand() sqlcom.Connection = sqlcon sqlcom.CommandText = "INSERT INTO [student](ID, LASTNAME, FIRSTNAME, SCHOOL) VALUES (@ParameterID, @ParameterLastName, @ParameterFirstName, @ParameterSchool)" sqlcom.Parameters.AddWithValue("@ParameterID", TextBox1.Text) sqlcom.Parameters.AddWithValue("@ParameterLastName", TextBox2.Text) sqlcom.Parameters.AddWithValue("@ParameterFirstName", TextBox3.Text) sqlcom.Parameters.AddWithValue("@ParameterSchool", TextBox4.Text) sqlcom.ExecuteNonQuery() End Using But I get this error: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) Please help, what solutions would you recommend to this problem?

    Read the article

  • How bad is it to use a virtual file system with VMWare? [closed]

    - by user30997
    IT is running a series of VMs that we'd like to see optimized further: if the VMs' are Windows XP, storing their NTFS images out to the virtual disk (ext3) provided by Linux/VMWare, how much of a hit are we taking - as opposed to having a partition of the host hard drive formatted NTFS to eliminate the translation layer and the extra level of operating system IO preparation?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >