Posts

Showing posts from July, 2011

c# - cached variables using lock and volatile -

c# - cached variables using lock and volatile - does lock forcefulness variables written straight memory instead of beëing cached volatile does? in this question orion edwards states using locks improve using volatile, if public variable accessed within lock, , lock, mean never cached outside of lock statement? private readonly object locker = new object(); private bool? _var = null; public bool? var { { lock (locker) { //possibly variable _var in cache memory somewhere homecoming this._var; //force _var memory } } set { lock (locker) { //possibly variable _var in cache memory somewhere this._var = value; //force _var memory } } } a lock introduces acquire-fence before first instruction, , release-fence after lastly instruction. the acquire-fence prevents instructions within lock beingness moved backwards in time , ab

mongodb - Node.js with mongo - Rendering "object" instead the data inside the template? -

mongodb - Node.js with mongo - Rendering "object" instead the data inside the template? - check code... var swig = require('swig'); var config = require('../config.json'); var mongojs = require('mongojs'); var objectid = mongojs.objectid; var db = require('mongojs').connect(config.mongodb, config.mongodbcollections); var roles; db.lists.find({type:'roles'}).toarray(function(err, item) { roles = item[0].data; console.log(roles); }); var sharetpl = swig.compilefile(__dirname +'/../html/register.html'); exports.index = function(req, res){ var output = sharetpl({ 'title': 'roles itself', 'roles' : [roles] }); res.send(output); }; this console.log output... [ { name: 'web developer', code: 'wdv' }, { name: 'web designer', code: 'wds' }, { name: 'system archtect', code: 'sar' } ] it's okay, far...but html... serv

vba - Visual Basic Excel Color Cells on Lost Focus -

vba - Visual Basic Excel Color Cells on Lost Focus - i need create vba script in excel colors 2 cells when value of 1 @ to the lowest degree 10% greater or less other private sub worksheet_change(byval target range) application.enableevents = false if target.address = aprx_lns if aprx_lns > aprx2_lns * 0.1 aprx_lns.interior.color = hex(ffff00) aprx2_lns.interior.color = hex(ffff00) elseif aprx_lns < aprx2_lns * 0.1 aprx_lns.interior.color = hex(ffff00) aprx2_lns.interior.color = hex(ffff00) end if end if application.enableevents = true end sub private sub worksheet_change2(byval target range) application.enableevents = false if target.address = aprx2_lns if aprx_lns > aprx2_lns * 0.1 aprx_lns.interior.color = hex(ffff00) aprx2_lns.interior.color = hex(ffff00) elseif aprx_lns < aprx2_lns * 0.1 aprx_lns.interior.color = hex(ffff00) aprx2_lns.interior.color = hex(ffff00) end if end if application.enableevents = true end sub what doing wron

Parsing html table with BeautifulSoup to python dictionary -

Parsing html table with BeautifulSoup to python dictionary - this html code i'm trying parse beautifulsoup: <table> <tr> <th width="100">menu1</th> <td> <ul class="classno1" style="margin-bottom:10;"> <li>some data1</li> <li>foo1<a href="/link/to/bar1">bar1</a></li> ... (amount of tags isn't fixed) </ul> </td> </tr> <tr> <th width="100">menu2</th> <td> <ul class="classno1" style="margin-bottom:10;"> <li>some data2</li> <li>foo2<a href="/link/to/bar2">bar2</a></li> <li>foo3<a href=&q

php - Broken HTML-Mail because of space character -

php - Broken HTML-Mail because of space character - here little snippet of php-code utilize create html e-mail: $tmpl = '<table border="0" width="100%";><tr><td>%title%</td></tr><tr><td>%text%</td></tr></table>'; $html = '<table border="0" width="100%";>'; $html .= '<td width="20%" style="padding:0;">'; if(isset($var)) { $html .= 'value: '.$object->val; } $html .= '</td>'; $html .= '</table>'; $tmpl = str_replace('%text%', $html, $tmpl); $mail->setbody( $tmpl ); $mail->send(); sometimes mail service in html view when viewed within email programme broken because there space character within opening td-element. this: < td width="20%" style="padding:0;"> where space character coming from? had same issue php

Java string replace using regex -

Java string replace using regex - i have strings values "address line1", "address line2" ... etc. want add together space if there numeric value in string "address line 1", "address line 2". i can using contains , replace this string sample = "address line1"; if (sample.contains("1")) { sample = sample.replace("1"," 1"); } but how can using regex? sample = sample.replaceall("\\d+"," $0"); java regex

c# - Regex On Text Producing Empty Value -

c# - Regex On Text Producing Empty Value - i trying utilize regex on line of text values of name=. var match = regex.match(textr, @"\bname='([^']*?)'"); the value of textr in question $mpelement[name="system.workitem.incident.queue.tier2.unassigned.view.header_id"]$ but brings {} do this: resultstring = regex.match(yourstring, @"(?<=name="")[^""]+").value; the lookbehind (?<=name=") ensures preceded name=" the negative character class [^"] matches character not double quote the + quantifier matches such chars 1 or more times c# regex

How can I style the Xamarin.Forms SearchBar in iOS? -

