Posts

Showing posts from August, 2013

controlling a bluetooth hardware remotely by php(control panel website) -

i having bluetooth low energy device broadcasts signal every 30ms. , have website control panel show devices statistics , send commands device. i want control intervals between signals bluetooth broadcasts. make interval more or less. in website want have page this, user can change intervals easily(or changing signal strength) i know beacon companies have such control panels. not know concept how can sends commands remotely device php. if has idea can me speed procedure please let me know.

python - Sympy reconfigures the randomness seed -

the use of python symbolic computation module "sympy" in simulation difficult, need have reliable fixed inputs, use seed() in random module. every time call simple sympy function, seems overwrites seed new value, getting new output every time. have searched little bit , found this . neither of them has solution. consider code: from sympy import * import random random.seed(1) _ in range(2): x = symbols('x') equ = (x** random.randint(1,5)) ** rational(random.randint(1,5)/2) print(equ) this outputs (x**2)**(5/2) x**4 on first run, , (x**2)**(5/2) (x**5)**(3/2) on second run, , every-time run script returns new output. need way fix enforce use of seed(). does help? docs on random : "you can instantiate own instances of random generators don’t share state" usage: import random # create new pseudo random number generator prng = random.random() prng.seed(1) this number generator unaffected sympy

sql - How are you supposed to choose K when creating a VARCHAR(K) column? Or are you? -

this i've never understood. let's want column storing email address. think, "ok, email addresses no more 15 characters, i'll 50 max characters play safe." and making column varchar(50) . of course, means have create code, possibly both client- , server-side validation of entries column. that brings question of why not use nvarchar time except in rare circumstances logic of application dicates fixed or maximum length. understand, if create varchar(50) , none of entries more 25 characters, not mean 50% of space wasted, database knows how optimize everything. again, brings question of why not use nvarchar . nvarchar has nothing "unlimited length of string" since unicode version of varchar . @ present time there no reasons use varchar (except backward compatibility issues) , nvarchar should preferred. so i'm supposing you're asking why don't use nvarchar(max) everywhere unlimited (2 gbyte of storage) instead of...

java - JxBrowser view is gone when stage is hidden -

