instruction
stringlengths
0
30k
Is it possible to use chapters in videos for the iPhone in an application? For example: I have a 3 minutes video to play. I have chapter 1 starting at 0s, chapter 2 at 50s, chapter 3 at 95s. Can I start plating the video at 50s (chapter 2) until the end? Can I make it play just the chapter 2 from 50s to 95s?
Is it possible to use chapters in videos for the iPhone in an application? For example: I have a 3 minutes video to play. I have chapter 1 starting at 0s, chapter 2 at 50s, chapter 3 at 95s. Can I start plating the video at 50s (chapter 2) until the end? Can I make it play just the chapter 2 from 50s to 95s? ...
so long as it is consistent amongst the team you work in then it doesnt matter too much that everyone does the same is the main thing
I use if (cond) { ... } else { ... } - Everything should always have braces. Even if now I only have one line in the if block, I made add more later. - I don't put the braces on their own lines because it's pointless waste of space. - I rarely put the block on the same line as the co...
if (x) { print "x is true"; } Opening and closing brace in same column makes it easy to find mismatched braces, and visually isolates the block. Opening brace in same column as "if" makes it easy to see that the block is part of a conditional. The extra white space around the block created by ...
C# 'generic' type problem
|c#|generics|image|
C# question (.net 3.5). I have a class, ImageData, that has a field ushort[,] pixels. I am dealing with proprietary image formats. The ImageData class takes a file location in the constructor, then switches on file extension to determine how to decode. In several of the image files, there is a "bit depth" field in ...
[ViewVC][1] provides a nice web interface to CVS (or SVN) and is reasonably easy to setup. It does not provide the same functionality as fisheye, however. I haven't tried the integration w/ a SQL DB backend though, I believe that will add some fisheye-like capabilities. [CVSTrac][2] also provides a web interface, wi...
window.frames['frameNameOrIndex'].location.reload();
Can't you use standard text file? You can read back data line by line.
I try to avoid TABLEs as much as possible, but when we are designing complex forms that mix multiple control types and different caption positions with pretty strict controls on grouping, using DIVs is unreliable or often near impossible. Now, I will not argue that these forms could not be redesigned to better accom...
Another one for Oracle using analytic functions: select col1 from ( select col1, dense_rank() over (order by col1 desc) rnk from tbl ) where rnk = :b1
I think it depends on the individual or group. Almost all shops have some exposure to one of these concepts. From there, I would introduce new concepts only as fast as you think the developer or team can absorb them. It's quite depressing to see teams start rejecting some of the important principles and concepts bec...
use String.Format() http://msdn.microsoft.com/en-us/library/aa331875.aspx
How to conditionally enable actions in C# ASP.NET website
|c#|concepts|
Using a configuration file I want to enable myself to turn on and off things like logging and using a cache in a C# website. I have a configuration xml file in which I can assert that logging and caching should be turned on or off. Then in the Application_Start event I read the file which will result in for example ...
Using a configuration file I want to enable myself to turn on and off things like (third party) logging and using a cache in a C# website. The solution should not be restricted to logging and caching in particular but more general, so I can use it for other things as well. I have a configuration xml file in which I ...
PDF Imposition in PHP
|php|pdf|imposition|
I'm looking for a PHP library that will allow me to create a print-ready PDF. The imposition should include 1-up, 4-up, 24-up, etc. layouts, and crop marks. FPDF, TCPDF and PHP's included PDF libraries allow me to create an image and plop it on a PDF, but the more advanced layouts and crop marks are a bit beyond me...
Sorry, not quite clear what 'Excel style' is, but PHP has a [ceil][1] function. [1]: http://us3.php.net/ceil
How to convert Strings to and from UTF8 byte arrays in Java
|java|syntax|
In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions?
It depends on your architecture. If you're all on the same tier, then you can go without the wrapper, though I'd probably pass an interface that View implements to Controller. Functionally, and from a coupling perspective, the interface approach and the wrapper approach are equivalent. However, if UI is on one tier ...
It depends on your architecture. If you're all on the same tier, then you can go without the wrapper, though I'd probably pass an interface that View implements to Controller. Functionally, and from a coupling perspective, the interface approach and the wrapper approach are equivalent. However, if UI is on one tier ...
Object initializers does in no way replace constructors. The constructor defines the contract that you have to adhere to in order to create a instance of a class. The main motivation for object initializers in the C# language is to support [Anonymous Types](http://msdn.microsoft.com/en-us/library/bb397696.aspx). ...
I'd like to add some further notes in my response. All other non-Microsoft operating systems we have tested do not suffer from this problem. Linux, FreeBSD, and Mac OS X (this final one on different hardware) all degrade much more gracefully in terms of aggregate bandwidth when moving from one thread to two. Linux f...
I'd like to add some further notes in my response. All other non-Microsoft operating systems we have tested do not suffer from this problem. Linux, FreeBSD, and Mac OS X (this final one on different hardware) all degrade much more gracefully in terms of aggregate bandwidth when moving from one thread to two. Linux f...
I'd like to add some further notes in my response. All other non-Microsoft operating systems we have tested do not suffer from this problem. Linux, FreeBSD, and Mac OS X (this final one on different hardware) all degrade much more gracefully in terms of aggregate bandwidth when moving from one thread to two. Linux f...
You can use a 'here document'. That is: sudo gem install ibm_db <<heredoc 1 heredoc What's between the \<\<\SOMETHING and SOMETHING gets inputted as entry to the previous command (somewhat like ruby's own heredocuments). The 1 there alone, of course, is the selection of the "ibm_db 0.10.0 (ruby)" ...
Just a random thought (no clue if this will help): Try setting the parent HBox and the Label's widths to 100%. That's generally fixed any problems I've run into that were similar.
Have a look at http://javahowto.blogspot.com/2006/06/fix-javac-java-lang-outofmemoryerror.html The arguments that you need to pass to JBuilder's javac is "-J-Xms256m -J-Xmx256m". Replace the 256m with whatever is appropriate in your case. Also, remove the quotes. This should work for java 1.4, java 1.5 and for...
<pre> -- Note, only works as long as no duplicate values are allowed in either table DECLARE @validcomparisons TABLE ( pkid INT, otherid INT, num INT ) INSERT INTO @validcomparisons (pkid, otherid, num) SELECT a.pkid, b.otherid, A.cnt FROM (select pkid, count(*) as cnt FROM @a group by pkid) a INNER JOIN...
We've also seen some issues with VS built-in server regarding some third-party controls which put their scripts at the \aspnet_client folder. Since the folder isn't there when you're not running under IIS, the controls didn't work. It seems a lot simpler to always work with IIS and avoid strange problems.
Unless you're doing rocket-science, a decimal is WAAAY overkill. And although it might give you more precise positions, it will not necessarily give you more precise (eg) velocities, since it is a fixed-point datatype and therefore is limited to a much smaller range than a float or double. Use floats, but leave the ...
Interestingly, this is the decompiled C# code, obtained via reflector. public int MyMethod(int param1, [Optional, DefaultParameterValue(0)] int param2, [Optional, DefaultParameterValue(1)] int param3) { return ((param1 + param2) + param3); } ...
The major reason I've found for using workflow foundation is how much it brings you out of the box in terms of tracking and persistence. It's very easy to get the persistence service up and running, which brings reliability and load distribution between multiple instances and hosts. On the other hand, just like form...
How do I "pause" my code in Visual Basic (VB6)?
|vb|processes|
I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait?
I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait? Trivial example: Call ExternalLongRunningProcess Call DoOtherStuff How do I delay 'DoOtherStuff'?
How do I delay code execution in Visual Basic (VB6)?
|vb6|vb|processes|
Check your Firefox preferences >> Tabs >> New windows should be opened in (a new window | a new tab). Do you have different settings for your Firefox on your Windows and on your Mac?
From experience it is easiest to go with where your skillset currently lies. If this is in vb6/vbscript etc I would first look towards vb.net. It also depends on any project timescales and delivery dates. You will be upto speed quicker in vb.net. If you have time on your hands I would seriously consider c#, if only to ...
How can I access the classes loaded by Java Web Start when dynamically compiling code?
|jnlp|java-web-start|dynamic-compilation|
I am dynamically compiling code in my client application. When I start the application with Java Web Start I get an exception. The exception only occurs when it is run through Java Web Start. //The exception evolver.core.model.change.execution.ExecutionException: Compilation failed! DynamicCompar...
|java|jnlp|java-web-start|dynamic-compilation|
A BSP is best for urban environments. A Quadtree is best for when you use a height map for terrain, etc. An Octree is best for when you have clumps of geometry in 3d space, such as a solar system.
Bracketing your one-liner if statements has the considerable sane-making advantage of protecting you from headaches if, at some later point, you (or other coders maintaining or altering your code) need to add statements to some part of that conditional block.
No matter what you do, without additional constraints on the input values, you cannot do better than O(n^2), simply because you have to iterate through all pairs of numbers. The iteration will dominate sorting (which you can do in O(n log n) or faster).
Here is a php4/php5 class that will sort one or more fields: // a sorter class // php4 and php5 compatible class Sorter { var $sort_fields; var $backwards = false; var $numeric = false; function sort() { $args = func_get_args(); $array = $args[0]; ...
One solution is to just store all numbers as rational numbers in the first place. There are libraries for rational number arithmetic (eg [GMP][1]). If using an OO language you may be able to just use a rational number class library to replace your number class. Finance programs, among others, would use such a solu...
I'd like to add some further notes in my response. All other non-Microsoft operating systems we have tested do not suffer from this problem. Linux, FreeBSD, and Mac OS X (this final one on different hardware) all degrade much more gracefully in terms of aggregate bandwidth when moving from one thread to two. Linux f...
I'd like to add some further notes in my response. All other non-Microsoft operating systems we have tested do not suffer from this problem. Linux, FreeBSD, and Mac OS X (this final one on different hardware) all degrade much more gracefully in terms of aggregate bandwidth when moving from one thread to two. Linux f...
You probably have to change it for both the client (you are running to do the import) AND the daemon mysqld that is running and accepting the import. For the client, you can specify it on the command line: mysql --max_allowed_packet=100M -u root -p database < dump.sql Also, change the my.cnf or my.ini file under...
How do i embed an image in a .NET HTML Mail Message
|c#|.net|html|
I have an HTML Mail template, with a place holder for the image. I am getting the image i need to send out of a database and saving it into a photo directory. I need to embed the image in the HTML Message. I have explored using an AlternateView: AlternateView htmlView = AlternateView.CreateAlternateViewFromSt...
For complex objects that will yield specific comparisons then implementing IComparable and defining the comparison in the Compare methods is a good implementation. For example we have "Vehicle" objects where the only difference may be the registration number and we use this to compare to ensure that the expected val...
When do you use Java's @Override annotation and why?
|java|annotations|
What are the best practices for using Java's @Override annotation and why? It seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there certain programming situations that call for using the @Override and others that should never use the @Override?
|java|annotations|
You can use Convert when you have a string that you want to convert to an int int i = Convert.ToInt32("1234"); Convert and casting will both throw an exception if they fail. i.e, this will still throw an exception, it will not return 0: Convert.ToInt32("1234NonNumber"); In many cases Convert and c...
Is it safe to get values from a java.util.HashMap from multiple threads (no modification)?
|java|multithreading|concurrency|hashmap|
There is a case where a map will be constructed, and once it is initialized, it will never be modified again. It will however, be accessed (via get(key) only) from multiple threads. Is it safe to use a `java.util.HashMap` in this way? (Currently, I'm happily using a `java.util.concurrent.ConcurrentHashMap`, and ha...
What do you think of using properties as object initializers in C#;
|c#|
I was wondering what people thought of using properties as object initializers in C#. For some reason it seems to break the fundamentals of what constructors are used for. An example... public class Person { string firstName; string lastName; public string FirstName ...
I was wondering what people thought of using properties as object initializers in C#. For some reason it seems to break the fundamentals of what constructors are used for. An example... public class Person { string firstName; string lastName; public string FirstName ...
|c#|
Browsers don't die out completely for about a decade. The first thing you must realise is that you *will* have some visitors that are using a browser you don't support. The question is not which browsers are not dead, but which browsers are worth supporting (the benefit) relative to the work it takes to do so (the co...
Browsers don't die out completely for about a decade. The first thing you must realise is that you *will* have some visitors that are using a browser you don't support. The question is not which browsers are not dead, but which browsers are worth supporting (the benefit) relative to the work it takes to do so (the co...
You should have a look the xHTML DTD (http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd), there all listed. Here is a quick review all the main ones : <br /> <hr /> <img /> <input />
A quick google search turns up this: [http://bytes.com/forum/thread174440.html][1] Read the message towards the bottom by greg@turnstep.com (you either want oid or ctid depending on what guarantees you want re persistence and uniqueness) [1]: http://bytes.com/forum/thread174440.html
Second vote for ElementTree (cElementTree is a C implementation that is a little faster, like cPickle vs pickle). There's some short example code here that you can look at to give you an idea of how it works: [http://effbot.org/zone/element-index.htm][1] (this is Fredrik Lundh, who wrote the module in the first place...
As far as I can remember of Word 97, you're fresh out of luck. The only document events in '97 were Open and Close. I don't have Word 97 available, but in Word 2000+ you can set a field that reads a document property. You could check that out. In Word 2003 it's under **Insert > Field...** and the one you're looking...
The Bind can't convert the null value to an int value, to set the ExportInfoID property. That's why it's not getting caught in your code. You can make the property a nullable type (int?) or you can handle the null in the bind logic. so it would be something like this bind receives field to get value from ...
Has anyone got an example of aerith style swing mixed with GUI maintainability of SWT editing?
|eclipse|swing|swt|lf|
My boss loves VB (we work in a Java shop) because he thinks it's easy to learn and maintain. We want to replace some of the VB with java equivalents using the Eclipse SWT editor - because we think it is almost as easy to maintain. To sell this - we'd like to use an aerith style L&F. Can anyone provide an example of...
Use the [Microsoft Anti-XSS library][1] which includes a javascript encode. [1]: http://blogs.msdn.com/ace_team/archive/2006/11/20/microsoft-anti-cross-site-scripting-library-v1-5-is-done.aspx
Login failed for user 'username' - System.Data.SqlClient.SqlException with LINQ in external project / class library
|linq-to-sql|
This might seem obvious but I've had this error when trying to use LINQ to SQL with my business logic in a separate class library project. I've created the DBML in a class library, with all my business logic and custom controls in this project. I'd referenced the class library from my web project and attempted t...
Maybe you're closing Visual Studio while some other instance is still alive. The settings of the last instance that is closed is the one that will be applied.
Bidirectional outer join
|sql|mysql|
Suppose we have a table A: itemid mark 1 5 2 3 and table B: itemid mark 1 3 3 5 I want to join A*B on A.itemid=B.itemid both right and left ways. i.e. result: itemid A.mark B.mark 1 5 3 2 3 NULL 3 NULL 5 Is t...
Paul - saw the update. Very interesting. It would be interesting to try it on Vista or Win2008, as people seem to be reporting some considerable I/O improvements on these in some circumstances. My only suggestion about a different API would be to try memory mapping the files - have you tried that? Unfortunatel...
I occasionally get this bug, and others related to layout/fonts/colouring etc. A little trick I've found is use the Tools -> Import and Export Settings, export your current settings once you've got everything setup as you like, then close and reopen Visual Studio and import. Hopefully that'll sort you out. In 2005 t...
Have a look at the new [Canvas][1] element which has been implemented in many browsers. I heard also that there is an ActiveX control for IE that implements the Canvas element too. [1]: http://en.wikipedia.org/wiki/Canvas_(HTML_element)
Have a look at the new [Canvas][1] element which has been implemented in many browsers. I heard also that there is an ActiveX control for IE that implements the Canvas element too. Update: Wait, you already said that. I should read the whole question next time! :) [1]: http://en.wikipedia.org/wiki/Canvas_(HTML_...
Go for SVG - and just tell the users to get the ADOBE SVG plug in for IE. See this excellent site - which is a UK Government Site (public service) [ELGIN][1] [1]: http://www.elgin.gov.uk