How can I style the Xamarin.Forms SearchBar in iOS? - i'm trying style xamarin.forms searchbar , can see there backgroundcolor property, no matter set, property ignored in ios. is possible customize xamarin.forms searchbar in ios (and how)? as near can tell, xamarin.forms not property implement backgroundcolor property, or broken. uisearchbar property closest true background color bartint, not set xforms. to solve this, took comments heart , created own custom searchbar custom renderer in order extend bartint property few other things wanted. note: in order utilize custom renderers create sure updated xamarin.forms 1.1.1.6206 or greater. update platform version utilize nuget in visual studio, or built in bundle manager in xamarinstudio. you need 2 classes, first 1 customsearchbar, ui utilize hold custom properties. goes in shared or portable class library. : using xamarin.forms; namespace app1 { public class customsearchbar : searchbar {

javascript - Timestamp in Appscript? -

javascript - Timestamp in Appscript? - i'm trying create timestamp within google sheets in appscript. whenever cell in columna updated, want current date/time placed in columnb. tried using now() function updated cells. same question post below in appscript not vba: excel now() shouldn't update existing timestamp thanks! function fillformulae(){ var ss = spreadsheetapp.getactivespreadsheet(); var sheets = ss.getsheetbyname("sheet1"); var lastusedrow = sheets.getlastrow(); (j=0; j < lastusedrow - 2; j ++ ){ var cell = sheets.getrange(3+j, 2); if (cell.getvalue() == '') { cell.setvalue(utilities.formatdate(new date(), "pst", "yyyy-mm-dd hh:mm:ss")); } } } javascript google-apps-script google-spreadsheet

c# - Setting a border around an Expander button resizes it slightly -

c# - Setting a border around an Expander button resizes it slightly - i making expander style, , noticed when border around expander 's togglebutton goes 0 non-zero value - "0,0,1,1", in case - resized slightly, shrink within border: not app-breaking... annoying can't prepare it. how can circumvent this? need border in togglebutton 's style 0 when expander collapsed (since expander has own border create doubly-thick border) , non-zero when expanded (since want button separated border rest of content). togglebutton style: <style x:key="expanderrightheaderstyle" targettype="{x:type togglebutton}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type togglebutton}"> <border x:name="bd" background="{staticresource mutedcolorbrush}" borderbrush="{staticresource expander.border}" paddi

PHP finding the nth element in array -

