Posts

Showing posts from September, 2010

Oracle SQL - Select only few elements from group -

i have following table representing tasks in processes: task_id | process_id | task_type_id ========+============+============= 1000 | 1 | 1001 | 1 | b 1002 | 1 | c 1003 | 1 | d 1004 | 2 | 1005 | 2 | c 1006 | 2 | d 1007 | 3 | 1008 | 3 | c 1009 | 3 | d i want isolate different process types. process type defined unique sequence of tasks. the following query select process_id, count(*) tasks_no, listagg(task_type_id,'>') within group (order task_id) task_sequence mytable group process_id can isolate task sequences: process_id | tasks_no | task_sequence ===========+==========+============== 1 | 4 | a>b>c>d 2 | 3 | a>c>d 3 | 3 | a>c>d now want aggregate result: task_sequence | tasks_no | process_no | proc_rep_ids ==============+==========+============+========

javascript - Highlight selected word -

i need implement both highlight , un-highlight selected text in textarea. please me implement one. tried following code highlight , un-highlight $('.highlight').click(function(){ var selection= window.getselection().getrangeat(0); var selectedtext = selection.extractcontents(); var span= document.createelement("span"); span.style.backgroundcolor = "yellow"; span.appendchild(selectedtext); selection.insertnode(span); }); $('.remove_highlight').click(function(){ var selection= window.getselection().getrangeat(0); var selectedtext = selection.extractcontents(); var span= document.createelement("span"); span.style.backgroundcolor = "white"; span.appendchild(selectedtext); selection.insertnode(span); }); here, .highlight , .remove_highlight separate buttons, in advance

Swift Struct's Reference Count -

i have question struct in wwdc2016, session recommend use sturct (value type) but if structs have 3 more inline variable words, struct must manage reference count store large value heap then question is when struct have 3 struct , each struct have 2 or 3 struct or value type i want know how works whether using reference count or not in situation below example of structs struct viewmodel { var titlemodel: titlemodel var contentmodel: contentmodel var layoutmodel: layoutmodel } struct titlemodel { var text: string var width: float var height: float } struct contentmodel { var content: string var width: float var height: float } struct layoutmodel { var constant: float var multiply: float } structures , enumerations have value-semantics. there no notion of reference count, because passed copying. members may pointers reference-types, pointer copied. long don't have reference-type in structure, don'

c# - Test Windows Store App as if I didn't purchase an IAP -

i'm testing app iap. want test change when purchasing iap, can't because have purchased it. there way "unpurchase" it? (it's durable , not consumable .) i know can workaround such adding code imitate iap purchase. point want verify works, not assume workaround correct. by using currentappsimulator , can simulate purchase status , change want, , app behave it's not begin simulated :) in article, there's full implementation , docs: https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.store.currentappsimulator.aspx

Adding minutes to time in PHP -

i'm trying add 60 or 90 minutes given time using php. i've tried doing in 2 ways, both ending unexpected result. input data: $data['massage_hour_from'] = '09:00:00'; $data['massage_duration'] = 60; first try: $data['massage_hour_to'] = date('h:i:s', strtotime('+' . $data['massage_duration'] . ' minutes', strtotime($data['massage_hour_from']))); second try: $datetime = new datetime($data['massage_date']); $datetime->settime($data['massage_hour_from']); $datetime->modify('+' . $data['massage_duration'] .' minutes'); $data['massage_hour_to'] = $datetime->format('g:i:s'); what doing wrong? i replaced variable names shorter ones, code works: $from = '09:00:00'; //starting string $duration = 90; //in minutes $date = new datetime($from); $date->add(new dateinterval("pt{$duration}m"));//add minutes $

sql - Identifying continuous stay using mysql -

