Stop Recording when no one speaks |
I dont know the real answer about your question but I guess you could do
it with memorystream(as we can say that before saving it is in the memory )
and you can reach and check if there is no changing or there is less
changing(other voices or breathing that is less desibell than human voice
) in bytes by stream methods .Then end close recording.MemoryStream
Has Some really usefull methods ı think that will help you can give it a
try
|
Rails: Search for person with language skills - e,g, speaks "German AND English" on one-to-many table |
I'm not sure of a general reference to refer you to, but this is basic SQL
stuff. Basically, the JOIN is performed first resulting in a number of
rows and then the WHERE is applied, filtering the rows. The conceptual
mistake here is thinking that the WHERE clause will somehow apply to the
full set of matched languages, but it doesn't work that way, each row of
the result is considered in isolation, therefore a clause like
(languages.name = 11) AND (languages.name = 10) will never return anything,
because languages.name only has a single value in each row. The query as
constructed could only work for an OR clause, so you could say something
like WHERE (languages.name = 11) OR (languages.name = 12).
In order to filter down the participants you need one join for each
language, so you want
|
Loading data from database with php and pure ajax in a textbox |
Your subject_id is not displaying because you have not printed your book_id
after fetching results from database in getbook.php
After this $result=mysql_query($sql);
Write echo $result['your_book_id_field_name'];
|
cannot connect to Postgres (pg) database from my Ruby Script using gem "pg"(This is not rails, just pure ruby) |
are you sure postgres is listening on a socket? are you sure the username
and password is right?
I would be inclined to try something like
require 'pg'
puts PG::Connection.ping(:dbname => 'oData',:user => 'am',:password
=> '')
puts "trying with tcp"
puts PG::Connection.ping(:dbname => 'oData',:user => 'am',:password
=> '', :port => 5432)
|
Ruby/Rails - Using Rails database functions in pure Ruby |
Is it possible to handle databases in Ruby as you would in a Rails
website?
Yes, activerecord is a gem and can be used outside of Rails.
See this question/answer: http://stackoverflow.com/a/1643938/382982
You could also use DataMapper, Sequel, etc.
|
c++ abstract classes using pure virtual functions in non pure virtual functions |
Why don't you simply add it to the constructor of the every child class?
If you want to avoid writing it every time in the constructor (or even
skipping or inheriting it) then you could use CRTP:
class Parent {
public:
Parent(){};
virtual void helloWorld() = 0; // no standard hello...
};
template <typename Par>
class ParentCRTP: public Parent {
public:
ParentCRTP(){
Par::doHelloWorld();
};
virtual void helloWorld(){
Par::doHelloWorld();
}
};
class Child : public ParentCRTP<Child> {
public:
static void doHelloWorld(){ // childs implementation of helloWorld
std::cout << "Hello, World!
";
};
};
This approach will not give you a pointer to the child class in your
child's hello method - a
|
Is pure p2p possible on iOS? |
"The Multipeer Connectivity framework (MultipeerConnectivity.framework)
supports the discovery of nearby devices and the direct communication with
those devices without requiring Internet connectivity."
Go to whats new in iOS7 and you will see this and you can read the docs on
it here:
https://developer.apple.com/library/prerelease/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/_index.html#//apple_ref/doc/uid/TP40013328
|
how to output pure text from PHP? |
Try using strip_tags() in PHP to filter the returned string. It will
remove the HTML tags, but leave the text untouched.
http://php.net/manual/en/function.strip-tags.php
|
Do we need to include normalize after using Pure css? |
It is not needed seperately as Pure builds on Normalize.css and provides
layout and styling for native HTML elements, plus the most common UI
components. It's what you need, without the cruft.
You can find the normalize.css file in this folder.
pure-mastersrcasecss
|
How to reveal content behind a div with pure css? |
you can use css pseudo selector like '+' in css
like
.classtext:hover + .eraser {left:50px;}
note '+' is like before, so eraser class should be first placed first
before .classtext will be second
|
Pure css table styling |
Better you div for this style.
If you want table, make design like this.
By default the inner tables ( having different heights ) will look similar
to one you want.
<table>
<tr>
<td>
<table height="x" style="background:">
<tr><td>Row 1</td> </tr>
<tr><td>Row 1</td> </tr>
<tr><td>Row 1</td> </tr>
<tr><td>Row 1</td> </tr>
</table>
</td>
<td>
<table height="y" style="background:">
<tr><td>Row 1</td> </tr>
<tr><td>Row 1</td> </tr>
|
Pure CSS grids do not float next to each other |
From the pure.css website:
The only constraints for Pure Grids are that all "units" are children of
a "grid". In other words, if you have an element with a pure-u-* class
name, it needs to be within a parent element with a pure-g or pure-g-r
class name.
So I believe that you shouldn't nest your columns under an additional
column. If you remove the parent column, they float correctly:
<div class="pure-g">
<div class="pure-u-1-2">
Lorem ipsum dolor it amet, consectetuer adipiscing elit,
sed diam nonummy nibh euismod
tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut
wisi enim ad minim veniam,
quis nostrud exerci tation ullamcorper suscipit lobortis
nisl ut aliquip ex ea commodo
consequat.
|
Pure CSS image swap |
Here is the Pure CSS Solution.
WORKING DEMO
The HTML:
<div class="images"> </div>
The CSS:
.images{background:
url(http://icons.iconarchive.com/icons/icojoy/maneki-neko/256/cat-2-icon.png)
no-repeat 0 0; height:300px; width:300px;}
.images:hover{background:
url(https://si0.twimg.com/profile_images/2940708431/842924fb3e2cc1f7fddf1b195c3f6c81.jpeg)
no-repeat 0 0; height:300px; width:300px; cursor:pointer;}
I hope this is what you are looking for.
|
Pure java adb client |
I created a small java project called jadb available here that implements
pars of what adb does, including sending files.
|
server side js on pure CSS |
<li> is not an XPages control and you can therefore not use
this.rendered.
Instead you can use the computed text control and set it to render as
<li>. Here's an example:
<xp:text escape="false" id="computedField1" tagName="li">
<this.rendered><![CDATA[#{javascript:x=sessionScope.get("level");x!="MR"}]]><
/this.rendered>
<xp:this.value><![CDATA[#{javascript:'<a
href="#">Report</a>'}]]></xp:this.value>
</xp:text>
The answers to this question contain other examples of similar approaches.
|
CSS: pure CSS scroll animation |
You can do it with anchor tags using css3 :target pseudo-selector, this
selector is going to be triggered when the element with the same id as the
hash of the current URL get an match. Example
Knowing this, we can combine this technique with the use of proximity
selectors like "+" and "~" to select any other element through the target
element who id get match with the hash of the current url. An example of
this would be something like what you are asking.
|
getComputedStyle in pure Javascript? |
var elem = document.getElementById("your-div");
if (elem.currentStyle) {
var margin = elem.currentStyle.margin;
} else if (window.getComputedStyle) {
var margin = window.getComputedStyle(elem,
null).getPropertyValue("margin");
}
alert(margin);
you can use this shim,works for all browsers:refer this
use currentStyle for Internet Explorer.
use getComputedStyle for other browsers
|
Using travis-ci.org with a pure as3 project |
We do not have built in support for ActionScript, but if it's possible to
run on Ubuntu, then it should be possible to test on Travis.
You can install any dependencies as part of the build process with apt-get:
before_install:
- sudo apt-get -qq update
- sudo apt-get -qq install some-package another-package
Looking at the FlexUnit docs, it looks like you need a frame buffer
available. You may have some luck using xvfb. We have some docs on that,
although aimed towards browsers, it may work for you too.
|
How to create two borders - Pure CSS |
If you simply want two borders without using CSS's outline property, why
don't you simply create a border bottom for div#headerWrapper and one for
div#headerContent making that of headerWrapper darker:
div#headerWrapper
{
border-bottom: solid 1px #3D9ED5;
}
div#headerContent
{
border-bottom: solid 1px #81CEFA;
background-color: #54BEFB;
}
If you want the exact appearance of your picture, you can do so by adding
the following code (assuming that the part below the border should be
empty):
header
{
height: 50px;
background-color: #FBFBFB;
}
If text should be inserted into the lower half of the picture, add it after
the outer div (in header) and remove the height from the CSS.
|
Multi threading in pure C++? |
Qt uses different threading libraries for the different operating systems.
For example, on Unix, you can use pthreads, and on Windows you can use
WinAPI support (like CreateThread function).
For example, Qt uses this code to create a thread on Unix systems:
int code =
pthread_create(&d->thread_id, &attr, QThreadPrivate::start,
this);
and this to create it on Windows system:
d->handle = (Qt::HANDLE) _beginthreadex(NULL, d->stackSize,
QThreadPrivate::start,
this, CREATE_SUSPENDED,
&(d->id));
All this is wrapped using preprocessor, so the right library is used for
the right system. Take a look at this code inside qthread_p.h and
everything should be clear to yo:
#ifdef Q_OS_UNIX
pthread_t thread_id;
QWaitCo
|
Is it possible to substitute pure html and js for JSP? |
Yes, that is what all the kids are doing. You use REST.
You can see an example of just that in this Quickstart.
|
Passing a 2-D array in pure C |
You should be careful, as an array of array is not the same as a double
pointer. While it's true that arrays decays to pointers, using a pointer to
a pointer as an array of arrays means you're actually using it as an array
of pointers.
Instead have the argument as a pointer to arrays, like
int (*v)[7]
|
Is there a way to determine the pure functions? |
You can't. However, you can make global variables readonly with declare -r,
eg:
declare -r cheese='nice'
If you then try to modify $cheese:
cheese='bad'
You will get an error:
bash: cheese: readonly variable
You can use this to prevent functions from changing variables, forcing them
to make a local copy if they need to use a variable.
|
Can you write between/3 in pure prolog? |
bet(N, M, K) :- N =< M, K = N.
bet(N, M, K) :- N < M, N1 is N+1, bet(N1, M, K).
In action:
$ swipl
?- [bet].
% bet compiled 0.00 sec, 1,064 bytes
true.
?- bet(1,5, K).
K = 1 n
K = 2 n
K = 3 n
K = 4 n
K = 5 n
false.
If you use a cut, you can prevent the final search failure, and recover the
exact builtin between/3 behavior:
bet(N, M, K) :- N < M, K = N.
bet(N, M, K) :- N == M, !, K = N.
bet(N, M, K) :- N < M, N1 is N+1, bet(N1, M, K).
In action:
?- [bet].
% bet compiled 0.00 sec, 416 bytes
true.
?- between(1,5,K).
K = 1 n
K = 2 n
K = 3 n
K = 4 n
K = 5.
?- [bet].
% bet compiled 0.00 sec, 240 bytes
true.
?- bet(1,5,K).
K = 1 n
K = 2 n
K = 3 n
K = 4 n
K = 5.
|
Is it possible with pure CSS, preferably compatible to version 2 |
There is the possibility to insert all you items into a table to get them
to the right position, just as you like. But this is a oldschool
programming style that is not rly anymore in use. (You have to take care of
min and max width's here because of different screen resolutions!)
Another option (and the best here) is to get your Big item into a div box
and also A+1 and B+2 into divs too.
Float them side by side with a clear after the A+1 float and it will work I
think.
(And dont forget the div arround all items ;) )
Second solution should be your choice, because you can easily get div
solutions up on smartphones too and you will save tons of code you dont
have to type down.
Hope it works, if you have issues with the div code to handle write me.
@Johan Bouveng!!! Yeah, you are right b
|
Pure interface of a class with subclasses |
Your example is doing things backwards: the interface should be defined
independently of any concrete classes with all pure virtual methods:
class IDerived
{
public:
virtual void foo() = 0;
virtual ~IDerived() {} // don't forget to include a virtual
destructor
}
And the concrete classes will derive publicly from the interface:
class Derived : public Base, public IDerived
{
public:
void foo();
}
If you want IDerived to also declare methods that Derived inherits from
Base, you can have Derived explicitly implement the method by calling the
inherited implementation:
class Derived : public Base, public IDerived
{
public:
void foo();
void bar() { Base::bar(); }
}
|
Why isn't my 2-column Pure CSS layout working? |
The two columns are divs so they need to be floating.
Try adding float: left; like so:
.pure-g-r [class *= "pure-u"] {
font-family: sans-serif;
float: left;
}
This is what I get when I add the float:
|
How to write $('input').after(" ") in YUI or pure javascript? |
Try following (http://jsfiddle.net/RCUcU/)
var nodes = document.querySelectorAll("input");
var text = "some text";
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
var textNode = document.createTextNode(text);
node.parentNode.insertBefore(textNode, node)
}
You will create text node (it isn't html element)
https://developer.mozilla.org/en-US/docs/Web/API/document.createTextNode
|
Create e-shop grid with pure css |
I would use something like responsivegridsystem You would put all div items
relating to each product within each grid box.
EDITED
Using the weblink content as an example, you would set a given height to
the description panel. That way all the prices would line up eg:
div.product-desc {
height: 90px;
}
|
Tooltip with pure css - Overflow problems |
Do you have to have a height for your #test container div? If you take
that out and set overflow:visible it works perfectly:
http://jsfiddle.net/shaunp/6JeRU/4/
#test{
width: 80px;
/* no height */
border: 1px solid black;
margin: 0 auto;
margin-top: 150px;
overflow: visible;
}
|
Targeting first visible element with pure CSS |
In pure CSS, no it's not possible. Chris Coyier has :first listed as purely
a jQuery construct: http://css-tricks.com/pseudo-class-selectors/.
|
Pure javascript div resize event |
These is no such event for <div> elements. You could however use an
interval function to watch the state of it's style.width and style.height.
If that changes fire a callback.
|
Make post archives with pure PHP and yii? |
Gj to whoever voted down my question, you were realy helpful. I guess
haters exist even on these kinds of websites, which is sad. Anyways ,enough
about them, here is something I came up with today by learning new MySQL
function, which I didn't know existed before :)
You can just use MySQL DATE_FORMAT(date_column,'%format') to select the
desired month, year, day, or any other "part" of the date, even though if
the date is in unix timestamp. This is a simple code I came up with after a
bit of fiddling around.
$query = "SELECT DISTINCT DATE_FORMAT(creation_date,'%M') as
creation_month, DATE_FORMAT(creation_date,'%Y') as creation_year FROM
posts";
$result = $connection->query($query);
if($result) {
while($row = $result->fetch_assoc()) {
$archiveArray[] = $row;
}
pr
|
What is better approach to testing pure functions? |
No, of course you are not supposed to duplicate the definition in this way.
What would be the point? You may as well simplify the test to prop_trivial
q k = calculate q k == calculate q k. The only case when I'd consider it is
when you plan to change the way function is calculated in the future and
want to check that it still returns the same result.
But if your unit tests are created by just putting values into the function
definition and seeing what comes out, they are also not particularly useful
either, for the same reason.
|
how do i create a triangular background with pure css |
you have used h1 in your html and h2 in your css!
this may help
h1 {
margin: -130px 0 0 200px;
}
i {
display: inline-block;
width: 0px;
height: 0px;
border-style: solid;
border-width: 200px 0 0 200px;
border-color: transparent transparent transparent red;
}
fiddle
|
How do I convert GBK to UTF8 with pure Javascript? |
http://www.1kjs.com/lib/widget/gbk/
There is a javascript to convert between gbk and unicode: which maps all
the 21886 gbk Chinese chars to unicode
You can simply download the javascript file , include it and using :
unicode to gbk:
$URL.encode(unicode_string)
or gbk to unicode:
$URL.decode(gbk_string)
I tested it. It's working well on my web :
zhuhaiyang.sinaapp.com/base64/index.html
which do base64 ency using pure javascript.
|
Is there any example like jquery-chosen in pure javascript? |
javascript code :
function select()
{
var selectedvalue=list.options[list.selectedIndex].text;
alert(selectedvalue);
}
Html :
<select id="list" onchange="select()">
<option></option>
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
</select>
This is a pure javascript code for dropdown list,you can show the selected
value in input text field using DOM.
|
Why there is no pure java djvu encoders? |
The djvu file format is open, but a full reference encoder is not part of
the standard:
DjVu is an open standard. The file format specification, as well as an
open source implementations of the decoder (and part of the encoder) are
available.
This is due to patents:
Several patents apply to two very specific aspects of DjVu and DjVuLibre.
The patents cover a particular aspect of the ZP-coder (the arithmetic coder
used in DjVu and implemented in libdjvu/ZPCodec.cpp) and the background
masking technique used in the IW44 wavelet encoder (implemented in
libdjvu/IW44EncodeCodec.cpp).
There is an outdated GhostScript to djvu converter, which may serve as a
encoder reference.
References
What is djvu
djvu Licensing
Java DJVU to PDF eBook converter
JavaDjvu
|
Pure JavaScript CSS3-like animation |
Why not just do this:
var start = document.getElementById("start");
start.style.left = + 10 + 'px';
CSS:
#start{
-webkit-transition: all .5s ease-in-out;
-moz-transition: all .5s ease-in-out;
-o-transition: all .5s ease-in-out;
transition: all .5s ease-in-out;
}
This would move your element 10px to the right in .5 of a second.
Edit regarding your edit:
To do that you could do this:
function move_left(current_pos){
var element = document.getElementById("start");
var start_left = element.style.left;
var end_pos = parseInt(start_left, 10) + 5;
if(current_pos != end_pos){
element.style.left = element.style.left + 1 + 'px';
current_pos = parseInt(element.style.left, 10);
return move_left(current_pos);
}else{
|
Canvas pure draw vs png image |
drawImage is actually faster.
I've updated the test case with a 50x50 PNG:
http://jsperf.com/canvas-draw-methods
In Firefox it's only slightly faster, but in Chrome the difference is huge,
with drawImage being faster by an order of magnitude.
(Note the previous version of the test was wildly skewed since the PNG I
was using was not the right size. Image size makes a big difference.)
|