PHP finding the nth element in array - php function nth item in array. here frequently. $hr = array(' ','mr.','ms.','mrs.','dr.','prof.','rev.','sir.',' ',' '); $na = trim($hr[$rs['tbhr']] .' '. $rs['tbfn'] ." ". $rs['tbln']); (this illustration code don't take literally) $rs = recordset of info $hr integer representing persons honor designation. what rather assign array item on fly nth function. however, i'm not finding in php. (i've looked it) maybe there improve way? tips? here i'd do. $na = trim(nth($rs['tbhr'], array(' ','mr.','ms.','mrs.','dr.','prof.','rev.','sir.','?','?')) ." ". $rs['tbfn'] .' '. $rs['tbln']); thus removing need create variable $hr. don't want create function either.

javascript - Add selectbox from Directives controller -

javascript - Add selectbox from Directives controller - i trying dynamicaly add together select box directive. same ng alternative works without directive directive gives empty list . please check below fiddle. i dont want set selectbox in directive template ... need add together them controller only.. fiddle:: http://jsfiddle.net/nfpch/2009/ code: <select ng-model="selectedoption" ng-options="option alternative in [1,2,3,45,6,8,9,7]"></select> the right way solve problem utilize directive compile function (read 'compilation process, , directive matching' , 'compile function') modify elements before compilation. working demo app.directive('hello', function () { homecoming { restrict: 'e', scope: {}, template: 'hello world', controller: function ($scope, $element, $attrs, $compile) { var el = angular.element('<select ng-model=

android - Not able to load images in Listview using Lrucache -

android - Not able to load images in Listview using Lrucache - am using 1 image view , 2 textview in listview , loading images web-services , when scroll listview images shuffle used lrucache. getting error when using bitmap bitmap = mmemorycache.get(hmlist.get("studentphoto")) , getting error log 06-20 15:54:01.995: e/androidruntime(6795): fatal exception: main 06-20 15:54:01.995: e/androidruntime(6795): java.lang.nullpointerexception 06-20 15:54:01.995: e/androidruntime(6795): @ **x.y.z.adapters.a_adapter.getview(a_adapter.java:165)** 06-20 15:54:01.995: e/androidruntime(6795): @ android.widget.abslistview.obtainview(abslistview.java:2207) 06-20 15:54:01.995: e/androidruntime(6795): @ android.widget.listview.measureheightofchildren(listview.java:1250) reference taking [http://stackoverflow.com/questions/20762817/listview-images-shuffle-while-scrolling] android listview android-listview bitmap

Adding exit voice command to Google Glass -

Adding exit voice command to Google Glass - is there simple way add together voice trigger close immersion app google glass? i'm learning write code glass , have basic hello world app , add together voice trigger exit home screen. there no simple way, go standard routine. add together voice trigger close alternative in menu , phone call finish() on execution. google-glass

Netsuite - Saved Search - String All True Results of Case Formula -

Netsuite - Saved Search - String All True Results of Case Formula - hoping can help me out netsuite question, , apologize in advance if i’m misusing lingo. i creating item based saved search , 1 of formula (text) result fields can have multiple true values when apply case formula. i’m combine true results of formula 1 comma separated string, instead of new item row each true value. sku contact type 123 john s owner 123 jane s clerk 123 jack s clerk formula (text) - custom label field name = contact name case when {type} = ‘clerk’ {contact} end currently results generate item (sku) row each case of clerk: sku contact name 123 jane s 123 jack s i’m looking results single string sku contact name 123 jane s, jack s i know case function noted above not string results itself; intended utilize grouping , max summary types, 1 contact name result. any solutions or work arounds? thanks there grou

Switch from POP up window to original window selenium python -

Switch from POP up window to original window selenium python - i using below code.at line 0 called website url, line no 1 clicked on image opens popup (2nd ie session) , handle pop using line 3,4,5,6 after in pop ie did work providing name alpha. now problem have close pop up(2nd ie session ) , focus need switch on first ie i,e line 0,1 ui. how can possible? 0 self.driver.get(url[0]+"abc.com") 1 self.driver.find_element_by_css_selector("input[type=\"image\"]").click() 2 time.sleep(15) 3 parent_h = self.driver.current_window_handle 4 handles = self.driver.window_handles # before pop-up window closes 5 handles.remove(parent_h) 6 self.driver.switch_to_window(handles.pop()) 7 self.driver.find_element_by_id("name").clear() 8 self.driver.find_element_by_id("name").send_keys(alpha) you have it: self.driver.close() self.driver.swi

python - Adding DataFrame groups as data columns -

python - Adding DataFrame groups as data columns - i've been struggling find way reshape dataframe liking. i'm new python , not familiar methods of dataframe. particularly pivoting. i've read through docs multiple times , still haven't found solution. (data below random) my original info pulled dataframe looks this: shellsurface s1 s2 elementhid sx sy sz sxy 0 1 88.340153 -88.340153 144 0 0 0 15.225413 1 1 66.370153 -66.370153 144 0 0 0 21.447455 2 1 74.422513 -74.422513 144 0 0 0 88.114254 3 1 22.324573 -22.324573 144 0 0 0 74.370153 4 2 14.322413 -14.322413 144 0 0 0 11.114425 there 3 surfaces per element, , elements quadrilaterals, have 4 separate entries need averaged in file. used frame.groupby(['elementhid','shellsurface'

osx - Can't attach Android Studio's debugger to Android process -

osx - Can't attach Android Studio's debugger to Android process - i can't attach android studio's debugger debuggable application process. else had issue? can't app listed in choose process dialog. i'm selecting attach debugger android process : and then, here's how process selection dialog android studio looks like: any ideas why app not shown in choose process list? although, ddms sees app in devices | logcat list: android monitor sees app in devices list: i've tried these actions: restarting macbook restarting devices: tried samsung galaxy note ii n7100 (4.3) , samsung galaxy s4 (4.4.2) reenabling settings->developer options on devices reenabling settings->developer options->usb debugging on devices restarting adb running adb kill-server , adb start-server reconnecting device macbook and/or plugging usb port launching genymotion virtual device on macbook restarting in tcp mode port: 5555 running ad

javascript - Jquery blockUI - Centering an image -

javascript - Jquery blockUI - Centering an image - i trying show image text in center of blockui. so far have managed absolute positioning need fit res. this have far. $('#maindiv').block({ message: '<div style="position: relative; width: 200px;">' + '<img src="pic.png" style="z-index: -1; width:200px" />' + '<p style="position: absolute; top: 40px; left: 60px;">wait</p>' + '</div>', css: { backgroundcolor: 'transparent', border: 'none' } }); the problem 'maindiv' can in different sizes , sizes div not centered. javascript jquery html css jquery-ui

php - Update Laravel 4 to newer version by using composer -

php - Update Laravel 4 to newer version by using composer - i'm using laravel 4, , example, there new version. allow say, laravel 4.2. can update laravel 4 setting composer.json , using composer command? don't want configure files manually when there newer version. composer.json: "require": { "laravel/framework": "4.2.*@dev" }, in cmd: composer update is right way? that correct, although need check official documentation , follow official upgrade guide, there still couple of files might need alter manually depending upon version upgrading from. php laravel-4

Scala Process with pipe -

Scala Process with pipe - i trying run bash command 1 in scala: cat "example file.txt" | grep abc scala has special syntax process piping, first approach: val filename = "example file.txt" (process(seq("cat", filename)) #| process(seq("grep", "abc"))).run() as far understand, executes first process, reads output scala , feeds sec process. problem that, performance reasons, execute both processes without leaving terminal. file huge , don't need whole output, that's why using grep in first place. so, sec approach one: val filename = "example file.txt" (process(seq("bash", "-c", "cat " + filename + " | grep abc"))).run() the problem here breaks if filename has spaces. seek escape spaces, rather have scala doing me (there many other characters need escape). is there way run command? it easy plenty escape filename: val escapedfilename = "

storage - How to store temporary values/objects per session in iOS app -

storage - How to store temporary values/objects per session in iOS app - so i've got hybrid e-commerce ios app i'm working on, , need store multiple string / array values temporarily duration of checkout process. if user leaves checkout process, want these values either deleted or reset. otherwise, @ periods of time during checkout process want able retrieve these values , utilize them. what's best way accomplish this? core info seems little more permanent i'm looking for, might right way go. can store stuff in there , delete when user leaves checkout process, i'm wondering if there's improve way it, basically. a note hybrid part: when user clicks "checkout", launch webview , checkout process continues there. i have info retrieval class (instantiated via js bridge) retrieves data, class goes out of memory it's done retrieving data i need access said info javascript in multiple separate parts, after info retrieval class has g

Passing array element to a function in c -

Passing array element to a function in c - code: #include<stdio.h> void display (int *); void show(int **); int main() { int a[3] = {1,2,3} ; display(&a[2]); homecoming 0 ; } void display(int *n) { show( &n ); } void show (int *m) { printf("%d",**m); } my aim define function name "show" can called function name "display" , both functions ("show" , "display") must called reference .the above programme gives error on "printf line" of "show()" "invalid type argument of unary '*' ". there error in programme ? function declarator of show in definition doesn't match prototype.change void show (int *m) { printf("%d",**m); } to void show (int **m) { printf("%d",**m); } c arrays pointers pass-by-reference

maven - How do I control order of test execution within a single integration test file? -

maven - How do I control order of test execution within a single integration test file? - i’m using maven 3.0.3, failsafe plugin v2.17 , junit 4.11. have integration test tests in next order @runwith(springjunit4classrunner.class) public class mytests { @test public final void testadd() { … } @test public final void testupdate() { … } @test public final void testdelete() { … } currently when run tests through maven part of “mvn clean install” run, “testdelete” getting run before “testadd” or “testupdate”. if alter name “testzzzdelete”, gets run lastly don’t that. how tests run in order specify them in file? failsafe configuration so: <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-failsafe-plugin</artifactid> <version>2.17</version> <configuration>

datatable - how to add row in temporary table data table in asp.net -

datatable - how to add row in temporary table data table in asp.net - protected void add_new_click(object sender, system.eventargs e) { datatable dt= new datatable(); datarow dr; dr = dt.newrow(); string customerid = ((textbox)gridview1.footerrow.findcontrol("txtcustomerid")).text; string customername = ((textbox)gridview1.footerrow.findcontrol("txtcustomername")).text; string customerfathername = ((textbox)gridview1.footerrow.findcontrol("txtcustomerfathername")).text; dt.rows.add(dr); gridview1.datasource = dt; gridview1.databind(); viewstate["sajjad_viewstate"] = dt; } try this: protected void add_new_click(object sender, system.eventargs e) { datatable dt= new datatable(); // add together columns here dt.columns.add(new datacolumn("cus

c - Run-Time Check Failure #2 - Stack around the variable 'input' was corrupted -

c - Run-Time Check Failure #2 - Stack around the variable 'input' was corrupted - i trying write short simple c programme trying store 5 numbers array , print them on screen. code following: #define _crt_secure_no_warnings #define size 5 #include <stdio.h> #include <stdlib.h> int main (void){ int i,input[size]; printf("please come in %d numbers",size); (i=0; i<=size-1;++i);{ scanf("%d",&input[i]); printf ("numbers entered are: \n"); printf("%d",input[i]);} homecoming 0; } when inputting 1 2 3 4 5 5 numbers store them in array input[size] , getting next error : run-time check failure #2 - stack around variable 'input' corrupted. i know error array input[size] overflow. can't figure out how 1 2 3 4 5 overflowing. thanks in advance. you have wrong semicolon here: for (i=0; i<=size-1;++i);{ // <---- wrong semicolon, braces scanf("%d",&inp

android - My eclipse IDE keeps crashing becasue of out of memory -

android - My eclipse IDE keeps crashing becasue of out of memory - my eclipse.ini -startup plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502 -showsplash org.eclipse.platform --launcher.defaultaction openfile -vmargs -xms512m -xmx512m trying increment vmargs 1024m caused other errors permgen space errors. what wrong? it appears have old version of eclipse. firstly suggest updating see if resolves problem. if don't want update, suggest specifying larger permgen space adding next line eclipse.ini : -xx:maxpermsize=256m i recommend using @ to the lowest degree 768 mb heap size, preferably 1024 mb: -xmx1024m android eclipse out-of-memory

Add-an-element function isn't working in a C program linked list -

Add-an-element function isn't working in a C program linked list - i'm working on simple c programme intended create linked list , display elements using 2 functions shto() - add together alement, , afisho() - display elements of list. problem function shto() used add together element @ end of linked list doesn't work well. when list null doesn't add together single element @ list. i'm guessing part of code isn't correct. if (koka == null) koka = shtesa; actually i've placed these 3 lines initialize list element. if remove these 3 lines programme won't work. koka = (node_s *)malloc(sizeof(node_s)); koka->vlera = 0; koka->next = null; could help me create programme work, if remove these 3 lines ? appreciate help. in advance! the code of programme below. #include <stdio.h> #include <stdlib.h> typedef struct node { int vlera; struct node *next; } node_s; node_s *koka, *temp, *

Rails: default controller spec fails -

Rails: default controller spec fails - i'm new rails , i'm trying specs pass. however, 1 of default specs fails next error: failures: 1) ratingscontroller index assigns ratings @ratings failure/error: expect(assigns(:ratings)).to eq([rating]) expected: [#<rating id: 1, rottentomatoes_id: 1, rater_id: 1, rating: 10, created_at: "2014-06-17 22:58:53", updated_at: "2014-06-17 22:58:53">] got: nil (compared using ==) # ./spec/controllers/ratings_controller_spec.rb:34:in `block (3 levels) in <top (required)>' finished in 1 min 34.34 seconds (files took 4.55 seconds load) 61 examples, 1 failure failed examples: rspec ./spec/controllers/ratings_controller_spec.rb:30 # ratingscontroller index assigns ratings @ratings here's spec (it's default controller spec generated bundle exec rails generate scaffold ... ): rspec.describe ratingscontroller, :type => :controller include_conte

python - Combobox unable to display 2-digits in a line -

python - Combobox unable to display 2-digits in a line - there comboxbox in ui did displays values of 1 10. class settingscombo(qtgui.qcombobox): values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] def __init__(self): qtgui.qcombobox.__init__(self) item in settingscombo.values: self.additems(str(item)) however, when execute code, number 10 displayed in 2 lines - 1 in line , 0 displayed in other line any ideas? qcombobox.additems (self, item) dont add together each item .pass total list it class settingscombo(qtgui.qcombobox): values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] def __init__(self): qtgui.qcombobox.__init__(self) self.additems(map(str,settingscombo.values)) python combobox pyqt

translation - TYPO3 Formhandler multistep form: keep language -

translation - TYPO3 Formhandler multistep form: keep language - i creating multistep form formhandler, including variety of translation labels. @ default, high german labels shown, there alternative switch website english language - when this, label texts change, works. my problem: when submit first step of form in english language sec page, form (and whole website) alter german. of course of study want remain in english. is there kind of hidden field has passed on formhandler "keep" current language? reason loses set language? did set linkvars in typoscript config? config.linkvars = l this means l parameter should remain in urls. forms translation typo3

16 bit - MATLAB: playing 16-bit audio -

16 bit - MATLAB: playing 16-bit audio - i have matrix (n,16) filled sound samples of 16 bits each. so matrix like: [0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1; 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1] and on. how can play sound? sound() using double floating points (from -1 1 values) . if convert values, guess work, im not sure. suggestions? @anderbiguri pretty much nailed it. take array, convert signed double, normalize , play it. as have n x 16 matrix, each row sample , each column bit number, first need convert matrix double format. can utilize bin2dec help that. however, bin2dec takes in string . such, can convert our matrix string array so. let's assume insound contains sound matrix specified before. i assume bits in big-endian format, important bit left bit, next downwards right bit. according comments, numbers signed 1's compliment. means should important bit 1, invert entire number. such, can figure out rows negative checking entire first c

javascript - Exception in defer callback: Error: No uiManager configured on Router -

javascript - Exception in defer callback: Error: No uiManager configured on Router - i guess improve question here more general: how debug errors deployed apps? meteor have commands/logs can at? i'm not sure begin because works fine locally. i'm getting error in browser console when seek view meteor app deployed *.meteor.com. output blank screen, locally, same code results in no errors , output normal. has seen before? there's a thread connecting accounts-ui-bootstrap-3 i'm not using that. for reference, i'm using meteor 0.8.1.3, blaze-layout 0.2.4, iron-router 0.7.1, , accounts-entry 0.7.3. edit: looking @ meteor logs right nil constructive far. are using meteorite? seek adding blaze-layout: mrt add together blaze-layout and check in .meteor/packages loads after iron-router. then deploy usual *.meteor.com javascript meteor meteor-blaze

javascript - Track canceled facebook login -

javascript - Track canceled facebook login - i wish track users presented facebook login dialog popup, , chose close (by clicking "cancel" or closed popup window). i using facebook sdk , invoking fb.login() from docs it's unclear, appear there might way track this, so, if here knows how, or can help, appriciated. thanks! complete code: var facebook = (function(){ // configuration var serverdomain = '365scores.com', appid = '158698534219579'; // load sdk asynchronously (function(d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/sdk.js"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); window.fbasyncinit = function(){ fb.init({ appid : appid, cookie :

shell - Run an Executable Terminal Program in Linux for Multiple Files to Produce Multiple Output Files -

shell - Run an Executable Terminal Program in Linux for Multiple Files to Produce Multiple Output Files - i have executable programme run in linux terminal. programme works follows: in terminal come in name of program. gives me next prompts: outputfile, times, input file, option, ect. i'm trying create script run programme on files in directory. of prompts programme gives same, except output , input files differ file file. there approximately 300 input files named 001h.pdb ... 300h.pdb. need output files 001p.acc ... 300p.acc. (also, responses program's prompts are: "outputfile", 1, "inputfile", bnl, next, next, allatm, next, next, no.) what reasonable csh script? i think might trick... #!/bin/bash # loop through .pdb files f in *.pdb echo debug: processing $f out=${f/h.pdb/p.acc} # determine name of output file # echo parameters needed programme "prog" ( echo "$out" echo 1 echo &quo

linux - Zero downtime deploy with node.js and mongodb? -

linux - Zero downtime deploy with node.js and mongodb? - i'm looking after building global app ground can updated , scaled transparently user. the architecture far easy, each part of application has own process , talk other trough sockets. this way can spawn many instances want each part of application , distribute them across globe accordingly needs. in front end of scheme i'll have load balancer, them route users closest instance, , when new code spawned instances spawn new processes new code , route new requests , gracefully shutdown. thank much advice. edit: the question is: best ( , simplest ) solution achieving 0 downtime when deploying node multiple instances ? about app: https://github.com/raynos/boot "socket" connections, http http requests, mongo database solutions i'm trying @ moment: https://www.npmjs.org/package/thalassa ( managed haproxy configuration files , app instances ), if don't know it, watch talk: https://www.y

javascript - getting the contents of a div tag with class -

javascript - getting the contents of a div tag with class - i trying read particular contents of kid iframe wrapped in div tag parent window. using detailsvalue = window.frames['myiframe'].document.getelementbyid('result').innerhtml; with i'm able access entire content of frame. need access portion of content. problem div wraps content looking contains class , no id. <div class="watineed"> <table class="details"> </table> </div> i unable access content in form of table (with no id , class). any help. edit1: need access content of table check char length , html tags nowadays in content. you can either using plain javascript (as mentioned notulysses): window.frames['myiframe'].document.queryselector('.watineed .details') or using jquery (since aded jquery) specifying iframe's document context $ : $(".watineed .details", window.frames['myiframe'].

css - jQuery isotope v2 and bootstrap 3 with different item sizes -

css - jQuery isotope v2 and bootstrap 3 with different item sizes - im using jquery 1.10.2 bootstrap 3.0.3 (http://getbootstrap.com/) , isotope v2 (http://isotope.metafizzy.co/). i have 4 different item-sizes (col-xs-12, col-xs-6, col-xs-4, col-xs-3), these columns mixed , defined user manage content - can't command order of items. no problem is, isotope using first item-size reference. this runs in error, if first item "col-xs-6" , sec smaller, layout broken. does know prepare issue? best regards ch jquery css twitter-bootstrap twitter-bootstrap-3 jquery-isotope

Javascript copy text script not working properly? -

Javascript copy text script not working properly? - i have javascript copying text reason isn't working , life of me can't figure out what! <script> function copytext(field) { var selectedtext = document.selection; if (selectedtext.type = 'text') { var newrange = selectedtext.createrange(); field.focus(); field.value = newrange.text; } else { alert('select text in page , press button'); } } </script> if (selectedtext.type = 'text') { should be if (selectedtext.type == 'text') { = setting == comparing javascript

delphi - How to use a sqlite database on a remote folder from a datasnap service? -

delphi - How to use a sqlite database on a remote folder from a datasnap service? - i've datasnap server created delphi xe5. server installed service. methods connect sqlite database info, using zeoslib components. if database file in local computer works fine. if it's on folder of remote folder (in network) doesn't work: says library routine called out of sequence same methods, same parameters, same code; distinct database locations. i've tried create network unit (i mean, instead having path \\server\folder\db.sqlite3 i've z:\db.sqlite3 ). the result same: doesn't work. any hint, please? sqlite delphi delphi-xe5 datasnap zeos

svn - Relocating the repository -

svn - Relocating the repository - i have visualsvn server installed on machine (which acts subversion server). have several projects in here, , going format machine, , reinstall visualsvn server on it. how can access old repository old projects have there? want find way how not impact of old projects in svn. can help me out , tell me files should backup , how transition properly? note: i'm using tortoisesvn client. easy way - save tree svnparentpath of server, homecoming after reinstall (as repos , content appaar automagically) svn-style way - svnadmin dump every repo, svnadmin load dump later (create repository in server's applet before load). svn visualsvn-server

arm - Build android ELF binary with nasm? -

arm - Build android ELF binary with nasm? - i'm trying write assemble code android. i'd nasm , doesn't seem back upwards android (arm) @ all: valid output formats -f (`*' denotes default): * bin flat-form binary files (e.g. dos .com, .sys) ith intel hex srec motorola s-records aout linux a.out object files aoutb netbsd/freebsd a.out object files coff coff (i386) object files (e.g. djgpp dos) elf32 elf32 (i386) object files (e.g. linux) elf64 elf64 (x86_64) object files (e.g. linux) elfx32 elfx32 (x86_64) object files (e.g. linux) as86 linux as86 (bin86 version 0.3) object files obj ms-dos 16-bit/32-bit omf object files win32 microsoft win32 (i386) object files win64 microsoft win64 (x86-64) object files rdf relocatable dynamic object file format v2.0 ieee ieee-695 (ladsoft variant) object file format macho32 nextstep/openstep

c++ - Generating Two Random Variables Between 0 and 1 Using Same Formula -

c++ - Generating Two Random Variables Between 0 and 1 Using Same Formula - i'm trying generate 2 different random variables between 0 , 1 @ start of main function. need 2 variables utilize in comparing different possible outcomes. however, when seek run formula twice says 'redefinition of gen' error. can please advise on how resolve error can re-use same formula , store values 2 different variables. random_device rd; mt19937 gen(rd()); uniform_real_distribution<> dis(0, 1); auto value = dis(gen); cout << "r value " << value << endl; random_device sd; mt19937 gen(sd()); uniform_real_distribution<> dis(0, 1); auto c = dis(gen); cout << "c value " << c << endl;} simply rename sec generator gen2 (same dis2 ): random_device rd; mt19937 gen(rd()); uniform_real_distribution<> dis(0, 1); auto value = dis(gen); cout << "r value " <&

c++ - Best way to seed mt19937_64 for Monte Carlo simulations -

c++ - Best way to seed mt19937_64 for Monte Carlo simulations - i'm working on programme runs monte carlo simulation; specifically, i'm using metropolis algorithm. programme needs generate perchance billions of "random" numbers. know mersenne twister popular monte carlo simulation, create sure seeding generator in best way possible. currently i'm computing 32-bit seed using next method: mt19937_64 prng; //pseudo random number generator unsigned long seed; //store seed every run can follow same sequence unsigned char seed_count; //to help maintain seeds repeating because of temporal proximity unsigned long genseed() { homecoming ( static_cast<unsigned long>(time(null)) << 16 ) | ( (static_cast<unsigned long>(clock()) & 0xff) << 8 ) | ( (static_cast<unsigned long>(seed_count++) & 0xff) ); } //... seed = genseed(); prng.seed(seed); i have feeling there much improve ways assure

c++ - how print an array row with pointers -

c++ - how print an array row with pointers - #include <iostream> #include <fstream> #include <string> using namespace std; int main(){ ifstream fin("c:\\users\\rati\\desktop\\iris_flower.txt"); float s=0; int x,n=5,m=150,i,j;float d[5]={0}; float **iris; float ss=n; iris=new float *[n]; for(i=0;i<n;i++) iris[i]=new float [m]; for(i=0;i<n;i++) for(j=0;j<m;j++) fin>> iris[i][j]; for(i=0;i<n;i++){ for(j=0;j<m;j++) cout<<iris[i][j]<<" "; cout<<endl; } for(j=0;j<m;j++){ for(i=0;i<n;i++) s+=iris[i][j]; d[j]+=s/ss; cout<<s<<endl; } scheme ("pause"); } this total code. want print row 2d array pointer(no loops).i hope can write fragment add together did want you can modify array pointers if want print array, have utilize loops. check out example:- int main() { int n = 3, m = 4, a[n][m], i, j, (* p)[m] = a; (i = 0; < n; i++) (j = 0; j < m; j++)

regex - htaccess conditional DirectoryIndex based on incoming traffic from certain domains -

regex - htaccess conditional DirectoryIndex based on incoming traffic from certain domains - i show different index pages surfers coming different domains. set list of domains, incoming traffic should directed index page on site, set list of domains incoming surfers should land on different index page on site, etc... example: surfer domain1.com , domain2.com , domain3.com should land on indexa.php surfer domain4.com , domain5.com should land on indexb.php etc.. help appreciated :-) give thanks you! you can utilize http_referer header this: rewriteengine on rewritecond %{http_referer} (domain1|domain2|domain3)\.(com|net|org|info)$ [nc] rewriterule ^/?$ /indexa.php [l,nc] rewritecond %{http_referer} (domain4|domain5)\.(com|net|org|info)$ [nc] rewriterule ^/?$ /indexa.php [l,nc] regex apache .htaccess mod-rewrite

.net - How To Check If Element Is Visible In Web Browser In VB.net? -

.net - How To Check If Element Is Visible In Web Browser In VB.net? - i want check if element visible (i.e. has not set display: none, visibility: hidden) in browser element in vb.net how can that? googled didn't found anything, not in official documents. the element like: <div id="elem"> <a href="dynamic link">link</a> <a href="dynamic link">link</a> <a href="dynamic link">link</a> </div> and want select 2nd tag, , check if visible. questions: how check if sec exists? how select sec tag above? how check if visible i tried: if (downloadsite.document.getelementbyid("elem").getelementsbytagname("a")[1] isnot nothing) ' working end if but doesn't work. .net vb.net dom browser

SHA1 error when using brew install ruby-build -

SHA1 error when using brew install ruby-build - i using linuxbrew(which linux equivalent of homebrew) install "ruby-build" command used:- brew install ruby-build and here error got, error: sha1 mismatch expected: 2599afa039d2070bae9df6ce43da288b3a4adf97 actual: 6d840506239fc0b47ad5c1b14bd5e3e0edbeaa60 archive: /home/user1/.cache/homebrew/makedepend-1.0.5.tar.bz2 retry incomplete download, remove file above. later tried deleting makedepend-1.0.5.tar.bz2 file , run above command again, still error persists. ruby-on-rails ruby fedora linuxbrew

playframework 2.0 - Play Framework 2 - Different views for different devices -

playframework 2.0 - Play Framework 2 - Different views for different devices - i'm building play 2.1.0 (java) app needs have 2 different versions: desktop web app , mobile web app. i'm looking way doesn't modify controllers' logic, relies on routing. ideal behaviour should be: routes same desktop , mobile controllers same desktop , mobile views different mobile , desktop, share naming convention. is there somewhere can hookup routing behaviour and, say, append .mob view name rendered view main.scala.html desktop , main.scala.mob.html mobile? ideal, since controllers need no changes (or ugly ifs) , each view needs have it's own mobile version. guess need request @ point perform device detection. cooler if fallback desktop view if no mobile view implemented specific action. any ideas? thanks, gonzalo i ended composing actions needed mobile version action. accomplish that, created @mobile runtime annotation used annotate these actions name of m

ios - No architectures in the binary. Lipo is failed to detect any architectures in the bundle executable -

ios - No architectures in the binary. Lipo is failed to detect any architectures in the bundle executable - yes know there other answers question , looked @ of them , darn reason maintain getting error no matter try. have tried solutions have been suggested , before mess things bad, thought best come here , post question. please help me using xcode ver 5.1.1 , these screen shots of plist looks , build settings in target can't post them because reputation low. ugh! ios xcode

SOLR Updated docs missing from query -

SOLR Updated docs missing from query - (still newbie; more questions) i'm performing atomic updates on solr 4 records via http calls. working correctly after fixed problems urls. but original problem still present: after update document, search queries no longer finding updated docs. do need re-index updated document? atomic updates cause document fall out of index? example: can search this: http://solrfarm.gateway.cco:8983/solr/records/select/?q=firstname:(tomas) recordtype:(myrectype)&rows=100 and xml looks like: <doc> <str name="id">collname-7276748</str> <str name="system">ohm liens</str> <long name="_version_">1464208859225653248</long> <bool name="optout">false</bool> </doc> i want alter optout value "true" , happening url looks this: http://prodsolr01.cco:8983/solr/records/update?stream.body=%3cadd%3e%3cdoc%3e%3cfield%20name=%22id%22%

php - Gmail IMAP using OAuth 2.0 and Service Account fails with status 400 -

php - Gmail IMAP using OAuth 2.0 and Service Account fails with status 400 - when seek connect gmail imap server using xoauth2 mechanism , service account, next response: {"status":"400","schemes":"bearer","scope":"https://mail.google.com/"} the code utilize in php is: $email = "an_user@of_a_domain.com"; require_once 'googleapiclient/google_client.php'; $client = new google_client(); $client->setuseobjects(true); $gac = new google_assertioncredentials( "xxxxxxxxxxx@developer.gserviceaccount.com", 'https://mail.google.com/', file_get_contents("path/to/private/key"), 'notasecret', 'http://oauth.net/grant_type/jwt/1.0/bearer', $email ); $client->setapplicationname("test app"); $client->setassertioncredentials($gac); $client::$auth->refreshtokenwithassertion(); $token = $client::$auth->getaccesstoken

matlab - Matrix division with defined Array -

matlab - Matrix division with defined Array - i trying split each element of matrix "a" each element of "b". want create new matrix of 4 "c" a=[5 6 9 1; 3 8 9 5; 5 4 2 0;7 8 2 1] b=[-0.1125,-0.0847,-0.0569,-0.0292] c = ./ b but getting error of in assignment a(i) = b, number of elements in b , must same. how prepare issue? try this c = a./repmat(b,size(a,1),1); use @shai's reply faster. here stats n = 100; k = 100; = randi(1000,n,n); b = randi(1000,1,n); #mine method tic; = 1:k c = a./repmat(b,size(a,1),1); end mine = toc mine = 1.2330 seconds #shai's method tic; =1:k c = bsxfun(@rdivide, a, b ); end shai = toc shai = 0.1085 seconds i can give more general reply if give me general dimensions matlab

javascript - Get email with Facebook Firebase Simple Login -

javascript - Get email with Facebook Firebase Simple Login - using facebook firebase simple login. trying person's real name, have done via user.displayname in firebasesimplelogin instance. when seek getting email user.email , returns undefined . have done same thing google+ , works fine, no undefineds returned. here code: var chatref = new firebase('https://******.firebaseio.com'); //no, didn't set firebase name in code =p var auth = new firebasesimplelogin(chatref, function(error, user) { if (error) { // error occurred while attempting login console.log(error); alert('an error occurred while trying log in.' + error); } else if (user) { // user authenticated firebase console.log('name: ' + user.displayname + ', email: ' + user.email); //with google, 'name: john doe, email: johndoe@example.com' returned //with facebook, 'name: john doe, email: undefined' returned } else { // user l

sql server - SQL Order By with 2 Column - Grouping of Sellers -

sql server - SQL Order By with 2 Column - Grouping of Sellers - i wanted grouping sellers order cost in sql, let's have below table info me. want order cost first, when seller exist multple time in table should below.(means same sellers together). table data sellerid sellername cost 88 flipkart 3950 32 ebay 4139 153 amazon 4139 96 walmart 4388 88 flipkart 5999 153 amazon 4464 requirement : sellerid sellername cost 88 flipkart 3950 88 flipkart 5999 32 ebay 4139 153 amazon 4139 153 amazon 4464 96 walmart 4388 code below not giving expected result. select sellerid, sellername, cost tablename order price, sellerid you can utilize window function min(..) over.. lowest cost each sellername , sort it. select sellerid, sellername, cost tablename order min(pr

firebase forge is no longer allowing me to view the dataset -

firebase forge is no longer allowing me to view the dataset - has seen error message when accessing forge: console message: failed: error: too_big: info requested exceeds maximum size can accessed single request. dislayed in forge viewer: data view not loaded: there much info in firebase. this happening accross of dev/uat/prod datasets. these datasets in exact same form. , accessible across levels. not big dataset. whole exported dataset around 15meg. firebase