Posts

Showing posts from March, 2011

android - How many levels does Firebase ChildEventListener listen to -

my current android application uses firebase store user data. my data has following " structure " ( and/or levels ) my-android-app.firebaseio.com/level0/level1/uuid1/uuid2 data objects stored @ uuid2 resemble this { "students":[ { "name":"amit goenka", "major":"physics" }, { "name":"smita pallod", "major":"chemistry" }, { "name":"rajeev sen", "major":"mathematics" } ] } i need able detect when child data added, removed or changed etc below (at) uuid2, want set childeventlistener using path android-app.firebaseio.com/level0/level1 is possible? during test far have had specify full path of:- my-android-app.firebaseio.com/level0/level1/uuid1/uuid2 firebase fire child_* event change under level register correct listener. fire

task - OpenMP scheduler -

i have problem distributing tasks in openmp. have next code: #include <stdio.h> #include <unistd.h> int cnttotal = 0; int cnt1 = 0, cnt2 = 0; int main() { int i; #pragma omp parallel #pragma omp single nowait (i = 0; < 60; i++) { if (cnttotal < 1) { cnttotal++; #pragma omp task { #pragma omp atomic cnt1++; usleep(10); cnttotal--; } } else { #pragma omp task { #pragma omp atomic cnt2++; sleep(1); } } } printf("cnt1 = %d; cnt2 = %d\n", cnt1, cnt2); return 0; } what didn't, cnt1 = 1 , cnt2 = 59 . think problem in openmp scheduler. or there don't catch. my feeling confuse task instantiation actual execution of task. #pragma omp task refers instantiaton of task , extremely fast. thing idle th

javascript - How to use CSS on autocomplete textbox selected values -

