Posts

Showing posts from 2012

sql server - How to check if running store procedure was triggered by job? -

is there way check within store procedure whether triggered job or using other methods i.e. ssis, @ hoc query etc? there similar question sql server find jobs running procedure check job steps, not need. this scenario. i have sp spdosomethingimportant , can run job or i.e. user in database. so within sp want have check if trigger job , name or id of job. i created following sproc: create procedure testme insert test_log select * sys.dm_exec_sessions session_id = @@spid go i ran ssms. in test_log , column program_name "microsoft sql server management studio - query" i created job run sproc. in test_log , column program_name "sqlagent - tsql jobstep (job 0xcb393e8ff0e9d44485204d0100803469 : step 1)" so if didn't want pass parameter indicate if it's running job, think figure out sys.dm_exec_sessions.program_name

javascript - HTML5 form button onsubmit not working -

i have simple form 2 html5 buttons. each button submits form different php page. working well, 'onsubmit' function never triggered. want show dialog box before delete.php page called. <form method="post"> <input type="text" name="fname"> <!-- html5 formaction --> <button type="submit" name="update" formaction="update.php">update</button> <button type="submit" name="delete" onsubmit="return confirm('do want delete?');" formaction="delete.php">delete</button> </form> i have tried different variations, javascript code never triggered. why? try this <form method="post"> <input type="text" name="fname"> <!-- html5 formaction --> <button type="submit" name="update" formaction="update.php...

java - Hibernate, delete from collection -

i have database contain 2 tables connect one-to-many relationship. enteract database through hibernate. this hbm.xml files: question.hbm.xml <?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="app"> <class name="question" table="question"> <id name="id" column="id" type="java.lang.long"> <generator class="native"/> </id> <property name="text" column="text" type="java.lang.string" not-null="true"/> <set name="answers" cascade="all"> <key column="question_id"/> <one-to-many class="answer"/...

python - Convert Spanish date in string format? -

