Posts

android - Hide Google Voice recognition -

i'm using google voice recognition , hide popup google , mic being shown.. code: intent intent = new intent( recognizerintent.action_recognize_speech); intent.putextra(recognizerintent.extra_language_model, getresources().getstring(r.string.ttslang)); try { startactivityforresult(intent, result_speech); } catch (activitynotfoundexception a) { toast t = toast.maketext(getapplicationcontext(), getresources().getstring(r.string.notts), toast.length_short); t.show(); } as think saw such apps, think possible.. if is, know how? many thanks! for that, need use speechrecognizer . example can found here . it's quite easy implement: speechrecognizer recognizer = speechrecognizer.createspeechrecognizer(this); recognizer.setrecognitionlistener(new recognitionlistener() { ... }); the listener c...

How to install tig docs via Homebrew? -

i installed tig via homebrew , tig works okay, there way cleanly install man pages via brew instead of source (i.e. avoiding make install-doc described @ https://github.com/jonas/tig/blob/master/install.adoc ) "if installed homebrew standard install directories, i.e. relatives /opt/homebrew, there 2 commands register binaries , man files used: /usr/bin/sudo -s echo /opt/homebrew/bin >/etc/paths.d/homebrew echo /opt/homebrew/share/man >/etc/manpaths.d/homebrew exit if using bash or zsh actual shell, have enter 1 simple command take account these 2 environment modifications: . /etc/profile if want learn more how these 2 directories used under macos x, read: man path_helper " - daniel azuelos

c++ - How to properly delete a map of pointers as key? -

i have map of key/value pointers : std::map<a*, b*> mymap; what proper way liberate memory of key only? i thinking doing : for (auto itr = _mymap.begin(); itr != _mymap.end(); itr++) { if (certaincondition == true) { delete itr->first; itr->first = nullptr; } } is correct way of doing it? map keep nullptr key , future iteration include nullptr ? you cannot modify key of container because used define ordering , changing in place invalidate ordering. furthermore, each key needs unique. therefore, need remove item map clean memory. if have key: mymap.erase(key); delete key; if have iterator within map: a* keycopy = itr->first; mymap.erase(itr); delete keycopy; edit per updated question: auto itr = mymap.begin(); while (itr != mymap.end()) { if (certaincondition == true) { a* keycopy = itr->first; itr = mymap.erase(itr); delete keycopy; } else { ++itr; ...

c# - Delete sqlite database file in .net environment -

i'm doing integration tests of software uses sqlite. the software needs use database file prevent data being lost. after each of tests, want delete database file leave @ beginning. the problem when try delete file throws exception says "system.io.ioexception: process cannot access file '*****' because being used process". before trying delete file, i'm closing , disposing of connection this: if(_connection.state == system.data.connectionstate.open) _connection.close(); _connection.dispose(); to delete file using instruction: file.delete(_databasefilepath); doing wrong?, miss something? in advance.

PHP exact match between input and regex pattern -

i'm trying build check reliably evaluates whether input ($f_username) mac address via regex 'cause there different syntax take. upon finding match. should transferred lowercase without deliminators. the function works fine in matching , transforming input, wrongly match longer input... e.g. 11-22-33-44-55-66-77-88 transferred 11-22-33-44-55-66 , $match set true... this should cause function go "else branch" is not exact match of pattern... contains match... have idea how match ? thanks taking time read , in advance answers :) function username_check($f_username) { global $match; if (preg_match_all("/([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})[^0-9a-fa-f]?([0-9a-fa-f]{2})/", $f_username, $output, preg_pattern_order)) { ($i = 1; $i <= 6; $i++) { $new_username .= strtolower($output[$i][0]); } $match = true; $new_username = "...

VBA read Outlook attachment from clipboard -

i'm searching way, using vba, retrieve file path or file data of outlook attachment copied clipboard user. i've implemented (in access) drag/drop option saves entire email (and associated attachments), because of common user workflow need (desire) right-click > copy single attachment has been requested. i've implemented solution thread: vba: read file clipboard , while successful files copied explorer window, not work outlook attachment copied clipboard. i've tested different shell clipboard formats listed here no luck: https://msdn.microsoft.com/en-us/library/windows/desktop/bb776902%28v=vs.85%29.aspx#cfstr_filenamemap any other suggestions/pointers appreciated.

React Native : Is it possible (/how) to pass props to a class of static functions? -

normally when passing props, 1 like: var myclass = require('./myclass.js'); <myclass prop1={prop1} prop2={prop2} /> these available in this.props scope of child component. if have helper class has static functions in it. how pass props class? declaration simply var myhelperclass = require('./myhelperclass.js'); the contents similar to var myhelperclass = react.createclass({ getinitialstate: function(){ return null; }, statics: { functionone: function(string){ var returnobject = {}; // this.props.. return returnobject; }, }, render: function() {} }); for i've created initalise function call in componentdidmount passes of data , function references down helperclass i'm curious. if myhelperclass stores static functions , doesn't render anything, create own store them. here's how package api calls: var api = { getallposts: function(token, daysago) { daysago = daysago || 0;...