every time client select item autocomplete textbox, automaticly appears in div created right under textbox. style css each selected item appears in div, , not whole div. example, want every selected item appear black border. (i use css on div, i'll border whole div , not on each item selected). that's js code. need add css new selected country. $(function() { /* textbox id */ $("#destinations").autocomplete({ select: function (event, ui) { /* div id */ $("#destinationschosen").html(function(i, origtext) { var selectedcountry = ui.item.value.tostring(); var currenttext = origtext.tostring(); if ((currenttext.indexof(selectedcountry) >= 0)) { alert("already exists"); return currenttext; } return currenttext + " " + selectedcountry; }) }

java - How to vibrate phone in Service? -

i'm programming android studio. want program vibrates phone. if don't open app. should in background , think have write in service. throws exception. how fix it? mainactivity: public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); intent i= new intent(mainactivity.this,silent.class); startservice(i); } silent service: public class silent extends service { public silent() { audiomanager myaudiomanager; myaudiomanager = (audiomanager)getsystemservice(context.audio_service); myaudiomanager.setringermode(audiomanager.ringer_mode_vibrate); } it throws exception: java.lang.nullpointerexception on silent.java.12 it happens on line: myaudiomanager = (audiomanager)getsystemservice(context.audio_service); i suggest move constructor code in oncreate() method of service, called when service

javascript - How do I ensure robust notification of mouseup? -

the goal reliably notified of mouseup events. concrete example, when left-click cloud should turn red , when release button should return blue. this fiddle works: canvas.addeventlistener("mousedown", function(e) { if (e.button === 0) { drawshape("#ff69b4", "red"); } }); canvas.addeventlistener("mouseup", function(e) { if (e.button === 0) { drawshape("#8ed6ff", "blue"); } }); window.addeventlistener("mouseup", function(e) { if (e.button === 0) { drawshape("#8ed6ff", "blue"); } }, true); https://jsfiddle.net/f1x6vc0c/1/ the great evil remains context menu. if click cloud, drag anywhere like, , right-click context menu , release left mouse button while context menu present mouseup forever lost. sure, disable context menu, on pages control - note same aberrant behavior occurs if activate context-menu in other app outside browser window. so, h

qt - Nested MouseArea hover -

i'm having issues nested mousearea s. when click red rectangle triggers exited event on top rectangle (for me @ least). intended behavior? if so, there workaround? edit clarification want able keep hover top rectangle while clicking child rectangle (the top rectangle should stay blue ). useful if want hide , unhide buttons etc. on hover, common practice in web interfaces (html/css). doing causes weird effects clicking buttons has been revealed entered signal disappear when click them. edit i made javascript demonstration wanted behavior: https://jsfiddle.net/uo4vousu/ if click red rectangle parent stays blue, want. in qml example parent becomes green. updated qml code mach jsfiddle. edit it might linux problem. here's example: rectangle { id: top width: 100 height: 32 anchors.centerin: parent color: "green" mousearea { anchors.fill: parent hoverenabled: true onexited: top.color = "gree

jquery - Console log set log level -

i having web application uses jquery , backbone in front end. receiving/sending big amount of data , store of values needed internal process. data send , receive should logged console if , if cookie set log level (trace,info,debug etc..) developer need. please let me know libraries or utilities available.

in app purchase - Bazaar(Iranian Android Market) inAppBilling error in Android 5 Lollipop -

Image
for inappbilling in app use bazaar(iranian android market) api. all things right in in android 5 lollipop not work correctly , return error : after many search found this similar problem , this link this one .( solutions similar together ) so try adding line : serviceintent.setpackage("ir.cafebazaar.pardakht"); after line: intent serviceintent = new intent("ir.cafebazaar.pardakht.inappbillingservice.bind"); now app return errors : java.lang.nullpointerexception: attempt invoke interface method 'boolean java.util.list.isempty()' on null object reference @ farahang.tedamouz.bzrbl.util.iabhelper.setuping(iabhelper.java:227) @ farahang.tedamouz.adapters.slidemenuadapter.onclick(slidemenuadapter.java:155) codes work completely-correctly in under android 5 lollipop versions have problem android 5 lollipop ! for binding play services this: intent = new intent("com.android.vending.billing.inappbilling

javascript - Page jumping after link click - jQuery AJAX call -

i'm making ajax call on link click, every time click, jumps few hundred pixels (not top of page. doing wrong here? // handle gallery nav click $('.gallery-nav-buttons a').click(function(e) { e.preventdefault(); updateimages('#image-container', $(this).attr('href')); return false; }); function updateimages(div, url) { // show loader $('.gallery-loader').show(); // delete current images , hide div $(div).empty(); $(div).hide(); // json getjsonimages(url).then(function(data){ // each image, render html , append div data.data.foreach(function(image) { // append images div var html = constructimagehtml(image); $(div).append(html); // hide loader $('.gallery-loader').hide(); // show image div $(div).fadein(1000); }); // set prev link if (typeof(data.links.prev) != "

sql - Can I choose what table to JOIN based on a CASE? -

for instance, if have table owner this: +-------------------------------+ | id catid dogid fishid | +-------------------------------+ | 1 464 (null) (null) | | 2 (null) (null) 93 | +-------------------------------+ and query similar this: select * owner join cat on owner.catid = cat.id join dog on owner.dogid = dog.id join fish on owner.fishid = fish.id; but instead of joining every time, can use case statement (or similar) "only join cat if value in catid column not null" . possible? each owner id have 1 of cat, dog, or fish (i.e. each owner, 1 not null). no, can use left join values: select owner.*, coalesce(cat.col, dog.col, fish.col) col owner left join cat on owner.catid = cat.id left join dog on owner.dogid = dog.id left join fish on owner.fishid = fish.id; you can choose (first) 1 matches in select .

javascript - How to increase the width of a modal-body of twitter bootstrap modal popup -

i have twitter bootstrap modal popup <div class="modal fade" id="div1" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog custom-class"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="close"> <span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="h2">log</h4> </div> <div class="modal-body"> <asp:gridview id ="gridview1" runat="server" autogeneratecolumns="false"

servlets - Restore attributes after losing session JSP -

i have page in jsp(search page) using differents combos. trying restore search attributes in case of losing session. how best way it? save attributes in cookies in request? you can save attributes in cookies , request both request scope limited , cookies access whole application prefer cookies.

woocommerce - How to remove custom post type slug & taxonomy-base from URL in WordPress -

i using woo-commerce i have bellow code remove post type "product" slug url , works fine. product url = http://example.com/product/product-name/ to product url = http://example.com/product-name/ function df_custom_post_type_link( $post_link, $id = 0 ) { $post = get_post($id); if ( is_wp_error($post) || 'product' != $post->post_type || empty($post->post_name) ) return $post_link; return home_url(user_trailingslashit( "$post->post_name" )); } add_filter( 'post_type_link', 'df_custom_post_type_link' , 10, 2 ); function df_custom_rewrite_rule() { add_rewrite_rule('(.*?)$', 'index.php?product=$matches[1]', 'top'); } add_action('init', 'df_custom_rewrite_rule'); now how remove taxonomy-base url example: product category url = http://example.com/product-category/product-category-name/ product category url = http://example.com/product-category-name/

android - Gradle - Jacoco code coverage without running connectedCheck -

i'm using android studio 1.2.2 , gradle plugin 1.2.3. i'm trying generate code coverage report without running gradlew connectedcheck , gradlew test . want avoid need have connected device or emulator, can speed builds on jenkins server. the best i've been able far include unit tests execution data in report, described here: jacoco code coverage in android studio . useful displaying results tests, @ moment want run unit tests (junit4 , robolectric). is there way edit createdebugcoveragereport gradle task doesn't run connectedandroidtest ? thank you. i managed find workaround. namely, disabling connectedandroidtest task. project.afterevaluate { def append = "append=true" def destfile = "destfile=$builddir/outputs/code-coverage/connected/coverage.ec" testdebug.jvmargs "-javaagent:$builddir/intermediates/jacoco/jacocoagent.jar=$append,$destfile" createdebugcoveragereport.dependson testdebug connect

linux - tar E command line switch -

we're migrating application old solaris box on relatively newer linux machine. i'm having trouble finding equivalent command line option used on our old server when running tar on newer one. i'm assuming obsolete now, don't see via man or searching online indicate why done away with... if has information, appreciated. the version of tar on old server 1.12, , version on new server 1.23. the command ran was: tar cef path-to-tar path-to-tar-up does know whether switch necessary anymore? unfortunately code using switch predates work on project, unaware of why particular switch being used currently.

c - UDP header length field is zero always while capturing sflow data from port 6343 -

i trying capture udp sflow data port 6343. trying capture udp header information provides source port, destination port, udp header length , checksum. able see ports capturing, udp , checksum fields 0 , 1 respectively means udp length not calculated , checksum not calculated. missing here udp header length , checksum calculation ?? following code use: #include<stdio.h> //for standard things #include<stdlib.h> //malloc #include<string.h> //memset #include<netinet/ip_icmp.h> //provides declarations icmp header #include<netinet/udp.h> //provides declarations udp header #include<netinet/tcp.h> //provides declarations tcp header #include<netinet/ip.h> //provides declarations ip header #include<sys/socket.h> #include<arpa/inet.h> #define port 6343 #define pckt_len 65536 void handlepacket(unsigned char *, int); int sockt; int i,j; struct sockaddr_in source,dest; int main() { int saddr_size,data_size; struc

Android RecyclerView which is in a Fragment which is in a ViewPager does not reload/refresh views if setOffscreenPageLimit is reached -

i have recyclerview in fragment again in viewpager , when swipe between viewpager pages, see ondetach of fragment being called reason recyclerview still present in particular position fragment in viewpager , scroll position of recyclerview being preserved when come detached fragment. i using fragmentstatepageradapter viewpager , returning position_none getitemposition() has no effect. please me understand problem here. try points. 1) myadapter extends fragmentstatepageradapter 2) set adapter fragment using getchildfragmentmanager() eg : mviewpager.setadapter(new myadapter(getchildfragmentmanager(), getactivity(), this)) 3) viewpagerfrgment override setuservisiblehint method @override public void setuservisiblehint(boolean isvisibletouser) { super.setuservisiblehint(isvisibletouser); if (isvisibletouser) { //update recyclerview } else { } }

android - Is it possible to set the SharedPreference in the BroadcastReceiver? -

i need generate notification using broadcastreceiver , need save data in broadcastreceiver class. so, used sharedpreference . not able save data insharedpreference`. sharedpreferences pref_date; public static final string mypreferences = "myprefs"; pref_date = context.getsharedpreferences(mypreferences,context.mode_private); _ed = pref_date.edit(); string t="hello"; _ed.putstring(_date,t); _ed.putstring(flag,"0"); _ed.commit(); yes, shareppreference kind of file has key-value pairs store , retrieve. can access anywhere within application. services created application.

php - Zend Framework : Zend Dojo Data -

i using zend dojo data pulling data table composite key (2 keys primary key) identifier. zend dojo data allows pass 1 key identifier setidentifier ('id'). if data set based out of 'id' , 'name' unique identifiers? setidentifier('id','name') kind of function available? or have work around ? zend dojo data reference please guide. regards, subeesh

Reading the different columns of csv file in C -

i have csv file has 2 columns named; timestamp, snr (int values). have write function asks first user input; value user wants? sample file: timestamp ; snr 16:15:12:468 ; 15 16:15:12:968 ; 20 for example: if enter snr , function should give me column no. of snr; (that column 2 here) values of snr. output : col. no. 2 15 /* time difference of ((16:15:12:968)-(16:15:12:458) = 500ms between these 2 output values*/ 20 but these values should given output on time interval. implies timestamp column has read first , difference between 2 timestamp (current & next) values should calculated. snr should given output on interval of difference between these 2 timestamp values. not want use array or structures because don’t want store values; require these values pass on other application on time interval. i wrote following code. user input , output column no. of file, not able content of these colum

javascript - jQuery $.post returning Object length: 0 -

i'm trying make pagination script using ajax, refuses grab correct id. code here $(document).on('click','#pagination a',function(e){ e.preventdefault(); var link = $(this).attr('href'); var $content = '.everything'; $.post(link+'', function(data){ var $new_content = $($content,data); console.log($new_content); },'html'); }); this returning following in console: object { length: 0, prevobject: object, context: undefined, selector: ".everything" } the object .everything exists in dom, item appears if console.log(data); . element contains 2000 characters. the issue doesn't happen when try grab element less content doing console.log($('.logo',data)); when elements in html snippet, inside outermost element. for example $('span', '<div><span></span></div>') returns jquery object containing span element, $('div

jsf - commandButton/commandLink/ajax action/listener method not invoked or input value not set/updated -

Image
sometimes, when using <h:commandlink> , <h:commandbutton> or <f:ajax> , action , actionlistener or listener method associated tag not being invoked. or, bean properties not updated submitted uiinput values. what possible causes , solutions this? introduction whenever uicommand component ( <h:commandxxx> , <p:commandxxx> , etc) fails invoke associated action method, or uiinput component ( <h:inputxxx> , <p:inputxxxx> , etc) fails process submitted values and/or update model values, , aren't seeing googlable exceptions and/or warnings in server log, not when configure ajax exception handler per exception handling in jsf ajax requests , nor when set below context parameter in web.xml , <context-param> <param-name>javax.faces.project_stage</param-name> <param-value>development</param-value> </context-param> and not seeing googlable errors and/or warnings in browser's jav

java - Dagger 2 not generateing components on Eclipse -

i have created java application eclipse , i'm using maven package management. several days ago able configure application work dagger 1 (adding dependencies pom file, enabling annotation processing , adding dagger, dagger-compile, javax , javawriter jars factory path). after several discussion colleagues decided use dagger 2. tried migrate dagger 1 implementation dagger 2 following dagger 2 documentation , did not work. for unexplained reason @component class dagger prefix not generated. because of decided try dagger 2 coffee sample . i created new eclipse java project, converted maven, added sample code , dagger 2 dependencies pom file: <dependency> <groupid>com.google.dagger</groupid> <artifactid>dagger</artifactid> <version>2.0.1</version> </dependency> <dependency> <groupid>com.google.dagger</groupid> <artifactid>dagger-compiler</artifactid> <version>2.

How can I split a string with accents in PHP? -

i split hurgarian strings have accents. use code: if(strlen($row['title'])<=20) { echo $row['title']; } else { echo substr($row['title'], 0, 17)." ..."; } i store these datas latin2_hungarian_ci coding in database , use charset in php files. both in php , html part: header('content-type: text/html; charset=utf-8'); <meta http-equiv="content-type" content="text/html; charset=utf-8"> but way if last character non english character (é,á,ö,ü,ó,ő,ú,ű,í) isn't appears well. against character appears � simbol. if don't use substr write whole tite out everíthing works good. now example: végzet erekly� ... or Északi széless� ... i can't understand substr, because in examples 1 of them write 15 characters , simbol, other 1 16 characters , simbol. how can write out first x characters of them? use iconv function change charset latin2 utf-8 , make mb_su

linux - How to deploy a self-building Docker image to make changes to itself in respect to the local environment? -

as quick recap, docker serves way write code or configuration file changes specific web service, run environment, virtual machines, cozy confines of linux terminal/text file. docker images save points of layers of code made either dockerfiles or can created containers require base image go off of anyways create. dockerfiles serve way automate build process of making images running desired commands , actions new containers spawned , roll them 1 file. now great , want take step further. building images, dependencies encumbersome because 1,you have rely on commands either not there within default os image, or 2, have lot of other useless commands not needed. now in head feel possible cant make connection yet. my desire dockerfile build scratch (litterally image of scratch) and build according. copy dependencies desired rpm or something, install it, find start command, , relay dependencies thats needed succesfully create , run image no flaw docker file. in programming sense, fr

java - Spring MVC no setter found for property 'xxxx' in class 'xxxx' -

i'm getting 4 'no setter found property 'xxxx' in class com.rusapp.batch.trans.olfmwriter'. fifth bean in class not have error, inputqueue. rest have errors in xml below @ each of property lines. the beans appear such: <bean id="inputqueue" class="com.rusapp.batch.trans.olfmwriter"> <property name="inputqueue" value="${${env}_mq_fm_input_queue}" /> </bean> <bean id="replyqueue" class="com.rusapp.batch.trans.olfmwriter"> <property name="replyqueue" value="${${env}_mq_fm_reply_queue}" /> </bean> <bean id="mqconnectionfactory" class="com.rusapp.batch.trans.olfmwriter"> <property name="mqconnectionfactory" ref="mqconnection" /> </bean> <bean id="jmsdestination" class="com.rusapp.batch.trans.olfmwriter"> <property name="jmsdestination&q

c# - Protected Memory Exception on Images when Fonts are Called -

Image
edit: so, see what's happening, don't understand why. dictionary<string, object> storing fonts fine, there's particular function runs, , when runs, dictionary gets partly wiped out. before: after: the code running between these images is: public static int countlines(string a) { int count = 0; string line; system.io.streamreader file; try { file = new system.io.streamreader(@a); } catch (exception ex) { messagebox.show("missing " + + "\n\n" + ex.tostring(), "exception"); return 0; } while ((line = file.readline()) != null) { if (line.substring(0, 2) == "10") { count++; } } file.close(); return count; } ---end edit--- i'm getting this tracedump when use many custom fonts. i'm using same solution listed here , , have tried vot

java - Index that is continually written to and queried -

i using lucene 5.2.1. i trying figure out how should opening indexreader s indexwriter s , indexsearcher s such can have index have items continually written whilst queries going on. currently code: path indexpath = paths.get("index"); directory dir = niofsdirectory.open(indexpath); indexwriterconfig iwc = new indexwriterconfig(new standardanalyzer()); iwc.setopenmode(indexwriterconfig.openmode.create_or_append); indexwriter indexwriter = new indexwriter(dir, iwc); indexreader indexreader = directoryreader.open(indexwriter, false); if start app , start putting documents index, can query fine. however, when stop app , restart, observing index directory being truncated (so added directory lost) i not see close() on variable dir (niofsdirectory), , commit() and/or close() on indexwriter(indexwriter). might need close these flush rest of data file. two notes found in niofsdirectory class 5.2.1. first note important windows o/s. note: niofsdirectory

Efficiently capture variable number of patterns with Julia regex? -

i pulling data out of giant text files sections interested in like ... section:numberofsurvivorspervault subsection:1958 xy:1_1034 xy:2_2334 subsection:1959 xy:1_1334 xy:2_2874 xy:7_12 ... section:meancapsperghoul subsection:1962 xy:1_234 xy:2_121 .... the sections/subsections randomly scattered throughout text file , have variable numbers of xy pairs. right readall'ing full text , capturing each , adding them dataframe with: function pushparametricdata(df, full) m = eachmatch(r"section:(.*)\r\nsubsection:([0-9]*)\r\n((xy:[0-9]*_.*?\r\n)+)"m, full) r = eachmatch(r"xy:([0-9]+)_(.*?)\r\n"m, m.captures[3]) push!(df, [m.captures[1], int(m.captures[2]), int(r.captures[1]), float(r.captures[2])]) end end end this works ok, think allocates @ least twice memory needs due 2 regexes, , @time shows 80% of run gc. there way can done without making intermediate copy? (from can tell it's not possible single regex).

neo4j - SDN4 - What are recommended strategies for doing auditing? -

i using spring data neo4j 4.0.0.rc1 build crud application , interested in auditing each , every operation performed on nodes , relationships, e.g. crud. general strategies accomplishing this? i aware of event listeners they best option available capturing audit information? impression neo4j may not inherently suitable store information - db typically recommended? depends on want information, how want access / query it. how need access etc. easiest dump audit-log file. otherwise database should able store kind of simple structured records.

c++ - Does the number of active visible HWNDs in Windows 7 (or up) affect performance notably? -

the question vague admittedly i'm trying avoid going down design rabbit hole. i'd heard anecdotally creating hundreds of buttons , other controls in application less performant writing own windowless controls , handling mouse click/move/tracking/capture logic self. i'll preference use hwnd based controls because don't have reinvent wheel not if application become unusable. based on experience hwnd-heavy application don't think encounter significant general performance problems. you will, however, need make sure you're not exceeding per-process , per-session handle limits ( which default 10,000 process , 32,768 session ) if going crazy creating o/s windows. at point, unable create new handles (and therefore unable create new window objects), application start acting in bizarre ways, , it's downhill there. you can run low on desktop heap when create tons of o/s handles, , can cause other instability issues. these reasons it's best des

Python Only Writes One of Three docs Using open() read() write() -

i have multiple html files copy+pasted single word doc reporting. i'm trying combine files opening file1 , copying test.doc . then, open file2 , append test.doc , , on. python writes file1 test.doc , , seems skip file2 , file3 . i've tried looping through each file , writing, had same result. i've tried few different file types, changing .html .txt . i think <html>report contents</html> stopping it. a push in right direction appreciated! import os file in os.listdir(os.getcwd()): newname = os.path.splitext(file) if '.html' in file: newfile = file.replace('.html', '.doc') os.rename(file, newfile) else: print('no html files convert, writing report') mainfile = open('test.doc', 'a') file1 = open('filetocopy1.doc', 'r') read1 = file1.read() mainfile.write(read1) file1.close() file2 = open('fil

windows - PostgreSQL cannot connect: service definition not found -

Image
in windows 10 pro 64-bit & new installation of postgresql 9.4, attempting connect server in pgadmin iii results in the service running , service name correct, seen here i brand new postgresql, fwiw, i've configured working symfony 2.7 application use postgresql , have (according symfony console) created database , schema. what required pgadmin connect properly? it turns out error message grossly misleading. there no issue service definition. instead, learned when logged in user other user created postgresql installation (e.g., postgres ) 1 needs @ command prompt: runas /user:postgres "c:\program files\postgresql\9.4\bin\pgadmin3.exe" there may more elegant solution making above cmd file. i'd know is!

markdown - add local image file in R presentation -

i'm trying include 1 imaging file ( .png ) using r markdown r presentation. followed suggestion from: how import local image using knitr markdown using ![title](my.png) , error: error: unexpected '[' in "![" the my.png file in current path. tried using absolute path got same error message. putting above inside r chuck failed too. i tried ```{r,fig.width=350, fig.height=250,echo=false} library(png) library(grid) appimg <- readpng('my.png') grid.raster(appimg) ``` but failed too! i working on windows 7 r studio 0.98.1102 , r 3.2.1 . after huge mount of google search. finanlly figure out problem. the key html cannot refer local file security reason. except local html file, can refer local file in same file directory. and r presentation html file webpage. so, put image file same directory html file, things work. @ least worked me. just use ![some caption](img_file_name.png)

osx - Applescript a "Retry" button -

i'm coding application password field: set password1 text returned of (display dialog "to continue please enter special passcode below." buttons {"cancel", "continue"} default button 2 default answer "" cancel button 1 hidden answer) if password1 "passwordhere" display dialog "you have entered password right! right password was: passwordhere entered password was: " & password1 buttons {"cancel", "continue"} default button 2 cancel button 1 else if password1 "" set password1 "empty passwordfield" end if display dialog "you have entered password wrong! right password was: ******** entered password was: " & password1 buttons {"cancel", "try again"} default button 2 cancel button 1 end if end now question is: how make "try again" button return first display dialog? possible? if not please in answer. also question

How to deal with distinction of parameters in Java? -

i need method expects different parameters, , behave differently depending on parameters, in example: public void dosomething(a a, b b, c c) { dosomegeneralstuff(); if a.ispresent() { dosomethingwitha(); } if b.ispresent() { dosomethingwithb(); } if c.ispresent() { dosomethingwithc(); } } an alternative this: public void dosomething(a a) { dosomegeneralstuff(); dosomethingwitha(); } public void dosomething(b b) { dosomegeneralstuff(); dosomethingwithb(); } public void dosomething(c c) { dosomegeneralstuff(); dosomethingwithc(); } but have bunch of redundant code in second example, that's why i'm still not satisfied. other patterns deal problem? you can use inheritance. have common interface of a , b , c . public void dosomething(common abc) { dosomegeneralstuff(); abc.dosomethingwithabc(); } interface common { void dosomethingwithabc(); } class implements common {

node.js - npm error code EPEERINVALID while installing mongoose-auto-increment and mongoose-simpledb -

hi have encountered following error while installing npm package mongoose-auto-increment , mongoose-simpledb both globally , locally. the error follows mongoose-auto-increment npm warn peerdependencies peer dependency mongoose@~4.0.0 included mongoose-auto-increment no npm warn peerdependencies longer automatically installed fulfill peerdependency npm warn peerdependencies in npm 3+. application need depend on explicitly. npm err! darwin 14.0.0 npm err! argv "node" "/usr/local/bin/npm" "install" "mongoose-auto-increment" npm err! node v0.12.4 npm err! npm v2.11.2 npm err! code epeerinvalid npm err! peerinvalid package mongoose not satisfy siblings' peerdependencies requirements! npm err! peerinvalid peer mongoose-auto-increment@4.0.0 wants mongoose@~4.0.0 npm err! please include following file support request: npm err! /users/febinp/downloads/shubham_application/project/npm-debug.lo

matlab - Human sensible outputs from finverse -

i using finverse , giving strange simplifications example >> syms x >> f = -0.0185*x^2 + 12.4698; >> finverse(f) ans = (2^(1/2)*185^(1/2)*(62349 - 5000*x)^(1/2))/185 rather simpler sqrt(12.4698 - x) / sqrt(0.0185) or effect. there way force "human sensible outputs"? tried simplify didn't much. you can used function simple syms x f = -0.0185*x^2 + 12.4698; z = finverse(f) v = simple(z); z = (2^(1/2)*185^(1/2)*(62349 - 5000*x)^(1/2))/185 >> v v = (23069130 - 1850000*x)^(1/2)/185 remove ; @ end of function calls, see @ different simplification.

C - Variadic macro which expands into set of macro calls on each argument -

i want have single macro call takes in multiple function pointers, , each function pointer called second macro function declaration. i want 2 macros on form #define function_def(func) extern int func(void); #define function_defs(...) (???) which called such function_defs( myfunc1, myfunc2, otherfunc1, otherfunc2, defaultfunc ) which expands into function_def(myfunc1) function_def(myfunc2) function_def(otherfunc1) function_def(otherfunc2) function_def(defaultfunc) in other words, single call function_defs expands function declarations of variadic arguments. currently i'm skipping first step , calling function_def on each function pointer, solution great. is possible? edit: thanks @vality introducing me x-macro. found post " real-world use of x-macros " needed. i not believe want precisely possible using standard c preprocessor. similar solution can accomplished x macros. to equivalent of code using them first d

excel - How to Return Values Using Rows and Columns as Variables (i, j)? -

i trying redesign table ease analysis , use of formulas in it. have list of customers , column each state. if customer has document state, cell filled in expiration date of document, otherwise cell remains empty. new table want create must bring list of documents customer , state. instead of having 50 columns 50 states of us, have column named "state" , column returning "expiration date" of document. new table ignore blank cells first table, means customer not have required document. built macro, runs no errors no changes. nothing happens. doing wrong? sub allcertificates() ' define variables dim database range set database = sheets("database").range("a2:ba10000") dim databaseh range set databaseh = sheets("database").range("a1:ba1") dim nstates integer nstates = database.columns.count dim ncustomers long ncustomers = database.rows.count dim ncerts long nce