Posts

Showing posts from June, 2011

java - Setting dynamic data to min and max attributes of @Range annotation - hibernate validators -

iam using hibernate validator validation of data. have used @range attribute validating particular field. @range(min=0,max=100) private string amount; this fine can dynamically change values of min , max instead of hard coding. mean can like: @range(min=${},max=${}) private string amount; annotations in java uses constants parameters. cannot change them dynamically. compile constants can primitives , strings.check link . if want make configurable can declare them static final. for example: private static final int min_range = 1; private static final int max_range = 100; and assign in annotation. @range(min=min_range,max=max_range) private string amount; the value annotation attribute must constant expression.

sql - loop row by row from an excel file map to variable -

Image
i have 4 columns in excel file. need assign values each row corresponding 4 variables can replaced lated in query doing on server. question is: how that? far tried doing sql task in create table 4 columns (having same names in excel file) , task transfer content of excel recordset destination stores results variable. created foreach loop in having tasks. missing, how can this? thanks edit please find below screenshot project. overview. in "execute sql task" there connection excel , has following statement create table tempvariablemapping ( asofdate varchar(20), assump_set varchar(20), marketname varchar(20), portname varchar(20) ); then in transfer task (in recordset destination), i'm assigning variable name user::recordsetoutput global variable of type object. in foreach loop i'm using foreach ado enumerator , pointing user::recordsetoutput variable find below variable mapping those 4 variables in variable mapping in want pass values each row ...

javascript - How to disable all keys in key board except tab key -

how disable keys in key board except tab key select box in html. can 1 provide code one? below tried below code not working i hope you..put textbox , selectbox in page.. document.getelementbyid("li1").onkeydown = function (e) { e.preventdefault(); } demo

xslt - Filemaker XSL Importing blank fields -

in learning import xml items filemaker 13 i've run problem using "xsl:for-each" obtain multiple rows of data import. xml i've been using w3 schools music example . the xsl i'm using convert xml follows: <?xml version='1.0' encoding='utf-8'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="/"> <fmpxmlresult xmlns="http://www.filemaker.com/fmpxmlresult"> <metadata> <field name="title" type="text"/> <field name="artist" type="text"/> <field name="country" type="text"/> <field name="company" type="text"/> <field name="price" type="number"/> <field name="year" type="number"/> </metadata> <resultset> <xsl:fo...

ios - How to pass auth token from Parse SDK to Fabric TwitterKit? -

i log in twitter users using +[pftwitterutils loginwithblock:] method parse sdk. user profile picture login second time -[twitter loginwithcompletion:] method fabric twitterkit. there way pass auth token parse sdk twitterkit , login once ? there way export auth token , auth token secret parse using pf_twitter class parse sdk. looks should possible create twitterkit session using -[twtrsession initwithsessiondictionary:] , twitter docs says nothing dictionary format , can't working. parse when user logged in using parse's twitterutils method called twitter . right i'm using swift, pftwitterutils.twitter() you'll data needed. guess should [pftwitterutils twitter]; in objective-c. the class pf_twitter on parse. fabric twitterkit once object you'll access authtoken , authtokensecret current user. gotta use method twitterkit (note: deprecated in future, @ update @ bottom): objective-c: [twitter sharedinstance] loginwithexistingautht...

javascript - React Native Http Interceptor -

like applications, i'm writing application requires lot of similar logic in http response/requests handlers. instance, have check refresh tokens , save them asyncstorage, or set headers authservice headers, or check 404 route same 404 error page. i'm big fan of http interceptor in angular; can define , register http interceptor (lack of better term) intercept http traffic , run combined, common logic. i have 2 main questions: since in react native, define these independent components, should not extracting common http logic in first place in order preserve re-usability of component? if don't want duplicate code, there way in react native (first) or objective-c/swift (second) intercept http traffic , provide handlers requests? have considered axios if trying intercept xhr? using axios interceptors - https://www.npmjs.com/package/axios , far seems work. here sample code import axios 'axios'; import promise 'promise'; // add reques...

