Posts

Showing posts from September, 2013

java - Docx to html conversion using docx4j v3 -

hi trying convert docx html using docx4j v3.below code. file initialfile = new file("input/table_1.docx"); inputstream = new fileinputstream(initialfile); wordprocessingmlpackage wordmlpackage = docx4j.load(is); htmlsettings htmlsettings = docx4j.createhtmlsettings(); htmlsettings.setwmlpackage(wordmlpackage); outputstream out = new fileoutputstream("input/table_1.html"); docx4j.tohtml(htmlsettings, out, docx4j.flag_export_prefer_xsl); string result = ((bytearrayoutputstream)out).tostring(); system.out.println(result); this error getting. have used mvn resolve jar dependency.can on error: exception in thread "main" org.docx4j.openpackaging.exceptions.docx4jexception: couldn't load xml stream @ org.docx4j.openpackaging.packages.opcpackage.load(opcpackage.java:504) @ org.docx4j.openpackaging.packages.opcpackage.load(opcpackage.java:302) @ org.docx4j.openpackaging.packages.wordprocessing...

Wordpress Login and Register pages no body class or id -

i need insert background image on these 2 pages: http://digesale.com/wp-login.php http://digesale.com/wp-login.php?action=register you can see background there, inserted wrapping div div. on smaller or larger screen resolutions background doesn't cover entire page or has slider, depending on if it's bigger or smaller resolution. what need somehow style "body" of these 2 pages css. body tag has no class , no id on these pages, , have no idea how style it. for example page http://digesale.com/privacy-policy/ has this: body class="page page-id-154 page-template-default and see how it's nicely styled , everything. can help? following should work you:- add_action( 'login_enqueue_scripts', 'wdm_style', 10 ); add_action( 'wp_enqueue_scripts', 'wdm_style' ); function wdm_style(){ $actual_link = "http://$_server[http_host]$_server[request_uri]"; //its check if register pag...

c# - CRM Dynamics 2015, Trigger Plugin on mobile phone fields click -

i have plugin in crm 2015, tested on create of record, need way trigger plugin clicking button next phone number field, plugin initiates phone call, how can accomplish this?. how trigger plugin on mobile fileds click, or perhaps button next mobile phone filed trigger plugin, best approach , possible.? i suggest create action , develop plugin handles it. following articles you: http://a33ik.blogspot.com/2013/10/custom-actions-walkthrough-for-net-and.html http://a33ik.blogspot.com/2013/10/custom-actions-deployment-through-crm.html

django compressor - Can I use a filter on all compress blocks except for one? -