i have used jxbrowser in javafx app : public class main extends application { private stage primarystage; private browser browser; private boolean firstminimize; private trayicon trayicon; public static void main(string[] args) { launch(args); } @override public void start(stage primarystage) { this.primarystage = primarystage; firstminimize = true; platform.setimplicitexit(false); createtrayicon(); browser = new browser(); browserview browserview = new browserview(browser); stackpane pane = new stackpane(); pane.getchildren().add(browserview); scene scene = new scene(pane, 380, 500); primarystage.initstyle(stagestyle.undecorated); primarystage.setscene(scene); primarystage.show(); browser.addrenderlistener(new renderadapter() { @override public void onrendergone(renderevent event) { system.out.println("here called..."); browser browser = event.getbrows...

Oozie shell action: exec and file tags -

i'm newbie in oozie , i've read oozie shell action examples got me confused things. there examples i've seen there no <file> tag. some example, in cloudera here , repeats shell script in file tag: <shell xmlns="uri:oozie:shell-action:0.2"> <exec>check-hour.sh</exec> <argument>${earthquakeminthreshold}</argument> <file>check-hour.sh</file> </shell> while in oozie's website , writes shell script (the reference ${exec} job.properties, points script.sh file) twice, separated #. <shell xmlns="uri:oozie:shell-action:0.1"> ... <exec>${exec}</exec> <argument>a</argument> <argument>b</argument> <file>${exec}#${exec}</file> </shell> there examples i've seen path (hdfs or local?) prepended before script.sh#script.sh within <file> tag. <shell xmlns="uri:oozie:shell-action:0.1...

whitespace - JavaScript ignores extra spaces? -

Image
in javascript quiz @ wscube tech there question whether javascript ignores spaces. correct answer “false”. isn’t javascript white-space independent? have read in many blogs is. why answer wrong? i seriously wouldn’t trust site… that’s short, sufficient answer give, i’d 2 other things: firstly, javascript doesn’t ignore spaces within strings: var str = "hello world"; this string has 16 spaces , won’t ignored that. however, in-between operators, keywords , tokens, javascript ignore spaces: var test = [ 0 , 1 , 3 ] . slice ( 2 ) ; this line parsed as var test=[0,1,3].slice(2); still, space between var , test isn’t ignored. not spaces equal. quiz question cannot answered in current form — well, or 2 forms… secondly, quiz has lot of inconsistencies, false information, outdated information , promotes bad practice. i’ve sent them huge list of things wrong quiz… it’s safer stick more “trusted” sit...

javascript - How to render binary data on canvas using WebGl? -

i using pnacl ffmpeg open, read , decode rtsp stream. having raw video frames need transfer webgl render on canvas. how can render binary data on canvas? i running following code: presume should grey canvas after running code, because passing rgba values of (120,120,120,1) synthetic data. var canvas = document.getelementbyid('canvas'); var gl = initwebgl(canvas); //function initializes webgl initviewport(gl, canvas); //initializes view port console.log('viewport initialized'); var data = []; (var = 0 ; < 256; i++){ data.push(120,120,120,1.0); } console.log(data); var pixels = new uint8array(data); // 16x16 rgba image var texture = gl.createtexture(); gl.bindtexture(gl.texture_2d, texture); gl.teximage2d( gl.texture_2d, // target 0, // mip level gl.rgba, // internal format 16, 16, // width , height 0, // border gl.rgba, //format gl.unsigned_byte, // type pixels // texture data ); console.log('pi...

c# - Listbox Separator -

what's best way divide listbox items groups? i've tried using environment.newline there's no way of removing without selecting it. i need have listbox items divided customers order. chef needs prepare these items, select on item when it's done until whole group of order finished. there's "finish" button remove selected group whitespace remain. is there better way this? the windows forms listbox control doesn't have such functionality. your first option use control, may find on web (i don't have control know in mind). another option custom draw listbox items. when hit specific identifier on start of item, can draw separator. need knowledge gdi+ though. read how to: create owner-drawn list box .

java - Run two while loops one after another taking user input -

in method want user input if passes first while need go second while loop, in second while if condition fails need re-run loop instead of re-running itself, first while being executed. //method read, validate , store postcode , purchase amount n customers public void addrecord(int customercounter) throws ioexception { int postcode; double purchaseamount; int conform =0; do{ bufferedreader breader= new bufferedreader(new inputstreamreader(system.in)); system.out.print("postcode: "); postcode= integer.parseint(breader.readline()); if(4121 >postcode) { system.out.print("postcode must greater 4121"); system.out.print("try again: "); } else if(postcode > 4123) { system.out.print("postcode must less 4123"); system.out.print("try again: "); ...

c# - Set column width of Gridview inside rowdatabound event. -

i have following piece of code. did not define boundfields in gridview. retrieving data using sql queries in aspx.cs file instead. possible adjust width of each column 0, 1, 2? there ways can into? have tried lot of ways still not working. please help! <asp:gridview id="surgicalgridview" runat="server" captionalign="top" horizontalalign="justify" datakeynames="id" onselectedindexchanged="surgicalgridview_selectedindexchanged" tooltip="excel file download tool" cellpadding="4" forecolor="#333333" gridlines="none" width="854px"> <rowstyle backcolor="#e3eaeb" /> <columns> <asp:commandfield showselectbutton="true" selecttext="download" controlstyle-forecolor="blue"> <controlstyle forecolor="blue"></controlstyle> </asp:comman...

c++ - Passing containers by value or by reference -

Image
i aware of differences between pass value, reference or pointer in general case. however, question special case container simple structure. assuming case: class image{ image()=default; image(image const&)=default; ~image()=default; int w; int h; uchar* data; } when passing object of class copied 2 integers , pointer not whole data. in case there purpose passing reference ? or there purpose not passing reference? the thing triggered question have read iterators in c++ designed light , passed value. so, think concept may applied classes represent container actual data no data. imho, best guidelines on how pass arguments can found in herb sutters excellent talk back basics! essentials of modern c++ style . in particular case, passing value best option, struct cheap copy. .

RegEx: words with two letters repeated twice (eg. ABpoiuyAB, xnvXYlsdjsdXYmsd) -

i had 2 regex tasks today -- , did 1 , failed other. first task find -- in long, long text -- words beginning "f" , ending vowel: (\bf)\w*([euioay]\b) and worked perfectly. the second 1 way difficult philology student ;-) have find words repeated @ least twice two-letter sequences, example: tatarak tatarak, "ta" twice; brzozowski brzozowski, "zo" twice; loremipsrecdks loremipsrecdks, "re" twice; can have please? in advance ;-) let's see: (\w{2}) matches 2 letters (or digits/underscore, let's ignore that) , captures them in group number 1. \1 matches whatever matched group. so \b\w*(\w{2})\w*\1 is you're looking (you don't need {2,} because if 3 letters repeated, 2 letters repeated. not checking more 2 makes regex more efficient. can stop matching after \1 backreference has succeeded).

c++ - Function will return a string which holds the section between the two indexes -

i have problem how can return string between ranges(given user) of char array. example: entered string “my name john". start index: 3 stop index: 6 function return “name” my code here address output #include <iostream> #include <conio.h> #include <string> #include <cstring> using namespace std; string *section(char*ary, int index_1, int index_2) { string sec=ary; string *str; str = &sec; *str = sec.substr(index_1, index_2); return str; } int main() { int starting_index = 0; int ending_index = 0; char *ptr; ptr = new char[200]; int = 0; char ch = _getche(); while (ch != 13) { ptr[i] = ch; i++; ch = _getche(); } (int j = 0; j < i; j++) { cout << ptr[j]; } cout << endl; cout << "enter start index: " << endl; cin >> starting_index; cout << "enter end index: " <...

javascript - JQ event handler on a click -

i have dynamically generated content contains links on ajax call success. links generated this. $('#mysomething').append('<a href = "' + url + '" target = "_blank" class = "myclickclass">' + name + '</a>'); i tried $('a.myclickclass').click(), $('.myclickclass').click(), $('.myclickclass').on('click', 'a', function({})), and $(document).on('click', '.myclickclass a', function (e) {} ); but nothing seems happen. new tab opened, event ignored. use $(".myclickclass")[0].click() you can directly attach event new anchor. $('body').append($('<a href = "http://www.google.de" class = "myclickclass">test</a>') .click(function() { alert("hey there"); })); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery....

lua - NodeMCU fails to connect to Bluemix with TLS -

i try connect nodemcu ibm bluemix iot foundation. unsecured mqtt connect works splendid , pushes data bmp180 cloud. however, when start using tls won't connect broker. tried make tls connection mqtt.fx , works fine, seems nodemcu problem. if run code: orgid="****" broker = orgid..".<bluemix>" brport = 8883 clientid = "d:"..orgid..":generic_esp:generic_esp_01" print("clientid: "..clientid) brpwd = "***********" bruser = "use-token-auth" local function publish() dofile('sensor.lc') m:publish('iot-2/evt/esp8266/fmt/json',payload,1,0, function(conn) print('payload published') end) end m = mqtt.client(clientid, 120, bruser, brpwd) c = false print('mqtt init') m:on('offline', function(con) print('mqtt offline'); c = false end) m:connect(broker, brport, 1, function(conn) print('mqtt connected: '..broker..':'..brport)...

oracle11g - ORA-01843: not a valid month: Oracle error -

i've written below oracle query getting ora-01843: not valid month: oracle error select distinct info1,info2,timestamp db_1 info1 = '3.14' , trunc(timestamp) = to_date('8/19/2015 5:58:51.420000 am','mm/dd/yyyy') i need display date in timestamp column getting error. pls help. you need remove timestamp part in clause , use trunc in select, this: select distinct info1, info2, trunc(timestamp) timestamp db_1 info1 = '3.14' , trunc(timestamp) = to_date('8/19/2015','mm/dd/yyyy'); or this: select distinct info1, info2, trunc(timestamp) timestamp db_1 info1 = '3.14' , timestamp = to_timestamp('8/19/2015 5:58:51.420000 am','mm/dd/yyyy hh:mi:ss.ff am');

Accessing Soap service using java adapter in mobilefirst -

i have written soap wsdl application using mobilefirst by: 1) using discover backend services option 2) writing own javascript adapter code follow documentation provided ibm. now final r&d consume soap service using java adapter. i have gone through many stackoverflow topics , samples haven't been able find related. can explain steps invoke soap-based webservice request using java adapter? the following video blog post details following java adapers: https://www.youtube.com/watch?v=ckm5480-6wi creating java adapter understanding java adapter structure implementing simple sayhello procedure http method implementing several procedures different http methods working various types of request parameters using java code access mobilefirst server functionality , java servlet functionality debugging java adapters communicating simple backend using using apache http client leveraging wsdl files , communicating soap based webservice using wlresourcereque...