linux - Trouble using "virt-install" on ubuntu to create VM, just hangs after displaying initial info -

i'm on ubuntu 14.04 box, , need create vm using "virt-install". have liked use "virt-manager", have ssh shell access. consulted various resources how create disk image , the "virt-install" command line. constructed thought valid command, after submitting it, virt-install emitted couple of lines of output , hung, not doing anything. i've been watching ~30 minutes or now, , nothing appears have happened. tried viewing environment shell, don't know how tell if it's doing anything. here's i've done far. i created disk image (all sudo): fallocate -l 200g /var/lib/libvirt/images/jumphost.img this returned , appeared allocate disk image. here's "virt-install" command line, , entire output: attuser@bl12-kvm-nest:/var/lib/libvirt/images$ sudo virt-install -r 24576 -n opnfv-arno-foreman -f /var/lib/libvirt/images/jumphost.img --cdrom=~/arno.2015.1.0.foreman.iso error error validating install location: che...

node.js - Compilation error installing nodetime -

i'm trying install nodetime module (for node), when do, following compilation error: make: *** [release/obj.target/nodetime_native/src/nodetime_native.o] error 1 make: leaving directory /home/fernando/node_modules/nodetime-native/build' gyp err! build error gyp err! stack error: make` failed exit code: 2 gyp err! stack @ childprocess.onexit (/home/fernando/apps/node-v0.12.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23) gyp err! stack @ childprocess.emit (events.js:110:17) gyp err! stack @ process.childprocess._handle.onexit (child_process.js:1074:12) gyp err! system linux 3.13.0-53-generic gyp err! command "node" "/home/fernando/apps/node-v0.12.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp err! cwd /home/fernando/node_modules/nodetime-native gyp err! node -v v0.12.2 gyp err! node-gyp -v v1.0.3 gyp err! not ok npm err! linux 3.13.0-53-generic npm err! argv...

javascript - Wrong charset with JSON data in Node.js project -

how can fix following problem? if use code on app.js renders page no problem: app.get('/layout', function(req, res){ res.render('empreendimentolayout', {"titulo": "página layout"}) }) .ejs file this: <head> <title><%=titulo%></title> </head> but if on app.js: var routes = require('./routes'); app.get('/layout', routes.layout); and inside layout.js: exports.layout = function(req, res){ res.render('empreendimentolayout', {"titulo": "página layout"}) }) then rendering like: p�gina layout it happens in json data send. if coming directly app.js works well, if coming .js file comes wrong charset.

primefaces - p:dialog with resizable="true" doesn't resize when its p:inputTextarea resizes -

i have p:dialog resizable="true" , contains p:inputtextarea , resizable: <p:dialog header="comment" widgetvar="commentdialog" modal="true" resizable="true" height="100"> <h:form> <h:outputlabel for="comment" value="comment:"/> <p:inputtextarea id="comment" title="comment" rows="6" cols="33" value="#{managedbean.comment}" required="true" styleclass="plaininput"/> <h:commandbutton value="submit"/> </h:form> </p:dialog> however, enter more text text area initial capacity, text area resize dialog not. how make dialog resize text area? remove height="100" attribute or set height="auto" instead. *tested in primefaces 5.1.1

java - JSONArray object have getString(""); not found -

imported header files are: import org.json.simple.jsonarray; import org.json.simple.parser.parseexception; import org.json.simple.parser.jsonparser; the line string name= jsonarray.getstring("name"); causes error: getstring("") not found that's because jsonarray doesn't have getstring() method. matter, jsonobject doesn't have getstring() method. we can guess without knowing jsonarray contains, guess need, string name= (string) ((jsonobject) jsonarray.get(0)).get("name"); edit: based on comment, think jsonarray of type jsonobject (not sure though), in case use, string name = (string) jsonarray.get("name");

python - Difficulty Creating column of Pandas Dataframe -

i wanted create new column of dataframe based on existing columns, want conditional on existing column in dataframe. following code not working. know why? if cv['keyword'] == 0: cv['left out'] = (cv['prediction numerator'] - (cv['rate'] *10000))/(cv['prediction denominator'] - 10000) else: cv['left out'] = (cv['prediction numerator'] - (cv['rate'] *10000 * 10))/(cv['prediction denominator'] - (10000 * 10)) i'm getting following error: traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\users\bwei\downloads\winpython-64bit-2.7.9.4\python-2.7.9.amd64\lib\site-packages\pandas\core\generic.py", line 709, in __nonzero__ .format(self.__class__.__name__)) valueerror: truth value of series ambiguous. use a.empty, a.bool(), a.item(), a.any() or a.all(). here's snippet of first 4 columns of dataframe. zip keyword pr...

Unable to Implement a Navigation Drawer on the Right Side of The Screen - Android / Java -

i've implemented , navigation drawer appearing on left side of screen - i'd appear on right side of screen (with it's icon in upper right hand corner of screen - in top left). found following article explains how so: http://stackoverflow.com/questions/18547277/how-to-set-navigation-drawer-to-be-opened-from-right-to-left/19358114#19358114 however when attempt implement code navigation drawer still appears on left side. source (snippet): @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.ss_home); ... mdrawerlist = (listview) findviewbyid(r.id.drawer_list); mdrawer = ( linearlayout) findviewbyid(r.id.drawer); mdrawerlayout = (drawerlayout)findviewbyid(r.id.drawer_layout); madapter = new simpleadapter(this, mlist, r.layout.drawer_layout, from, to); mdrawertoggle = new actionbardrawertoggle(this, mdrawerlayout, r.drawable.icon_list_top_right , r.string.dra...

javascript - Prevent View Opening Kendo -

in aspx, using kendo gantt, need prevent opening of view edit task when double click on third column of gantt "grid". this js, how can that? regards <script type="text/javascript"> $(function (e) { $(".k-gantt").on("dblclick", ".k-gantt-treelist .k-grid-content tr", function () { var uid = $(this).attr("data-uid"); e.preventdefault(); if (uid) { $("#gantt").data("kendogantt").edittask(uid); } }); }); </script> you can exclude 3rd column triggering function on click event. $(".k-gantt").on("dblclick", ".k-gantt-treelist .k-grid-content tr :not(td:nth-child(3))", function () { var uid = $(this).attr("data-uid"); e.preventdefault(); if (uid) { $("#gantt").data("kendogantt").edittask(uid); } });

python - Why is there a large overhead in pickling numpy arrays? -

suppose have simple array in python: >>> x = [1.0, 2.0, 3.0, 4.0] when pickled, reasonably small size: >>> pickle.dumps(x).__len__() 44 how come if use numpy array, size larger? >>> xn = np.array(x) >>> pickle.dumps(xn).__len__() 187 converting less precise data type helps little bit... >>> x16 = xn.astype('float16') >>> pickle.dumps(x16).__len__() 163 other numpy/scipy data structures sparse matrices don't pickle well. why? checking in debugger, numpy array has fields max, min, type etc apart data, not sure python list has. a complete list can found on http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html as pickling binary copying, these other fields being copied, resulting in larger size.

Ajax http 500 error Azure not on local -

when running ajax request error message: failed load resource: server responded status of 500 (ok) the problem server error not seem occur. when run application on local machine azure database don't error message. published azure application generates error. have done remote debugging , though browser display error server keeps handling request , minutes later finishes request. if there not server error. the server needs 10 minutes finish request. believe has fact request long (because works on smaller databases). know azure has restrictions on cpu time on app service level free switched basic (no cpu time restrictions) should not problem. request sql intense (about 20k sql queries). ajax call: $.ajax({ async: true, cache: false, type: "post", url: foourl, contenttype: 'application/json', datatype: "json", data: json.stringify(null), success: function (error_message) { $("#foobar").removeclass("loa...

java - Is Ruby compatible with strict Page Object Pattern? -

i have built various test automation frameworks using page object pattern java ( https://code.google.com/p/selenium/wiki/pageobjects ). two of big benefits have found are: 1) can see methods available when have instance of page (e.g. typing homepage. show me actions/methods can call homepage) 2) because navigation methods (e.g. gotohomepage() ) return instance of subsequent page (e.g. homepage), can navigate through tests writing code , seeing takes you. e.g. welcomepage welcomepage = loginpage.loginwithvaliduser(validuser); paymentspage paymentspage = welcomepage.gotopaymentspage(); these benefits work java since type of object (or page in case) known ide. however, ruby, object type not fixed @ point , ambiguous ide. therefore, cannot see how can realise these benefits on automation suite built using ruby (e.g. using cucumber). can show me how use ruby page object pattern gain these benefits? from further investigation, looks initial requirement can fulf...

c++ - How to structure an app-game? -

i have started project making game using cocos2d-x , visual studio (c++). wondering if had tips on how should structured, purely theoretical? i've done decent amount, have menu set-up buttons etc, have player class load in when press play. should have enemy class? create , deal those. want keep track on how many enemies spawned in can stuff based on that. how recommend switch between levels? also file format should store data in? looking theoretical tips building game! best regards, fresh face. search internet... asking high level. find tutorial , follow :) this website has loads of stuff.

c# - "Value cannot be null.\r\nParameter name: typeName" when receiving queue messages -

i have error above "value cannot null.\r\nparameter name: typename" this stack trace: > " @ system.runtimetype.gettype(string typename, boolean throwonerror, boolean ignorecase, boolean reflectiononly, > stackcrawlmark& stackmark)\r\n @ system.type.gettype(string > typename, boolean throwonerror)\r\n @ > x.queuehelper.getbody[t](brokeredmessage brokeredmessage)\r\n @ > x.queuehelper.<>c.<receivemessage>b__3_0(brokeredmessage message)" the code have follows i send message without exceptions(this controller action) [httppost] [validateantiforgerytoken] public actionresult create([bind(include="id,nombre,nit,nombrerepresentantelegal,telefonorepresentantelegal,nombrecontacto,telefonocontacto,propiedadesextra")] empresa empresa) { if (modelstate.isvalid) { var propiedadeslist = formvalues in request.form.todictionary() ...

python - Echo pyodbc output in php script in Ubuntu 14.04 -

i have ubuntu 14.04 machine running local server. on server, have php script needs access data on remote microsoft azure sql database. i unable find way access database ubuntu uing purely php, tried out python script , imported pyodbc library after following tutorial: https://snakeycode.wordpress.com/2013/12/04/installing-pyodbc-on-ubuntu-12-04-64-bit/ i can run script fromthe terminal, , connects azure sql database , prints output of query console. this great news, began test out on local server. on server, in php method, call echo shell_exec('my_script.py'); this gives me error: pyodbc.error: ('08001', '[08001] [unixodbc][freetds][sql server] unable connect data source (0) (sqldriverconnect)') why my_script.py not work when executed local server? use tds version 8.0 , mention same in pyodbc.connect connection string. sample code: #!/usr/bin/python "proof connection @ pyodbc level." # test pyodbc connection....

Unfortunately,NavigationBar has stopped in android studio emulator -

i have done coding in android studio when running app in android studio emulator it's not working. here code:- **mainactivity.java** package com.example.arpi.navigationbar; import android.app.activity; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.widget.drawerlayout; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.app.actionbar; public class mainactivity extends activity implements navigationdrawerfragment.navigationdrawercallbacks { /** * fragment managing behaviors, interactions , presentation of navigation drawer. */ private navigationdrawerfragment mnavigationdrawerfragment; ...

apache - How to mod_rewrite a URL but ignore directories? -

in short: how ignore directories whe doing mod_rewrite? old site: http://www.domain.com/shop/dir1/dir2/dir2/page.html new site want "page.html" , redirect him /page.html longer version tried , tried, failed. hope idea: we have old site has behind /shop/ , can contain directories followed filename, page.html my thing is, directories not important... it's last page. how can ignore between /shop/......filename.html ? so: old site: http://www.domain.com/shop/dir1/dir2/dir2/page.html new site want "page.html" , redirect him /page.html this must easy, don't know! thanks in advance

c++ - Gsv::buffer error -

in c++ project, want use gsv::buffer gtksourceview library. declare buffer this: glib::refptr<gsv::buffer> buffer; i create : buffer->create(); but when want use inherited fonction gtk::buffer: buffer->set_text("somethings"); the executable exit , return: erreur de segmentation (core dumped) what problem? thanks help you create pointer, don't make point anywhere. in essence, buffer null pointer. from the refptr default constructor refernece : afterwards null , use of -> cause segmentation fault. you need explicitly create object pointed to, using static gsv::buffer::create function, e.g. glib::refptr<gsv::buffer> buffer = gsv::buffer::create();

c++ - how to use sleep() in GTK+ -

i'm making app read cards , print balance, when user wants see balance clicks on balance enquiry button on main screen. i've created background using cairo. when user click balance enquiry screen showing show card should paused 2-3 seconds, i'm using sleep() function. problem screen sleeps on click on bal. enq. button, i'm sure sleep() after code prints show ur card on screen. you can't use sleep() in gtk+ gui application, block entire application , make unresponsive. application causes gtk+ work update interface; if sleep, stop gtk+ running , ui changes won't happen until application wakes up. look glib's timeout api: g_timeout_add() sensible place start.

xml - How to compare node attribute against node -

i trying figure out how similar `if exists in (node) i have following xml , on xls i´m tryingto compare if available flags @id exists in contact/biographical/flags <availableflags> <flag id="happy">happy</flag> <flag id="curious">curious</flag> <flag id="busy">busy</flag> <flag id="expert">expert</flag> <flag id="client">client</flag> <flag id="manager">manager</flag> </availableflags> <contact> <biographical> <age>33</age> <flags> <flag>happy</flag> <flag>expert</flag> </flags> </biographical> <contact> xls <xsl:if test="@id=contact/biographical/flags/@flag"> <input type="checkbox...

