In my application I inherit a javastreamingaudio class from the freeTTS package then bypass the write method which sends an array of bytes to the SourceDataLine for audio processing. Instead of writing to the data line, I write this and subsequent byte arrays into a buffer which I then bring into my class and try to process into sound. My application processes sound as arrays of floats so I convert to float and try to process but always get static sound back.
I am sure this is the way to go but am missing something along the way. I know that sound is processed as frames and each frame is a group of bytes so in my application I have to process the bytes into frames somehow. Am I looking at this the right way? Thanx in advance for any help.
Given an integer, write a program that converts the given number to a number (in base 10).
Hint - The given number could be in any base, but the base is unknown.
Hello!
I'm developing a Genetic Algorithm in python were chromosomes are composed of strings and integers. To apply the genetic operations, I want to convert these groups of integers and strings into bit strings.
For example, if one chromosome is:
["Hello", 4, "anotherString"]
I'd like it to become something like:
0100100100101001010011110011
(this is not actual translation). So... How can I do this? Chromosomes will contain the same amount of strings and integers, but this numbers can vary from one algorithm run to another.
To be clear, what I want to obtain is the bit representation of each element in the chromosome concatenated.
If you think this would not be the best way to apply genetic operators (such as mutation and simple crossover) just tell me! I'm open to new ideas.
Thanks a lot!
Manuel
I need to use @font-face feature and my fonts are in OTF/TTF format and Microsoft browsers support only EOT format. I tried to use Microsoft tool WEFT, but it didn't work or I didn't understand how it works. Is there any other way to convert my fonts to EOT format?
I know this is a total newbie question, but the answer may not be obvious to many new programmers. It wasn't initially obvious to me so I scoured the Internet looking for Perl modules to do this simple task.
I will get data in DataTable. I am going to iterate data in foreach. I will have all types of data in Datatable. Now I need to find Double for each item (string) in DataTable. How to find IsDouble for string?
Ex:
I have "21342.2121" string. I need to covert this to Double. But sometimes the data will be "TextString". So I can't use Double.Parse().
How to handle this?
In Java, is there a simple method to convert the format of a given string? For example, I have the string "test22". I'd like the binary value and hex value. As well as possibly the ascii values of each character?
HI,
I want to convert MicrosoftOffice Docs(.doc,.docx,ppt,xlsx,xls) +PDF+Images++Audio/Video into an swf file. The idea behind this project is to open the documents on any machine which have a flash plugin. I want to do this in VC++.
I'm using Silverlight and need to display some OTF fonts. Now Silverlight supports OTF fonts in version 4 but it does not seem to support OTF fonts with PostScript outlines. I have some OTF fonts with postscript outlines that won't show up. Is there a (free) way of converting between OTF with postscript outlines to TrueType fonts or OTF with TrueType outlines. (Incidentally I've tried TransType but am having no joy with it).
I have a string of binary numbers that was originally a regular string and will return to a regular string after some bit manipulation.
I'm trying to do a simple caesarian shift on the binary string, and it needs to be reversable. I've done this with this method..
public static String cShift(String ptxt, int addFactor)
{
String ascii = "";
for (int i = 0; i < ptxt.length(); i+=8)
{
int character = Integer.parseInt(ptxt.substring(i, i+8), 2);
byte sum = (byte) (character + addFactor);
ascii += (char)sum;
}
String returnToBinary = convertToBinary(ascii);
return returnToBinary;
}
This works fine in some cases. However, I think when it rolls over being representable by one byte it's irreversable. On the test string "test!22*F ", with an addFactor of 12, the string becomes irreversible. Why is that and how can I stop it?
Is there a library or a class/function that I can use to convert an integer to it's verbal representation?
Example input: 4,567,788
Example output: Four million, Five hundred sixty-seven thousand, seven hundred eighty-eight
For reference, I am using C# and .NET 3.5.
I want to implement a generic method on a generic class which would allow to cast safely, see example:
public class Foo<T> : IEnumerable<T>
{
...
public IEnumerable<R> SafeCast<R>()
where T : R
{
return this.Select(item => (R)item);
}
}
However, the compiler tells me that Foo<T>.SafeCast<R>() does not define parameter 'T'. I understand this message that I cannot specify a constraint on T in the method since it is not defined in the method. But how can I specify an inverse constraint?
i created a simple voice recording using wav format. my problem is i wanted it to save as PCM format without using comercial components. i have MSACM.pas but i dont know how to use it. My compiler is delphi.
At work today, we threw together this attempt:
xquery version "1.0";
declare option saxon:output "omit-xml-declaration=yes";
declare variable $x := 99;
string-join(
for $b in (128,64,32,16,8,4,2,1)
let $xm := $x mod ($b*2)
return
if ( $xm >= $b ) then "1" else "0"
, "")
Do you have a better way?
I can successfully save the characters < and .
I do this with these options:
entities : """
cleanup : false
verify_html : false
So far no problems.
However, whenever I put anything between that text it gets converted into a tag:
<xxx>
converts to
<xxx></xxx>
How do I stop that?I am trying to enter sample HTML into TinyMCE so I can document some XML. There must be a standard way of doing this I imagine.
I recently read (and unfortunately forgot where), that the best way to write operator= is like this:
foo &operator=(foo other)
{
swap(*this, other);
return *this;
}
instead of this:
foo &operator=(const foo &other)
{
foo copy(other);
swap(*this, copy);
return *this;
}
The idea is that if operator= is called with an rvalue, the first version can optimize away construction of a copy. So when called with a rvalue, the first version is faster and when called with an lvalue the two are equivalent.
I'm curious as to what other people think about this? Would people avoid the first version because of lack of explicitness? Am I correct that the first version can be better and can never be worse?
any PHP or Ruby library to convert Tranditional Chinese to Simplified Chinese or vice versa (Big5 <-- GB)? the iconv library won't do it as it merely convert the encoding -- the glyph stays the same.
I have strings that look about like this:
stringA = @"29.88";
stringB = @"2564";
stringC = @"12";
stringD = @"-2";
what is the best way to convert them so they can all be used in the same mathmatical formula?? that includes add, subtract.multiply,divide etc
Hi,
In one of our databases, there is a table with dozens of columns, one of which is a geometry column.
I want to SELECT rows from the table, with the geometry transformed to another SRID. I want to use something like:
`SELECT *`
in order to avoid:
SELECT col_a, col_b, col_c, col_d, col_e, col_f,
col_g, col_h, transform(the_geom, NEW_SRID), ..., col_z
Any ideas?
Adam
Both queries below translates to the same number
SELECT CONVERT(bigint,CONVERT(datetime,'2009-06-15 15:00:00'))
SELECT CAST(CONVERT(datetime,'2009-06-15 23:01:00') as bigint)
Result
39978
39978
The generated number will be different only if the days are different. There is any way to convert the DateTime to a more precise number, as we do in .NET with the .Ticks property?
I need at least a minute precision.
i want to how to profile my code...
i have gone through the docs , but as there were no example codes given i could not get anything from it.
i have a large code and it is taking so much time hence want to profile and increase its speed.
i havent written my code in method , there are few in between but not completely.
i dont have any main in my code..i want to know how to use profiling..
looking for some example or sample code of about how to profile..
i tried psyco i.e just addded two line at the top of my code
import psyco
psyco.full()
is this write,it did not show any improvement.
and other way of speeding up ,please suggest.
thanks in advance..
I'm still getting the hang of lots of things and thought I should post some code I made with pygame and get some feedback^^.
I posted code here:
http://urlvars.com/code/snippet/39272/my-bouncing-program
http://urlvars.com/code/snippet/39273/my-bouncing-program-classes
There's tome things that I implemented that I'm not using yet I just realized like a timer at the bottom of the main while loop. If my code isn't readable, I'm sorry, I'm self taught and this is the first code I've ever posted anywhere.
By the way I made some variables that take the screensize and half it to find a point to spit out the squares, but when I try to use it, it makes a weird effect :/
Try switching the list i have in the newbyte() function with the halfScreen variable and see it freak out o.O
thank you