Posts

Showing posts from January, 2015

javascript - Updating html table with input -

i learning js, html, css, , general web development first time , wanted create simple (or thought) table use keeping track of items have. essentially want make dynamically-sized table can take , save input. i thinking of way make javascript function in order add tags tables input given. have seen personal website developer had input boxes submit button, causes data added in table in html file's table. for instance, if have: <table id="inventory"> <thead> <tr> <th>item name</th> <th>item number</th> <th>item color</th> </tr> </thead> </table> would possible me add <tr class = "boxtype"> <th>boxv1</th> <th>#1111</th> <th>blue</th> </tr> the above block table using javascript , inputs? i tried making addrows method after snooping around web, , created temporary version of table empty when re...

hdfs - Will the replicates of Hadoop occupy NameNode's memory -

we know each file in hdfs occupy 300 bytes memory in namenode, because each file has 2 other replicates, 1 file totally occupy 900 bytes memory in namenode, or replicates don't occupy memory in namenode. looking @ optimisation name node memory usage , performance done @ hadoop-1687 can see memory usage blocks multiplied replication factor. however, memory usage files , directories not have increased cost based on replication. the number of bytes used block prior change (i.e. in hadoop 0.13) 152 + 72 * replication, giving figure of 368 bytes per block default replication setting of 3. files typically using 250 bytes, , directories 290 bytes, both regardless of replication setting. the improvements included 0.15 (which did include per-replication saving, there still per-replication cost). i haven't seen other references indicating per-replication memory usage has been removed.

sitecore - EXM 3.2.0: Email Campaign Manager doesn't show the history of drafts / created messages -

Image
we need setup exm 3.2 sitecore 8.1 in production after configured exm in development. works fine in dev ... in production don't see message history section (screenshots below) mongodb , exm.dispatch database exist , nothing wierd apears in logs. clue might cause here? thank in advance sitecore exm messages stored in sitecore_master_index . try rebuild index control panel -> indexing manager.

c# - Cannot find resource named 'UndockArrowBrush' -

i try add hidden control tfspendingchanges xaml definition <usercontrol xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" visibility="hidden" mc:ignorable="d" x:class="vsextensions.integrationsectionview" x:name="integrationsection" d:designwidth="39" d:designheight="39"> <grid x:name="layoutroot" visibility="hidden"> </grid> </usercontrol> when run visual studio throw error : system.reflection.targetinvocationexception: exception has been thrown target of invocation.. ---> system.windows.markup.xamlparseexception: provide value on 'system.windows.staticresource...

Cordova Security Alert Google Play Android -

i have app published on google play , have received warning recently: https://support.google.com/faqs/answer/6325474 i have upgraded cordova version via command line , re-uploaded apk , still same warning. any ideas on how resolve issue? thanks, chris you need not update android version explicitly. updating cordova version through cli automatically updates cordova android version well. need remove android platform , add once again after cordova update , rebuild android platform again. hope helps.

arrays - Excel: Subtract 2 values based on multiple criteria to get message response rate -

Image
hi i'm trying track response rates in various message threads , having trouble writing formula. included link sample data set sudo formula below. appreciated! data set link: https://docs.google.com/spreadsheets/d/1tgocxxxtlntizsdqyvglespfjzdi73y61cfzcskrgvm/edit?usp=sharing sudo formula: if ("actionable" = "y") then find next row has: a) next "message #" in sequence , b) same "thread_id" , c) sent other user = "n" then subtract "date" value of second row first row data set: user_id thread_id message_id date fromuser_id sent other user message # actionable responsetime 3198 5555 22115 1/22/2016 20:41:00 1109 y 1 y 3198 5555 22217 1/25/2016 4:22:00 3198 n 2 n 3198 5555 22225 1/25/2016 15:03:00 1109 y 3 y 3198 5555 22226 1/25/2016 15:04:00 1109 y 4 n 3198 5555 22228 1/25/2016 17:01:00 3198 n 5 n 319...

javascript - Changing the value of the variable from outside of model -