how convert date in string format compare current time? i tried this: import time, datetime if time.strptime(date.find(text=true), "%a, %d/%m/%y").now() > datetime.now(): but error: valueerror: time data u'dom, 07/02/2016' not match format '%a, %d/%m/%y' need advice on how this. you need setup proper locale before handling language/region specific data. try again with import locale locale.setlocale(locale.lc_time, '') time.strptime(date_string, "%a, %d/%m/%y") the '' tells library pickup current locale of system (if 1 set). if need parse date in different locale, situation little bit more complex. see how strftime date object in different locale? gritty details. it possible explicitly set specific locale, e.g. locale.setlocale(locale.lc_time, 'es_es.utf-8') time.strptime('dom, 01/02/1903', '%a, %d/%m/%y') => time.struct_time(tm_year=1903, tm_mon=2, tm_mday=1, tm_hour=...

c - how to convert a double value into scientific notation and store it in a string -

this question has answer here: correct format specifier double in printf 7 answers i know while printing can convert regular number scientific notation using %e , there way convert scientific notation , store in string . can same string converted decimal notation ? i intend convert , print number entered user scientific notation , add entered number , display final result . entered numbers in decimal notation , output in scientific notation. yes, there sprintf() , , snprintf() this char string[100]; int result; double value; value = 1e-3; result = snprintf(string, sizeof(string), "%e", value); if ((result < 0) || (result >= sizeof(string))) error_please_dont_use_string(); // return or else fprintf(stdout, "%s\n", string);

image - How to reduce size of a multipart file in java -

i have java spring mvc application in there option upload image , save server. have following method: @requestmapping(value = "/uploaddocimagecontentsubmit", method = requestmethod.post) public string createupdatefileimagecontentsubmit(@requestparam("file") multipartfile file, modelmap model) { //methods handle file upload } i trying reduce size of image refering following: increasing-resolution-and-reducing-size-of-an-image-in-java , decrease-image-resolution-in-java problem facing in above examples, dealing java.io.file objects saved specified location. dont want save image. there way can use similar compress multipart image file , continue upload. why don't resize on client before upload? save bandwidth blueimp jquery upload can this

mysql - Total of Male and Female in Grade 8 using sql, codeigniter -

Image
i have problem total in yearlevel total number of male , female in grade 7: i can count using codeigniter: <h3> total students: <?php echo $this->db->count_all('studentinformation'); ?></h3> and group them using this: select yearlevel, sex, count(id) numgender studentinformation group sex, yearlevel my problem count in yearlevel total of grade7, grade 8 , arrage them perhaps you're looking for? use case expressions conditional counting: select yearlevel, count(*) studentcount, count(case when sex = 'female' 1 end) femalecount, count(case when sex = 'male' 1 end) malecount studentinformation group yearlevel

Angularjs: pass a parameter to controller -

i have link in html page this <td><a href="#/reg_det"> drivers </a></td>. i need send parameter {{registration.publicid}} angular controller when user clicks on link, don't know how can it? this possible through $scope. read more here: https://docs.angularjs.org/guide/scope unless go ng-click: (example) <button ng-click="yourfunction(registration.publicid)">drivers</button>

r - dcast restructuring from long to wide format not working -

my df looks this: id task type freq 3 1 2 3 1 b 3 3 2 3 3 2 b 0 4 1 3 4 1 b 3 4 2 1 4 2 b 3 i want restructure id , get: id b … z 3 5 3 4 4 6 i tried: df_wide <- dcast(df, id + task ~ type, value.var="freq") and got error: aggregation function missing: defaulting length i can't figure out put in fun.aggregate . what's problem? the reason why getting warning in description of fun.aggregate (see ?dcast ): aggregation function needed if variables not identify single observation each output cell. defaults length (with message) if needed not specified so, aggregation function needed when there more 1 value 1 spot in wide dataframe. an explanation based on data: when use dcast(df, id + task ~ type, value.var="freq") get: id task b 1 3 1 2 3 2 3 2 3 0 3 4 ...

regex - Use ARGV[] argument vector to pass a regular expression in Ruby -

i trying use gsub or sub on regex passed through terminal argv[] . query in terminal: $ruby script.rb input.json "\[\{\"src\"\:\" input file first 2 lines: [{ "src":"http://something.com", "label":"foo.jpg","name":"foo", "srcname":"foo.jpg" }] [{ "src":"http://something123.com", "label":"foo123.jpg", "name":"foo123", "srcname":"foo123.jpg" }] script.rb: dir = file.dirname(argv[0]) output = file.new(dir + "/output_" + time.now.strftime("%h_%m_%s") + ".json", "w") open(argv[0]).each |x| x = x.sub(argv[1]),'') output.puts(x) if !x.nil? end output.close this basic stuff really, not quite sure on how this. tried: regexp.escape pattern: [{"src":" . escaping characters , not escaping. wrapping pattern b...

ms access - Build Report From Form -

in access 2000 how can command button click, take data on form , populate report? in thought process capture primary key of data displaying on form, , somehow need passed report report knows data pull database populate. just not sure on how such? edit have data on form , added command button form open report vba of docmd.openreport "report1", acpreview, , "empid = " & me.empid the textboxes on report bound corresponding database fields, anytime report generates shows me #name? , empid invisible field on report primary key, , me.empid field on form primary key.

javascript - Reset position in dragended event -

i'm trying reset position of group if it's not dragged in dropzone. it works when try drag second time, group moves dragged @ first. i think it's related origin. here's code , fiddle function init(){ var drag = d3.behavior.drag() .origin(function (d) { return d; }) .on("dragstart", dragstarted) .on("drag", dragged) .on("dragend", dragended); entities = svg.selectall("g") .data([{ x: 750, y: 100 }]) .enter() .append("g") .attr("class","entity-group") .attr("transform", function (d) { return "translate(" + d.x + "," + d.y + ")"; }) .attr("initial-x", function (d) { return d.x }) .attr("initial-y...

c - what pointer magic is this -

i learning c . starting understand pointers , type casting. following along guides , examples , ran across declaration: uint32_t *sp; ... *(uint32_t*)sp = (uint32_t)somevalue; what happening here? first asterisk mystery me. breaking down: *(uint32_t*)sp basically says treat sp pointer uint32_t ( (uint32_t *) cast expression ), , dereference result. so, *(uint32_t*)sp = (uint32_t)somevalue; means, "take somevalue , convert type uint32_t , , store result thing sp points to, , treat thing though uint32_t ." note cast on sp redundant; you've already declared pointer uint32_t , assignment written as *sp = (uint32_t) somevalue;

linux - MongoDB does not install on CentOS 6.7 -

Image
i'm windows guy. when need use linux based os, choose ubuntu. however, time didn't give me choice. i tried install mongodb link of mongodb site . have created repository file try install , error message: error: package: mongodb-org-tools-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2) requires: libstdc++.so.6(cxxabi_1.3.5)(64bit) error: package: mongodb-org-mongos-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2) requires: libstdc++.so.6(glibcxx_3.4.14)(64bit) error: package: mongodb-org-shell-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2) requires: libstdc++.so.6(glibcxx_3.4.14)(64bit) error: package: mongodb-org-server-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2) requires: libstdc++.so.6(cxxabi_1.3.5)(64bit) error: package: mongodb-org-server-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2) requires: libstdc++.so.6(glibcxx_3.4.15)(64bit) error: package: mongodb-org-shell-3.2.1-1.amzn1.x86_64 (mongodb-org-3.2) requires: libstdc++.so.6(glibcxx_3.4.15)(64bit) according m...