in settings compressor i'm using slimit of javascript: compress_js_filters = ['compressor.filters.jsmin.slimitfilter', ] some of js files shouldn't go through slimit though because file minified, or javascript throws error when minified other files. template block ends looking this: {# code minify #} {% block compressed_libs %} {% compress js %} <script src="/static/js/compress_this.js"></script> <script src="/static/js/also_compress_this.js"></script> ... {% endcompress %} {% endblock %} {# code shouldn't minify #} {% block non-compressible_libs %} <script src="/static/js/already.min.js"></script> <script src="/static/js/breaks-everything.js"></script> {% endblock %} can set different compress filter rules different blocks/files "non-compressible" files can still concatenated compressor while skipping slimit? ...

c++ - Is `x = std::move(x)` undefined? -

let x variable of type has been initialized. following line: x = std::move(x) undefined? in standard , it? no, not undefined behavior, going implementation defined behavior, depend on how move assignment implemented. relevant lwg issue 2468: self-move-assignment of library types , note active issue , not have official proposal should considered indicative rather definitive, point out sections involved standard library , points out conflict. says: suppose write vector<string> v{"a", "b", "c", "d"}; v = move(v); what should state of v be? standard doesn't specific self-move-assignment. there's relevant text in several parts of standard, , it's not clear how reconcile them. [...] it's not clear text how put these pieces together, because it's not clear 1 takes precedence. maybe 17.6.4.9 [res.on.arguments] wins (it imposes implicit precondition isn't mentioned in moveassig...

parallel processing - bootstrap a dataset in R -

i need perform bootstrapping dataset in r. data in form of list contains 2 matrices , has following properties: both matrices n m , contain positive integers (including 0). data <- list(a=matrix(,n,m), b=matrix(,n,m)) a number of marbles, 10000 distributed each matrix, i.e., 10000 divided in n*m parts. in other words, sum of entries each matrix fixed. > sum(data$a) [1] 10000 > sum(data$b) [1] 10000 the marbles distributed according affinity of ij -th elements marbles, i.e. how many marbles end ij -th entry of matrix depends on probability associated every cell of matrix. the probabilities associated elements different 2 matrices. my goal estimate parameters lead underlying probabilities. model assumes 2n parameters, n number of rows , 1 set each matrix. parameters combine in complex manner , 2 matrices must analyzed together. parameters <- data.frame(a=numeric(n), b=numeric(n)) right now, approach using: i define function sgen takes input mat...

ios - XCUITest - How to simulate locking of the device -

i writing xcuitests app in swift, , wondering if it's possible simulate locking , unlocking of device. i've looked @ xcuiapplication methods there don't seem allow me lock device. this not possible @ moment.

php - How to execute only page URL and redirect to another page? -

i want execute url page redirect requested header location. page not redirect. previous page showing here. see code- example.php <?php function test() { $aa = 'good morning'; //file_get_content('http://localhost/demoproject/test.php'); $ch = curl_init('http://localhost/demoproject/test.php'); curl_exec($ch); return $aa; } $text = test(); header('location:http://www.google.co.in/search?q='.urlencode($text)); ?> in test.php file have written 1 pdf generated code , email function generate pdf file attachment. want http://localhost/demoproject/test.php execute. when run example.php file. page redirect http://www.google.co.in/search?q=good+morning showing current page test.php data. how execute url not retrieve data? you can have output not sent browser setting option curlopt_returntransfer $ch = curl_init('http://localhost/demoproject/test.php'); curl_setopt($ch, curlopt_returntransfer, true)...

Visual Studio 2015 RTM Find in Files dialog broken -

the find in files , replace in files dialogs not open. neither through shortcuts nor through menu items. what problem, how debug this? update: the same dialogs broken on copy of visual studio 2013 well. started happening after uninstalling vs2015 rc , installing vs2015 rtm. i thought had problem, turns out, dialog not visible on primary screen. using find in files shortcut, typing text , pressing enter did bring find results 1 panel. the find in files dialog open , undocked on third screen don't actively use , had turned off. visual studio 2015 enterprise had decided put there self. after hitting "ctrl + shift + f" , main window blink. hit "win + arrow left/right" until search dialog appears on screen.

html5 - Unexpected z-index of contents in MathJax -

i writing sketch of webpage in html5/css3 , observed unexpected behaviour of contents in mathjax respect z-index. my idea have top div , fixed, image, name , contacts, , following contents shown below scrolling vertically. as this updated jsfiddle shows, seems work 1 thing: math delimited mathjax delimiters \( , \) flows above #top div , image, not below text around. the following, updated z-index es, should reproduce problem on chrome , opera (on windows) , on chrome , android browser (tested on samsung s3 , s4). <!doctype html> <html lang="en"> <head> <title>name surname</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <script type="text/x-mathjax-config"> mathjax.hub.register.startuphook("mathmenu ready",function () { mathjax.menu.bgstyle["z-index"] = 1; }); </script> ...

javascript - How to reload a jquery Datatable after the user finished editing operation? -

i using asp.net mvc4 . want refresh table after user has edited column.(i not want make when user press enter, want refresh when user finishes writing , clicks somewhere else.this jquery script : <script language="javascript" type="text/javascript"> $(document).ready(function () { $('#result').datatable().makeeditable(); }); </script> and controller: public string updatedata(string id,string value, int columnposition) { objectid oid = new objectid(id); var query = n in objectmongocollection.asqueryable<user>() n.userid == oid select n; user user = query.firstordefault(); if (user == null) { return "error"; } else { if (columnposition == 0) { user.name = value.trim(); } else if (columnposition ...

html - Twitter bootstrap Navbar justified links with logo/brand -

i cant seem justify links , have logo in navbar. links , logo overlap on left hand side. want make links justify right of logo. %body %nav.navbar.navbar-inverse.navbar-fixed-top .container-fluid .navbar-header %button.navbar-toggle.collapsed{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"} %span.sr-only toggle navigation %span.icon-bar %span.icon-bar %span.icon-bar .container-fluid .navbar-header %a.navbar-brand{:href => "#"} %img{:alt => "image", :height => "50", :src => "/assets/logo.png"} %ul.nav.navbar-nav.nav-justified %li %a{:href => "#"} link %li %a{:href => "#"} link %li %a{...

javascript - preg_replace create two different variables by spliting another one -

i using post xmlhttprequest in order send data php script. part of javascript code this: function phppost(a, b){ var hr = new xmlhttprequest(); hr.open("post", "phppostexample.php", true); hr.setrequestheader("content-type", "application/x-www-form-urlencoded"); hr.send("send="+a+""+b); } and part of php code this: if(isset($_post['send'])) { $code = preg_replace('#[^0-9]#', '', $_post['send']); $name = preg_replace('#[^a-za-z0-9]#', '', $_post['send']); the problem want 2 variables give ( a , b ), become $code , $name when run phppost(43365, "hello world 43"); php script gives me $code 4336943 , $name 43369helloworld43. how can make php scriipt give me $code 43369 , $name hello world 43 (with gaps between words)? in advance really elaborating on @charlietfl's comment: function phppost(a, b){ var h...

javascript - How do I use a negative timestamp to do math? -

i'm using google spreadsheets , have sheet in following format: start | end | partial result | expected | total 08:00 | 12:00 | 04:00 | 05:00 | -01:00 14:00 | 18:00 | 04:00 | 05:00 | -01:00 ---------------------------------------------------- | month tot| -02:00 as can see, allows negative duration stamps. causing me lot of trouble in google scripts. i want email monthly summary. here's simple snippet: var sheet = spreadsheetapp.getactive().getsheetbyname(...); var monthlytotal = sheet.getrange(1, 1).getvalue(); //the total @ cell a1 now, when debug, shows monthlytotal date object, set tue dec 26 1899 14:50:28 gmt-0300 (brt) (this quite correct, result -81:16:00 , subtracted 81:16 1970-01-01 00:00:00 , no issues there). now, have no idea how duration format ( -81:16 ). have tried converting date object negative timestamp, +monthlytotal returns believe wrong value ( -2212132172000 ). i have ...

requireJS and Google+ Javascript API -

i have been trying while , totally stuck on issue , hope can give me ideas how can solve this. problem here. i use google javascript api site login. javascript is define(function (require) { init = function(){ require( ['https://apis.google.com/js/platform.js?onload=renderbutton'], function(gapi){ renderbutton(); }); }, renderbutton = function(){ console.log("renderbutton called"); gapi.signin2.render('google-signin', { 'scope': 'https://www.googleapis.com/auth/plus.login', 'width': 151, 'height': 25, 'longtitle': true, 'theme': 'dark' }); }, }); when this, returns error message "referenceerror: gapi not defined" so have tried below no luck. define(function (require) { init = function(){ require( ['https://apis.google.com/js/platform.js?onl...

xlsxwriter - avoid repeating code in xlsxwritter -

Image
i want create time sheet xlsxwritter, find process , going tremendously long code below: worksheet.set_column('b6:b6', 3) worksheet.write('c9', "day") worksheet.write('c7', "date") worksheet.write('e7', "start") worksheet.write('f7', "end") worksheet.write('c7', "sun") worksheet.write('c8', "mon") worksheet.write('c9', "tue") worksheet.write('c10', "wed") worksheet.write('c11', "thu") worksheet.write('c12', "fri") worksheet.write('c13', "sat") worksheet.write('j7', "sun") worksheet.write('j8', "mon") worksheet.write('j9', "tue") worksheet.write('j10', "wed") worksheet.write('j11', "thu") worksheet.write('j12', "fri") worksheet.write('j13', "sat") work...

node.js - What is cb() in Node? -

where people getting cb() from, node thing or vanilla js thing? for example: managing node.js callback hell promises, generators , other approaches they're using cb() guess callback , return error or value or both in cases depending on callback function sig is? cb in context you're describing how vanilla callback function passed (typically) asynchronous function, common pattern in node.js (it's labelled next, can call bananas if desire - it's argument). typically first argument error object (often false - if went planned) , subsequent arguments data of form. for example: function myasyncfunction(arg1, arg2, cb) { // async things cb(false, { data: 123 }); } then using function: myasyncfunction(10, 99, function oncomplete(error, data) { if (!error) { // hooray, went planned } else { // disaster - retry / respond error etc } }); promises alternative design pattern return promise object myasyncfunction ...

ios - Center of rect under UINavigationBar -

i sound stupid can't retrieve center of rect below navigation bar. i tried moving center down [uiapplication sharedapplication] delegate] window] rootviewcontroller] navigationcontroller] navigationbar].frame.size.height seems returns value of 0 points. searched online couldn't find relevant. how can do?

Android option menu remove on view pager -

i'm using view pager tabs using toolbar android action bar . now in 1 of tab ,i'm creating menu fragment ,its working fine set has option menu true on fragment . question is,how can remove menu when user slides different tab or click on different tab . what best procedure it. i'm creating option menu in fragment this @override public void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); sethasoptionsmenu(true); } @override public void oncreateoptionsmenu(menu menu, menuinflater inflater) { // todo auto-generated method stub inflater.inflate(r.menu.custommenu, menu); super.oncreateoptionsmenu(menu, inflater); } you need have sethasoptionsmenu(true); in fragments and override below in fragments @override public void oncreateoptionsmenu(menu menu, menuinflater inflater) { super.oncreateoptionsmenu(menu, inflater);...

ios - Stick element to the keyboard bottom during animations -

i'm struggling keyboard in ios 8 trying glue element above during animations. in messages have input pushing appearing keyboard. i've found lots of topics here, of them how handle appearing keyboard, not dismissal. seems apple use other curve or speed whatever dismissal, have asynchronism when close keyboard, while appearing animation synchronised. here i've got now: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillhideorshow:) name:uikeyboardwillshownotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillhideorshow:) name:uikeyboardwillhidenotification object:nil]; - (void)keyboardwillhideorshow:(nsnotification *)note { nsdictionary *userinfo = note.userinfo; cgrect keyboardendframe = [userinfo[uikeyboardframeenduserinfokey] cgrectvalue]; [self adjustformcontainersize]; // method opening orange card uiviewanimationcurve curve = [userinfo[uikeyboardanimatio...

bioinformatics - Python-remove highly similar string from dataset -

Image
i have genomic dataset contained base messages, this: position samp1 samp2 samp2 samp3 samp4 samp5 samp6 ... posa t t t t t t t ... posb g g g ... posc g g g g g g g ... ... this file has 100000+ lines, each line contains 200 bases of 200 samples. want remove positons haves high similar base in every samples, pic below of 100 % same, , remove 1 of them we defined similar ratio (similar base number) / (sequence length): posh c c c c c c c c posi c c c c c c similarity of posh , posi 6 / 8 = 75% required, similar ratio above 99% regarded highly similay, , remove 1 of similar positions. how can work in python efficiently? thank you. similarity of 6/8 between posh , posi , looks want inverse of normalized hamming dist...

What is the maximum length of an openAM SSO token? -

i have found configuration parameters might affect length, nothing defines it. have found 94 characters , 107. tia it best not rely on length of sso token. future releases of openam may change token encoding (using jwt, example). want make generous allowances this.

comparing input Date & Time with current date & time in android -

i creating "to-do things" app user can create tasks done. in main activity have fragment consists of 3 edittexts ie notification content , date & time of notification. each new entry added database. database displayed in form of listview in activity. my questions are-: q1) want compare date & time of each entry & print come ie date & time after present date & time.so how should perform comparison? q2) when date & time reached generate notification . q1) use calendar class. can take calendar object , set date , time user data (using calendar.set) , compare calendar set current time follows: calendar cal = gregoriancalendar.getinstance(); cal.settimeinmillis(system.currenttimemillis()); to compare 2 calendars can use calendar.before method, or can convert them "timeinmillis" , calculate difference in milliseconds. q2) use the alarmmanager , broadcastreceiver

android - Null Pointer Exception at calling postInvalidate method in thread class -

i have created custom thread , used postinvalidate method recalling , move image there null pointer exception @ thread class animthread postinvalidate . package com.example.ahmad.ballmoving; import android.view.view; /** * created ahmad on 7/30/2015. */ public class animthread extends thread { private view threadview; public animthread(view view ) { if(view!=null) { threadview = view; } } @override public void run() { while(true) { try { thread.sleep(1000); threadview.postinvalidate(); } catch (interruptedexception e) { e.printstacktrace(); } } } } this custom view class . package com.example.ahmad.ballmoving; import android.content.context; import android.graphics.bitmap; import android.grap...

php - How to install custom package from a zip file (MVC) - Laravel -

i'll try not steal time , short possible.. say have structure in laravel app (it's rest api, sort of): rootfolder/app/models rootfolder/app/http/controllers rootfolder/app/http/routes.php rootfolder/public (these folders use @ part) now, have zipped file following structure: rootfolder/app/models/mynewmodeltoimport.php rootfolder/app/http/controllers/mynewcontrollertoimport.php rootfolder/public/somefilesandfolderstoimport mynewdatabasetouploadonserver.sql now, want laravel automatically extract these files corresponding locations , upload mynewdatabasetouploadonserver.sql database private server... overall, install "package" zip file, install plugins wordpress.. thanks time

.net - Add image to a cell in ListView -

i want add images determinate cells in listview, can add first item, here code: lbldata.text = lblr1.text = rulliera1.item(0).codicerulliera lblvassoior1.text = "vassoio : " & rulliera1.item(0).codicevassoio each row clstotemanime in rulliera1 dim itm listviewitem = new listviewitem("") itm.subitems.add(row.anima.descrarticolo) itm.subitems.add(row.codiceanima) if row.nonlavorare itm.imageindex = 0 else itm.imageindex = 1 end if lvr1.items.add(itm) next with itm.imageindex = 0 can add image first element in row, want : itm.subitems(x).imageindex = 1 one more thing: how can center image in cell? add lvs_ex_subitemimages extended style listview.

Compare 2 Values in Javascript -

i have problem compare values in javascript, here code : if(removecomma(f.txt_mintransfee.value) >= removecomma(f.txt_maxtransfee.value)){ alert("minimum transfer fee must less maximum transfer fee"); return; } if(removecomma(f.txt_minexfee.value) >= removecomma(f.txt_maxexfee.value)){ alert("minimum express fee must less maximum express fee"); return; } if(removecomma(f.txt_minearsfee.value) >= removecomma(f.txt_maxearsfee.value)){ alert("minimum settlement fee must less maximum settlement fee"); return; } i tried values : txt_mintransfee = 1 , txt_maxtransfee = 22 txt_minexfee = 2 , txt_maxexfee = 22 txt_minearsfee = 3 , txt_maxearsfee = 22 but problem cannot pass 3rd function, alert "minimum settlement fee must less maximum settlement fee" first, parse strings numbers, handling errors invalid input. then, compare numbers. var m...

migration - Error migrating from GeneXus 9 to GeneXus Evo 2 U5 -

i'm migrating kb genexus 9 genexus evo 2 u5. i'm using .net , sql server, , followed steps mentioned in gxtechnical have following error: ========== developermenu compilation started ========== gxexec "c:\modelos gx\postulantes\dataprot\blddevelopermenu.cs" -r:gxbasebuilder.dll -arg:csc="c:\windows\microsoft.net\framework\v3.5\csc.exe" -arg:mdlpath="c:\modelos gx\postulantes\dataprot" building bin\messages.spa.dll read in 570 resources 'messages.spa.txt' writing resource file... done. compilador de microsoft (r) visual c# 2008, versi¢n 3.5.30729.5420 para microsoft (r) .net framework, versi¢n 3.5 (c) microsoft corporation. reservados todos los derechos. error:build error target bin\genexus.programs.common.dll: .\gxobjectcollection.cs not exist. developermenu compilation failed ========== assemblies compilation started ========== gxexec "c:\modelos gx\postulantes\dataprot\bldassemblies.cs" -r:gxbasebuilder.dll -arg:csc=...

java - Shared preferences user name -

i have app i'd able let user customize far setting user name, email address , picture navdrawer preference menu. i'm not 100% sure how though. i'm not sure how set listeners key preference screen. since these values have id's can replaced user preference put in? any great. since want these values persist through each use of app, use sharedpreferences save values. retrieve , set them in navdrawer adapter sharedpreferences pref = preferencemanager.getdefaultsharedpreferences(youractivity.this); pref.edit().putstring("name", nameedittext.gettext().tostring()).commit(); to retrieve... pref.getstring("name", defaultvalue); any additional "putstring" using same key overwrite data. hopefully answers question. if not can further. documentation too. edit refer comments below. actionbardrawertoggle mdrawertoggle = new actionbardrawertoggle(this,mdrawerlayout,r.drawable.ic_playlist, r.string.drawer_open, r.string.d...

javascript - Saving jasmine expect() results -

does expect() have return type (or promise fulfills)? if not, how can store/access result of it('should...') 's expect() ? edited-clarification : want store , use these results during subsequent tests. reason: i'd make tests resilient enough know if should skipped because prior tests failed, without having make comparison second time , wait nested promises resolve again. have @ http://jasmine.github.io/2.3/custom_reporter.html allows notified of suite/specs success/failure executed. you store information in object accessible specs.

regex - In the angular, how can we check if a value match a pattern? -

how can check if value match pattern in code? not use ng-pattern in function. thanks. use pure javascript match function. var str = "the rain in spain stays in plain"; var res = str.match(/ain/g); res array matched values. can test if there match checking array length: if ( res.length > 0 ) console.log("match"); from here use in directive, better controller since in angular 2 there no controllers.

java - Transform one type to another -

i need improve code: final string valuestring = value.tostring(); if (path.class.isassignablefrom(destinationtype)) { fixedvalues.put(key, paths.get(valuestring)); } /* ... above, other types ... */ { } else { fixedvalues.put(key, valuestring); } so decided implement transformer-like converts type x y . i created interface public interface converter<s, d> { d convert(final s source); class<d> getdestinationclass(); class<s> getsourceclass(); } so when need implement conversion implement interface public class stringtointegerconverter implements converter<string, integer> { @override public integer convert(final string source) { return integer.parseint(source); } @override public class<integer> getdestinationclass() { return integer.class; } @override public class<string> getsourceclass() { return string.class; } } (example of string -> integer) now, convert types have class converter...

ruby - How to create http-equiv="content-language" using metamagic? -

i using metamagic meta tags. want generate following line: <meta http-equiv="content-language" content="en" /> using metamagic. how can create this? i added gem files , working, , for: <% meta owner: "xyz" %> i result: <meta name='owner' content="xyz"/> given source code , not possible. you can use tag instead: tag 'meta', 'http-equiv' => 'content-language', 'content' => 'en'

qt - Multiple inheritance of QApplication and QAbstractNativeEventFilter -

i want filter usb device insert/removal events in qt application. need use installnativeeventfilter() install native filter (derived qabstractnativeeventfilter ) app. problem need emit signals event filter, , connect them slots in app. so, if can inherent both qapplication , qabstractnativeeventfilter , both signals , slots in same class, , it's more convenient connect them. code below safe or not? class qapp : public qapplication, public qabstractnativeeventfilter { virtual bool nativeeventfilter(const qbytearray &eventtype, void *message, long *) q_decl_override; signals: void devicechanged(); ... }; qapp a(argc, argv); a.installnativeeventfilter( &a ); why want derive qapplication ? emit signals, need derive qobject : class nativeeventfilter : public qobject, public qabstractnativeeventfilter { q_object q_signal void signal1(); ... public: explicit nativeeventfilter(qobject * parent = 0) : qobject(parent) {} bool nativeeventfilt...

c# - Date Output (XSLT) -

i'm doing conversion xml format 1 (with updated schema). did xslt altova mapforce , i'm writing program in c# convert documents. the problem here date format, xslt doing job c# giving me wrong output (20-14-xx-xx). c# code far: private void picturebox3_click(object sender, eventargs e) { openfiledialog open = new openfiledialog(); open.filter = "xml files|*.xml"; if (open.showdialog() == dialogresult.ok) { try { xdocument xmldocument = xdocument.load(open.filename); xdocument transformeddoc = new xdocument(); using (xmlwriter writer = transformeddoc.createwriter()) { xslcompiledtransform transform = new xslcompiledtransform(); transform.load(xmlreader.create(new streamreader(@"c:\xslt\converter.xslt"))); transform.transform(xmldocument.createreader(), writer); } savefiledialog savefiledialog = ne...

regex - Regular expression pattern to allow digit and asterisk -

how can last 4 digits in $mybuildnumber, asterisk? want $newversion return "2.8.1.*"; however, code not return me: $mybuildnumber = "mybuildnumberis_2.8.1.*" $versionregex = "\d+[*]?\.\d+[*]?\.\d+[*]?\.\d+[*]?" $versiondata = [regex]::matches($mybuildnumber,$versionregex) switch($versiondata.count) { 0 { write-error "could not find version number data in mybuildnumber." exit 1 } 1 {} } $newversion = $versiondata[0] write-host "version: $newversion" you can use character class digit , * : [\d*]+\.[\d*]+\.[\d*]+\.[\d*]+

java - Test Fails from SonarRunner test task but not from project test task in multi project -

i have multi project setup test task sub project builds without issues fails when trying run sonarrunner task. have test compile dependencies subproject on other sub projects. how tell sonarrunner include subprojects in compile time tests ? using gradle build system. project structure: root: project - class project b src - class b test - testclass b ( imports class ) example: sonarrunner task execution :sonarrunner execution failed task ':projectb:test'. indvidual execution :projectb:test build successful

implement captcha in theme (wordpress) -

first of all, thank in advance help. i'm having problem because never told before. i have wordpress theme has own registration/login form. past week experiencing login attacks , stuff, want implement captcha login form. the problem is, how can implement captcha directly theme , make work? having here , apparently nobody had problem. thank guys again , maybe sorry obbious question... i'm kinda noob in this! at end found solution. the "problem" woocommerce 1 "hosting" login form. installed plugin: https://wordpress.org/plugins/no-captcha-recaptcha-for-woocommerce/ and works expected. than answers!

c# - Create List in Linq query -

i trying create list in select new in linq set property of object. linq query below object definitions. public class someobject { public list<latlng> coordinates{get;set;} } public class latlng { public double lat; public double lon; public latlng(double lat, double lon) { this.lat = lat; this.lon = lon; } } list<latlng> coordinates = null; var query = loc in loclist select new someobject ( coordinates = new latlng(loc.lat,loc.lon) // tried line below doesn't work. //coordinates = new latlng(loc.lat,loc.lon).tolist() ); the important line this coordinates = new latlng(loc.lat,loc.lon) how can make list<latlng> coordinates property list<latlng> type? try this var query = loc in loclist select new someobject { coordinates = new list<latlng> { new latlng(loc.lat,loc....

logging - Android NDK C++ library print log on android studio? -

hi building c++ native library based on android ndk tool. however, couldn't figured out how print log in c++ file android logcat . here have done. i have follow this guide. add __android_log_print(android_log_info, "log", "hi logg"); include android/log.h and android { defaultconfig { ndk { modulename "modulename" ldlibs "log" } } the app able compile there's no log printed. can me?

python - Random sampling of non-adjacent cells in a pixel grid -

Image
suppose have n*n grid. choose k << n random cells of grid not adjacent. if simulate grid 2d numpy array containing 0 , 1 , efficient way in numpy/python? valid example: non-valid example: here's straightforward implementation of rejection sampling. there may faster way adjacency check query_pairs thing (which in case check collisions), since want test if there @ least 1 pair within distance threshold. import numpy np scipy.spatial import ckdtree kdtree n = 100 k = 50 valid = false while not valid: # generate k grid indices coords_flat = np.random.random_integers(0, n ** 2 - 1, size=k) coords = np.unravel_index(coords_flat, dims=(n, n)) # test there no adjacent cells valid = len(kdtree(coords).query_pairs(1.0)) == 0 print(coords) taking @ results: import matplotlib.pyplot plt grid = np.zeros((n, n), dtype=np.bool) grid[coords] = true plt.imshow(grid) plt.savefig('result.png')

ios - Object added in Parse several times after checking for all non similar objects: -

i querying objects parse, append array. check if array contains particular object, if not, wish add particular object parse. however, each different object in array, , therefore in parse, particular object gets added. instance, if have 4 different objects, object in question added 4 times. see code below: @ibaction func nextweek(sender: anyobject) { self.view.layoutifneeded() uiview.animatewithduration(0.5, animations: { self.viewheight.constant = 93 self.view.layoutifneeded() }, completion: nil) var array2 = [string]() var query1 = pfquery(classname: "sendmessage") query1.wherekey("messagesent", equalto:pfuser.currentuser()!.username!) query1.wherekey("messagereceived", equalto:self.namelabel.text!) query1.findobjectsinbackgroundwithblock { (objects1, nserror) -> void in if let objects1 = objects1 as? [pfobject] { object1 in objects1 { if object1...

Is it possible to override Symfony Intl JSON data? -

is possible override json data under symfony/src/symfony/component/intl/resources ? example, in data/languages/en.json change "zh": "chinese" more "zh": "mandarin chinese" . did tried copy file under app/resources/data/languages/en.json change on there? also don't forget clear cache

swift - iOS Dropdown Menu? -

Image
i'm making app in want user able select unit of time want added (seconds, minutes, hours). how can create dropdown menu allows user select unit of time want use? example of want achieve in google's mobile sign page.

java - Wait for Runnables to finish -

i have implemented programm in javafx dynamically generates input mask , generates word-document after button click on mask. i define in db-table input fields available in mask. i'm adding support custom procedures executed on specific states of program (onfocuslost of field,onchange,...) wich works perfect. now i'm stuck @ ongenerate execution. when render mask, hold list of runnable s store actions should executed on generation (at render time know action should executed. @ generation time have read data in again. thought save action functionalinterface . , need no inputparameter , no returnvalue ... ended runnable ) textfield tf = ...; string s = ...; actionsbeforegenerate.add(() -> { tf.settext(s); }); so now, if press generate button, following: private void startgenerate(){ //main.getactionsbeforegenerate() == list<runnable> main.getactionsbeforegenerate().foreach(action -> action.run()); generateworddocument();...

encryption - C++ AES How to encrypt data block by block -

aes has maximum block size of 128, , key sizes 128, 196 & 256. i have implemented aes algorithm so: int main() { unsigned char key[key_128] = "very strong key"; unsigned char plaintext[16] = "this test"; unsigned char ciphertext[16]; unsigned char decptext[16]; aes_ctx_t *ctx; virtualaes::initialize(); ctx = virtualaes::allocatectx(key, sizeof(key)); virtualaes::encrypt(ctx, plaintext, ciphertext); cout << "encrypted: " << ciphertext << endl; virtualaes::encrypt(ctx, ciphertext, decptext); cout << "decrypted: " << decptext << endl; return 0; } but want encrypt larger data 128bits, example string that's 512 bits long. need somekind of loop splits strings 128bit blocks , encrypts & joins them again, have hard time doing this. provide example? i more familiar c#, has several modes of encryption exposed through system.security.cryptography namespace. know how cipher block...

SSIS default value is not being set when source value in null -

problem: oledb source has null value in phone. destination table has phone not null default 1234567. oledb destination has keep nulls unchecked according read here https://msdn.microsoft.com/en-us/library/ms187887(v=sql.110).aspx the default value column should inserted if incoming value null. but it's not happening. , don't want transformation in ssis. can help? in data flow task, in ole_db source, set data access mode 'sql command' , write out select statement below select column_a ,column_b ,isnull(phone, 1234567) ,column_c ,column_d etc. source_table

logging - Regex for log fields not always in order -

i hope able me on headache. bit stuck on regex/grok/logstash syntax. trying parse kibana logs, fields in logs not comes in same order. here 3 logs exemple. {"name":"kibana","hostname":"22e1923b59f3","pid":1,"level":30,"req":{"method":"post","url":"/elasticsearch/_msearch?timeout=0&ignore_unavailable=true&preference=1438549037831","headers":{"host":"192.168.33.10:5601","connection":"keep-alive","content-length":"779","accept":"application/json, text/plain, */*","origin":"http://192.168.33.10:5601","user-agent":"mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/44.0.2403.125 safari/537.36","content-type":"application/json;charset=utf-8","referer":"http://192.168.33.10:5601/...

winapi - Windows 8.1 and Windows 10 API changes issue -

Image
i have full fledged app built windows 8.1... through research, discovered api changes between 8.1 , 10 nt , app built 8.1 work on 10.. so question windows 10 app work on windows 8.1? if yes, how can go it? i've created report on changes winapi 8 vs winapi 10 may discover differences in details. it's available on this page . report generated of abi-cc tool.

detect sequence in hive column with lead function -

i'm trying detect sequence in column of hive table. have 3 columns (id, label, index). each id has sequence of labels , index ordering of labels, like id label index x 1 y 2 x 3 y 4 b x 1 b y 2 b y 3 b y 4 b x 5 b y 6 i want identify if label sequence of x,y,x,y occurs. thinking of trying lead function accomplish like: select id, index, label, lead( label, 1) on (partition id order index) l1_fac, lead( label, 2) on (partition id order index) l2_fac, lead( label, 3) on (partition id order index) l3_fac mytable yields: id index label l1_fac l2_fac l3_fac 1 x y x y 2 y x y null 3 x y null null 4 y null null null b 1 x y y y b 2 y y y x b 3 y y x y b 4 y x y null b 5 x y null null where l1(2,3) next label values. check pattern where label = l2_fac , l1_fac = l3_fac this work id = a, not id = b label sequence is: x, y, y, y, y, x. don't care 3 y's in row interested w...

javascript - How to propagate value from one custom element to another in Polymer 1.0? -

i have 2 custom elements. student-details.html , student-service.html student-details.html looks this <link rel="import" href="../bower_components/polymer/polymer.html"> <link rel="import" href="student-service.html"> <dom-module id="student-details"> <style> </style> <template> <h1>student details</h1> <h1>{{studentid}}<h1> //this value printed <student-service user-data={{studentid}} service-name="studentdetails" response-data={{responsedata}} ></student-service> <h1>{{responsedata.name}}</h1> <img width="70" height="70" src="{{responsedata.image}}" /> <h1>{{responsedata.qualification}}</h1> <h1>{{responsedata.speciality}}</h1> <h1>{{responsedata.phone}}</h1> <h1>{{responsedata.email}}</h1>...

mysql - PHP - How to build multiple input search -

i have form around 7 inputs , want let user search according criteria choosea. so example: inputs name can be: name age gender registration date but user wants pick first 3, sql query like: select * table name='.$name.' , age= '.$age.' , gender = '.$gender.' cool work, facing problem of how build different sql query based on user input using mvc architecture. my idea like: // syntax nette framework please don't care it, basicly need logic in mvc public function findmatch($name= null, $age= null, $gender = null) { $selection = $this->database->table('table'); if ($name) { $selection = $selection->where('name', $name); } if ($age) { $selection = $selection->where('age', $age); } if ($gender) { $selection = $selection->where('gender', $gender); } return $selection; } but helps "or" selection not "and". please can m...

python - How to select DataFrame columns based on partial matching? -

i struggling afternoon find way of selecting few columns of pandas dataframe, checking occurrence of pattern in name (label?). i had been looking contains or isin nd.arrays / pd.series , got no luck. this frustrated me quite bit, checking columns of dataframe occurrences of specific string patterns, in: hp = ~(df.target_column.str.contains('some_text') | df.target_column.str.contains('other_text')) df_cln= df[hp] however, no matter how banged head, not apply .str.contains() object returned by df.columns - index - nor 1 returned df.columns.values - ndarray . works fine returned "slicing" operation df[column_name] , i.e. series , though. my first solution involved for loop , creation of list: ll = [] in df.columns: if a.startswith('start_exp1') | a.startswith('start_exp2'): ll.append(a) df[ll] (one apply of str functions, of course) then, found map function , got work following code: import re sel = df.col...

Arrange two variables by two mismatching irregular time-series in R/Python? -

i have date/time hourly gives stream discharge , date/time on hour @ irregular intervals gives stream sediment concentration. i'm unsure how post data frames here, looks like: datetimedis, discharge, datetimesed, sediment 6/12/15 12:00 1.1 6/12/15 18:00 1231 6/12/15 13:00 113 6/13/15 1:00 12312 6/12/15 14:00 123 21 6/13/15 8:00 12321 6/12/15 15:00 12 6/13/15 15:00 12312 6/12/15 16:00 12 6/14/15 19:00 4324 6/12/15 17:00 23 6/15/15 2:00 534523 6/12/15 18:00 123 6/15/15 9:00 52341 etc i have ~2500 raws of data discharge, , ~500 columns sediment. there way use ddply or r package or python paste values of sediment next discharge value corresponds same time? in example data, want instance sediment value @ 6/12/15 18:00 paste next discharge value @ time. i need paste them there space in-between containing na values or empty values can later interpolate them. assuming have 1 dataframe datetime , discharge(df) , time , sediment concentration(df2) following ...

c++ - Difference in stringstream behavior for void* type using libc++ and libstdc++ -

the following test program returns different results depending on whether i'm using libc++ or libstdc++. #include <sstream> #include <iostream> int main() { int = 0; void* optr = &a; void* iptr; std::stringstream ss; ss << optr; std::cout << ss.str() << '\n'; ss >> iptr; std::cout << iptr << '\n'; return 0; } i'm using following version of clang xcode 5 on osx 10.9.2 $ xcrun clang++ --version apple llvm version 5.0 (clang-500.2.79) (based on llvm 3.3svn) target: x86_64-apple-darwin13.1.0 thread model: posix here's output of test when built libstdc++ , libc++ $ xcrun clang++ test.cpp <-- libstdc++ version $ ./a.out 0x7fff5ec723e8 0x7fff5ec723e8 $ xcrun clang++ test.cpp -stdlib=libc++ <-- libc++ version $ ./a.out 0x7fff5205125c 0x7fff5 is bug in libc++ implementation of stringstream? usage of void* stringstream valid c...