function searcharticlemodel() { var self = this; self.param = ''} var searchmodel = new searcharticlemodel(); ko.applybindings(searchmodel, document.getelementbyid("ko-search-module")); $('.tag-menu').on('click', function(e) { showsearch(); // searchmodel.param("tags") } i need give string value tag param. not able that. tried stuck @ this. using knockout first time bit confused. have knockout model param value null. , trying set value of param when following function called. you should use ko.observable() make changes affect ui. function searcharticlemodel() { var self = this; self.param = ko.observable() } var searchmodel = new searcharticlemodel(); ko.applybindings(searchmodel, document.getelementbyid("ko-search-module")); $('.tag-menu').on('click', function(e) { showsearch(); // searchmodel.param("tags") } also i...

c# - Max array range limit -

i'm working on code 2d game player has 3 hearts. if player collides bombprefab, loses 1 heart. if player collides heartprefab, wins heart. if collides 3 consecutive times bombprefab, game ends. the hearts texture follows. array 0 (3 hearts) array 1 (2 hearts) array 2 (1 heart). i having problem limiting array! want know how following response: if player has 3 hearts , collides heartprefab, object destroyed, there no change in number of hearts player has. the code below works take , give hearts. when collide 1 heartprefab, , have 3 hearts (maximum) error: index out range array. how should proceed? c# answer if possible using unityengine; using system.collections; using unityengine; using system.collections; public class heart : monobehaviour { public texture2d[] initialheart; private int heart; private int manyheart; void start () { // game start 3 hearts @ range 0 getcomponent<guitexture> ().texture = initialheart [0];...

Excel VBA returning values to multiple cells from XML web query -

i have xml data on web. prices , price data of in game item: https://api.eve-central.com/api/marketstat?regionlimit=10000002&typeid=34 invoke of function single value (for example highest buy order): b 1 itemid buy/max 2 34 =importxml("https:// ... &typeid=34", "//buy/max") 3 35 function looks like: function importxml(url string, query string) dim document msxml2.domdocument60 dim http new msxml2.xmlhttp60 http.open "get", url, false http.send set document = http.responsexml importxml = document.selectsinglenode(query).nodetypedvalue end function it's ok 1 value. if got 500 items, getting data extremely long. populate multiple cells (in case two) need modify input link adding &typeid=35 : https://api.eve-central.com/api/marketstat?regionlimit=10000002&typeid=34&typeid=35 with link can 2 values msgbox . need work on data need in cell b3 . code looks this: function importxml(url...

rest - How to find property name exists in soap ui response thats in Json -

i trying figure out how find if particular property name exists in json response using soap ui. ex: {"day_details": [{ "duration": "p0y0m0dt9h17m", "activities": [ { "crew_base": "nyp", "to_location": "nyp", "start_datetime": "2016-04-26t12:52:00-04:00", "end_datetime": "2016-04-26t16:30:00-04:00", }, } from above code need find if "activities", crew_base property name exists. not concern data or value has. appreciated.

google spreadsheet - Get value from cell next to another cell -

i've got 2 sheets. sheet one product | grams | kcal food | 23 | ? food2 | 55 | ? sheet two product | kcal food | 104 food2 | 33 how can in sheet 1 find cell next food entered. ex. when enter "food2", want automatically kcal value food list in sheet two. so food2's kcal cell should 33*55 try formula in cell c2 of sheet1: =arrayformula(if(a2:a="",,b2:b*vlookup(a2:a,sheet2!a:b,2,0)))

r - ggplot2 facet wrap: y-axis scale on the first row only -

Image
is possible add y-axis facet wrap, first row, shown in screenshot? code plot: library(ggplot2) mydf <- read.csv('https://dl.dropboxusercontent.com/s/j3s5sov98q9yvcv/bpdf_by_nb') ggplot(data = mydf) + geom_line(aes(x = yearmonth, y = newcons, group = 1), color="darkseagreen3") + geom_line(aes(x = yearmonth, y = demolitions, group = 1), color = "black") + theme_minimal() + labs(title="new constructions vs demolitions (2010 - 2014)\n") + theme( axis.line = element_blank(), axis.title.x = element_blank(), axis.title.y = element_blank(), axis.text.x = element_blank(), axis.text.y = element_blank()) + facet_wrap(~ nb) result: (i've manually added legend place want place scale) the idea taken this answer. p <- ggplot(data = mydf) + geom_line(aes(x = yearmonth, y = newcons, group = 1), color="darkseagreen3") + geom_line(aes(x = yearmonth, y = demolit...

wpf - Best practice for binding properties of controls within a DataTemplate? -

i see there have been lot of question asked on years, how best bind data within datatemplate, there best practice? in case want memorycopybtn copy text of selected memorylistitem textbox, can work on in viewmodel. i can find listview using findname, show null listviewitem on pageload. i can put in memory model page, don't think that's best practice. i see that various options walking visual code tree, want during runtime, way? what options? thank you. <listview x:name="clipboardlist" xmlns:m="using:quickieedit.models" itemssource="{x:bind viewmodel.memoryitems}"> <listview.itemtemplate> <datatemplate x:datatype="m:memoryitem"> <stackpanel orientation="horizontal"> <button x:name="memorycopybtn" c...

How do I configure git to do push with my user to GitHub? -

when commits , push command line, git push commit github commit it's not github user. when intellij github requires username , password , commits linked account. how can configure ? i found example here : $ git config --global user.name "john doe" $ git config --global user.email johndoe@example.com you'll need set ssh key on local machine. here's how done.

assembly - Strange symbols appear when I print memory with 'Int 21h/AH=09h" -

Image
i'm using tasm, tlink , td (debugger) in dosbox. i've tried programming simple asm 8086 program suppose print value @ address 0100h. when print result output resembles: my code is: .model small .stack .data .code .startup mov si,0100h mov word ptr[si],31 mov dx,0 mov ah,09h mov dx,[si] int 21h mov ah,4ch int 21h end invoking 21h interrupt ah set 09h , print $ terminated string in register dx . in case dx contains 31h , point (i assume) garbage, that's why you're getting random symbols printed. create string want print inside data section, , make dx register point it, before invoking print syscall.

python - Doc2vec : TaggedLineDocument() -

so,i'm trying learn , understand doc2vec. i'm following tutorial . input list of documents i.e list of lists of words. code looks like: input = [["word1","word2",..."wordn"],["word1","word2",..."wordn"],...] documents = taggedlinedocument(input) model = doc2vec.doc2vec(documents,size = 50, window = 10, min_count = 2, workers=2) but getting unicode error(tried googling error, no ): typeerror('don\'t know how handle uri %s' % repr(uri)) can please me understand going wrong ? thank ! taggedlinedocument should instantiated file path. make sure file setup in format 1 document equals 1 line. documents = taggedlinedocument('myfile.txt') documents = taggedlinedocument('compressed_text.txt.gz') from source code : the uri (the think instantiating taggedlinedocument with) can either: 1. uri local filesystem (compressed ``.gz`` or ``.bz2`` files handled...

Elasticsearch Analyzer Inheritance -

let's have analyzer below. "custom_analyzer": { "type": "custom", "char_filter": [ "html_strip" ], "filter": [ "stemming_exclusion", "kstem" ], "tokenizer": "standard" } now want have custom analyzer 1 additional filter. this: "custom_analyzer": { "type": "custom", "char_filter": [ "html_strip" ], "filter": [ "stemming_exclusion", "kstem", "new_filter" ], ...

jquery - Why is my AJAXoned Action's return not being seen as successful by the caller? -

in asp.net mvc app, i've got ajax call in view's script section: $(".ckbx").change(function () { . . . $.ajax({ type: 'get', url: '@url.action("getunitreportpairvals", "home")', data: { unit: unitval, report: rptval }, cache: false, success: function (result) { alert(result); } }); }); stepping through controller action being called: public actionresult getunitreportpairvals(string unit, string report) { homemodel model = new homemodel(); int rptid = getreportidforname(report); datatable unitreportpairemailvalsdt = new datatable(); unitreportpairemailvalsdt = sql.executesqlreturndatatable( sql.unitreportpairemailquery, commandtype.text, new sqlparameter() { parametername = "@unit", sqldbtype = sqldbtype.varchar, value = unit ...

javascript - Dynamically adding multiple events to multiple webviews -

im new using electron , kinda new using webview tag, pre-apologize maybe not knowing obvious. im trying dynamiclly create web views , add following events them. did-start-loading did-stop-loading did-finish-load page-title-updated dom-ready im using mix of jquery , pure javascript im not having luck. have attached code below can try find obvious there. im not getting javascript errors in debug menu @ same time none of seems working. function addtab(url){ tabcount++; var newtab = '<li href="#content-' + tabcount + '" id="tab' + tabcount + '" class="current"><img src="system_assets/icons/logo.png" /><span>tab home</span><a class="tabclose" href="#"></a></li>'; var newcontent = '<div id="content-' + tabcount + '" class="contentholder" style="display:block;"><webview id="webview-content-' + tabcou...

c - Optimizing an openCL calculation with bitwise operations -

let me commence stating objective: attempting compare 2 13-bit integers: >, <, , =; have calculation trillions of times, imperative optimize as possible. my program utilizes python 2.7 , pyopencl achieve calculation. averaging 800 gflops out of ati radeon 6870 fine now. so here question: if instead of caring out <, >, , = operators on 4 byte floats (as doing now), wrote bitwise functions handle <, >, , =, , able process 2 - 13 bits objects @ time, increase speed? or c have efficient way of finding <, , >, , = (obviously) floats?

arrays - python, scikit-learn - Weird behaviour using LabelShuffleSplit -

following scikit-learn documentation labelshufflesplit , wish randomise train/validation batches ensure i'm training on possible data (e.g. ensemble). according doc, should see (indeed, notice train/validation sets are evenly split via test_size=0.5 ): >>> sklearn.cross_validation import labelshufflesplit >>> labels = [1, 1, 2, 2, 3, 3, 4, 4] >>> slo = labelshufflesplit(labels, n_iter=4, test_size=0.5, random_state=0) >>> train, test in slo: >>> print("%s %s" % (train, test)) ... [0 1 2 3] [4 5 6 7] [2 3 6 7] [0 1 4 5] [2 3 4 5] [0 1 6 7] [4 5 6 7] [0 1 2 3] but tried using labels = [0, 0, 0, 0, 0, 0, 0, 0] returned: ... [] [0 1 2 3 4 5 6 7] [] [0 1 2 3 4 5 6 7] [] [0 1 2 3 4 5 6 7] [] [0 1 2 3 4 5 6 7] (i.e not evenly split - data has been put validation set?) understand in case doesn't matter indices put train/validation sets, hoping still 50%:50% split???

python - No attribute error when resampling -

i have dataframe date count 0 2012-03-23 2 1 2012-03-25 1 2 2012-03-26 1 3 2012-03-27 1 4 2012-03-28 3 5 2012-04-05 2 6 2012-04-06 1 7 2012-04-08 2 8 2012-04-10 1 9 2012-04-11 1 i trying daterange date column using df.set_index('date').resample('d').fillna(0).reset_index() but results in attributeerror: 'int' object has no attribute 'lower' even though date column no strings in it. any idea casuing error? future warning says resample deferred method. you pieced solution already. df.set_index('date').resample('d').mean().fillna(0).reset_index()

java - In Vaadin how to display data from a joined table? -

Image
i display products data on page using javaee , vaadin working except category column displays entire object instead of category name. i joining 2 tables product , category based on category_id column , fetching , displaying category name category table. query mentioned in productdaoimpl class below. vaadin version in pom <vaadin.version>7.6.5</vaadin.version> productsui.java @title("home") @theme("mytheme") @widgetset("com.study.crud.myappwidgetset") public class productsui extends ui { private static final logger log = logger.getlogger(productsui.class); private final grid productsgrid = new grid(); private datasource datasource; @override protected void init(vaadinrequest vaadinrequest) { getdatasource(vaadinrequest); configurecomponents(); buildlayout(); } private void getdatasource(vaadinrequest vaadinrequest) { vaadinservletrequest req = (vaadinservletreq...

xamarin.android - Navigation Drawer back button Xamarin -

i using binding awesome material drawer library mikepenz. i have implemented navigation drawer library , have managed change hamburger menu arrow when go level deep. have problems arrow work correctly. when click on arrow, rather going previous page, opens navigation drawer. after looking original library, have identified, following code responsible manage arrow button. appreciate , if can me bit write listener code in c#. .withondrawernavigationlistener(new drawer.ondrawernavigationlistener() { @override public boolean onnavigationclicklistener(view clickedview) { //this method called if arrow icon shown. hamburger automatically managed materialdrawer //if arrow shown. close activity advancedactivity.this.finish(); //return true if have consumed event return true; } }) here binding libray use : materialdrawer-xamari...

python - Seaborn / Matplotlib: How to repress scientific notation in factorplot y-axis -

Image
simple example below issue can't solve. n.b. other seaborn plotting methods seems have arguments repress exponential form seemingly not factorplots . tried matplotlib solutions including suggested in similar question none work. not dupe of this question . use factorplots , ideally want find proper solution opposed workaround. data = {'reports': [4, 24, 31, 2, 3],'coverage': [35050800, 54899767, 57890789, 62890798, 70897871]} df = pd.dataframe(data) df produces dataframe: coverage reports 0 35050800 4 1 54899767 24 2 57890789 31 3 62890798 2 4 70897871 3 and seaborn code: sns.factorplot(y="coverage", x="reports", kind='bar', data=df, label="total") produces plot: is there way y axis display appropriate numeric scale based on coverage values? it looks following line solves issue: plt.ticklabel_format(style='plain', axis='y') here documentation ...

Async CSLA Calls -

the 'standard' csla async server calls have typically been structured per following: base class: public static void getmyobject(eventhandler<dataportalresult<myobject>> callback) { var dp = new dataportal<myobject>(); dp.fetchcompleted += callback; dp.beginfetch(); } viewmodel: protected override void oninitialize(object parameter) { base.oninitialize(parameter); base.isbusy = true; myobject.getmyobject((o, e) => { if (hasnoexception(e)) { model = e.object; } base.isbusy = false; }); } with new async/await features, format this: public async static task<myobject> getmyobject() { return await dataportal.fetchasync<myobject>(); } and protected async override void oninitialize(object parameter) { base.oninitialize(parameter); base.isbusy = true; model = await myobject.getmyobjectasync(); base.isbusy = false; } should callback pattern considered deprecated @ point, or still useful ui te...

database - Backup/Restore to sdcard in Android -

i'm trying backup/restore app database external sdcard preferences activity. able save database external sdcard, don't understand how can transfer file default path (data\package.app\databases). idea? i this: export: inputstream myinput; string dbpath = "/data/"+pckgname+"/databases/refuel_db"; string sdpath = environment.getexternalstoragedirectory().getpath(); try { myinput = new fileinputstream(environment.getdatadirectory() + dbpath); // set output folder on scard file directory = new file(sdpath + "/refuel"); // create folder if doesn't exist: if (!directory.exists()) { directory.mkdirs(); } // set output file stream up: outputstream myoutput = new fileoutputstream(directory.getpath() + ...

c++ - Decimal Generate Random Number within a range including negatives? -

i have below function generate random number within min, max range: #include <stdlib.h> /* srand, rand */ #include <time.h> /* time */ //.. int generaterandom(int min, int max) //range : [min, max) { static bool first = true; if (first) { srand(time(null)); //seeding first time only! first = false; } return min + rand() % (max - min); // returns random int between specified range } i want include c++ create random decimal between 0.1 , 10 functionality or/and create random decimal number between 2 other numbers functionality above function without excluding negatives. want decimal between "any" range: [negative, negative] , [negative, positive] , [positive, positive] you need make sure min , max ordered correctly, , use floating point rather integers, e.g. double generaterandom(double min, double max) { static bool first = true; if (first) { srand(time(null)); fir...

plsql - After a trigger is executed on one table, is it possible to display the values of a column from another table? (PL/SQL) -

i have trigger execute when table updated. trigger updates table. i'd display changes of second table. this code have: create or replace trigger update_club_fee after update of fee on sporting_clubs each row begin update club_membership set amount = (duration*:new.fee) :old.club_id = :new.club_id; dbms_output.put_line('customer id is: '||:new.customer_id); dbms_output.put_line('previous amount '||:old.amount); dbms_output.put_line('new amount '||:new.amount); end; i don't think trigger appropriate tech solution. ui code captures change club membership should propagate changes child tables , deliver reporting. but if need use triggers, it's not going possible quite that: you cannot reference :old , :new on club_membership - these records relate trigger's owning table (sporting_clubs in case). :old.amount not resolve an update on 1 row in sporting_clubs may result in many rows being updated in club_membership (each clu...

compilation - Cross-compiling ZSH statically -

i want cross-compile zsh arm (an android device) statically. want result bunch of binaries not require bunch of libs android not have. don't care size of binary. have compiled (statically) ncurses android , try compile zsh: ttouch zsh$ cflags="-wl,-static -static-libgcc -l/media/files/lab/compilenv/ncurses-5.9/root/lib -lncurses" ./configure --host=arm-linux --disable-dynamic --disable-restricted-r --disable-gdbm --with-term-lib=ncurses --prefix=$(pwd)/root/ <everything ok> ttouch zsh$ make -j16 <everything ok> ttouch zsh$ readelf -d src/zsh | grep needed 0x00000001 (needed) shared library: [libncurses.so.5] 0x00000001 (needed) shared library: [librt.so.1] 0x00000001 (needed) shared library: [libm.so.6] 0x00000001 (needed) shared library: [libc.so.6] 0x00000001 (needed) shared library: [libgcc_s.so.1] so, how can compile zsh statically?

Game wont fully load on Android (Xamarin/CocosSharp) -

let me start saying i'm new xamarin/cocossharp , game development in general. did basic game/application starting cocossharp template shared application in vs2015. app works on wp (emulator & device) wont start on android. after emulator laoded get: android 4.4 emulator no exception has been generated. errors in output window, don't crash application: debug output it looks android version of app doesn't go further class mainactivity.cs, generated template , should not modified. btw have same problem while trying execute examples xamarin.com strugling issue since 2 days, appreciated! thank in advance, cheerz this issue answered. it necessary set gpu emulation true in hardware properties of virtual device.

java - The requested resource is not available on my bookstore application -

i keep getting error dont know how figure out. complete web.xml file believe solely web.xml issue. or there other file causing requested resource problem... <?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <!-- definition of root spring container shared servlets , filters --> <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/spring/root-context.xml</param-value> </context-param> <!-- creates spring container shared servlets , filters --> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class...

javascript - Achieve this outcome without the use of Modernizr? -

for reasons i'd rather not into. trying achieve effects of menu : demo : http://tympanus.net/codrops/2013/04/19/responsive-multi-level-menu/ but without use of modernizr possibly using jquery in place. part of code tripping me : $.dlmenu.prototype = { _init : function( options ) { // options this.options = $.extend( true, {}, $.dlmenu.defaults, options ); // cache elements , initialize variables this._config(); var animendeventnames = { 'webkitanimation' : 'webkitanimationend', 'oanimation' : 'oanimationend', 'msanimation' : 'msanimationend', 'animation' : 'animationend' }, transendeventnames = { 'webkittransition' : 'webkittransitionend', 'moztransition' : 'transitionend', 'otransition' : ...

Golang Facebook Graph API App Engine -

i'm using huandu/facebook golang access fb api. https://github.com/huandu/facebook this works locally when try run google app engine environment, can't run. i used code locally: res, err := fb.get("/me", fb.params{ "fields": "id,first_name,last_name,name", "access_token": usertoken, }) in documentation (link above) mention app engine environment can'f figure out how ge work fb.get convention. thanks. edit almost got work!: // create global app var hold app id , secret. var globalapp = fb.new("<appid>", "<appsecret>") session := globalapp.session(usertoken) //user token here context := appengine.newcontext(r) //not sure r should be... session.httpclient = urlfetch.client(context) res, err := session.get("/me", nil) if err := json.newencoder(w).encode(res); err != nil { panic(err) } if id , name. need request other parameters. do in r parameter ...

c - What if thread exit before other thread wait for it(join)? -

for example, if create 3 threads , join them in same order. if second thread exit first, happen pthread_join. program block until tid1 exits or directly return pthread_join(&tid2,null)? pthread_t tid1,tid2,tid3; pthread_create(&tid1, null, somefun, null); pthread_create(&tid2, null, somefun, null); pthread_create(&tid3, null, somefun, null); pthread_join(&tid1, null); pthread_join(&tid2, null); pthread_join(&tid3, null); when code calls: pthread_join(&tid1, null); if tid1 has not exited yet, call block until does. if tid2 exits in meantime, doesn't change behavior of particular call. in scenario, when call return, next call: pthread_join(&tid2, null); will return since tid2 has exited. if want perform work when arbitrary thread finished, you'll need use other pthread_join() synchronize "some thread finished" event. perhaps waiting on condition variable gets signaled every thread w...

ruby - Having Issues with Action Mailer Rails -

right working on building mailer feature app built in ruby on rails send message account when hasn't checked in day. forgo sending said email accounts not have check ins enabled. here code sending email inactive accounts: def self.inactive_accounts account.all.select |account| yesterday = (1.day.ago.beginning_of_day..1.day.ago.end_of_day) account.check_ins.where(worked_at: yesterday).empty? end end def self.notify inactive_accounts.each |account| missingcheckinmailer.missing_check_in(account,1.day.ago).deliver_now end end what trying figure out start code keeps these emails being sent accounts not have check in enabled.

string - C# : delete repetitive character -

this question has answer here: replace “\\” “\” in string in c# 7 answers in c# application, desktop folder doing : string path = environment.getfolderpath(environment.specialfolder.desktopdirectory); which gives string : "c:\\users\\username\\desktop". see there 2 slashes, problematic. there easy way delete slash each time meet them ? thank in advance. just know, "\\" 1 character - backslash escape character (it used in things \r or \n). since escape character, string representation of actual backslash, have escape it, leading double backslash, "\\". tldr: "\\" in string represents single backslash. if want verify this, try printing out string "\\". in general, remove duplicate character, can use .replace function: mystring.replace("xx", "x");

javascript - How do you make function with any number of arguments with a callback -

for example have function passconcatenatedstringback(){ var i,concatstring; for(i=0; i<arguments.length;i++){ concatstring = arguments[i]; } callback(concatstring); // error since callback undefined } how implement in node callback style? without using promises function passconcatenatedstringback(){ var i,concatstring, error; var args = array.prototype.slice.call(arguments); //convert array kenichi shibata pointed out var callback = args.pop(); //get callback function , remove arguments. for(i=0; i< args.length;i++){ concatstring += args[i]; } callback(error, concatstring); } just take last argument , use callback. should still implement validations checking if user provided valid callback.

javascript - Check to see if a HTML button gets released -

so want able tell when html button no longer clicked/touched can change boolean true false. <input id="clickme" type="button" value="click start." onclick="playit();" /> i way see if it's still pressed work well. just add onmouseup button: <input id="clickme" type="button" value="click start." onmouseup="playit();">

python 3.x - Django integerField empy value -

model - http://pastebin.com/krba4mft import script - http://pastebin.com/cegrb8q7 error - valueerror: invalid literal int() base 10: '' i keep getting error though i've set integerfield(blank = true, null = true) any ideas?

php - Laravel & phpMyAdmin - pdoexception no connection could be made because the target machine actively refused it -

i'm using laravel 5.2 , phpmyadmin (which i'm running through instantwordpress) , when try migrate database error message command line: [pdoexception] sqlstate[hy000] [2002] no connection made because target machine actively refused this .env file looks like: app_env=local app_debug=true app_key=base64:ibh/yugaxtc2a2rrd7a9ve5io7abpxlyfjuflyfnrfa= app_url=http://localhost db_connection=mysql db_host=localhost db_port=3306 db_database=micedb db_username=roo db_password=roo cache_driver=file session_driver=file queue_driver=sync then, when @ app in browser have landing page though initial migrate has worked there's nothing in database , when try register error message , stack trace. in config->database 'mysql' => [ 'driver' => 'mysql', 'host' => env('db_host', 'localhost'), 'port' => env('db_port', '3306'), 'database' => env('db_databas...

is there a way to set a variable to something at the end of foreach loop if condition not met in C#? -

foreach (objecta in alist()) { foreach (objectb b in blist) { if (a.variable != b.variable1 && a.variable() != b.variable2) { a.setvariable("error"); } } } the problem getting goes through foreach loop first time , sets variable error without checking if other values (when goes through loop again) finds match. what wait until goes through lists , @ last foreach loop iteration if nothing in alist matches variable target && variable source in blist set error flag. any suggestions around appreciated. try doing other way around. search match instead of searching non-matches. foreach (objecta in alist()) { bool foundmatch = false; foreach (objectb b in blist) { if (a.variable == b.variable1 || a.variable() == b.variable2) { foundmatch = true; break; } } if (!foundmatch) { a.setvariable("error"); } } ...

ios - How to know a UIView is resizing to inner side or outer side? -

how know uiview resizing , frame increasing or decreasing (or inner side or outer side)? for e.g. have uiimageview (and using third party library resize object). current frame is, (somex, somey, 200,50), if resize in way changes width 300 , in case changes 150. should able know that, increased/decreased. you can key-value observing . example, if uiimageview *imageview can: [imageview addobserver:self forkeypath:@"frame" options:0 context:null]; you need implement method in order react changes: - (void)observevalueforkeypath:(nsstring *)keypath ofobject:(id)object change:(nsdictionary *)change context:(void *)context { uiimageview *imageview = (uiimageview *)object; // gotta do, save current size in // instance variable can compare , see increase/decrease in size }

while loop multiplication table python -

okay trying accomplish using while loops , using them efficiently. nested while loops tricky me , hard understand. trying make 10x10 multiplication table header. so current code is: firstnumber = int(input("please enter first number: ")) secondnumber = int(input("please enter second number: ")) count = 0 while(count < 1): print("{:17} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5}"\ .format(firstnumber, firstnumber + 1, firstnumber + 2, firstnumber + 3,\ firstnumber + 4, firstnumber + 5, firstnumber + 6, firstnumber\ + 7, firstnumber + 8, firstnumber + 9)) print("{:5} {:}".format(" ", "-"*65)) count += 1 counter = 0 while(counter < 10): downsolution = firstnumber * secondnumber print("{:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5}"\ .format(secondnumber, "|", downsolution,\ downsolu...

javascript - Why is the following map function returning the strings with commas? -

Image
i'm looping through object. if 1 of keys matches value of fields object return value of type of fields object: // objects user: { email: '', password: '' } formfields: [ { name: 'email', type: 'text', required: true }, { name: 'password', type: 'password', required: true } ] // html <input :type="getproptype($key)" // function getproptype (key) { console.log(this.fields) console.log(key) return this.fields.map(field => { if (field.name === key) return field.type }) } it works except comma returned every field.type : which strange since logs don't output commas: what cause? i think trying extract type of object same name value of key, in case more appropriate solution - ie find element given name extract type getproptype(key) { console.log(this.fields) console.log(key); var type; this.fields.some(field => { if (field.name === key) { type =...

Camera's exposure was auto changed when I set custom mode - ios, objective-c -

i'm using avcapturedevice capture video frame image process , control exposure duration, iso using setexposuremodecustomwithduration:(cmtime)duration iso:(float)iso completionhandler:(void (^)(cmtime synctime))handler and think keep exposure level setting. when set mode avcaptureexposuremodecustom, can see preview image's brightness changed when move camera capture different position. (especially light dark side) but when change exposure mode avcaptureexposuremodelocked, brightness fixed. i have been check white-balance, focus, torchmode locked or disable, isadjustingexposure keeping false, , exposure duration , iso parameter not change during problem happening. - (void) setcameraexposure:(cmtime)exposureduration iso:(int)iso { [self.avsession beginconfiguration]; avcapturedevice *videodevice = [avcapturedevice defaultdevicewithmediatype:avmediatypevideo]; if (videodevice) { [videodevice lockforconfiguration:nil]; // set exposure ...

ruby - Rails 4 - Heroku logs -how to make sense of an error message -

i'm trying push code heroku. i error message heroku logs. can't make sense of it. so far can decipher, it's to user , roles models, are: user rolify attr_accessor :current_role has_and_belongs_to_many :roles, join_table: "users_roles" role class role < activerecord::base has_and_belongs_to_many :users, join_table: "users_roles" belongs_to :resource, :polymorphic => true validates :resource_type, :inclusion => { :in => rolify.resource_types }, :allow_nil => true scopify end user_roles join table has: create_table "users_roles", id: false, force: :cascade |t| t.integer "user_id" t.integer "role_id" end add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id", using: :btree can understand error message means? /app/vendor/bundle/ruby/2.3.0/gems/activerec...