c# - How can i calculate percentages and report them to backgroundworker? -

now i'm reporting each file name i'm searching in , it's working fine. want report percentages progress progressbar1 have in designer. calculation should include if program enter while loop. added counterfiles variable not sure how it. i have method: public list<string> findlines(string dirname, string texttosearch) { int countfiles = 0; int counter = 0; list<string> findlines = new list<string>(); directoryinfo di = new directoryinfo(dirname); if (di != null && di.exists) { if (checkfileforaccess(dirname) == true) { foreach (fileinfo fi in di.enumeratefiles("*", searchoption.alldirectories)) { if (string.compare(fi.extension, ".cs", true) == 0) { countfiles++; //countfiles / backgroundworker1.reportprogress(0, fi.name); system.threading.thread.slee...

ruby - How to extract data from text columns -

i have 2 addresses side-by-side in multi-line string: adresse de prise en charge : adresse d'arrivée : rue des capucines rue des tilleuls 92210 saint cloud 67000 strasbourg tél.: tél.: i need extract addresses on left , right regexp, , assign them variables. need match: address1 : "rue des capucines 92210 saint cloud" address2 : "rue des tilleuls 67000 strasbourg" i thought of separating them spaces, cant find regexp count spaces. tried: en\s*charge\s*:\s*((.|\n)*)\s* and similar, gives me both addresses, , not i'm looking for. appreciated. assuming each address section in each line indented as or further corresponding "adresse" in first line, following can extract not 2 addresses aligned sidewards, n addresses in general. lines = string.split(/#{$/...

c++ - Are macros the only way to force inline -

i have class member function critical path in application. must fast possible application deliver expected (read: rather hoped) overall performance. the function rather complex have identical sections repeated several times. like: if (condition) { //... code } if (another condition} { //... identical code may change condition } if (condition) { //... code (same above) } // , on in order make code easier read, understand , maintain break down , use function calls instead. like: if (condition) { some_function(some_param); } if (another condition} { some_function(some_other_param); } if (condition) { some_function(some_param); } i can't afford overhead calling functions make sure some_function inlined - always. i searched , read several post discussing similar issues not same. these post indicates way macro . i hate use macros on other hand hate complexity of current function. choosing between 2 evils. is so? macros way achieve this? up...

c++ - std::queue with different container type depending on runtime data -

i have class needs use std::queue instance var store data. problem std::queue either uses std::deque container type default or 1 needs provide container type @ compile time. container use depends on runtime data of class user, therefore can't specify on compile time. after instanciation of std::queue , providing proper container implementation don't care anymore container itself, use interface of std::queue. the containers provide std::deque or boost::circular_buffer , both store same type of elements, it's 1 used whenever caller store infinite amount of data , circular _buffer if not. the way found far custom abstract base class acting common interface 2 derived implementations different std::queue instances. in case have duplicate interface of std::queue annoying. is there way declare , instanciate std::queue in such way? "std::queue unknown/runtime provided container". template parameters must known @ compile type. not able change underlying...

listview - android how to set notifySetDataChanged() for an ArrayList -

i'm trying refresh listview contents when go activity activity. refresh contents when go further main app screen , come back. this activity set listview , it's adapter: public static final string id = "id"; public static final string iidd = "iidd"; private static final string desc = "description"; private appcompatdelegate delegate; cursor c; listview listfood; simpleadapter myadapter; arraylist<map<string, string>> names = new arraylist<map<string, string>>(); integer i_d; integer iddd; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activityfood_main); listfood = (listview) findviewbyid(r.id.listviewf); listfood.setonitemclicklistener(viewfoodlistener); // database read databaseconnectorfood db = new databaseconnectorfood(this); db.open(); c = db.getfooddata(); while(c.movetonext()) { map<s...

assembly - What is the difference in using global _main and global _start in the text section of asm -

i new @ assembly language. have been studying confused between these two: global _main , global _start .. if knows it, please help! main or _main or main_ (openwatcom) known c language, , call ed "startup code" "usually" linked - if you're using c. _start known linker ld (in linux) default entrypoint (another symbol can used) , not call ed. thus, there no return address on stack. stack starts number of arguments. os may differ.

graphics - Visualize tree data -

i'm looking program visualize tree of data. it's small, 20 nodes. i'd graph suitable presentation in vector graphics format such pdf, svg, etc. the input simple list of connected node pairs, this: specie,monosaccharide specie,polysaccharide specie,protein specie,nucleic_acid nucleic_acid,dna nucleic_acid,rna rna,mrna rna,ncrna cytoscape seems complex, graphviz seems dead (website unresponsive), , gephi won't plot first example in tutorial. i'd run graphing program on mac, , i'm happy write small program, preferably pyton or perl, generate graph. recommendations please? it surprises me graphviz website not available, should temporary. suggest represent graph in python using igraph . see hint here , usual check docs , tutorial

node.js - SSL connection code fails with error code ENOTFOUND on bluemix, but code works perfectly on localhost -

i have application makes outbound https request internal server fetch data , sends data client. when run code on local machine, works expected. however, when push code bluemix, error enotfound. here code: var options = { host: 'servername', path: "path", port: '7988', key: fs.readfilesync('server.key'), cert: fs.readfilesync('mycertificate.crt'), rejectunauthorized: false }; options.agent = new https.agent(options); var gis_req = https.get(options, function(gis_res) { gis_res.on('data', function(d) { res.send("" + d); }); gis_res.on('error', function(e) { res.send("" + e); }); }); gis_req.on('error', function(e) { res.send("gis req error " + e); }); edit: code works fine on both server , local machine http requests, not https.

amazon web services - AWS node.js SDK getting 'Access Denied' using AWS example -

i'm new @ aws, maybe i'm missing obvious required. i have 2 version of code, different passing bucket 4 chars string vs 5 chars. getting different response aws. why that? var aws = require('aws-sdk'); var s3 = new aws.s3(); s3.createbucket({bucket: 'node4'}, function() { var params = {bucket: 'node4', key: 'mykey', body: 'hello!'}; s3.putobject(params, function(err, data) { if (err) console.log(err) else console.log("successfully uploaded data mybucket/mykey"); }); }); running app.js: ➜ aws node app.js { [allaccessdisabled: access object has been disabled] message: 'all access object has been disabled', code: 'allaccessdisabled', region: null, time: fri feb 05 2016 20:45:11 gmt+0200 (ist), requestid: 'somerequestid', extendedrequestid: 'someextendedrequestid', statuscode: 403, retryable: false, retrydelay: 30 } ...

statistics - Partial Least Square Regression using R -

i'm new r. want use "pls" package partial least square analysis on data. the data information design elements, whether exist or not, in 0 , 1 , last column contains emotion score. want find design elements contribute emotion. from example found on internet, need call > plsr(density ~ nir, 6, data=yarn, validation="cv") when try this: plsr(density ~ nir, 6, data=mydata, validation="cv") i error: error: object 'nir' not found how call function correctly using data? thank in advance this works me (i downloaded pastebin , saved file called "junk.dat") dat <- read.csv("junk.dat") library("pls") summary(plsr(adorable~.,data=dat)) the formula adorable~. says adorable (your last column name) response variable , of remaining columns in data frame should used predictors.

rubygems - Loading the correct gem version error LoadError: cannot load such file -- capistrano/rails -

i trying run capistrano update: cap production deploy but error: cap aborted! loaderror: cannot load such file -- capistrano/rails /home/deploy/apps/my-web-app/releases/20151214160634/capfile:7:in require' /home/deploy/apps/my-web-app/releases/20151214160634/capfile:7:in <top (required)>' here --trace $cap production deploy --trace cap aborted! loaderror: cannot load such file -- capistrano/rails /home/deploy/apps/my-web-app/releases/20151214160634/capfile:7:in `require' /home/deploy/apps/my-web-app/releases/20151214160634/capfile:7:in `<top (required)>' /home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load' /home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/rake_module.rb:28:in `load_rakefile' /home/deploy/apps/my-web-app/shared/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:689:in `raw_load_rakefile' /home/deploy/apps/my-web-app/shared/bundle...

java - When is finish() executed? -

i searching, when ondestroy executed on android application, found executed when device low of resources(ram, cpu) , when finish() called user. for example, when press button return activity previous activity, finish() executed? or in situation finish() executed? thanks. finish not callback method ondestroy , won't called system. developer can call if needs .

javascript - Request header field Access-Control-Allow-Headers is not allowed by Access-Control-Allow-Headers in preflight response -

i trying make login page cross domain couldn't solve problem, error is: xmlhttprequest cannot load http://localhost/testing/resp.php . request header field access-control-allow-headers not allowed access-control-allow-headers in preflight response. my javascript code is: $('#login').click(function(){ var username = $('#uname').val(); var password = $('#pass').val(); var result = $('.result'); result.text('loading....'); if (username != '' && password !=''){ var urltopass = 'action=login&username='+username+'&password='+password; $.ajax({ type: 'post', data: urltopass, headers: {"access-control-allow-headers": "content-type"}, url: 'http://localhost/testing/resp.php', crossdomain: true, cache: false, success: function(responsetext){ console.log(responsetext); if(responsete...

php - How works the pseudo-variable $this in symfony? -

i understand official explanation $this : http://php.net/manual/en/language.oop5.basic.php but if try understand object reference in case of symfony, don't know it, example: each time when need return theme, use this: public function indexaction() { return $this->render('foo/bar.html.twig', array()); } or when generate form: public function indexaction(request $request) { // create form $form = $this->createformbuilder() ->add('name', texttype::class) ->add('email', emailtype::class) ->add('subject', texttype::class) ->add('message', textareatype::class) ->add('send', submittype::class) ->getform(); } but object $this? , if working other word or value not $this, try understand better. if asking located methods called $this in controller, take @ extends ...

Openmp and Fortran, crashing code -

this related previous question . trying parallelize code mixed syntax (f77 , f90) i've added 1 of many routines portion in code !$omp parallel shared (xdif,cdiff, dg,bfvisc,r,ro,xm ) private ( l ) !$omp l=2,n-1 xdif(l)=cdiff(l)*fjc+(dg(l)+bfvisc(l))* & (4.d0*pi*r(l)**2*ro(l)/xm(n))**2 enddo !$omp end !$omp end parallel after compiling (using -fopenmp ) code runs few seconds , error i'm getting is: segmentation fault (core dumped) i didn't use module omp_lib (since suggested in answer previous question) try (using call omp_set_num_threads(4) before first line). , both ways have same problem. what can do? i've been advised print output flags -g -fbacktrace -fcheck=all -wall . here is: @ line 2828 of file mainii.f fortran runtime error: index '0' of dimension 1 of array 'l1mlos' below lower bound of 1

Rotate SVG line around center using CSS -

i'm trying animate svg go being plus minus. when clicked, rotate whole svg , change color. make 1 of line s svg scale 0. you can see here: http://codepen.io/nonimage/pen/rrekpw however, you'll see, line scales 0 moves off upper right corner. want scale while staying in center. what doing wrong? instead of this: .add-remove.remove .inner__1 { transform: scale(0); transform-origin: center center; } use this: .inner__1 { transform-origin: center center; } .add-remove.remove .inner__1 { transform: scale(0); }

android - how to set current location in start of the app? -

i working on googlemap . code google developer site. struggling set current location when application starts. i implement onmylocationbuttonclick() , when click, take me current location. implementing else. need show current location map view start. idea? package com.jatinderbhola.mymapapp; import com.google.android.gms.common.connectionresult; import com.google.android.gms.common.googleplayservicesutil; import com.google.android.gms.common.api.googleapiclient; import com.google.android.gms.location.locationservices; import com.google.android.gms.maps.cameraupdate; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.googlemap.onmylocationbuttonclicklistener; import com.google.android.gms.maps.onmapreadycallback; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.cameraposition; import com.google.android.gms.maps.model.circleoptions; import com.goog...

jquery - Unable to hide very long menu items due to Bootstrap Code -

i'm trying make menu items dissapear before shifting second row, , making 3 bar menu pop menu items dissapear resize browser. http://jsfiddle.net/qwwru7eh/ so far have tried style them media queries using display none , display:block inline css style tags: i isolated issues bootstrap following code, cant desired effect styling it: @media (min-width: 872px) { .navbar-toggle { display: none; } } @media (max-width: 871px) { .navbar-nav .open .dropdown-menu { position: static; float: none; display:none; width: auto; margin-top: 0; background-color: transparent; border: 0; -webkit-box-shadow: none; box-shadow: none; } .navbar-nav .open .dropdown-menu > li > a, .navbar-nav .open .dropdown-menu .dropdown-header { padding: 5px 15px 5px 25px; } .navbar-nav .open .dropdown-menu > li > { line-height: 20px; } .navbar-nav .open .dropdown-menu > li > a:hover, .nav...

Writing to existing CSV or Excel File in Visual Studio C# -

i want able continually update csv or excel xlsx file, maybe using npoi or else really. need accomplish below. example of code below, capturing timings. code using selenium. each time test run, need timings exported existing excel/csv file have stored on c: drive. dont want overwrite existing cells, instead want add new timings on next blank row each time. my existing excel file, have 3 header columns. these titled "date of test", "name of test", "elapsed time" [test] public void timeforwebpagestoload() { iwebdriver driver = new firefoxdriver(); datetime currentdatetime = datetime.now; var datetime = currentdate.tostring(); var sw1 = stopwatch.startnew(); driver.navigate().gotourl("http://www.google.com"); sw1.stop(); console.writeline("time google load {0}", sw1.elapsed); var sw2 = stopwatch.startnew(); driver.navigate().gotourl("h...

c# - How to combine 2 tables using Entity Framework 6 and Linq in an MVC Project? -

Image
i want know how data relationals tables. i want images table named "noticias1" relationated "noticias" (noticias spanish word means news sorry university). here diagram image here " noticias1 " table gets images contain news in table "noticias" here " noticia " table contain 1 "noticia" means news in english here actual view img as can see shows "noticias" table have 1 news not problem. now want images "noticias1" every news in table "noticias" show in view. (the named 1_0 featured img). here controller public class noticiascontroller : controller { // get: noticias public actionresult index(int? page) { var entities = new model.cobecaintranetentities(); //where n.fehasta < datetime.now && n.activo var noticias = n in entities.noticias n.activo && n.fedesde ...

python - Join author names with first ones separated by comma and last one by "and" -

i'm new python , have list of names separated \and , need join separating first ones comma , last 1 'and'. if there more 4 names return value should first name along phrase 'et al.'. if have authors = 'john bar \and tom foo \and sam foobar \and ron barfoo' i should 'john bar et al.'. whereas with authors = 'john bar \and tom foo \and sam foobar' i should 'john bar, tom foo , sam foobar'. it should work 1 author name, returning single name (and surname) itself. i tried doing like names = authors.split('\and') result = ', '.join(names[:-1]) + ' , '.join(names[-1]) but doesn't work. question how can use join , split first authors separated comma , last 'and' taking account if there more 4 authors first author name should returned along 'et al.'. start splitting out names: names = [name.strip() name in authors.split(r'\and')] # assuming raw \ here, ...

android - displaying progress dialog inside runOnUiThread in fragment -

i have simple android application should display progress dialog when press 'activate' button. basically, when press 'activate', app display progress dialog while detecting nearby sensors. update progress dialog message while detects sensors. following code implemented inside fragment. but code not display progress dialog. don't see when press 'button'. seems frozen. @override public void onclick( view v) { v.setenabled(false); activatebutton.setenabled(true); final activity activity = getactivity(); final progressdialog pd = new progressdialog(activity); activity.runonuithread(new runnable() { @override public void run() { pd.settitle("activating..."); pd.setmessage("please wait..."); pd.setcancelable(false); pd.setindeterminate(false); pd.show(); int count = 1; pd.setmessage("detecting sensors...\...

How to find when OS is last updated in java -

i want know when os last updated(for linux , widnows) programmatically in java. there way find it? ideas!! to knowledge there nothing in oracle apis knows upgrade state of system vm might running on. you determine set of heuristics can use determine upgrade state of given host system, , write platform specific parts of that, switching on system.getproperties("os.version") , friends. the hard part determining heuristics. they'll different different systems, versions, releases... it occur me these sorts of things covered in apache commons classes. if has minimal support sort of thing, will. followup prompted comments: apache commons doesn't seem have this, not surprising. at end of day, first offhand comment still key question: "upgrade" mean systems jvm might find on? free followup question: subset of systems need functionality for? answer these , can start on solution. because asking in core java pretty asking impossible.

javascript - Unable to make an Image Blob JSON Serializable -

jira ticket created due base64encode failure: https://jira.appcelerator.org/browse/tc-5876 my current cfg: titanium sdk 5.1.2.ga testing on iphone ios 9.1 i'm stuck in problem in project client requires images took on device (using camera) sent webservice , afterwards seen on device using app (both android , ios devices). titanium provides ti.blob object (event.media) after taking picture (which not json serializable) , need somehow send server. server responds json object, blob must somehow json serializable. i've tried many ways without success: 1 - base64encode blob var base64blob = ti.utils.base64encode(event.media); doesn't work, stucks app , throws asl exceeded maximum size error. imagine image large base64encoded. 2 - read blob buffer var blobstream = ti.stream.createstream({ source: event.media, mode: ti.stream.mode_read }); var buffer = ti.createbuffer({ length: event.media.length }); var bytes = blobstream.read(buffer); it works have no idea ...

android - mobile webapp into playstore, itunes ect -

dear lovely people on stackoverflow. i doing research on differences between native mobile applications , webapplications. far, found lot. perspective frontend webdeveloper, wonder 1 thing, can't find infos on. when publish webapp under domain, responsive , insert metatags: <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="mobile-web-app-capable" content="yes" /> it possible launch app in fullscreen view on mobile devices. applies just, if user saved mobile webapp his/her homescreen bookmark. android , ios create looking applauncher on devices homescreen, suitable application. but app-stores big markets too, wonder, if possible, upload "applauncher" respective stores. the web-app still hosted server/domain, , published store app nothing more, downloadable webapp launcher, or more chrome/safari-launcher in full screen view. is somehow possible? would glad, if tell me his/her expe...