Posts

Showing posts from March, 2015

java - Reload an <img src =<%= function() %> > in jsp -

hi have query regarding image reload in jsp page my code : <!doctype html> <html lang="en"> <head> <!-- script auto refresh of graphs 5 seconds interval --> <script type="text/javascript"> var load, generation, store, ep,transaction,battery; window.onload = function() { transaction = document.getelementbyid("transaction"); setinterval(function() { transaction.src = transaction.src.replace(/\?.*/, function() { return '?' + new date() }) }, 1000) } </script> <%! public string transactionfunc(){ system.out.println("---------transactionfunc------------"); string name=psmapp.getinstance().notif.gettransaction(); string src = "../stylesheet/images/energydeficit256.png"; if(name!=null && name.equals("buy")){ src = "../stylesheet/images/energydeficit256.png"; } else if(name!=null && name.equals("sell"))...

ruby - Using databag in CHEF recipe -

i have been struggling on week solve issue. there can me out solving this. i have databag mongo, contents of databag is: { "firstuser": { "id": "firstuser", "password": "123", "db": "mydb", "role": "readwrite" }, "seconduser": { "id": "seconduser", "password": "123", "db": "mydb", "role": "readwrite" }, "thirduser": { "id": "thirduser", "password": "123", "db": "mydb", "role": "read" }, "id": "users" } i want loop through databag, in order create users in mongodb. have come (and lot more fruitless attempts) users_databag_item = data_bag_item('mongodb', 'users') users_databag_item.each_pair | user, values | log "db.createuser( { user: '#{values['id']}', ...

Android buildTypes for Alpha/Beta/Production apk -

i want release apk on play store. release on alpha, beta , if goes release on production. can define different api endpoint each in buildtype inside gradle. if yes how? want change end point of api calling throughout application. if release apk on alpha api points http://test.alpha.bla.bla for beta: http://test.beta.bla.bla for production: http://test.production.bla.bla . so in version of app (alpha/beta/production) having same version code without need upload new apk. thanks. i assume mean want 3 different build targets (and 3 different uploads google play): in build.gradle have android part, in there can define productflavors following: productflavors{ alpha{ buildconfigfield 'string', 'server','http://test.alpha.bla.bla' } } but make enums , refere (instead of type "string" have specifiy full package name + enum type , , in last part (the value), full package name + enum ) you can reference server u...

javascript - Multer returning req.file undefined -

hey, know question has been asked plenty of times before, , i've tried implementing solutions, don't work me. i have been tearing hair out trying figure out how upload file , read file size through node. tried using formidable npm, seems no longer maintained can't find documentation on it. had no way of dealing errors tried using multer. however, repeatedly undefined log when try log req.file. i have server.js code below var express = require('express'); var formidable = require('formidable'); var multer = require('multer'); var path = require('path'); var upload = multer({dest: './uploads'}); var fs = require('fs'); var app = express(); var port = 8080; app.use(express.static(__dirname+'/views')); app.set('views', './views'); app.set('view engine', 'jade'); app.get('/', function(req, res){ res.render('index.jade'); }); app.post('/uplo...

python - ZipFile: extract only the subfolder, not the whole folder -

is possible extract subfolder archive, rather whole folder? i.e. : have .zip / .tar.gz file named my_archive , has inside folder folder_1 . folder_1 has inside subfolder_1 , subfolder_2 , subfolder_3 . want directly extract subfolder_1 , subfolder_2 . how do it? edit:it ok if copy folder_3 well, important part go directly inside folder_1

php - Open cart not use $this->db->query in model file -

working in open cart model view controller structure know $db library file , store in page load , set key value in registry file. question in model file place open cart use.path of file catalog\model\order\order.php . $order_query = $this->db->query('select * `'.db_prefix."order` but in same model file, in places open cart not use variable. $sql = ' select * '.db_prefix."order_sellerhistory

android - Retrieve Images from database on the basis of json data -

Image
currently developing application displays cricket scores api. api returns json data of list of live matches, has unique id of every match. passing unique id of match in url, entire scorecard of match. but, doesn't return photos of players playing. want display them in imageview along playername, runs, balls, boundaries,etc. something this.. what's best way? firebase or else? you need use libraries glide loading images link. and links of images can maintain static array of url's of images or may write dynamic code links of profile images extracted json id's (by requesting on generic url using id's) have need not maintain static array.

.net - What is Process Heap? -

recently reading book "under hood of .net memory management" author mentioned process heap few times , written talk in last chapters. unfortunately there nothing process heap there ) can advice books or materials read on ? thanks.

How do I get the newest time value in Android Java SQL in my database? -

i have sql database 2 columns "message" , "datetime". want know when last entry added. want highest datetime value. what efficient way query database in android/java value? assuming have sqlite: if column text or real give newest item: select * table order date(column) desc limit 1 or select * table order datetime(column) desc limit 1 or simply select * table order column desc limit 1

post - String object in arduino becomes empty -

i using arduino develop small iot project. till working fine. steps of projects are: create xml string sensor reading send xml post server. the odd thing first 3 trials work perfectly. however, after that, string holding xml becomes empty. below portion of code: void loop() { while (serial3.available()>0) { char c = serial3.read(); if (gps.encode(c)){ createxml(); delay(1000); if(seconds_passed==10000 && !isxmlempty) { xml+="\n</start>"; serial.print(xml); serial.print(f("send server")); seconds_passed=0; isxmlempty=true; string temp =""; temp = "xml="+xml; char *param = new char[temp.length()+1]; temp.tochararray(param,temp.length()); serial.println(param); if(!postpage(servername,serverport,pushpage,"xml=123")) serial.print(f("fail ")); else serial...

linked list - Implementing a Set in Java using a LinkedList -

i have create class named myset includes methods isempty(), insert(object o) etc. thought use linked list of objects implement myset class. new java, stuck creating object i.e. not clear how start with. thought of this: public class myset { linkedlist<object> ll = new linkedlist<object>(); } i further have write method: public myset union(myset a) : returns set union of current set set a. can done iterating through a, if element @ particular index in not contained in ll add element ll. how write in java code? ps: assignment question , aren't allowed use sets implementation. some starting points. you should either use "true" generics: class myset<t> { private final linkedlist<t> objects = new linkedlist<t>(); or leave generics out, like: class myset { private final linkedlist objects = new linkedlist(); you see, solution linkedlist<object> ll = new linkedlist<object>(); will allow user can...

c# - Include only partial entity in EF6 Include -

i have model includes punches can have attachments has properties id, name binarydata. if do: var result = context.punchset .where(p => p.punchtype == punchtype && p.project.id == projectid) .include(c => c.contractor) .include(c => c.clearedby) .include(c => c.createdby) .include(a => a.attachments) the query slow molassis since attachments can both many , large. in case need id , name of attachments. tried: var result = context.punchset .where(p => p.punchtype == punchtype && p.project.id == projectid) .include(c => c.contractor) .include(c => c.clearedby) .include(c => c.createdby) .include(a => a.attachments.select(a2 => new attachment() { id=a2.id, name=a2.name} ); but ends error: the include path expression must refer navigation property defined on type. use dotted paths reference navigation properties , select operator collection navigation properties. parameter name: pat...

java - Spring MVC with Tomcat won't open Hello World html page -

i'm trying open simple html page writes hello world, on localhost:8080/hello inside spring mvc app. use spring boot comes own tomcat. web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <display-name>angular rest spring</display-name> <servlet> <servlet-name>angular</servlet-name> <servlet-class> org.springframework.web.servlet.dispatcherservlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>angular</servlet-name> <url-pattern>*</url-pattern> </servlet-mapping> </web-app> i tried pu...

c# - Functional Principles in objectorientated Programs -

today saw piece of code , thinking it's sense. made little example can see how works. far know should nested functionality heavy use of lambda-caculus used in functional languages. because find not understandable (jumping file file) know if of have similiar experience this. example function one public void dosomethinga(int inputint, action<int?, exception> result) { try { int? retval = inputint; result(retval, null); } catch (exception e) { result(null, e); } } example function two static void dosomethingb(int? baseint, action<exception> result) { try { result(null); } catch (exception e) { result(e); } } example call of both. public int? calculatesomething(int input) { int? result; dosomethinga(input, (resultint, aexception) => { ...

Report display nothing but blank pages when published -

my web application runs fine locally when published reports nothing blank pages. when check page elements using f12 button, there 4 errors: failed load resource: net::err_name_not_resolved http://crystalreportviewers13//js/crviewer/crv.js failed load resource: net::err_name_not_resolved mastersection.aspx:64 uncaught referenceerror: bobj not defined mastersection.aspx:73 uncaught referenceerror: bobj not defined how can resolve these errors? bobj not defined reason report coming blank. there few possible causes issue, there's solution each. paraphrase this article there 4 causes: 1. crystalreportviewers12 folder missing: copy folder crystalreportviewers12 c:inetpubwwwrootsystem_web2_0_50727 default website custom website in iis. or point virtual directory aspnet_client folder in directory. 2. application pool running under integrated mode when iis 7 used: select application pool in iis manger , go basic settings. under managed pipeline mode, ch...

ios - How to get a MKAnnotationView that's draggable without any delay? -

the below code works , gives me draggable annotation view. however, i've noticed annotation view not draggable beginning on, rather after finger has rested short moment on annotation view. when directly going drag movement dragging doesn't affect annotation view instead pans map. doesn't feel drag'n'drop. both on device , in simulator. viewcontroller (delegate of mapview) override func viewdidload() { /// ... let gesturerecognizer = uilongpressgesturerecognizer(target: self, action: #selector(addpin)) mapview.addgesturerecognizer(gesturerecognizer) } func addpin(gesturerecognizer: uigesturerecognizer) { if gesturerecognizer.state != uigesturerecognizerstate.began { return } annotation in mapview.annotations { mapview.removeannotation(annotation) } let touchlocationinview = gesturerecognizer.locationinview(mapview) let coordinate = mapview.convertpoint(touchlocationinview, tocoordinatefromview: mapview) ...

arrays - Trying to understand the usage of multidimension dynamic fields in C -

i'm trying learn c @ moment , have encountered task cannot solve on own. simple minesweeper implementation. short description program should do: gets input files via command line, opens them 1 @ time, creates minesweeper field each , if multiple files opened program saves them formatted in 1 file. don't want format them 1 beneath other, want use dynamic 2 dimensional array, matrix expands without losing saved mines. each input file has same build: 3\t5\n 0\t3\n 3\t7\n ... the first line indicates size of n x m matrix , following lines coordinates of mines. here code far: #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> typedef struct game{ int n; int field[]; }game; int read_files(char **input, int length); int make_field(char *input, int i, int *ptr); void increment(int i, int j, game); int is_inside_bounds(int i, int j, game); void free_field(); void safe_field(); int main(int argc, char **argv...

c# - Report does not execute on computers other than my own -

my application not work on computer own. when open exe bin folder on computer brings report , can run no problem. when go computer crashes , displays error: problem event name: clr20r3 problem signature 01: crystaltest.exe problem signature 02: 1.0.0.0 problem signature 03: 57d0272d problem signature 04: crystaldecisions.shared problem signature 05: 13.0.17.2096 problem signature 06: 576134be problem signature 07: 69d problem signature 08: 1 problem signature 09: system.typeinitialization os version: 6.1.7601.2.1.0.256.48 locale id: 1033 additional information 1: 0a9e additional information 2: 0a9e372d3b4ad19135b953a78882e789 additional information 3: 0a9e additional information 4: 0a9e372d3b4ad19135b953a78882e789 i created new c# windows form application project, added existing crystal report new item, added crystalreportviewer form, , added code: private void crystalreport...

.htaccess - Redirect all numbered PHP pages to home -

a legacy php site i'm replacing contains static numbered php file every pagination of content, is: example.com/pictures-1.php example.com/pictures-2.php example.com/pictures-3.php . . . example.com/pictures-x.php where x can integer 999. how set rewrite in .htaccess 301 redirect of above pages home, i.e. https://www.example.com ? thanks. simple thing want is: rewriteengine on rewritecond %{request_uri} ^/pictures-(\d+).php rewriterule ^.*$ http://example.com [l,r=301,nc] you can of course extend pass page rewritten using following: rewriteengine on rewritecond %{request_uri} ^/pictures-(\d+).php rewriterule ^.*$ http://example.com?page=%1 [l,r=301,nc] there's handly little tool helps .htaccess @ http://htaccess.mwl.be/

c# - Stream.CopyToAsync never calls my WriteAynsc method -

i wrote custom stream class needs hit database read/write info. wanted use xxasync database methods, advised write both synchronous , asynchronous methods in stream since couldn't use connection.openasync() in synchronous read/write methods. however, after implementing both versions, when use stream destination in call following in simple console application's void main() method: task.run( async () => { using ( var ctx = new jobcontext() ) { // create assemblycache record , assemblykey... using ( var fs = new system.io.filestream( @"c:\btr\source\assemblies\btr.rbl.evolution.documents.dll", system.io.filemode.open, system.io.fileaccess.read, system.io.fileshare.none, 8192, true ) ) using ( var bs = ctx.getbinarywritestream<assemblycache>( a...

javascript - How $.contains() jquery function Works? -

i'm new jquery , don't know how $.contains() works in jquery.. tried code , know gives boolean value don't know how works exactly.. html: <div> <span>mm</span> </div> jquery code: $(document).ready(function() { if($.contains( $('div'), $('span') ) == true){ alert('yup'); }; }); can explain... the contains jquery method looks second argument child or descendant of first argument. while first arguments needs dom object such element or document type, have noticed unexpected behavior if second argument not dom object (like passing in jquery collection). you should stick using individual nodes (like element or document) method. if need check multiple items, use loop or iterator method (see jsfiddle example below). think of dom (document object model) tree. tree has stem , branches. root html element. there have branches head , body . each of branch further other elements. each branch ma...

asp.net - Update panel, end request handler, no error object? -

all, when upgraded asp.net 2.0 asp.net 3.5 , in custom end request handler, args.get_error() returns null (i traced way function sys$webforms$pagerequestmanager$_endpostback(error, response), error object null there too). happens on production server, on development machine works, error object. both win 7 machines, iis 7.5. fyi: on server, log error, , clear via ctx.server.clearerror(); set asyncpostbackerrormessage on script manager. **update: setting allowcustomerrorsredirect="false" on scriptmanager explicitly resolves issue. ** found on msdn little explanation: https://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.allowcustomerrorsredirect(v=vs.110).aspx remarks the asyncpostbackerror event raised when there page error during asynchronous postbacks. how errors on server sent client depends on allowcustomerrorsredirect property, asyncpostbackerrormessage property, , custom errors section of web.config file. here's client script code h...

python - 405 error when custom-defined PATCH method is called for Django REST APIView -

i making api call in test client: response2 = self.client.patch('/object/update/%d/' % object_id, {'object_attribute':4}) the relevant serializer , view class object: class objectupdateserializer(serializers.modelserializer): class meta: model = object include=('object_attribte','another_attribute',) class objectview(apiview): def patch(self, request, pk, format=none): obj = object.objects.get(id=pk) data = request.data.copy() """do stuff data here...""" serializer = objectupdateserializer(instance = obj, data=data, partial=true) if serializer.is_valid(raise_exception=true): serializer.save() return response(serializer.data,status.http_200_ok) i able work put method when used that, wanted have api call methods more in-line methods mean (so patch parti...

R - extract number from string(special solution) -

i have string x <- "avd_1xx_2xx_3xx" need extract number x(string) , put them in new variables num1 <- 1xx num1 <- 2xx num1 <- 3xx however, can't predict number of digits each number instance, x "avd_1_2_3" or "avd_11_21_33" or likes could give me solutions? thanks we can use str_extract stringr . extract multiple matches use str_extract_all , returns list of length 1 (as have single element in 'x'). extract list element, can use [[ i.e. [[1]] . library(stringr) str_extract_all(x, "\\d+[a-z]*")[[1]] #[1] "1xx" "2xx" "3xx" a similar option using base r regmatches/gregexpr regmatches(x, gregexpr("\\d+[a-z]*", x))[[1]] #[1] "1xx" "2xx" "3xx" the pattern match 1 or more numbers ( \\d+ ) followed 0 or more lower case letters ( [a-z]* ). it better keep vector rather having multiple objects in global environment.

internet explorer - Azure Portal Login automatically uses Windows Account -

in internet explorer , when go site authenticated via azure ad, login page automatically chooses log me in windows account. functionality typically great, need use different credentials (my clients). how can tell ie not automatically log me azure ad windows credentials? when use different browser, expected functionality exists , prompted enter login credentials want. also, solution can not "just use different browser". client uses ie , won't allow users install different browsers. i running windows 10. thanks in advance opening ie inprivate window should allow login user need. use ctrl+shift+p or settings icon->safety->inprivate browsing.

sql server - Reverse a password string and then for each character reversed display the previous letter in the alphabet -

we have application stores passwords in following order in database; reverse original password user creates , increments characters 1. instance if choose password - ' demo ' - password stored - ' pnfe ' - used reverse( column ) , reverses column instead of demo being stored pfne stored enfp can see enfp demo incremented 1 character. i started working @ company , no means programmer, looking around database tables , accidentally stumbled upon table. reason want able see password when running script or query because people here forget passwords every other week, either have reset passwords or try work out, schlepp. appreciated. cheers jason msdn has example of this. modified take previous ascii value ever db has, in reverse, , return it. if object_id('tempdb..#psswd') not null drop table #psswd create table #psswd (userid int, pswd varchar(40)) insert #psswd (userid, pswd) values (1,'pnfe'), (2,'tofuujl') declare @userid ...

javascript - Cross Origin error with window.fetch() on Safari -

i'm trying use window.fetch api , along polyfill unsupporting browsers. my code works in both chrome , firefox, failing in safari (all on mac osx). function signup(fullname, email, restaurant, source) { return new promise((resolve, reject) => { const params = `cm-name=${encodeuricomponent(fullname)}&cm-ottdth-ottdth=${encodeuricomponent(email)}&cm-f-hykuuh=${encodeuricomponent(restaurant)}&cm-f-hyurjd=${encodeuricomponent(source)}`; fetch(`http://tastyplc.createsend.com/t/d/s/ottdth/?${params}`, { method: 'get', mode: 'no-cors' }) .then(response => response.text()) .then(data => resolve(data)) .catch(error => reject(error(error))); }); } i following error in safari: xmlhttprequest cannot load http://tastyplc.createsend.com/t/d/s/ottdth/?cm-name=example&cm-ottdth-ottdth=example%40example.com&cm-f-hykuuh=charlotte%20street&cm-f-hyurjd=website%20sign%20up . origin http://loca...

javascript - Expire or Time Out never ending loop after X seconds -

how can stop process after, say, 5 seconds? <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="text/javascript"> function changebanner(){ // change banner code } window.onload = function () { setinterval(changebanner, 100) }; </script> so changing banner every 100 milliseconds. i'd stop after 5 seconds. i thought settimeout might trick; window.onload = function () { settimeout(setinterval(changebanner, 100), 5000) }; but makes no difference. i'd stop after 5 seconds. store return value given setinterval , use clearinterval var timer = setinterval(changebanner, 100); settimeout(function() { clearinterval(timer) }, 5000); there several libraries implement function wrappers achieve same. example, in underscore.js use _.before : var changebannerlimited = _.before(50, changebanner); var timer = setinterval(changebannerlimited,...

reactjs - TypeError jQuery timepicker is not a function on test -

i'm building test using mocha , chai reactjs components. have structure components: scheduleapp scheduleform under scheduleform i'm using jquery plugin bootstrap-timepicker . i'm using plugin called bootstrap-datepicker , running fine notice componentdidmount on scheduleform . // scheduleform.jsx component import react, {proptypes} 'react'; import jquery 'jquery'; import datepicker 'bootstrap-datepicker'; import timepicker 'bootstrap-timepicker'; export default class scheduleform extends react.component { handlechange() { // code handle onchange event } componentdidmount() { jquery(this.refs.startdate).datepicker({ autoclose: true, format: 'yyyy-mm-dd' }).on("changedate", function(e) { this.onstartdatechange(e); }.bind(this)); jquery(this.refs.starttime).timepicker({ defaulttime: '8:00 am', ...

javascript - Understanding upsert with $push -

i have region collection: var regionschema = new mongoose.schema({ name: {type: string}, registrations: [{type: mongoose.schema.types.objectid, ref: 'registrations'}], ... }); a registration collection: var registrationschema = mongoose.schema({ firstname: {type: string}, ... }); in controller instantiate registration save region upsert option set true : var registration = new registration(req.body.registration); ... region .update( { _id: user.region}, { $push: {registrations: registration}, { upsert: true } ) .exec(); what find objectid("...") does, in fact, pushed onto registrations property of region, e.g.: { name: "northwest", registrations: [objectid("57d038a1466345d52920b194")] } but there no matching document _id in registrations collection. question: not understanding nature of upsert flag; not suggest calling save on registration unnecessary? the upsert flag applies collec...

ios - CFNetwork internal error when load multiple images from local JSON file into tableview -

Image
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"chatcell"; chatcell *cell = \[tableview dequeuereusablecellwithidentifier:@"mycell"\]; if (cell == nil) { \[tableview registernib:\[uinib nibwithnibname:cellidentifier bundle:nil\] forcellreuseidentifier:@"mycell"\]; cell = \[tableview dequeuereusablecellwithidentifier:@"mycell"\]; } chatdata *chatdata = \[self.loadedchatdata objectatindex:\[indexpath row\]\]; \[cell.images sd_setimagewithurl:\[nsurl urlwithstring:@"http://dev.apppartner.com/apppartnerprogrammertest/images/justin_avatar.png,http://dev.apppartner.com/apppartnerprogrammertest/images/drew_avatar.png"\]placeholderimage:\[uiimage imagenamed:@"placeholder"\]\]; \[cell loadwithdata:chatdata\]; return cell; } why getting cfnetwork internal error when try load mu...

Perl DBI : quote function v/s bind_params , handling large inputs -

want understand difference between dbi::quote v/s bind_params of statement handlers, while handling large inputs stored procedure. environment : perl + dbi + freedtds -> sql server sample code 1 : using function quote() $xml = `cat bigfile_insrt.txt.xml.5k`; $qouted = $dbh->quote($xml); $dbh->do(qq{exec sp_toload \@xml = $qouted}); code seems can handle till 100mb worth of $xml sample code 2 : using bind_params clob my $qry = "exec sp_toload \@xml = ?"; $xml = `cat bigfile_insrt.txt.xml.5k`; $sth = $dbh->prepare($qry); #$sth->bind_param(1,$xml,sql_longvarbinary); $sth->bind_param(1,$xml,sql_clob); $sth->execute(); gets truncated 7k bytes max $xml wondering why bind_params both sql_longvarbinary or sql_clob cannot go beyond 7k bytes, while sample 1 using quote can handle ~100mb of data

ruby - Secure Password Generation With Random Chars -

i trying generate random password contains special chars using ruby. know if there standard generating such passwords. have considered using weighted probability distribution , assigning weights such there higher probability of picking special chars , not sure if widely-accepted standard. you can use securerandom ( docs ): require 'securerandom' password = securerandom.base64(15) # => "vkvuwvpuwsmczf9nn/do"

php - Protect form with session token -

i wrote script protect form session token; script not work if try validate form fields before checking token. me figure out wrong script please? <?php session_start(); class token { public static function generate() { return $_session['token'] = base64_encode(openssl_random_pseudo_bytes(15)); } public static function check($token) { if (isset($_session['token']) && $token === $_session['token']) { unset($_session['token']); return true; } return false; } } ?> <?php $display_form = false; if (isset($_post['submit'])) { $username = $_post['username']; $userpass = $_post['userpass']; if (strlen($username) < 4) { $error_name = 'required'; ...

pandas - python - writing into excel -

i m new python. m able parse xml don't know how write excel. sample xml: <?xml version="1.0" encoding="utf-8"?> <breakfast_menu> <food> <name>belgian waffles</name> <price>$5.95</price> <description>two of our famous belgian waffles plenty of real maple syrup</description> <calories>650</calories> </food> <food> <name>strawberry belgian waffles</name> <price>$7.95</price> <description>light belgian waffles covered strawberries , whipped cream</description> <calories>900</calories> </food> my code: import xml.etree.elementtree etree xmld = etree.parse('simple.xml') root = xmld.getroot() child in root: children in child: print children.tag," : % s" %children.text output: name : belgian waffles price : $5.95 des...

grails 2.5.4 won't start from terminal StackOverflowError -

i'm running grails 2.5.4(i cannot upgrade version), runs in ide (intellij) cannot grails command run terminal. if type "grails" , nothing else, throw error. the error is: exception: java.lang.stackoverflowerror thrown uncaughtexceptionhandler in thread "main" i can't seem anymore information out of --verbose also, running java 8 so found out going on through excessive trial error. issue had db2 installed on machine. don't know why causing issue. might running issue, that's problem me.

java - javax.servlet.ServletException: Filter [jersey]: could not be initialized Websphere Liberty -

i trying run web application on websphere liberty , following error: [error ] srve0315e: exception occurred: java.lang.throwable: javax.servlet.servletexception: filter [jersey]: not initialized @ com.ibm.ws.webcontainer.webapp.webapp.handlerequest(webapp.java:4913) @ [internal classes] caused by: javax.servlet.servletexception: filter [jersey]: not initialized @ com.ibm.ws.webcontainer.filter.filterinstancewrapper.init(filterinstancewrapper.java:163) ... 1 more caused by: com.sun.jersey.core.spi.scanning.scannerexception: uri scheme wsjar of uri wsjar:file:/opt/wlp/usr/servers/defaultserver/apps/expanded/eureka.war/web-inf/lib/jersey-servlet-1.11.jar!/com/sun/jersey not supported. package scanning deployment not supported such uris. try using different deployment mechanism such explicitly declaring root resource , provider classes using extension of javax.ws.rs.core.application @ com.sun.jersey.core.spi.scanning.packagenamesscanner.scan(...

Printing `argv[]` with nasm -

i'm trying print command line arguments given program, using nasm: global main extern printf section .rodata fmt db "argument: %s", 10, 0 section .text main: push ebp ; push ebp0 mov ebp, esp ; [ebp1] == ebp0 push dword[ebp+8] ; push argc call print_args mov eax, 0 ; return(0) mov esp, ebp ; pop pop ebp ; stack frame ret print_args: push ebp ; pusheo ebp1 mov ebp, esp ; [ebp2] == ebp1 mov edi, dword[ebp+8] ; [ebp+8] == argc jmp lop postlop: mov esp, ebp pop ebp ret lop: sub edi, 1 cmp edi, 0 jz postlop mov esi, [ebp] ; [esi] == ebp1 mov ebx, [esi + 12] ; [esi+12] = [ebp1+12] = argv[0]? push ebx push fmt call printf jmp lop however, prints garbage (i believe should print argv[0] , argc-1 times.). i'm compiling ...

reactjs - How to create dynamic elements in material-ui popover? -

how create dynamic elements in material-ui popover? want example it. class mypopover extends react.component { constructor(props) { super(props); this.state = { popoveritems: [] }; } componentdidmount() { ... fetch popover items ... ... set state ... } render() { return ( <muithemeprovider> <popover open={this.state.open} anchorel={this.state.anchorel} anchororigin={{horizontal: 'left', vertical: 'bottom'}} targetorigin={{horizontal: 'left', vertical: 'top'}} onrequestclose={this.handlerequestclose} > <menu> {this.state.popoveritems.map( (item) => { <menuitem primarytext={item.name} /> })} </menu...

sails.js - Configure sailsjs to redirect unknown routes as /#/path for angularjs when html5 mode is true -

i'm using sailjs angularjs routing , need html5 mode true, hard page load except /index.html generates 404 error. in non-sailsjs case when using plain nodejs, add in routes re-write not matched existing routes /#/route on index.html. not know how in sailsjs. in regular node.js, like: app.get('*', function (req, res) { return res.redirect('/#' + req.path); });

database - loop through cursor's data and compare for another table's value sql -

i have 2 tables. want desc table 2 after following steps: 1. select name table1 type = 'animal'; 2. loop through each names 1. , check table2 i.e o_name = name; 3. check if desc exist o_name. 4. if desc doesnot exist insert 'pet' record on table2. how do it? have cursor has name table1. thinking loop through cursor's record beyond not being able do. please suggest me: declare cursor data select name table1 type='animal'; begin c in data loop // after can do?? cannot select because there // multiple rows end loop; end; / table1: id | name | type ---| ---- | ----- 1| apple | food 2| ball | game 3| cat | animal 4| cow | animal 5| ball | game table2: o_name | desc ---| ---- apple| eat cat| pet cow| you still can query , don't need cursor. note databases optimized working on sets of records, , that's sql queries do...

angular - How to handle javascript with import statements -

i updated rc6 today got syntaxerror: unexpected token import @angular/core/src/reflection/reflection.js . upon inspection many other .js files in @angular/core npm package have import statements. why compiled .js files have import statements , how configure webpack handle them? i'm answering close question. question didn't apply because should using @angular/core/bundles/core.umd.js not @angular/core/src/reflection/reflection.js esm (es6 module) file. want know answer, javascript files import statements should used in es6 environments , not in browser unless transpiled bable (credit @mario tacke)

Auto generate multiple rows from one query php mysql -

i new here , have coders block, please assist, trying multiple results 1 query , create new rows of values it.e.g want row 1 generate row 2 , 3 row 1 general transaction, row 2 interest made row 1 1% , commission made in row 3 @ 0.5%, possible generate query output following results? date | end date | shop | trans | amount | ref no -----------|-------------|--------|----------|----------|--------- 16/9/2016 | 16/10/2016 | fgb | payed | 10 000 | 251 15/10/2016 | xxxxxxxxx | xxx | xxxx | 100 | 251 15/10/2016 | xxxxxxxxx | xxx | xxxx | 50 | 251 these results should in 1 table possible? in advance. in mysql cannot make new row out that. but can create columns. in case can run example like select *, amount * 0.01 interest, amount * 0.005 commission your_mega_table; and if modify code can 3 versions of row different amounts. otherwise need kind of cron script or trigger or ...

how to show a spinner using a filter in angularjs? -

i using filter show values in table. values fetching ajax calls , want show spinner while values fetching. wrote: app.filter("fetchedvalue", function(){ return function(fetchedvalue){ if(angular.isundefined(fetchedvalue)){ return "image";//this spinner }else if(fetchedvalue === null){ return "na"; } else{ return fetchedvalue; } } }); it not working. not sure how spinner when value undefined. know how it? i think misunderstand filter for. function should return true or false depending if want value given function filtered or not. see https://docs.angularjs.org/api/ng/filter/filter , angularjs custom filter function to answer question though, forget filter, , use ng-if or ng-show or ng-hide on <img> when value undefined. <img ng-hide="fetchedvalue" src="spinner.gif" /> th...

node.js - mongodb insert() always successful -

i have written following mongoose schema collection. mongoose schema doesn't seem executing strict check @ data types of objects , items being inserted in document. forexample: if change "activity_performed":true to "activity_performed":"adsfsadf" the mongodb doesn't give error while inserting data. doing wrong , how can enforce mongoose , mongodb practice strict type checking while inserting data. function initschema() { activityschema = mongoose.schema({ observationnumber : number, observation_data : [{ child_id : number, child_observation_data : [{ activity_performed: boolean, observation_date: string, teacher_id: number }] }] }); } function insertdata() { var activitymodelobject = new activitymodel(); activitymodelobject.observationnumber = 1593570; activitymodelobject.observation_data = {"child_id...

osx - Will certain Mac apps break in the new announced MacOS? -

i've been using app named coursenotes college , noticed has not been updated since 2014. i've used years , has lot of important notes in it, , don't seem same functionallity in apps evernote. in new upcoming macos, there chance break , lose data? i've been scanning internet days , can't seem find answer. contacting developer has resulted in no answers whatsoever. thanks in advance, jorden people point out isn't suitable question, let's see if can out anyway... simple answer: yes. there chance app break in new os, if app last updated day before new os released, nature of os updates. your best option install new os first on different machine, external disk, or virtual machine; , test apps before update primary machine. if can't make sure have verified full backup before upgrade can restore should upgrade break important. hth

SSIS Import - Excel Connection Manager opening files on import -

morning, background: have simple job imports data 3 xlsx files 3 sql tables using ssis (vs 2013). on large corporate network, scheduling capabilities slim. have been using excel scheduler 3 years no real issues speak of. scheduler uses batch file fire off , kill various projects. times not overlap. issue: said, have been having strange issue. on above mentioned job, runs fine when opening vs , running manually (99% of time). when scheduler fires off job batch file, opens of excel connections (the actual files open read write prompt) when gets part of etl process! final word: see happening on other packages excel connection manager exists (there 2 others out of 15). appears opening upon data validation of connection. delay validation setting makes no difference (nor should in case). has ever seen behavior? @ complete loss , killing vibe! :) thank in advance, corey

database - Should the contents of a column acting as a primary key be interpretable or purely unique integers -

i have luxury of designing database scratch. when designing columns act unique keys should use unique integers or should attempt make values interpretable. if had lookup table of ward names in hospital should id column contain unique codes in someway relate name of ward or unique integers? resist temptation overload id values meaning. use other attributes store info you're considering stuffing id. overloading id "meaning" bad because: if data being stuffed id changes, must id. id's should never change if data type of data changes, you'll have problem, example: if id numeric, , stuffed info changes numeric text, you'll have big problems if stuffed data changes simple field one-to-many child, model break what believe has "important" meaning may not important in future. "specially encoded" data become useless , burden, serious restriction what "identifies" product may change business evolves if have seen...

sql - Performing an Update query with a date -

can perform update query checking value of date whether date entered greater date stored in database. if @input_date > table.date update table set table.value = 0, table.date = @input_date else update table set table.value = @input_value, table.date = @input_date use case statement try this update table set table.value = case when @input_date > table.date 0 else @input_value end, table.date = @input_date