Cassandra Table Definition out of Sync -

we have problem cassandra. have on table 'card_ix' , 3 different cassandra nodes. if execute following insert statemtn on node #1 , #2 works fine: insert card_ix(key,value1string,value2bigint) values('abc', 'value1', 1234); when execute command on node #3 following error occurs: bad request: unknown identifier value2bigint some time ago changed name value2string value2bigint , changed datatype accordingly. dropped whole table , created new one, same table name. the following command displays same, correct result on 3 nodes. describe table card_ix; a select * card_ix; results in following error: failed decode value '\x18\x94\xcau\x19)\x12\x11' (for column 'value2string') text: 'utf8' codec can't decode byte 0x94 in position 1: invalid start byte the table names displayed in select statement old ones. does has idea problem is?

Python : looping through each row of html table based on headers -

i'm new python(3.4) , have parsed html table headings[ ] , rows[ ] , cells [ ] wish store each of these table (mysql) field names being items in headings[ ] there 4 headings("data0","data1","data2","data3") there 6 rows the code there rudimentary using beautifulsoup: soup = beautifulsoup(r.text) table = soup.find("table") cells = [] rows = table.findall('tr') headings = [th.get_text().strip() th in table.findall("th")] row in rows: cell in row.findall('td') cells .append(cell.get_text().strip()) i'm used doing case statements, or, heaven forbid, number of if statements. place them under cell in row.findall('td') . working counter , doing like: for row = 0 len(rows) cell = 0 len(headings) select case cell case = 0 (save cell contents field called headings[0] case = 1 (save cell contents field called headings[1] ... i'm not wor...

restructuredtext - how to document a single space character within a string in reST/Sphinx? -

i've gotten lost in edge case of sorts. i'm working on conversion of old plaintext documentation rest/sphinx format, intent of outputting few formats (including html , text) there. of documented functions dealing bitstrings, , common case within these sentence following: starting character blank " " has value 0. i tried writing inline literal following ways: starting character blank `` `` has value 0. or starting character blank :literal:` ` has value 0. there few problems how these end working: rest syntax objects whitespace inside of literal, , doesn't recognized. the above can "fixed"--it looks correct in html ( ) , plaintext ( " " ) output--with non-breaking space character inside literal, technically lie in our case, , if user copied character, wouldn't copying expect. the space can wrapped in regular quotes, allows literal recognized, , while output in html fine ( " " ), in plaintext ends double-quoted "...

spring - Prevent system properties/variables being evaluated in Java properties? -

i using spring load properties: <util:properties id="service-properties"> ... <prop key="postscript"></prop> ... </util:properties> <bean class="org.springframework.beans.factory.config.propertyplaceholderconfigurer" id="propertyconfigurer"><property name="properties" ref="service-properties" /> </bean> however, 1 of properties can have value following (this camel xml simple language snippet): postscript=<setbody><simple>${in.header.type}</simple></setbody> the problem, when value of property, is: postscript=<setbody><simple></simple></setbody> i think seems trying resolve ${in.header.type} variable, thinking system variable maybe? i'd know how stop variable being resolved? i've tried escaping quotes no good. got answer camel docs :-) http://camel.apache.org/simple.html a...

c# - Version-independent code for Rfc2898DeriveBytes (has Dispose on .NET 4.0 but not on 2.0) -

i'm writing small .net 2.0 compatible assembly uses rfc2898derivebytes . on .net 2.0 rfc2898derivebytes not implement idisposable , while in .net 4.0 rfc2898derivebytes implement idisposable . my assembly loaded in .net 4.0 applications , in .net 2.0 applications. do need dispose rfc2898derivebytes using .net 4.0 or can ignore memorystream ? if so, how can write .net 2.0 , .net 4.0 compatible code, calling dispose on .net 4.0? (at best without reflection , on.) i guess not using dispose on class not dangerous because idisposable comes abstract derivebytes -class. you could: rfc2898derivebytes rfc = null; try { var salt = new byte[128]; rfc = new rfc2898derivebytes("password", salt); } { idisposable disp = rfc idisposable; if (disp != null) { disp.dispose(); } } even roslyn, compiler doesn't remove as idisposable : http://goo.gl/oobkzv (right pane, in release mode, optimizations active) (note i'm n...

Qt - Cannot export QImage to 16bit bmp -

i have created simple application , need export pixmap 16-bit bmp image. have several pixmap items have loop first create qimage , convert format_rgb16 : for(qlist<image_handler * >::iterator it=imageitems->begin(); it!=imageitems->end(); it++) { ... // image_handler inherits qpixmap qfile export_image(path+"/img_"+code+".bmp"); qimage export_img = (*it)->toimage().converttoformat(qimage::format_rgb16); export_img.save(&export_image, "bmp"); ... } where image_handler custom qpixmap. images exported @ path given, correct filename. when @ properties of file (in windows) can see image depth 24-bit. unfortunately need them 16-bit. what doing wrong here? or bug in qt? how can export 16-bit bmps pixmap? turns out, qt forcibly converts image, before saving bmp. qt-src/src/gui/image/qbmphandler.cpp:777 : bool qbmphandler::write(const qimage &img) { qimag...

jquery - Fancybox set content source class name -

using fancybox 2, i've been able trigger content source types via class on triggering element. example, <a href="..." class="fancybox.iframe">...</a> trigger iframe. i'm updating fancybox v1 on existing code base, , adding these classes each link isn't particularly desired. i can: add class dynamically js (each link has class of iframe jquery hook onto, add right class on top of on page load) somehow change settings of fancybox 2 pickup iframe class , use instead of fancybox.iframe . add type: iframe call options. for sake of compatability, i'd go second option, there's nothing on documentation on whether it's possible. is possible change class fancybox looks detect content source?

scala - Is it possible to correctly calculate SVD on IndexedRowMatrix in Spark? -

i've got indexedrowmatrix [m x n], contains x non-zero rows. i'm setting k = 3. when try calculate svd on object computeu set true, dimensions of u matrix [m x n], when correct dimensions [m x k]. why happen? i've tried converting indexedrowmatrix rowmatrix , calculating svd. result dimensions [x x k], calculates result non-zero rows (matrix dropping indices, in documentation). is possible convert matrix, keeping rows indices? val csv = sc.textfile("hdfs://spark/nlp/merged_sparse.csv").cache() // original file val data = csv.mappartitions(lines => { val parser = new csvparser(' ') lines.map(line => { parser.parseline(line) }) }).map(line => { matrixentry(line(0).tolong - 1, line(1).tolong - 1 , line(2).toint) } ) val coordinatematrix: coordinatematrix = new coordinatematrix(data) val indexedrowmatrix: indexedrowmatrix = coordinatematrix.toindexedrowmat...

javascript - JSpdf working in Internet Explorer but not working in Chrome -

Image
hi bit stuck here, trying use jspdf printing html pdf. first of tried examples , worked. when try implement same in django website, there issue. 1. working internet explorer, able download pdf 2. same not working chrome (why). by following post : get_url().createobjecturl error able understand that: issue ajax calls changing url other value. also looked in : window.url.createobjecturl(blob); undefined in application but doesn't says clear solution problem. how make things work. so far have checked : none of js files inclusion missed , working fine internet explorer. in explorer ajax calls doesn't works here error getting any appreciated :) not sure if can much, understand error seeing caused createobjecturl being undefined, first thing check why happens. have tried writing window.ulr.createobjecturl(new blob) in console? try writing on application page, , if stil happens, have changes url object. the next step temporarily remo...

Javascript promises deep in the stack -

i decided have fallback call server when creating model in case can't find value information available locally. want have async if possible, mean have make in chain of code consume , return promises? i'm going use pseudo code illustrate point initially, call stack can little long , don't include things aren't central question. let me know if need more go on though. function router() { if (condition) { controller.renderdocument(options); } } controller.renderdocument(options) { documentcollection.findorcreatedocumentholder(options); } documentcollection.findorcreatedocumentholder(options) { var model = this.findorcreatedocument(options); } documentcollection.otherfunction(options) { // illustrate there's several entry points kind of functionality var model = this.findorcreatedocument(options); } documentcollection.findorcreatedocument(options) { if (!options.type) options.type = resolvetype(options); // othe...

c# - Show EULA in ClickOnce -

Image
i want show eula (end-user license agreement) window before installing application clickonce. i googled lot , chose follow link . i combined solutions of first reply of discussion , 1 eula.bat. looks great want customize window more. i prefer not show button view eula printing. i want make eula textbox can't copyed. i want alternative solution other eula.bat popup window. product.xml <?xml version="1.0" encoding="utf-8" ?> <product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" productcode="eula.bootstrap.component"> <!-- defines list of files copied on build --> <packagefiles> <packagefile name="en/eula.bat"/> <packagefile name="en/eula.rtf"/> </packagefiles> <commands> <command packagefile="en/eula.bat" arguments='' > <exitcodes> <exitcode value=...

java - Split a string with multiple delimiters while keeping these delimiters -

let's have string: string x = "a| b |c& d^ e|f"; what want obtain looks this: a | b | c & d ^ e | f how can achieve using x.split(regex) ? namely regex? i tried link: how split string, keep delimiters? it gives explanation on how 1 delimiter. however, using , modifying fit multiple delimiters (lookahead , lookbehind mechanism) not obvious not familiar regex. the regex splitsplitting on optional spaces after word boundary \\b\\s* note \\b checks if preceding character letter, or digit or underscore, , matches number of whitespace characters string split on. here sample java code on ideone : string str = "a| b |c& d^ e|f"; string regex = "\\b\\s*"; string[] spts = str.split(regex); for(int =0; < spts.length && < 20; i++) { system.out.println(spts[i]); }

Linux for loop KSH issue -

the following code works fine in 1 system , not other same specs. system a: ksh --version version sh (at&t research) 93u+ 2012-08-01 uname -a linux servera 2.6.32-431.5.1.el6.x86_64 #1 smp fri jan 10 14:46:43 est 2014 x86_64 x86_64 x86_64 gnu/linux code: #!/bin/ksh cd /home/path/ if [ `ls -1 *.log 2>/dev/null | wc -l` -gt 0 ] ; echo "log files more zero" f in `ls -1 *.log` ; echo $f sleep 1 done fi output: log files more 0 file1.log file2.log file3.log system b: ksh --version version sh (at&t research) 93u+ 2012-08-01 uname -a linux serverb 2.6.32-431.5.1.el6.x86_64 #1 smp fri jan 10 14:46:43 est 2014 x86_64 x86_64 x86_64 gnu/linux code: #!/bin/ksh cd /home/path/ if [ `ls -1 *.log 2>/dev/null | wc -l` -gt 0 ] ; echo "log files more zero" f in `ls -1 *.log` ; echo $f sleep 1 done fi output: log files more 0 and hangs forever ..... any thoughts why ?? ...

javascript - Cannot switch view in HTML5 mode in AngularJS -

i playing around this code make work html5 links. somehow not able make work: view not resolved url. in addition, not clear whether need put "/" in front of view name. if do, browser url link shows "file:///addstudent" without base, on other hand , if not, see url base. supposed that? in case see error message: "this webpage not found" . doing wrong here? thanks! testangularjs.htm <html> <head> <title>angular js views</title> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular-route.min.js"></script> <base href="file:///home/myusername/projects/parser_ui/"> </head> <body> <h2>angularjs sample application</h2> <div ng-app="mainapp"> <p><a href="addstudent">add studen...

python - Issue importing object within the same directory -

let's assume have directory structure: tumblelog/ __init__.py manage.py when try import app __init__.py in manage.py statement: from tumblelog import app i following error: importerror: no module named tumblelog you have import module not directory. your code has be: from __init__ import app this create pyc file. "from" expression declares file, "import" declares function being imported. alternatively, if want import functions write import __init__ and write __init__.app() to use it or import without having retype module time: from __init__ import *

reactjs - Firebase library for Node.js breaks when using 'babel' loader. Specifically: "Uncaught TypeError: Cannot read property 'navigator' of undefined" -

i'm building app reactjs, webpack, babel, , firebase. when run webpack bundle code using babel loader, see following printed out amongst many other lines: [babel] note: code generator has deoptimised styling of "/users/.../myproject/node_modules/firebase/lib/firebase-web.js" exceeds max of "100kb". then when try , require('firebase') in app, , run in browser... browser prints out following in console. uncaught typeerror: cannot read property 'navigator' of undefined (anonymous function) @ firebase-web.js:12 (anonymous function) @ firebase-web.js:262 __webpack_require__ @ bootstrap da2fff1ce4ea892319dc:19 aa @ playerstore.js:3 __webpack_require__ @ bootstrap da2fff1ce4ea892319dc:19 prop @ player.js:19 __webpack_require__ @ bootstrap da2fff1ce4ea892319dc:19 (anonymous function) @ index.js:13 __webpack_require__ @ bootstrap da2fff1ce4ea892319dc:19 obj.__esmodule.default @ bootstrap da2fff1ce4ea892319dc:39 (anonymous function) @ b...