c - "Error: unknown type name ..." while working on a 1st-class ADT fused with a 2nd-class ADT. -

good morning everybody. i'm new here on so, , i'm asking question because have readjust algorithms , programming's exam of yesterday. while typing exam on codeblocks, got error couldn't fix. basically, exam asked load on memory infos file (format: char *namecity, int population, int distance) in data structure, , asked calculate mutual distances each city , collect them in data structure. decided make 2 adts: first defined in library "vett.h": #ifndef vett_h_included #define vett_h_included #include "list.h" typedef struct vett { char nome[21]; int abitanti, dist; lista_t list; } item; item *vectinit(int n, item *v); item *vectinsert(item *v, char *nome, int people, int dist, int i); #endif // vett_h_included i made "almost-adt" or "2nd class adt" (r.sedgewick) based on teacher lessons. doing so, main create array struct, , have direct access fields of struct; each "cell" contains: name of city, p...

php - How to include JS/CSS files into templates of Slim Framework? -

i developing simple web app slim framework. got stuck simple problem. want include static files (css , javascript) template. my project folder structure follows: index.php //<=== routing happens. /flot layout.css jquery.js .... /templates first_template.php my header of first_template.php contains: <link href="../flot/layout.css" rel="stylesheet" type="text/css"> <script language="javascript" type="text/javascript" src="../flot/jquery.js"></script> when call projects root url http://localhost/xampp/projectx/ (i'm using xampp) template shows up, css , javascript stuff not working. google chrome console shows: get http://localhost/xampp/projectx/flot/layout.css 404 (not found) http://localhost/xampp/projectx/flot/jquery.js 404 (not found) any suggestions? spent almonst 1 hour in googling, overall documentation of slim framework still literally slim :) ...

c# - Compare files in Visual Studio easier -

does know of extension/add-in visual studio 2015 lets me mark 2 (different) files in solution explorer, right-click, , display same compare window used source control? i can use compare on 1 file , dialog window can replace tfs path path second file, time-consuming operation tend compare quite (i have external tool updates 2 or more data files in project). i can recommend codecompare . free version has ton of features , has amazing visual studio , eclipse integration. option comparing mind bogeling. trully amazing tool looks nice. it standalone tool, integrates seamless vs