can identifying continuous stay based on dates , site name. example sample below - name start_dt end_dt site 2015-01-07 2015-01-31 tss 2015-02-01 2015-02-28 tss 2015-03-01 2015-03-14 tss 2015-03-21 2015-03-31 tss 2015-04-01 2015-04-11 tss expected output: name start_dt end_dt site 2015-01-07 2015-03-14 tss 2015-03-21 2015-04-11 tss if possible assign stay id output. thanks! the idea identify periods of adjacent stays start. can left join see if previous stay ends on day before. then, accumulating flag on day provides grouping mechanism identifying groups of adjacent stays. information rest aggregation: select name, site, min(start_dt), max(end_dt) (select t.*, (case when t2.site null 1 else 0 end) startflag, (@cnt := if(@s = site, @cnt + (case when t2.site null 1 else 0 end), if(@s := site, 1, 1)

Enabling git in Windows 10 command line -

i cannot seem make git work native windows command line. have tried powershell, have path git bin in environment variables, still giving me " command not found " when type git . have looked @ solutions here , , none of them work me. don't have c:/program files/git folder (or program files(x86)) . i can make command line git work if open git desktop app , use "open terminal git enabled" option there. that , good, except opening desktop app takes forever on laptop, , prefer able whip out command line pull code. i open reinstalling git , following specific instructions, or installing more workable version of git, if has suggestions. thank you. simply uncompress latest git windows release portable archive (like portablegit-2.7.2-64-bit.7z.exe ) anywhere want , add path: c:\path\to\git;c:\path\to\git\bin;c:\path\to\git\usr\bin;c:\path\to\git\mingw64\bin you git-bash.exe (recent 4.3+ bash based on msys2 ), 200+ unix commands right in regul

SQL table with a choice list (in pure SQL or with Java) -

i willing create myself table in database make. don't know how create choice list fill fields. i explain problem more specifically. want obtain this ...................................................... table employees (just example) ....................................................... index / name / profession 1 / john / manager ..........<= here choice list between possible jobs have how can this? want employee table editable (like in gui interface in java), , values of profession can edited (meaning, can select different value choice list). many in advance help! tom i recommend have 2 tables in db. 1 employee , 1 jobs.. in ui (java) have business populate drop down jobs table.. when save ui info have write in both tables if necessary. e.g. employee table: id, name, job_id , job table id, name. need 2 methods 1 read employee , 1 read jobs. dropdown have 3 properties: id (id job table, display - name job table , binding value

selenium - Selenuim xpath each element 5 -

i new in selenuim . use selenuim , xpath selector.i know how element.but how use xpath each element 5? you can solve in language of choice. python for example, in python, extended slicing allows rather simply : driver.find_elements_by_xpath("//table/tr")[0::5] you can use position() function , mod operator: //table/tr[position() mod 5 = 0] driver.find_elements_by_xpath("//table/tr[position() mod 5 = 0]") java list<webelement> elements=driver.findelements(by.xpath("//tbody/tr[position() mod 5 = 0]")); system.out.println(elements.size()); (webelement element : elements) { system.out.println(element.gettext()); }

FormatException when passing DateTime.toString() to AppendFormat C# .NET -

i'm trying following: var policybuilder = new stringbuilder(); var expiration = datetime.utcnow.adddays(1).tostring("s") + "z"; policybuilder.appendformat("{ \"expiration\": \"{0}\",\n", expiration); however, last line throws following exception: exception of type 'system.formatexception' occurred in mscorlib.dll not handled in user code additional information: input string not in correct format. 'expiration' string, why getting error? thanks if want { @ beginning have use two: policybuilder.appendformat("{{ \"expiration\": \"{0}\",\n", 10); see: escaping braces in composite formatting opening , closing braces interpreted starting , ending format item. consequently, must use escape sequence display literal opening brace or closing brace. specify 2 opening braces ("{{") in fixed text display 1 opening brace ("{") ,

c# - checkbox value not inserting in database -

Image
whenever checkbox in dialog box checked , after clicking button doesn't save data database save 'n' checkbox checked saves 'n' how solve problem. want save 'y' database if checkbox checked. html:-this html section in checkbox declared <form id="form1" runat="server"> <div id="dialog"> <label>first</label> <asp:checkbox id="checkbox1" runat="server" /> <label>second</label> <asp:checkbox id="checkbox2" runat="server" /> <label>third</label> <asp:checkbox id="checkbox3" runat="server" /> </div> <asp:button id="button1" runat="server" text="button" onclick="button2_click" /> </form> jquery:-here jquery script.dialogbox checkbox <script type="text/javascript">

c# - Create a dynamic horizontal repeating table in Infopath 2013 based on a previously given number? -

problem: have regular repeating table when comes rows need columns repeat based on difference between 2 fields. ex. difference field has value 4 table needs have 4 columns (the number of rows variable because of repeating table control). the problem lies in fact there no maximum difference, can value, creating columns , adding formatting rules hide them isn't feasible solution. is there way using c# can create new field or table, or access created table in infopath form? https://docs.google.com/spreadsheets/d/1nj5xouved-chtsjkgjom_qnxkf5ktbr4otdsjmmukkw/edit?usp=sharing the link above excel sheet small demonstration of expected output. thanks.

javascript - Could you provide an example on "datatables.typescript.definitelytyped"? -

i want know benefit of "datatables.typescript.definitelytyped" package. also please let me know there site can take create application data table? i know how create datatable normal jquery-datatable , angular-datatable. however, want know "datatables.typescript.definitelytyped" datatable?

c++ - How do you approach a private variable from a different class -

void user :: buyapples(){ while(1){ cout<<"how many want buy? press 0 quit.";cin>>qq; if(qq==0) return ; if(qq<= f.getnumofapples()){ if(salary>=(qq*200)){ invofapples+=qq; salary-=(qq*200); showsalary(); } else{ cout<<"not enough money"<<endl; void homescreen(); } } else{ cout<<"there's not enough apples in stock"<<endl; continue; } } } this code market qq being input using cin. i can change salary , private variables in user class. but need change private variables in fruit class int numofapples . how can change numofapples ? i can't seem change variable user class. when tried change fruit class, qq doesn't carry over. do? if want access private variable

regex - Regex_replace not replacing correctly in Oracle SQL -

i'm trying following regex expression work oracle sql: select regexp_replace(' "abc_78": 123, ', '.*?abc.*?: (.*?),.*', '\1') dual; select regexp_replace(' "abc_78": 123, "def_79": [', '.*?abc.*?: (.*?),', '\1') dual; the first 1 returning "123" (which deem correct) while second 1 returning "123 "def_79": [" . what's issue @ stake here? bad regex or weird functioning of oracle? regex seems work when tried against sublime text. i'm running query directly off oracle sql developer. thanks it's replacing correctly. select regexp_replace(' "abc_78": 123, "def_79": [', '.*?abc.*?: (.*?),', '\1') dual; first: (regex engine) finds '"abc_78": 123' 123 group $1. replaces 'abc_78: 123' group 1 123. and have little diffrence in regex patterns like: '.*?abc.*?: (.*?

ios - addSubview on cellForItemAtIndexPath issue in Swift -

i have collectionview custom cells. trying add dynamic labels in each cell, added last cell shown. if make scroll, labels disappear of cell , appear in new cell shown. number , text of labels achieved web service. cellforitematindexpath function: override func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { let cell = collectionview.dequeuereusablecellwithreuseidentifier(reuseidentifier, forindexpath: indexpath) as! undatedcell cell.titlelabel.text = "sacar al perro" cell.locationlabel.text = "casa" var aux: cgfloat = 0 label in labelsarray { let labelwidht = calculatelabelwidht(label) + 20 cell.labelsview.addsubview(label) label.leftanchor.constraintequaltoanchor(cell.labelsview.leftanchor, constant: aux).active = true label.centeryanchor.constraintequaltoanchor(cell.labelsview.centeryanchor).ac

c++ - OpenCV SVM HOG detector svm.predict() exception -

i using visual studio 2013 opencv 2.4.11 trained svm with xml file of positiv , negative samples. here code want compare image. build ok, when run debug it's break on svm.predict(). unhandled exception @ 0x00007fff43148a5c in consoleapplication2.exe: microsoft c++ exception: cv::exception @ memory location 0x000000af2d16eca0. and there in local variables near svm information not available, no symbols loaded opencv_ml2411d.dll any idea or clue what's wrong? void compare() { //variables char fullfilename[100]; char firstfilename[100] = "e:\dropbox/dip/images/train/"; int filenum = 5; //262; //load trained svm xml data cvsvm svm; svm.load("e:/dropbox/dip/images/train/trainedsvm.xml"); //count variable int nnn = 0, ppp = 0; (int = 1; i< filenum; ++i) { sprintf_s(fullfilename, "%s%d.jpg", firstfilename, + 1); //printf("%s\n", fullfilename);

ios - Location service randomly not working -

Image
i have strange issue apple location service. first of code i'm using user location: import corelocation @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate,uisplitviewcontrollerdelegate,cllocationmanagerdelegate { //core location let locationmanager = cllocationmanager() func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. //core location // ask authorisation user. self.locationmanager.requestalwaysauthorization() //clore location // use in foreground self.locationmanager.requestwheninuseauthorization() if cllocationmanager.locationservicesenabled() { locationmanager.delegate = self locationmanager.desiredaccuracy = kcllocationaccuracynearesttenmeters locationmanager.startupdatinglocation() } r

laravel - Zizaco entrust does not create the entrust.php -

why file entrust.php not created when run this: php artisan vendor:publish i'm following this config , composer.json "zizaco/entrust": "5.2.x-dev" "you can publish configuration package further customize table names , model namespaces. use php artisan vendor:publish , entrust.php file created in app/config directory." file entrust.php not created. can do? odd. in link provided and, if not appear, manually copy /vendor/zizaco/entrust/src/config/config.php file in config directory , rename entrust.php.

linux - Bluetoothctl without any user interaction -

right can pair , connect phone machine without user interaction in way: $bluetoothctl #power on #discoverable on #pairable on #agent noinputnooutput #default-agent from phone search bt device , pairs , connectly automatically. have 2 problems: it still asks authorize services: authorize service [agent] authorize service 0000110e-0000-1000-8000-00805f9b34fb (yes/no): but not because i've specified noinputnooutput ! how trust device? it's enough type trust need automatically same reason. in general, there reliable c++ library handle bluetooth connections , common profiles a2dp , hfp?

r - How to paste into RStudio data on the clipboard -

this regular "trick": data=read.table(stdin(),header=true, sep=" ") however, if try copy , paste following: per weight cat 1 0.9753 0.1653 cat 2 0.9896 0.1891 cat 3 0.9911 0.1673 cat 4 0.9816 0.1667 cat 5 0.9926 0.1748 cat 6 0.9786 0.1367 using line of code above, several error messages: more columns column names - self explanatory... or... error: unexpected numeric constant in "1 0.9753" so, should address these error messages, or there way import data, , deal inconsistencies within rstudio?

not connecting to web socket properly in gatling -

i want connect web socket through gatling. not working. socket listener not messsage. code given below.can suggest problem? there recording option websocket in gatling. recorder record http requests. `val scn = scenario("recordedsimulation") .exec(http("login") .post("/user/login") .formparam("email", "username") .formparam("password", "*******") .check(headerregex("set-cookie", "localhost:1337.sid=(.*); path=/").saveas("cookie"))) .pause(5) .exec(http("get sid") .get("/socket.io/?eio=3&transport=polling&t=1468496890883-0") .headers(headers_3) .check(regex("\"sid\":\"(.*)\",").saveas("sid")) ) .pause(4) .exec(ws("connect websocket").open("/socket.io/?eio=3&transport=websocket&si

dialog - How to Catch Input from Card Reader Pin Pad -

i new android. currently, developing application performs credit card transaction each time payment made, phone connected card reader through audio jack port. in order make payment successful, credit card authorized user needs enter pin( pin entered card reader ). @ stage, application prompt dialog box request user enter pin. so, here hardest part. when dialog box appears, user shall enter pin number pin pad( from card reader connected phone ) instead of entering soft keypad(from phone).i have been googled around seems haven't met looked , noticed in order this, need implement input method manager. still figuring out how can done , appreciate if of me solution. in advance here code dialog box appears final edittext et = new edittext(iccardactivity.this); new alertdialog.builder(iccardactivity.this) .settitle(title) .setview(et) .setpo

java - Hibernate doesn't use setter when field is null -

i want validate data before saving db (check if field not null, add matches regex in setter). if field null, hibernate doesn't use setter. should in case? @column(name = "table_name") private string tablename; public void settablename(string tablename) { assert.hastext(tablename); // assert.hastext() - method spring util this.tablename = tablename; } so want method assert.hastext() throw exception if tablename null. please, take @ hibernate docs. hibernate annotations can validate lot of cool things like: null fields, field size, etc ... here's doc: http://hibernate.org/validator/documentation/getting-started/ it's friendly ;)

how to upload multiple files using flask in python -

here code multiple files upload: html code: browse <input type="file" name="pro_attachment1" id="pro_attachment1" multiple> python code: pro_attachment = request.files.getlist('pro_attachment1') upload in pro_attachment: filename = upload.filename.rsplit("/")[0] destination = os.path.join(application.config['upload_folder'], filename) print "accept incoming file:", filename print "save to:", destination upload.save(destination) but uploads single file instead of multiple files. how to in template, need add mulitple attribute in upload input: <form method="post" enctype="multipart/form-data"> <input type="file" name="photos" multiple> <input type="submit" value="submit"> </form> then in view function, uploaded files can list through request.files.getlist('ph

php - Sonata admin - custom menu item roles -

how can setup custom roles custom routes without sonata admin, using sonata admin menu builder. sonata.admin.group.content: label: test label_catalogue: test icon: '<i class="fa fa-file-text"></i>' items: - route: custom_route_1 label: 'custom_route_1' - route: custom_route_2 label: 'custom_route_2' - route: custom_route_3 label: 'custom_route_3' i want setup separate roles each element of menu. you must add option roles in yml code : sonata.admin.group.content: label: test label_catalogue: test icon: '<i class="fa fa-file-text"></i>' items: - route: custom_route_1 label:

xamarin.forms - Bind Custom Object Type in Xamarin Forms -

i'm working xamarin forms @ moment , i'm impressed mvvm concept , try use bindings recommended. if have textfield want display text in bind textfield string. thing though bind custom object-type instead. let's represents order id. order id displayed string of special format. let's 10 characters, 2 first country code, rest individual. nice have contained in object can validate self. there way can bind custom object? how control how represented in view? should use tostring()? bit unflexible since perhaps display bit differently in different context. any feedback helpful(except validation in order, know how that). have tried binding text field custom object's property? such <entry text="{binding customobject.id}"/> or label.setbinding(label.textproperty, "customobject.id");

python 2.7 - ImportError: Numpy OpenBLAS flavour is needed for this scipy build -

i use python 2.7 on pycharm , try make surface file points , read way through libraries matplotlib, mpl_toolkits. when run code copy example's web have error: c:\python27\python.exe c:/users/rublloal/pycharmprojects/untitled3/matplotlib1.py traceback (most recent call last): file "c:/users/rublloal/pycharmprojects/untitled3/matplotlib1.py", line 10, in scipy.misc import imread # cargo imread de scipy.misc file "c:\python27\lib\site-packages\scipy__init__.py", line 122, in raise importerror("numpy openblas flavour needed scipy build.") importerror: numpy openblas flavour needed scipy build. thanks i use python 2.7 on pycharm , downgrade scipy 0.18 0.16 , had same problem you, reinstall numpy - (numpy-1.10.0b1-cp27-none-win32.whl) pip. you can find wheel here: https://pypi.anaconda.org/carlkl/simple/numpy/ , problem disappear. maybe answered late, hope else :)

linking C code with Fortran module.function() -

i have build c shared library (.so) under solaris, in order use dlm (dynamic loadable module) exelis idl language. this c library must use fortran f90 functions, included in fortran modules. i compile both c , fortran code (with -fpic, -g, ...) have problem call fortran libraries c. in .so files, fortran functions included in modules named module.function eg: $ nm idl_spi.so [290] |...|func |glob |0 |15 spi_m_libscient.spi_scient_init_common_ in c code, can't use of : spi_scient_init_common_() => symbol not found in library (uncomplete name) spi_m_libscient.spi_scient_init_common_() => unknown structure spi_m_libscient is there way call fortran module_name.function_name() c ? or change fortran behaviour when compiling module.function(), rename example module__function in objet file i find f90 command line option

Android, How can i set the fragment to display in the activity even closing the app? -

is there way save fragment on change?even after closing app , open again fragment stay there you can use shared preferences save variables you'll need next time open app. look @ documentation. protected void ondestroy(){ super.ondestroy(); sharedpreferences sharedpref = getactivity().getpreferences(context.mode_private); sharedpreferences.editor editor = sharedpref.edit(); editor.putint(getstring(r.string.saved_high_score), newhighscore); ... editor.commit(); } protected void oncreate(){ sharedpreferences sharedpref = getactivity().getpreferences(context.mode_private); long highscore = sharedpref.getint(getstring(r.string.saved_high_score), defaultvalue); ... }

java - I am stuck in scheduling task through Alarm Manager -

i want schedule 10 alarm daily start , stop service. past alarm trigger, search lot on google did't correct solution. here code please check , me. intent start_intent,stop_intent; list<calendar> calander_list; static pendingintent pendingintent; calendar[] startcal,stopcal; alarmmanager[] startalarm,stopalarm; pendingintent[] startintent,stopintent; sharedpreferences sp; random rd; context context; global variable sp have stored time. public alarm_schedul(context cont) { context = cont; rd = new random(); calander_list = new arraylist<calendar>(); startalarm=new alarmmanager[5]; stopalarm=new alarmmanager[5]; startcal=new calendar[5]; stopcal=new calendar[5]; startintent=new pendingintent[5]; stopintent=new pendingintent[5]; start_intent=new intent(context,alarm_reciver.class); start_intent.putextra("alarmtype","start"); stop_intent=new intent(context,alarm_reciver.class); stop_

c++ - Stack size in QThread -

what maximal default stack size when using qthread in qt5 , c++ ? have qvector in thread , calling myvector.append() method, , i`m interested how big vector can be. found uint qthread::stacksize() const method returns stack size, if changed method setstacksize() , default stack size? the stack size plays role if compiling 32 bit application and you're allocating storage buffer explicitly on stack. using automatic qvector or std::vector instance doesn't allocate large buffers on stack - you'd need use custom allocator that. iirc in 64 bit applications, memory laid out such won't ever run out of stack space reasonable number of threads.

events - Nativescript Android physical back button override? -

how can override android physical button can make own code on it's event. i'm using newest nativescript. you can try this: var applicationmodule = require("application"); var androidapplication = applicationmodule.android; var activity = androidapplication.startactivity || androidapplication.foregroundactivity || topmost().android.currentactivity || topmost().android.activity; activity.onbackpressed = () => { //your code here };

python - Query Active Directory using logged on users credentials Python3 -

i'm creating small application queries active directory computer names. using ldap3 module since seems 1 of few supporting python3, open alternatives. is there way use logged on users credentials authenticate ldap server? this way user can run program , computer names if they're logged in domain user, without having enter username/password each time. more info environment: windows domain python 3.4 modules: ldap3, pywin32, pyqt4

javascript - Assign multiple images (files) from one file input to another file input(s) - upload -

i have successful upload code works perfect using ajax when select each file upload dialog. each upload has own form , input file (button upload) seen below. current code uploads files sequentially user can select more 1 photo but not together & use queuing algorithm settimeout in javascript check if first upload finishes start second upload, third, , on. <form id="form1"> <input type="file" id="userfile1" name="userfile[]" multiple/> </form> <form id="form2"> <input type="file" id="userfile2" name="userfile[]" multiple/> </form> . . . the problem now, when select multiple images upload (let's 2 images using ctrl), using first input file, them in array: document.getelementbyid('userfile1').files; so now, how can assign second image selected second input file userfile2 because want resume upload before? not working me , read there

java - Error in using ThreadPoolExecutor -

i have following job want threadpoolexecutor run.i want print start time , end time of each job. start times printing end times not printing. dont know doing wrong please help! import java.util.concurrent.timeunit; public class job implements runnable { private long starttime,endtime,delay; int id; public job(long delay) { this.delay=delay; } public int getid() { return id; } public void setid(int id) { this.id = id; } public long getstarttime() { return starttime; } public void setstarttime(long starttime) { this.starttime = starttime; } public long getendtime() { return endtime; } public void setendtime(long endtime) { this.endtime = endtime; } @override public void run() { setstarttime(system.nanotime()); try{ timeunit.milliseconds.sleep(delay); }catch(interruptedexception e){ } setendtime(system.nanotime()); } } following main class import java.util.vector; import ja

sitecore - DropList field in WFFM is showing value in message body -

Image
we have identified issue/functional requirement have droplist of countries , same goes title in below image but need in response email body of send email save action it's arabic text should used instead of english value of selected option. there solution or fix ? or have go customization ? i don't think there way out-of-the-box use text instead of value. can create custom "send email message", similar sitecore.form.submit.sendmail , override formatmail method.

javascript - facing an issue with parseFloat when input is more than 16 digits -

i facing weird issued. parsefloat(11111111111111111) converts 11111111111111112 . i noticed works fine till length 16 rounds off higher when input length > 16. i want retain original value passed in parsefloat after executed. any help? integers (numbers without period or exponent notation) considered accurate 15 digits. more information here

Get back PHP-code from XML -

i have xml files "pages" website. faced bad situation: when tried put php-code inside xml saves well: <content>&lt;p&gt;testtext &amp;nbsp; somemoretext&lt;/p&gt;&#13; &#13; &lt;p&gt;&amp;nbsp;&lt;/p&gt;&#13; &lt;?php echo ('php!');?&gt;</content> but! when echoing through simple xml ok except php-code, reason it's commented out now! <!--?php echo ('1');?--> just in case if saving process important: $content = htmlspecialchars($_post['editor1']);//safe string $rec = $xml->createelement("content", $content);//saving $root->appendchild($rec); need masterpiece guys!!!

typescript - Bind each array element to option tag -

i trying bind array element class option tag. in angular.io "tour of hero" tutorial ( https://angular.io/docs/ts/latest/tutorial/toh-pt2.html ) following list : <li *ngfor="let hero of heroes" (click)="onselect(hero)"> <span class="badge">{{hero.id}}</span> {{hero.name}} </li> if understand right *ngfor="let hero of heroes" associate each hero ( each element in heroes array ) li element , display caracteristics of associated hero {{hero.id}} example. i associate because if simple loop print don't see how hero object after onselect(hero). i have been trying same option : <option *ngfor="let perso of persos"> <span>{{perso.id}} : </span> {{perso.nom}} </option> but (click)="onselect(hero)" isn't effective since click event isn't triggered option. couldn't find right trigger. , additionnal information welcomed.

Plot discrete points on a graph TI-BASIC -

i've been delving ti-basic programming language on ti-89 titanium appears online documentation scarce, i'm kind of stumbling around in dark while trying learn syntax. i've worked through basic concepts presented in guidebook on programming, seem far complete/descriptive. for starters, how may plot discrete points 1 may in statistics (i.e. value @ every integer on x-axis)? so far see may append generated points end of list [note "->" mean "sto"] newlist(5)->total disp total displays list {0. 0. 0. 0. 0.} . now, if write loop iterate on list like for i,.2,1.,.2 i->total[i] i should have list {.2 .4 .6 .8 1.} . here problem arises: want plot these points on graph screen against integers on x-axis, starting @ x=1. how do this? specifically, want plot points (1., .2), (2., .4), (3., .6), (4., .8), (5., 1.) the issue attempt attempted store values @ .2, .4, .6, , .8 slots in list, not exist. fix problem, do: :for i, 1,

windows - Connecting to ODBC Data Source in Visual Studio -

Image
i had working on old 32-bit windows 7 machine running vs 2010 having trouble on new 64-bit windows 7 machine running vs 2015. all want add oracle odbc connection visual studio's server explorer. following error: i have configured , set 32-bit , 64-bit odbc utilities odbc drivers, both pass "test connection". have set oracle sql developer connect exact same source using same credentials , able read server in question. here successful connection attempt in odbc utility: i removed oracle odp.net developer toolset visual studio , connections working. find oracle's software incredibly frustrating , hard use. wernfried thank taking time help.

reactjs - Accessing a Browserify/Babel ES6 Module with ES5 Syntax -

context i have es6/react-js file called externalcomponent.react.jsx , following structure: import react 'react' import swipeable 'react-swipeable' const externalcomponent = react.createclass({ //... }) export default externalcomponent i have used browserify/babel compile file es5 version (the new es5 file called my-external-component-in-es5.js ) using following command: browserify -t babelify --presets react myexternalcomponent.react.jsx -o my-external-component-in-es5.js the output of file quite large (>20,000 lines of javascript); however, appears wrap externalcomponent in large iife (might wrong this). problem my goal access class externalcomponent pure es5 context (in development environment, unable use es6). i'm assuming going involve 1 of following: within externalcomponent.react.jsx , somehow add externalcomponent global namespace , when compiles es5 can refer externalcomponent name. somehow access ex

d3.js - d3 zoom and pan upgrade to version 4 -

help appreciated updating code below work in version 4. have changed zoom.behaviour d3.zoom i'm not clear other changes needed. looks more complicated v3! <!doctype html> <html> <head> <!-- <script type="text/javascript" src="http://d3js.org/d3.v3.js"></script>--> <script data-require="d3@4.0.0" data-semver="4.0.0" src="https://d3js.org/d3.v4.min.js"></script> <style type="text/css"> body, html { width: 100%; height: 100%; margin: 0; } svg { position: absolute; top: 0; left: 0; } p { text-align: center; } </style> </head> <body> <p>use mouse pan (click , move) / zoom (scrollwheel)</p> </body> <script type="text/javascript"> var svg = d3.select("body") .append("sv

c# - How to find start/end of ramp in revit, perhaps with sketches? -

Image
i have bunch of ramps know begin , end points of (and in case of multiple begin/end points know how connect). these list<transitionpoint> ret = new list<transitionpoint>(); filteredelementcollector collector = new filteredelementcollector(doc); icollection<element> ramps = collector.ofcategory(builtincategory.ost_ramps).toelements(); foreach (var ramp in ramps) { //what goes here? } these ramps contain following properties: type comments ramp max slope (1/x) category url design option type name ramp material function manufacturer family name model keynote type image text size shape text font maximum incline length assembly description assembly code type mark category thickness cost description now if these stairs use icollection stairs = collector.ofcategory(builtincategory.ost_stairs).ofclass(typeof(stairs)).toelements(); , can cast objects stairs there not appear class simmulair stairs allow me adres stairs.getstairsruns(). anybody k

Android Studio - How to ( close, quit, exit, kill, etc.) an application -

this question has answer here: is quitting application frowned upon? 37 answers firstly, i've tried solutions issue can not find solution. question: when user press exit button in application want kill application. there few methods finish(); or system.exit(0); if use on mainactivity, work. want this, if mainactivity or activity or b activity doesnt matter activty when press exit button kill application , go phones menu. this trick finishaffinity(); check deails: api description finish activity activities below in current task have same affinity. typically used when application can launched on task (such action_view of content type understands) , user has used navigation switch out of current task , in own task. in case, if user has navigated down other activities of second application, of should removed original task part of

api - RESTful secure resources by user -

i building springboot restful api oauth2 security component. i wondering how protect resources, thinking more business logic. example, if have list of courses /rest/v1/courses , , courses have supervisor , suppose logged role_supervisor (no admin access) , make call /rest/v1/courses , business logic can see courses supervisor. 1) should make /rest/v1/courses?supervisor_id=2 . classic filter, ok if admin, logged in, see other data if trace url , change id. 2) should make /rest/v1/courses , supervisor_id successful login? have check every request against login data. think more secure approach, it's sound little tedious, , forget perform security checks in controller method. 3) maybe there more generic solution , couldn't find or think? thank you, , sorry english. restful apis stateless. therefore every request must validate request's credentials, either token or checking oauth service. if supervisor_id linked credentials (e.g. token value xyz

c# - Random generates number 1 more than 90% of times in parallel -

this question has answer here: is c# random number generator thread safe? 11 answers consider following program: public class program { private static random _rnd = new random(); private static readonly int iterations = 5000000; private static readonly int random_max = 101; public static void main(string[] args) { concurrentdictionary<int,int> dic = new concurrentdictionary<int,int>(); parallel.for(0, iterations, _ => dic.addorupdate(_rnd.next(1, random_max), 1, (k, v) => v + 1)); foreach(var kv in dic) console.writeline("{0} -> {1:0.00}%", kv.key, ((double)kv.value / iterations) * 100); } } this print following output: ( note output vary on each execution ) > 1 -> 97,38% > 2 -> 0,03% > 3 -> 0,03% > 4 -> 0,03% ... > 99 -> 0,

jquery - Script Sends me to search.html? instead of the desired website -

alright, basically, index.html contains search bar doesn't it's supposed to- when enter pressed, should take me google.com/(gsecode)q=(what typed), instead sends me index.html? instead of want use jquery script trigger button click. have looked solutions don't seem work. html: <input type="text" id="text-box" size="size"> <input type="submit" id="submit" onclick="(javascriptcode)" name="google search"> jquery: document.getelementbyid("id_of_button").onclick = function() {clickfunction()}; function clickfunction() { document.location.href = 'https://cse.google.com/cse?cx=009002930969338329916:kta6o_isob0&q=' + escape(document.getelementbyid('search-box').value) } $("text-box").keyup(function(event){ if(event.keycode === 13){ $("#submit").click(); } }); i'm not sure if code loose example or final product,

sql server - SQL query to show customers those accounts have 10 deposits or more in his account -

Image
i have huge doubt have make query show customers made more 10 deposits greater or equal 50,000 in period, not leave me , i'm sure script wrong: the consult need is: make query accounts client name. accounts have had more 10 deposit greater or equal $ 50,000.00 january 2016 date amount. here script: declare @nombrecliente varchar(100) declare @apellidocliente varchar(100) declare @cantidadcuenta int declare @sumamonto decimal declare @fechainicio varchar(10) set @nombrecliente = 'name' set @apellidocliente = 'lastname' set @cantidadcuenta = ( select count(b.clienteid) [dbo].[clientes] inner join [dbo].[cuentasbancarias] b on a.clienteid = b.clienteid a.nombre = @nombrecliente , a.apellidos = @apellidocliente ) select @cantidadcuenta if @cantidadcuenta >= 10 begin set @sumamonto = ( select sum(a.monto) [dbo].[depositos] inner join [dbo].[cuentasbancarias] b on a.cuentaid = b.cuentaid inner join

java - JTableheader with checkable and sortable column -

i have jtable headers sortable, below code have used: tablerowsorter<foldermodel> sorter = new tablerowsorter<foldermodel>(foldermodel); setrowsorter(sorter); one column header has checkbox, rendered custom renderer, check , uncheck column values. i have choose different gesture distinguish between check/uncheck , sorting. think single click sort , double click check/uncheck, problem double click fires sorting. solution possible? thanks trashgod realized it's bad idea trying overload header column checkbox when headers sortable too. it's better put checkbox outside table.

How does the Intellij choose the constructor when I click Find Usage? -

i have got constructor takes 4 parameters: string, object, object, myenum . public myclass(string name, object val1, object val2, myenum cat) { // find in usage = 202 this.name = name; this.val1 = val1; this.val2 = val2; this.cat = cat; } in 95% usage cases last parameter null , create constructor takes 3 parameters , sets last 1 null. some ideas came mind gave try following solution: change last parameter myenum integer (compilation error - not matter): public myclass(string name, object val1, object val2, integer cat) - still 202 find usage add new constructor last parameter of type object: public myclass(string name, object val1, object val2, object cat) , first constructor (with integer ) has 196 usages , second 1 6. this wanted (i have got 6 invocations non null last element) reason of behaviour? intellij make checks , if input type myenum cannot passed integer type, null can passed both, why in case of first constructor there 6 less results

qt - Dependency conflict during install of openssl-devel -

my fedora's kernel version - 4.1.13-100.fc21. i trying install developer libraries openssl enternig command: sudo yum install openssl-devel it gives output: error: packet: pcre-devel-8.35-14.fc21.x86_64 (updates) requires: pcre(x86-64) = 8.35-14.fc21 installed: pcre-8.35-17.fc21.x86_64 (@updates-testing) pcre(x86-64) = 8.35-17.fc21 available: pcre-8.35-7.fc21.x86_64 (fedora) pcre(x86-64) = 8.35-7.fc21 available: pcre-8.35-14.fc21.x86_64 (updates) pcre(x86-64) = 8.35-14.fc21 another option bellow use --skip-broken overcome problem. entering: sudo yum install openssl-devel --skip-broken provides output packets missed due problems dependencies: krb5-devel-1.12.2-9.fc21.x86_64 fedora krb5-devel-1.12.2-19.fc21.x86_64 updates libselinux-devel-2.3-5.fc21.x86_64 fedora libselinux-devel-2.3-10.fc21.x86_64 updates 1:openssl-devel-1.0.1k-12.fc21.x86_64 updates pcre-devel-8.35-7.fc21.x86_64 fe

java - How get full info of runtime.getruntime.exec("netstat") -

i can't full info netstat, not rooted device. if use process process = runtime.getruntime().exec("netstat -n"); with "-n" or other doesn't work. how read stream netstat process.getoutputstream().close(); bufferedreader reader = new bufferedreader( new inputstreamreader(process.getinputstream())); string line; while ((line = reader.readline()) != null) { // parse line required info } reader.close(); how can pid or process name using netstat (or other monitor network activity) without root i test in android 6.0 , only: proto recv-q send-q local address foreign address state click see you must input stream process object , read process output line line until null line received. proto recv-q send-q local address foreign address state it's first line of netstat output. for example: https://stackoverflow.com/a/13506836/4449456

java - Android darken background -

does know how programmatically darken view's background alertdialog or navigationdrawer doing it? need background overlaps toolbar (1) , statusbar , icons statusbar should visible(2). in case should not dialog . example, had darken background around button or customview . example image i looking answer question long time, found solution. i researched code "dialogplus" library , find out key point. orhanobut/dialogplus getwindow().getdecorview(); final layoutinflater inflater = (layoutinflater) getsystemservice(layout_inflater_service); final view background = inflater.inflate(r.layout.frame, null); final animation = animationutils.loadanimation(this, r.anim.in); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { viewgroup decorview = (viewgroup) getwindow().getdecorview().findviewbyid(android.r.id.content); decorview.addv

http - How browser correctly calculate epiration datetime of cookie with different timezone on server and client side -

the server , client in different time zone. difference in 6 hours. server sets cookie 1 hour client correctly receives , keeps hour, although client 5 hours ago. how client correctly sets cookie on hour? browser looks @ header "date"? if so, if server behind proxy server, set own "date" header? must provide proof reference rfc or where. there 2 ways specify maximum age cookie: expires attribute: http://tools.ietf.org/html/rfc6265#section-5.2.1 max-age attribute: http://tools.ietf.org/html/rfc6265#section-5.2.2 max-age relative time of setting.. texpiration = tsetting + max-age otherwise, expires attribute sets date / time value including timezone: http://tools.ietf.org/html/rfc6265#section-5.1.1 example rfc itself: expires=wed, 09 jun 2021 10:18:14 gmt there many standards (old , new) favor gmt (utc) date / time format: https://tools.ietf.org/html/rfc7231#section-7.1.1.1 https://www.w3.org/protocols/rfc2616/rfc2616-sec3.html fr