c# - FolderBrowserDialog on company network to select subfolder -

Image
in wpf app user needs select folder, path in company network. use system.windows.forms.folderbrowserdialog , following code gets executed on button click event: folderbrowserdialog fbd = new folderbrowserdialog(); fbd.selectedpath = "\\\\company.net\\data\\_confidential"; dialogresult result = fbd.showdialog(); when folderbrowserdialog opens, system automatically scans other network devices , causes following problem: the network tree gets filled other devices , causes selectedpath scroll away. pretty annoying when user starts searching special subfolder, because has scroll down or selection clicks can hit newly added device (lost focus). how can avoid problem? thoughts: can extend/overwrite system.environment.specialfolder enum , set fbd.rootfolder = system.environment.specialfolder.mysepcialnetworkpath; should access network folder dialog/control? should remove "browse..." button in view , instead scan whole \...

contour - An Error in R: When I try to apply outer function: -

here code: step1: define inverse function use later inverse = function (f, lower = -100, upper = 100) { function (y) uniroot((function (x) f(x) - y), lower = lower, upper = upper)[1] } step2: here functions , inverse: f1<-function(x,m1,l,s1,s2){l*pnorm((x-m1)/s1)+(1-l)*pnorm((x+m1)/s2)} f1_inverse = inverse(function(x) f1(x,1,0.1,2,1) , -100, 100) f2<-function(x,m2,l,s1,s2){l*pnorm((x-m2)/s1)+(1-l)*pnorm((x+m2)/s2)} f2_inverse = inverse(function(x) f1(x,1,0.1,2,1) , -100, 100) step3: here final function combines above functions (i sure function correct): copwnorm<-function(x,y,l,mu1,mu2,sd1,sd2) { (l*dnorm(((f1_inverse(pnorm(x))$root-mu1)/sd1))* dnorm(((f2_inverse(pnorm(y))$root-mu2)/sd1))) } step4: want create contour plot function in step enter code here 3: x<-seq(-2,2,0.1) y<-seq(-2,2,0.1) z<-outer(x,y,copwnorm) contour(x,y,z,xlab="x",ylab="y",nlevels=15) here problem comes in, when tried apply function outer(x,y...

ssl - Android trust a self-signed certificate during testing -

during development period, server uses self-signed ca certificate. production server use real certificate. with ios, able drag certificate inside emulator , trusted on. for android, solutions found involve code. don't want insert code in application testing. there similar solution ios offers? is there similar solution ios offers? no. i don't want insert code in application testing. you welcome use techniques dependency injection, make easier have alternative configurations in different build types. during development period, server uses self-signed ca certificate. please note regular ssl certificates rather inexpensive.

sql server - Insert into table does not work with select left join -

i trying insert new records openrowset query existing table not exist in table. here's code: insert src_table rep.id ,rep.column1 openrowset (blabla) rep left join src_table tab on rep.id = tab.id tab.id null i error: incorrect syntax near 'rep'. however when run query follows: select rep.id ,rep.column1 openrowset (blabla) rep left join src_table tab on rep.id = tab.id tab.id null works expected giving me rows don't exist in src_table. doing wrong? you had it: insert table (id, column) select rep.id ,rep.column1 openrowset (blabla) rep left join src_table tab on rep.id = tab.id tab.id null

Visual Studio 2015 code format issue -

Image
in vs 2015 options under text editor > c# > tabs set indenting smart , checked option keep tabs . now if auto-format code, formated expected. space before comment changed spaces if there tabs: in previous versions of visual studio, tabs stays on auto code formatting. there seems no option change behavior. this not issue of beautification. issue me, because auto-formated files marked different our tool chain. how can prevent this? i opened issue on github . this stated "intentional change". because files has been auto-formated has spaces instead of tabs, huge amount of file differences show in our tool chain. hard accept.

ssh - Hadoop multinode cluster, root permission denied -

we trying make multinode cluster on hadoop, after running start-dfs.sh file on master asking root@slave , root@master's password , shows password denied. ssh slave , ssh master master running properly. how proceed ? screenshot of terminal start cluster hduser $ bin/start-dfs.sh . because, must have created ssh public keys hduser only. user supposed there in slave machines also. not advisable use root .

ios - Navigation working very slow -

on working navigation based application performing 3-4 push. when pop 4 controller view , on takes time 2 sec delay. performing background operations storing images in file manager when press button previous view nav bar gets clicked because of slow navigation. unable understand problem delay. thanks in advance. try write code push on main thread, i.e. dispatch_async(dispatch_get_main_queue(), ^(){ [self.navigationcontroller pushviewcontroller:yourviewcontroller]; });

ios - Map head nowhere on first time -

i put map ios app , setted in way: - (void)viewdidload { [super viewdidload]; cllocationcoordinate2d cord = {.latitude = 44.508473, .longitude = 11.375828}; [self.mymap setregion:mkcoordinateregionmake(cord, mkcoordinatespanmake(.005, .005)) animated:yes]; addressannotation * annotazione = [[addressannotation alloc] init]; [annotazione setcoordinate:cord]; [self.mymap addannotation:annotazione]; } and addressannotation.m: - (void)setcoordinate:(cllocationcoordinate2d)coord { coordinate = coord; } it works first time open map's view shows zone near antartica sea (pin head coordinates map shows antartic sea zones) , closing , reopening map's view shows pin. how can show map zoomed on pin @ first opening? thank much! there's nothing wrong code. define coordinate property addressannotation , let compiler synthesize appropriate setter , rid of custom setter, though that's unrelated problem describe ... it's eas...

jquery - Bootstrap Table - To change the background color row -

i need change background color row, not working well. this js code: $("#table-results").bootstraptable({ method: 'get', url: '/json/data-results.json', columns: [{ field: 'type' }, { field: 'customer_name' }, { field: 'address' }, { field: 'img', align: 'center' }], onloadsuccess: function(res) { $("#table-results").on('click-row.bs.table', function (e, row, $element) { $($element).addclass('danger'); }); } }); other way (but not working) $("#table-results").bootstraptable({ columns: [{ field: 'type' }, { field: 'customer_name' }, { field: 'address' }, { field: 'img', align: 'center' }], onclickrow: function (row, $element) { $($element).addclass(...

c# - File uploads to asp.net web api using pure javascript via ajax -

i trying file uploads through ajax web api. server side codes prove working cause have managed post files using debugging fiddler , works fine. failing write successful javascript code able upload. below html code: function sendimage() { var data = new formdata(); var file = document.getelementbyid('upload').files[0]; data.append("image",file); if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp_br=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp_br=new activexobject("microsoft.xmlhttp"); } xmlhttp_br.onreadystatechange = function () { if (xmlhttp_br.readystate == 4 ) { var data = xmlhttp_br.responsetext; alert(xmlhttp_br.status+" "+data); var file = json.parse(data); } } xmlhttp_br.open("post","http://localhost:59103/"+"api/upload/testupload",true); xmlhttp_br.setrequestheader("content-t...

php - How to add plus + and minus - button in quantity box of product listing page (list.phtml) -

below code, <?php if($_product->issaleable()): ?> <script type="text/javascript"> function setqty(id, url) { var qty = document.getelementbyid('qty_' + id).value; document.getelementbyid('cart_button_' + id).innerhtml = '<button type="button" class="button" onclick="setlocation(\'' + url + 'qty/' + qty + '/\')"><span><span>add cart</span></span></button>'; } </script> <label for="qty"><?php echo $this->__('qty:') ?></label> <input type="text" name="qty_<?php echo $_product->getid(); ?>" id="qty_<?php echo $_product->getid(); ?>" maxlength="12" value="1" onkeyup="setqty(<?php echo $_product->getid(); ?>, '<?php echo $this->getaddtocarturl($_product) ?>');" title="<?php echo $t...

Firefox slow with javascript running off the hard-drive, not with uploaded files -

i'm developing javascript-based game engine. i'm running off local drive because reuploading every single small change webserver takes time. the local copy runs fine in chrome (with --allow-file-access-from-files parameter), in firefox (v19) engine slows down massively. website loads fully, movement or clicks react until script crashes. clearing cache or closing tabs doesn't make go faster. when upload site server however, runs fine in firefox. i've tried disabling security.fileuri.strict_origin_policy in dev-profile. makes little faster, doesn't solve slowdowns. is there known issue local javascript running slower in firefox? instead of testing code on file: url, why not use local web server? should run same on other web server, , able test app in browsers without fiddling security settings. what os running? can install xampp on of popular oses. on windows, people prefer uniform server . on osx can use xampp or built-in web server. then s...

Unit test using dependency injection and mock objects without hitting Database -

i'm new unit testing.can explain me how done unit testing without hitting database . and want know that, is dependency injection essential unit testing? if yes, explain me sample code. helpful me. i had created unit testing login, hits database. want test same case login, without hitting database. in this, used microsoft.visualstudio.testtools.unittesting . here code, [testmethod] public void _01_loginuser_01_valid() { bluser.user.userdto user = new bluser.user.userdto(); user.username = "mohan"; user.userpassword = "abc"; bluser.model.fs_user result = bluser.user.loginuser(user); assert.areequal("mohan", result.username); } and business logic is, public static fs_user loginuser(userdto userdto) { try { var context = new userdbentities(); { var loginuser = c...

jquery - Navigation bar disappears with CSS animations -

i using css3 animations animate.css library. real nice , work when combine them wow.js however, when scrolling down page , animations go screen, fixed navigation bar on top of screen disappears couple seconds, time animation displaying, , goes screen. how can avoid happen? don´t want fixed navigation bar disappear, ever. i fixed it! after many tries deleted z-index property of fixed navbar section , doesn´t disappear anymore.

html - Angularjs and populating fields/placeholder blinking -

i know angularjs populates fields via model. html loads first: <input type="text" data-ng-model="values.myvalue" placeholder="trololol"> then javascript: $scope.values = {}; $scope.values.myvalue = 'herro value'; this works, there blink second placeholder displays updates value 'herro value'. i'm wondering if there way can put value straight html without screwing angularjs model? example. <input type="text" value="herro value" data-ng-model="values.myvalue" placeholder="trololol"> then when javascript loads, model takes over. safe way of getting rid of blink on page load? the ng-cloak attribute should prevent this: https://docs.angularjs.org/api/ng/directive/ngcloak

windows - Conditional loading of Chrome based on working internet (WLAN) connection -

i have thin client running stand alone on windows xp embedded used information screen. information shall pulled internet (through website) when wlan-connection has been succesfully established. i'm looking way on windows launch, check working internet connection. if connection ok, want launch website internet in google chrome. if no working connection has been found, want launch local website in chrome. in pseudo-code: if (working internet connection) launch chrome internet else launch chrome local website end maybe possible piece of visual basic? or there other scripting possible? script shall run on system startup. in advanced version of script create local copy of website automatically when there working connection. all because wlan connection quite unrealible in place used. thanks in advance! this, randy birch's vb.net site, should it: http://vbnet.mvps.org/index.html?code/internet/internetcheckconnection.htm

callback - Can not echo the value outside of the function using PHP -

i need echo value outside of function using php. explaining code below. complain.php: generateticketid('w1',$con,function($ticket){ $ticket_id=$ticket; }) echo $ticket_id; here using callback function when trying echo value of $ticket_id ,i not getting anything.please me resolve issue. in php, global variables not visible inside functions. also, expected, local variables of function not visible in other functions or in global context. there several ways use variable in context not visible, depending on usage type (read, write or both). in particular situation, appropriate way use use language construct : // external $ticket_id (global or local function contains code) $ticket_id = 'foo'; generateticketid('w1', $con, function($ticket) use (& $ticket_id) { $ticket_id = $ticket; // internal $ticket_id, local anonymous function }); echo $ticket_id; the use keyword binds variable $ticket_id (visible context cod...

go - Why doesn't this Golang code to select among multiple time.After channels work? -

why doesn't golang code select among multiple time.after channels work? see code below. 'timeout' message never issued. why? package main import ( "fmt" "time" ) func main() { count := 0 { select { case <-time.after(1 * time.second): count++ fmt.printf("tick %d\n", count) if count >= 5 { fmt.printf("ugh\n") return } case <-time.after(3 * time.second): fmt.printf("timeout\n") return } } } run on playground: http://play.golang.org/p/1gku-cwvah output: tick 1 tick 2 tick 3 tick 4 tick 5 ugh because time.after function, on every iteration returns new channel. if want channel same iterations, should save before loop: timeout := time.after(3 * time.second) { select { //... case <-timeout: fmt.printf("timeout\n...

How to prompt for user input inside Powershell? -

i want prompt user input in "groupname" . possible? get-adgroup -filter {name -like "*groupname*"} | select name $groupname = read-host "group name" get-adgroup -filter { name -like $groupname } | select name edit after comment: get-adgroup -filter { name -like "*$($groupname)*" } | select name

c# - How to programmatically determine the SSL/TLS protocols enabled in Windows server -

which ssl or tls protocols particular windows server supports, , of these enabled, stored in registry at: hkey_local_machine\system\currentcontrolset\control\securityproviders\schannel\protocols does .net contain simple method of enumerating , examining these protocols, application running on server can determine enabled? i know query registry, there issues this: changes these registry entries don't take effect until server reboot - need know in-use protocols it not clear effect various values have. there disabledbydefault value , enabled value - most articles 0 , 1 means protocol enabled, 1 , 1 mean? some articles confusingly indicate enabled should 0xffffffff not 1.

mysql - sql search for substring using LIKE vs locate() -

i'm trying write query find string contains substring. what's difference between following 2 methods? select * table names '%bob%' select * table locate('bob', names) i first learned use like, having "illegal mix of collations.." error saying i'm comparing english (latin) , chinese (big5). while googling methods fix collation problem came across locate(), didn't complain collations when tried it. wondering if can keep using locate() or if there's downsides it. to large extent, matter of taste. the important consideration like ansi standard sql , supported (if not all) databases. locate specific mysql, not portable other databases. some databases optimize expression x 'y%' use index. mysql doesn't, not consideration you. another advantage like supports initial matches ( 'y%' ) , final matches ( '%y' ) intermediate matches. 1 method three. equivalent statements using locate more c...

Ionic Cordova video file for upload service -

have succeeded in making uploadvideo function ionic , cordova framework, capture new recording or pick earlier recorded video device library , upload remote service. seems $cordovacapture or/and $cordovacamera result in uri representation of video -on, -to , -for device itself. not file , result in upload failure. there way ionic cordova app can grab file through uri or there cordova plugin or method allow me catch video file recorded or chosen on device? my apps record , chose video code shown below, if have , working code, prefer base answer around instead. in code videopath holds uri file. angular.module('myapp.controllers', []) .controller('videoctrl', function($scope, $cordovacapture, $cordovacamera){ // used cordova-video(player) // display recorded or choosen video $scope.data = { videopath: "" }; // camera capture video function $scope.capturevideo = $scope.capturevideo = function(){ var options = { quality: 50, ...

sql - combobox items connect to column table in C# winforms -

i have form:"emloyees" combobox1. have table "city". when add emloyee "emloyees" table open combobox1 cities have , choose one. if in table city add city, want when try add emloyee when open combobox1 there city add. want connection between table city , combobox1 in form you need make sql query employee , can display in combobox i have similar project know its that citycomboboxemp.datasource = cityshow.usesqlcommand("select * city").tables[0]; cityshow use class that's runing sql commands

c# - Getting dynamically added labels to look like tags -

Image
what i'd have similar on main page: so, did add code: c# code-behind: protected void loadinterests() { //fill interests based on table values string strsql2 = "select um.matchvalue, dd.ddlvalue tmpusermatch um "; strsql2 = strsql2 + "inner join (select storedvalue, ddlvalue tmpdropdowns ddlname = 'ddlinterests') dd "; strsql2 = strsql2 + "on um.matchvalue = dd.storedvalue "; strsql2 = strsql2 + "where matchfield = 'matchinterests' , userid = '" + lbluserid.text + "'"; using (var con = new sqlconnection(strcon1)) using (var adapter2 = new sqldataadapter(strsql2, con)) { datatable dt2 = new datatable(); adapter2.fill(dt2); foreach (datarow row in dt2.rows) { label dynamiclabel = new label(); dynamiclabel.id = "lbl" + row["ddlvalue...

How can I format 'time' field - Angularjs and mySql -

i using laravel , angular. have function grabs these records include time field (hh:mm:ss). need display mm:ss portion of value. i have tried using; {{ score.time | date: 'mm:ss' }} but not working. should trying alter table/col schema never need hh portion anyway or should filtering results - either in laravel(php) or in angular? this how getting records in laravel public function scores($id) { return score::where('game', '=', $id) ->get(); } one way following (taken this answer ) you can create accessor function in post model. public function gettimeattribute($value) { return date('i:s', strtotime($value)); } this way, each time you'll call $score->time display date returned accessor instead of default value. more info here : accessors-and-mutators if don't want function in models can create basemodel class , make models extend basemodel class.

How to make a range repeat n-times in Google SpreadSheet -

i use arrayformula() simplify way create reports. instead of having create reference in each cell (eg. =c1 , =c2 , =c3 , =c4 in each cell, use =arrayformula(c1:c4) in 1 single cell. same job, simpler , keeps things more organized, because need in 1 cell possible errors. it works great when have reference range take values of c1:c4 a1:a4 range. in a1 cell write =arrayformula(c1:c4) , magic. it bit trickier when ranges not same length, feasible nonetheless. instance, if want stack 2 or more range link c1:c4 on top of b1:b3, on cell a1 can write =arrayformula({c1:c4;b1:b3}) . my problem using arrayformula() copy repeating pattern. instance, if want copy content of cell c1 4 times use =arrayformula({c1;c1;c1;c1}) . this work , achieve desired effect. however, wondering if there better way that. =arrayformula({c1}*12) pattern repeat 12 times. enable me have dynamic formula, such =arrayformula({c1}*count(d:d)) pattern repeat according variable. do have ideia on how ach...

javascript - Delete column contents in html table with loop -

i have html table rows filled loop , want delete last 2 columns rows inside click event on print button : js : $("#print").on('click', function(){ //i want remove columns here }) how can this? i'm not sure if looking (delete columns or columns content) can try followings suggestions. delete last 2 columnns : you can call following code remove last child several times as number of columns want remove : $("table").find("th:last-child, td:last-child").remove(); $("#print").on('click', function(){ var remove_cols_number =2; for(var i=0;i<remove_cols_number;i++){ $("table").find("th:last-child, td:last-child").remove(); } }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table style="width:100%" border='1'> <tr> <th>column 1</...

python - DigitalOcean module not loaded or installed properly -

i'm trying use digitalocean python module found here . i installed with: sudo pip install -u python-digitalocean in python shell, get: >>> import digitalocean >>> manager = digitalocean.manager(token="secretspecialuniquesnowflake") traceback (most recent call last): file "<stdin>", line 1, in <module> attributeerror: 'module' object has no attribute 'manager' and: >>> dir(digitalocean) ['__builtins__', '__doc__', '__file__', '__name__', '__package__'] i'm quite new python i'm not sure what's gone wrong. can please?

android - Duplicate jar file Error -

error failure: build failed exception. what went wrong: execution failed task ':app:transformclasseswithjarmergingfordebug'. com.android.build.api.transform.transformexception: java.util.zip.zipexception: duplicate entry: com/google/android/gms/analytics/internal/command.class i added following dependencies dependencies { //compile 'com.google.android.gms:play-services:+' compile 'com.google.android.gms:play-services:8.4.0' compile 'com.google.android.gms:play-services-location:8.3.0' compile files('libs/twitter4j-core-4.0.2.jar') compile project(':devsmartandroid') compile project(':facebooksdk') compile project(':libphotoview') compile files('libs/android-support-v4.jar') compile project(':library') //compile 'com.google.android.gms:play-services-gcm:7.5.0' //compile 'com.google.android.gms:play-services-analytics:7.5.0' compile files('libs/gcm.jar') compile file...

PhoneGap - Cordova build android faild -

i'm new in phonegap. have problem when try build cordova : sudo cordova build android here log : running command: /home/paul/documents/projets/tozer0-app/platforms/android/cordova/build [error: failed find 'java_home' environment variable. try setting setting manually.] error building 1 of platforms: error: /home/paul/documents/projets/tozer0-app/platforms/android/cordova/build: command failed exit code 2 may not have required environment or os build project error: /home/paul/documents/projets/tozer0-app/platforms/android/cordova/build: command failed exit code 2 any idea ? just add java_home , android_home , ant_home path , point out corresponding bin directory as: android studio add ~/.bashrc file: export android_home=/path/to/android/sdk export path=$path:$android_home/bin you can same ant. java jdk add /etc/profile file: java_home=/path/to/jdk jre_home=$java_home/jre path=$path:$java_home/bin:$jre_home/bin export java_home exp...

php - Opencart 2.0 - add product direct to cart -

i have installed opencart ver. 2.1.0.1 what want add products directly landing pages (basic html/css) cart of opencart. earlier opencart version 1.5, using tweak , working fine. ideally adding ?route=checkout/cart&add_product=1&product_id[]=170&qty[]=1 after domain name, add product cart. any opencart expert highly appreciated. in opencart v2 , upwards change has been made follows: the link changed to onclick="cart.add('<?php echo $product['product_id']; ?>', '<?php echo $product['minimum']; ?>');" where onclick event triggers add cart function parameters product id - unique identifier of product. minimum - refers quantity being ordered.

javascript - date fields displayed incorrectly on iPhone -

Image
on accommodation tab of this page , there couple of date fields use this datepicker . works fine on desktop browser, when page viewed on iphone dates shown below fields: incidentally, tried upgrading current (deprecated) datepicker this newer version , didn't work out. i looked little through code , found out declaration in 1 of css included what's causing problem. seem merge style don't know in 1 (datepicker.css ?), anyway, declaration .datepicker:before{content:''; display:inline-block;} is what's causing problem. don't know purpose of in grand scheme, deleting declaration, or changing display type inline-block block , makes right. try investigate starting there,avoiding break style other browsers working, , understand meaning of inline-block , since they're present in both .datepicker:before and .datepicker:after

Ball/circle shape tracking in video or live feed with OpenCV (Python) -

Image
as task school our group has create application knows when goal scored. means ball shaped object passes line. first attempting input video, opencv track ball, , output video. i have put bunch of other code snippets have found on stackoverflow, doesn't work. i creating new post because other related threads either c++ or use colour detection instead of shape detection use. can't find clear answer on outputting video file when turned series of images. following code have far: import cv2 import numpy np cap = cv2.videocapture('bal.mp4') fourcc = cv2.videowriter_fourcc(*'xvid') out = cv2.videowriter('output1.avi',fourcc, 20.0, (640,480)) while(1): # take each frame ret, frame = cap.read() if ret == true: if ret == 0: break frame = cv2.medianblur(frame,5) cimg = cv2.cvtcolor(frame,cv2.color_bgr2gray) circles = cv2.houghcircles(cimg,3,1,20,param1=50,param2=30,minradi$ if circl...

javascript - the content (webview) doesnt fill the app window -

i'm trying out electron create standalone version of website, have main.js (excerpt) function createwindow() { // create browser window. mainwindow = new browserwindow({ width: 800, height: 600, "min-width": 800, "min-height": 500, resize: true, "use-content-size": true }); // , load index.html of app. mainwindow.loadurl('file://' + __dirname + '/index.html'); // open devtools. mainwindow.webcontents.opendevtools(); // set window resizable mainwindow.isresizable(true); // emitted when window closed. mainwindow.on('closed', function () { // dereference window object, store windows // in array if app supports multi windows, time // when should delete corresponding element. mainwindow = null; }); } then index.html looks this: <!doctype html> <html> <head> <meta charse...

android - Java Eclipse Mars - Deleted Debug.Keystore - By Mistakenly -

i made new android application , uploaded on google play store. have big problem. created new key overwriting old one. old debug.keystore file replaced new one. means old certificate has been gone. now have old md5 , sha1 key saved in text file. possible create key file using md5 , sha1 have ? google asking same certificate had earlier or won't able publish updates. http://prntscr.com/9vho29 the old debug.keystore file replaced new one. means old certificate has been gone. afaik, cannot publish app on play store uses debug keystore. if mean replaced production keystore, restore keystore recent backup, talented developers maintain backups of development environment. is possible create key file using md5 , sha1 have ? no.