Posts

Showing posts from January, 2013

angular - Exportable class with nested object as property -

i'm trying create exportable class has object property in angular 2. reason can bind form using ngmodel. for example, if have object: user: { name: string, address: { street: string, city: string, state: string } } currently have similar this: export class user { name: string; address: any; } is there way make address property same 'user' object without using 'any' tag? seems simple fix, can't seem find answer. thank you you can this: export class user { name: string; // can single object address: { city: string, street: string, state: string }; // can array addresses: { city: string, street: string, state: string }[]; }

ember.js - Get helper in hbs when getting nested object -

suppose have following objects: image: { size: { l: { url: 'l.jpg', }, m: { url: 'm.jpg', }, s; { url: 's.jpg', } } }, mysize: 'm' if want corresponding image url in template, how should that? tried: {{get image mysize 'url'}} but not work. i can url want typing this: {{get (get image mysize) 'url')}} however unintuitive , ugly workaround. there better way? thank you. you need use concat helper along it: {{get image (concat 'size.' mysize '.url')}} but sounds job computed property: imageurl: ember.computed('mysize', 'image.size', function() { let { image, mysize } = this.getproperties('image', 'mysize'); return ember.get(image, `size.${mysize}.url`); }) that way can use {{imageurl}} in template. ember twiddle

php - yii text field validtaion with ckeditor -

i have text field in have used ckeditor <div class="row"> <?php echo $form->labelex($model,'text'); ?> <?php echo $form->textarea($model, 'text', array('id'=>'editor1')); ?> <?php echo $form->error($model,'text'); ?> </div> <script type="text/javascript"> ckeditor.replace( 'editor1' ); </script> rules in model is public function rules() { return array( array('text', 'required'), array('text', 'validatewordlength') ); } public function validatewordlength($attribute,$params) { $total_words= str_word_count($this->text); if($total_words>4000) { $this->adderror('text', 'your description length exceeded'); } if($total_words<5) { $this->adderror('text', 'your description length small'); } } this works fine 1) whe...

android - Option Menu Animation -

Image
how can give slide down animation : <set xmlns:android="http://schemas.android.com/apk/res/android" > <translate android:duration="1000" android:fromydelta="0" android:toydelta="100%" /> </set> for " option menu " opening .like animation : just add line style.xml please add on application main style define in manifest <style name="apptheme" parent="theme.appcompat.light.noactionbar"> <item name="android:popupanimationstyle">@style/animation</item> </style> style.xml : <style name="animation"> <item name="android:windowenteranimation">@anim/your_specific_animation</item> <item name="android:windowexitanimation">@anim/your_specific_animation</item> </style>

winrt xaml - Can timer run in Background Task -

say have 3 pages: p1, p2 , p3 user can navigate p1 -> p2 -> p3 at p3 , need timer keep running , trigger call function @ interval. say, timer call function in every 1 minute interval. 1) timer function: tick = 60; if (_fixedtick > 0) { _fixedtick--; } else { call func(); } the problem: if user navigate p3 p2 , stop timer. i come across background task question a)how build timer call function @ fixed interval. ie: tick =60. b) above (1) timer function way handle timing? c) can some1 show me how create background timer in background task. can use above (1) timer function in background task timer keep running whether user navigate p3 p2. namespace mytimertask { public sealed class firsttask : ibackgroundtask { public void run(ibackgroundtaskinstance taskinstance) { } } appreciate help. thanks no, background task not way go. create simple dispatchertimer in global location static class, static p...

javascript - How to remove blank slide on different devices on flexslider? -

i have created responsive slider using flexslider ipad , iphone. slider have different content on 2 device. let have 1 slide on ipad , 2 slides on iphone. blank slides on ipad, automatically. there magical way remove blank slide on ipad? my css: iphone-only{display:none !important;} ipad-only{display:none !important;} @media (max-width: 320px){ iphone-only{ display:block !important} } @media (min-width:768px) , (max-width:1024px){ ipad-only{ display:block !important} } my html: <div class="flexslider"> <ul class="slides"> <li> <div class"ipad-only"> ipad slide 1 </div> <div class"iphone-only> iphoneslide1 </div </li> <li> <div class"iphone-only"> iphone slide 2 </div> </li> </ul> </div>

javascript - Is it possible to upload multiple files using module "multiparty" in node? -

was using multiparty node module in node app uploading single file. now, want upload multiple files using same multiparty module.i googled not find solution , ended finding 'multer' module in link giving issue existing application. so, there way achieve uploading of file using 'multiparty' ? after many failed attempts , experimentation got answer, have sent form object server client. have check of below code on server side app.post('/multifileupload', function(req, res) { var singlefile; var form = new multiparty.form(); form.parse(req, function(err, fields, files){ var filearry=files.uploadfiles; if(filearry == null ){ res.send('no files found upload.'); return; } for(i=0; i<filearry.length; i++) { newp...

c# - SuperSocket ReceiveFilter implementation -

according supersocket documentation, have implement receivefilter receive binary data , convert object application can work it. currently i'm working client side using supersocket.clientengine. documentation seems fixedheaderreceivefilter - fixed header body length protocol work best me. i'm not quite understanding it's logic. so uses first 4 bytes request name, , 2 bytes request body length. /// +-------+---+-------------------------------+ /// |request| l | | /// | name | e | request body | /// | (4) | n | | /// | |(2)| | /// +-------+---+-------------------------------+ protected override int getbodylengthfromheader(byte[] header, int offset, int length) { return (int)header[offset + 4] * 256 + (int)header[offset + 5]; } protected override binaryrequestinfo resolverequestinfo(arraysegment<byte> header, byte[] bodybuffer, int offset, i...

asp.net - Is there a tool in VS2015 to debug webapi routes? -

in visual studio 2015 (enterprise), there still no built-in tool dissect , display routing information webapi calls? webapi route debugger not seem work asp.net 5 (and mangles default page in template) glimpse not offer "launch now!" button anymore can tell ( http://blog.markvincze.com/use-glimpse-with-asp-net-web-api/ ). routedebugger figuring out routes will/will not hit. http://nuget.org/packages/routedebugger saying doesn't work. after googling found solution problem, add event handler in global.asax.cs pick incoming request , @ route values in vs debugger. override init method follows: public override void init() { base.init(); this.acquirerequeststate += showroutevalues; } ... protected void showroutevalues(object sender, eventargs e) { var context = httpcontext.current; if (context == null) return; var routedata = routetable.routes.getroutedata(new httpcontextwrapper(context)); } then set breakpoint in show...

python - pycharm debugger not working properly -

i doing simple python coding in pycharm problem whenever debug starts debugging other file in project , not 1 working with. i did go run-->edit configuration , check if file set debugging , still debugs file when start debugging. any appreciated if debug using pressing shift-f9 debugs last file debugged, might file debugged yesterday... to debug new file press alt-shif-f9 . you can see these 2 different debugging options run menu. there debug <last file> , there debug...

ruby on rails - How can I check multiple value in Model enum -

i want check status of instance if has more 2 values this model use rails enum class product < activerecord::base enum status: [:status1, :status2, :status3] end i can check 1 status of instance use rails enum like product.first.status1? if want check multiple statuses this product.first.status1? || product.first.status2? how can check enum values like product.first.status?(:status1, :status2)`# not work does method exist? simple answer : [:status1, :status2].include?(product.first.status)

node.js - Using path.resolve from webpack bundle file -

i have server file created src/server/index.js , bundled , run build/server.js . when importing modules works, having , issue folder can't found when using path.resolve . i doing once server file bundled following path cannot found. guess because not importing , therefore never bundled. path.resolve(__dirname, 'server/email_templates') is there way make sure application can find folder after being bundled ? i have tried adding resolve object webpack config, seems work requiring , importing modules, not using path module. here's webpack config object. entry: { app: path.join(__dirname, 'src/server/index.js') }, output: { path: path.join(__dirname, 'build'), publicpath: '/assets/', filename: 'server.js', librarytarget: 'commonjs2', }, target: 'node', module: { loaders: [ { test: /(\.js|\.jsx)$/, exclude: /node_modules/, loader: 'babel...

readfile - How do I read in a consecutive row of a text file in each step of a do-loop in fortran? -

i have dataset of parameter values 30 species, , want run script conducts simulation each species. parameter values stored in .txt file, each row different species, , each column different parameter value. i'd set do-loop reads in relevant row of parameter values each species, runs simulation script, , writes .txt file of output each species. unfortunately, i'm new fortran , having lot of trouble understanding how read in consecutive rows .txt file in each step of loop. tried making simplified script test whether read step working: program driver implicit none integer :: mm ! forgot line in first version of question , edited add in character(7) :: species !! first column species name real*8 :: leaf_variable ! next 3 columns variable values real*8 :: stem_variable ! real*8 :: root_variable ! open (12, file = "species_parameters.txt") ! open .txt file mm = 1,30 ! set loop read (12,*) specie...

arraylist - how to add a value to a list of values for a single key in a hashmap (Java) -

hi have written this: hashmap<string, string> map1 = new hashmap<string, string>(); map<string, arraylist<string>> map2 = new hashmap<string, arraylist<string>>(); i trying allow more 1 value each key in hashmap. if first key '1', want allow '1' paired values '2' , '3'. so like: 1 --> 2 |--> 3 but when do: map2.put(key, value); it gives error says "incompatible types" , can not converted arraylist , says error @ value part of line. thenk much if using java 8, can quite easily: string key = "somekey"; string value1 = "somevalue1"; string value2 = "somevalue2"; map<string, list<string>> map2 = new hashmap<>(); map2.computeifabsent(key, k -> new arraylist<>()).add(value1); map2.computeifabsent(key, k -> new arraylist<>()).add(value2); system.out.println(map2); the documentation map.computeifabsent(...) ha...

javascript - how can I make the client talk to the express server? -

so trying link interface server message input in front end posted in separate webpage hosted on server. eg "hello [name]" this interface: <form id="loginforma" action="userlogin" method="post"> <div> <label for="insert message here">message: </label> <input type="text" id="message" name="message"></input> </div> and server trying post message to: var express = require('express'); var app = express(); app.use(express.static('public')); var bodyparser = require('body-parser'); app.use(bodyparser.urlencoded({ extended: true })); app.use(bodyparser.json()); app.post("/userlogin", function(request, response) { response.send( "hello " + request.body.message ); }); app.listen(process.env.port || 8080, process.env.ip); i not sure how make interface , server talk each other. store messa...

How to monitor Android network performance? -

we want network performance monitoring monitoring api calls. using android network monitoring integrated android studio. there problem framework. can give amount of data transfer , receive. doesn't give number of api call. metrics necessary determine if there unnecessary api call. otherwise hard determine. integrated android studio , can't use in test framework because gives graph hard compare result. i want know if there framework available can used different metrics of network performance. hey there library provided facebook. please check: network-connection-class [ facebook-code-site ] [ github link ]

asp.net mvc - Cannot implicitly convert type 'bool?' to 'bool' Checkbox MVC -

i working checkboxes in mvc. have table 1 column bit type.the following code giving me error. [httppost] public string index(ienumerable<city> cities) { if (cities.count(x => x.chosen) == 0) { return "you did not select city"; } ...... } chosen bit type here. , when trying build says: cannot implicitly convert type 'bool?' 'bool'. explicit conversion exists (are missing cast?) error self explainary. x.chosen bool? type ( nullable<bool> ). it mean should first check on null . example: [httppost] public string index(ienumerable<city> cities) { if (cities.count(x => x.chosen.hasvalue && x.chosen.value) == 0) { return "you did not select city"; } ...... } it's better write this: [httppost] public string index(ienumerable<city> cities) { if (!cities.any(x => x.chosen.hasvalue && x.chosen.value)) re...

publish subscribe - get metrics for google cloud pubsub -

i using google cloud pubsub , want know how number of outstanding, delivered , undelivered messages in pubsub. there available api provided google pubsub this? you'll want @ stackdriver monitoring . in particular, there metrics google cloud pub/sub , including subscription/num_undelivered_messages , subscription/num_outstanding_messages. can access graphs of these properties in stackdriver .

python - Tensorflow TypeError: Fetch argument None has invalid type <type 'NoneType'>? -

i'm making rnn loosely based off of tensorflow's tutorial . relevant parts of model follows ("comment if need see more, don't want make post long xd): input_sequence = tf.placeholder(tf.float32, [batch_size, time_steps, pixel_count + aux_inputs]) output_actual = tf.placeholder(tf.float32, [batch_size, output_size]) lstm_cell = tf.nn.rnn_cell.basiclstmcell(cell_size, state_is_tuple=false) stacked_lstm = tf.nn.rnn_cell.multirnncell([lstm_cell] * cell_layers, state_is_tuple=false) initial_state = state = stacked_lstm.zero_state(batch_size, tf.float32) outputs = [] tf.variable_scope("lstm"): step in xrange(time_steps): if step > 0: tf.get_variable_scope().reuse_variables() cell_output, state = stacked_lstm(input_sequence[:, step, :], state) outputs.append(cell_output) final_state = state and feeding: cross_entropy = tf.reduce_mean(-tf.reduce_sum(output_actual * tf.log(prediction), reduction_indices=[1])) tr...

angularjs - How to access this json object -

i'm using express js send data mysql. send using res.json(thedata) . in client side in console: { "data":[ { "plazaid":1, "plazaname":"fff", "plazaaddress":"fff", "plazacontactno":"45645", "plazalanes":"34", "plazastatus":"y", "clientid":1 }, { "plazaid":2, "plazaname":"plaza2", "plazaaddress":"p2", "plazacontactno":"000", "plazalanes":"2", "plazastatus":"a", "clientid":2 } ], "status":200, "config":{ "method":"get", "transformrequest":[ null ], "transformresponse":[ nu...

authentication - Redirect user after login in laravel 5.1 -

i trying implement feature where, after logging in, user gets redirected url depending on role. have roles part set up, i'm having trouble testing user's properties after login. i followed instructions here create user login page. have authcontroller looks this: namespace app\http\controllers\auth; use app\user; use validator; use app\http\controllers\controller; use illuminate\foundation\auth\throttleslogins; use illuminate\foundation\auth\authenticatesandregistersusers; class authcontroller extends controller { use authenticatesandregistersusers, throttleslogins; protected $redirectto = '/test'; ... } my __construct() function validates user, don't know how access user object after login. presently have: public function __construct() { $this->middleware('guest', ['except' => 'getlogout']); if ( \auth::check() ) { $user = \auth::user(); if ( $user->admin() ) { // a...

php - Compile mysqli with mysqlnd to use as dynamic extension? -

can compile mysqli mysqlnd use dynamic extension? need linux windows machine (though use linux distro if needed). why? because hosting provider dumb. mysqlnd should default driver php 5.4+, don't use php 7.0 version. contacting them waste of time, insisted mysqlnd deprecated in favor of mysqli (which isn't how works).

javascript - Html zoom control options for elements -

i have inside have background map,using z index have placed spans on markers i want give user option of zooming contents of parent div contains img , span i.e map , markers. now have make sure markers position set updates accordingly after zoom top , left hard coded when plotted dynamically. so can give me pointers implementing ,any examples or libraries or how using css? thanks in advance

PHP:Why printf("%.2f", 0.02) output 0.024?why is not 0.02? -

when code : <?php printf("%.2f", 0.02);?> output: 0.02 when code : <?php var_dump(printf("%.2f", 0.02));?> output: 0.02int(4) when code : <?=printf("%.2f", 0.02)?> output: 0.024 <?=var_dump(printf("%.2f", 0.02))?> output: 0.02int(4) why <?=printf("%.2f", 0.02)?> isn't outputing 0.02 ? <?=printf("%.2f", 0.02)?> correspond <?php var_dump(printf("%.2f", 0.02));?> ? i think you've missed important here. from manual returns length of outputted string. so, while printf outputs browser, returns length of 0.02 , 4

swift - Why Are My Default Property Values Still Showing as Parameters in Init()? -

Image
i have protocol describes marine water parameter needs tested: protocol parameter { var name: string { } var unit: unit { } var value: double { } } i have struct, calcium , conforms parameter : struct calcium: parameter { var name: string = "calcium" var unit: unit = unitdispersion.partspermillion var value: double } since name , unit parameters of calcium have default values, why need provide them in init method? shouldn't need provide value value ? i trying understand protocol-oriented-programming , appreciate little guidance here. this has nothing whatever protocols. you not have provide initializer value . have not provided any initializer. therefore initializer have 1 provided automatically , , initializer memberwise initializer wants parameters properties. if don't that, write initializer yourself: struct calcium: parameter { var name: string = "calcium" var unit: unit = unitdispe...

javascript - Using Select2 with Jeditable -

i new jquery plugins know basic jquery. i trying combine select2 plugin jeditable in html table. have done want. problem dropdown shows , closed. have made jsfiddle of have done https://jsfiddle.net/ongforog html code: <table> <tr> <th>location</th> </tr> <tr> <td class="sites_select">location 1</td> </tr> </table> jquery code: $(".sites_select").editable("localhost/timesheet/sites/update", { data : "{'lorem ipsum':'lorem ipsum','ipsum dolor':'ipsum dolor','dolor sit':'dolor sit'}", type: "select", onblur: 'ignore' }).on('click', function () { $(this).find('select').select2({}); }); $(document).on('change', '.sites_select select', function () { $(this).trigger("submit"); }); only problem having when click shows ...

curl response is different from the responce of java.net.URL -

curl -v https://whatwg.org/html header is: http/1.1 301 moved permanently location: https://html.spec.whatwg.org/multipage however.. string link = "https://whatwg.org/html"; url url = new url(link); httpurlconnection conn = (httpurlconnection) url.openconnection(); int status = conn.getresponsecode(); system.out.println("response code ... " + status); response code ... 200 the first , second results different, doing wrong , how should receive 301 ?

android - Use text from EditText in activity1 on button in activity2 -

i want button in activity2 show text entered in edittext in activity1. first app using more 1 activity may trying pass things wrong. i've tried setting button text direct edittext value saving didn't work right. direction appreciated! activity1 start_day called when button in activity1 pressed. sends app activity2. public class addtasksactivity extends appcompatactivity { public final static string taskone = "task 1 content"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_add_tasks); } public void start_day(view view){ intent intent = new intent(this, daytasksactivity.class); intent.putextra("taskone", taskone); startactivity(intent); } } activity2 currently button shows text activity1 "task 1 content." i'm doing right in passing things around can't seem working , haven't ...

javascript - Moving to the selected row in the HTML table when the table has scrollbar -

i have table , using selected property of row when user clicks on row in table. in other panel have map , has employees displayed on it. each row in table has unique id , when user clicks on employee image on map employee row in table gets highlighted. if table has 40 rows have vertical scrollbar shown. when click on employee id 40 row in table gets selected row not shown in view because table has scrollbar , hidden scrollbar. following html code: <div class="customtable"> <table class="table" id="employeestable"> <thead class="active"> <tr> <th>employee id</th> <th>employee state</th> </tr> </thead> <tbody> <div> <tr ng-repeat="employee in employees ng-class="{'selected':employee.empid == selectedrow}" id="row{{employee.empid}}...

routing - Angular 2, RC5 router-outlet inside another router-outlet -

i'm trying make 1 project 1 router-outlet inside router-outlet: it work this: in first router-outlet have 2 views: auth component (/login) admin component (/admin) then in second outlet inside admin component, own routes, render these: dashboard (/admin) profile (/admin/profile) users (/admin/users) now, in angular 2 docs, can see have implementation using modules. don't want use multiple modules (or have to?). is there way make implementation without separating modules? i want default component admin area, why wanted second router-outlet, example: dashboard have headercomponent, leftnavcomponent, , dashboardcompoent. profile page have these headercomponent , leftnavcomponent too, , thing change profilecomponent, have same structure. think don't need repeat every importing every different admin page. wanted have 1 main admin component, have dynamic content based on current route. i tried , searched in internet lot, example find official angular...

java - AWS SWF Promise IllegalStateException: Not ready -

i trying execute swf workflow. running issue regarding state of promise object. code strucutre below: methods in workflowclientimpl.java: @override public void dosomething() { new trycatch() { @override protected void dotry() throws throwable { system.out.println("workflow started"); promise<someobject> someobject = activityclient.doaction(param1); if(someobject.isready()) { boolean redo = shouldrestartworkflow(someobject); if(redo) { promise<void> timer = decisioncontextprovider.getdecisioncontext().getworkflowclock() .createtimer(timeunit.minutes.toseconds(5)); continueasnew(timer, param1); } } } @override protected void docatch(throwable e) throws throwable { system.err.printlnt("error occured while workflow"); ...

linux - compiling mem.c without CONFIG_STRICT_DEVMEM flag -

i'm trying compile mem.c module config_strict_devmem disabled. idea have module allow me access address space in /dev/mem above 1mb. why? i'm doing testing requires access memory space. i copied mem.c home directory, removed code has access restriction , compiled it. i'm getting following warnings: warning: "kmsg_fops" [/home/user/projects/new_mem/mem.ko] undefined! warning: "tty_init" [/home/user/projects/new_mem/mem.ko] undefined! warning: "phys_mem_access_prot" [/home/user/projects/new_mem/mem.ko] undefined! warning: "xlate_dev_mem_ptr" [/home/user/projects/new_mem/mem.ko] undefined! warning: "devmem_is_allowed" [/home/user/projects/new_mem/mem.ko] undefined! warning: "splice_from_pipe" [/home/user/projects/new_mem/mem.ko] undefined! warning: "shmem_zero_setup" [/home/user/projects/new_mem/mem.ko] undefined! make[1]: leaving directory `/usr/src/linux-headers-4.4.0-34-generic' my quest...

python - Django Static image File Failed to load resource -

fixed solution, in main programs urls.py had add these lines. from django.conf import settings django.conf.urls.static import static urlpatterns += static(settings.media_url, document_root=settings.media_root) i have model called item within there have image field. added new item image database , tried loading inside of index template. dont image when @ console says ("websitename/site_media/items/image.jpg 404 (not found)") i think problem lies within settings.py file cant figure out did wrong here. index.html template {% load static %} <div class="item" style="background-image: url('{{ item.img.url }}')">` model.py class item(models.model): name = models.charfield(max_length=200) img = models.imagefield(upload_to='items', default='', blank=true, null=true) def __str__(self): return "%s" % (self.name) views.py def index(request): latestitems = item.objects.all().order...

forms - Web2py multi-digit value from dropdown gets treated as a list of values -

i have sqlform.factory field: field('course', requires=is_in_set(course_query, multiple=true), widget=sqlform.widgets.multiple.widget), that gets contents query: course_query = external_db.executesql("select course_id, course_title course") i want user able select 1 or more courses, can. upon submit, course_id(s) submitted captured by: courses = request.vars.course then loop through returned course_id's , insert them table: if form.process().accepted: course in courses: external_db.enrolment.insert(student_id=student, course_id=course) response.flash = 'record saved' this works fine when user selects more 1 course. each submitted record gets inserted database correct course_id. if user selects 1 course, happens have 2-digit id, first digit gets inserted. i have found if single 2-digit course_id value submitted web2py treats list, each digit individual element. how make treat double-digit values request.vars singl...

pointers - What's the difference between variable assignment and passing by reference? -

i'm pretty new golang, , compiled languages in general, please excuse ignorance. in code this: package main import "fmt" func assign() int { return 1 } func reference(foo *int) int { *foo = 2 return 0 } func main() { var a, b int = assign() reference(&b) fmt.println(a) fmt.println(b) } ...what practical difference between assigning value vs. passing b reference? in terms of real-world code, why json.unmarshal() require pass pointer empty variable rather returning unmarshalled value can assign variable? passing value requires copying of parameters, in case of reference, send pointer object. golang pass value default, including slices. for specific question json.unmarshal, believe reason unmarshal code can verify whether object passed in contains same field names compatible types found in json. example, if json has repeated field, there needs corresponding slice in object unmarshaling into. so, need pass in struct want json ...

c++ - SDL2 and OpenGL, forcing FPS with Vsync disabled? -

i'm having issue opengl functions seem force application run 60fps. i'm using sdl2 , specify sdl_gl_setswapinterval(0) during initialization, thought disabled vsync. example, following line of code return 16 ms every time (assuming code run in loop, if have drawn on-screen in similar fashion take 16 ms run function instead , 1 in order of microseconds instead of milliseconds): uint32 begin = sdl_getticks(); glint lightbuffer = glgetuniformlocation(cnight_shader.gprogramid, "lightbuffer"); glint varying_time = glgetuniformlocation(cnight_shader.gprogramid, "varying_colour"); glactivetexture(gl_texture2); glbindtexture(gl_texture_2d, texcolorbuffer); gluseprogram(cnight_shader.gprogramid); gluniform1i(lightbuffer, 2); gluniform1f(varying_time, cnight_shader.f1); draw_quad(0, 0, screen_width, screen_height); // (0, 0, mytexture); gluseprogram(null); glbindtexture(gl_texture_2d, 0); glactivetexture(gl_texture0); uint32 end = sdl_getticks(); std::cout ...

wordpress - Instant article and repeating image -

i received general warming: general warnings: repeating cover image , first image: cover image , image '9iememaison.quebec_v1xi5heeg9_8dqdz.png' seem same or same image. please consider removing or replacing 1 of images. so dug internet , found nothing - except this: https://wordpress.org/support/topic/same-image-displayed-twice "i performed preg replace on function "get_the_content()" of "class-instant-articles-post.php" before returning variable $this->_content;" but problem cover image , first image same. how either remove cover image, or rename first image in way wordpress , instant article thing? it's other image @ moment it's same image, because feature image on website , thumbnail generate , image use in post same. don't use different image, best way maybe making wordpress function that: copies image renames image puts link in post , if image update image also. or maybe i'm going deep , there easier ...

android - In app billing consumable item -

i trying implement google in-app billing selling consumable items (coins). tested non-consumable item , worked fine. can't make consumable. every time test it, can buy once ! here code : public class mainactivity extends appcompatactivity { iabhelper mhelper; boolean verifydeveloperpayload(purchase p) { string payload = p.getdeveloperpayload(); /* * todo: verify developer payload of purchase correct. * same 1 sent when initiating purchase. * * warning: locally generating random string when starting purchase , * verifying here might seem approach, fail in * case user purchases item on 1 device , uses app on * different device, because on other device not have access * random string generated. * * developer payload has these characteristics: * * 1. if 2 different users purchase item, payload different between them, * 1 user's purchase can't replayed user. * * 2. payload must such can verify when app wasn't * 1 initiated purchase flow...

layout - "Canvas: trying to draw too large bitmap" when Android N Display Size set larger than Small -

i have published app crashing @ startup on android n when newly introduced display size os setting set large value. when in logcat, see following message: java.lang.runtimeexception: canvas: trying draw large(106,975,232 bytes) bitmap. i've traced issue imageview in first activity shows nice big background image. image in question 2048x1066 , in generic drawables directory, no matter density, image used. everything works okay when display size setting small . when go default , stops working. if swap image out smaller one, works @ default , if go large , stops working again. my guess adjusting display size causes device behave physically smaller device higher pixel density. don't understand i'm supposed here. if put in progressively smaller images progressively higher resolutions, won't on large displays. or not understanding something? any pointers appreciated. i case, moving (hi-res) splash bitmap drawable drawable-xxhdpi solution. i ha...

java - Spring Security Auth0 library throws error when Auth0 user is a Twitter social login -

our server application uses spring security auth0 java library verify java web tokens (jwts). when jwt based on user used social login through twitter, library throws null pointer exception because class auth0userinfo expects email_verified flag exist in jwt when email present. i'm using auth0 rule email via twitter api because twitter not give email out. after try add flag email_verified = true in same rule. cannot add email_verified flag user object in rule because auth0 seems prevent being persisted. there way both email , email_verified flag user object jwt contains information?

excel - Copy range as image and paste into Outlook (results small/blurry) -

i'm trying copy range of cells picture, put picture in email, send email excel macro. i'm able of this, image comes out smaller/blurrier original. i've tried sorts of copy/paste methods results same. when copy picture manually copy picture (as shown on screen) without macro, paste outlook using ctrl+v, image looks fine. any idea why happening? here's code: sub sendmail() dim aoutlook object dim aemail object dim rngeaddresses range, rngecell range, strrecipients string dim rngedata range set aoutlook = createobject("outlook.application") set aemail = aoutlook.createitem(0) set rngedata = worksheets("promo sync").range("a5:y86") 'copy range rngedata.copypicture appearance:=xlscreen, format:=xlpicture dim worddoc word.document set worddoc = aemail.getinspector.wordeditor 'paste picture aemail.display worddoc.range.paste set rngeaddresses = activesheet.range("ak2:ak23") each rngecell in rngeaddresses.cel...

iOS UIAlertController Dark Theme -

i'm working on app ios dark theme , want use uialertcontroller . however, white alert looks out of place. against human interface guidelines on dark themed app use dark themed uialertcontroller (when dark themed alert mean switching white background dark grey , text white includes buttons). assuming it's not against guidelines how go achieving this? can't seem find theme uialertcontroller allow this. well, customizing uialertview / uialertcontroller not possible, there's plenty of custom alert implementations on cocoacontrols, take there. it's more philosophical question; guess doesn't violate anything.

python - Disable Alt+Tab Combination on Tkinter App -

how can disable alt+tab combination, tab on tkinter app. disabled alt , f4 - return "break" - can't disable tab key it. tkinter provides no option this. alt-tab intercepted before tkinter ever sees it. if want this, you'll have find platform-specific hooks.

python - Pad dates within groups with pandas -

i'm trying pad dates within group ('type') , backfill new rows. i've seen examples using reindex, i'm not sure how pad these dates while maintaining groups. in: type date value 2016-01-01 1 2016-01-04 3 b 2016-01-10 4 b 2016-01-13 7 desired out: type date value 2016-01-01 1 2016-01-02 3 2016-01-03 3 2016-01-04 3 b 2016-01-10 4 b 2016-01-11 7 b 2016-01-12 7 b 2016-01-13 7 df.set_index('date').groupby('type', as_index=false).resample('d').bfill().reset_index().drop('level_0', axis=1) out: date type value 0 2016-01-01 1 1 2016-01-02 3 2 2016-01-03 3 3 2016-01-04 3 4 2016-01-10 b 4 5 2016-01-11 b 7 6 2016-01-12 b 7 7 2016-01-13 b 7

vba - Excel formula to remove intermediate rows -

Image
i've excel sheet looks this: i want remove values isn't multiple of 0.1., i.e., in above example, want keep rows 1.2, 1.3, 1.4 , delete intermediate rows. how can write formula this? thanks. in @ third column, i'd enter formula: =round(a1,1)=a1 looks this: then sort on column c, , delete false rows.

angularjs - Angular-service TypeError: Cannot read property 'saveURL' of undefined -

i trying write service store query string of url. doing storing in cookie , retrieving it. when try access saveurl method controller add query string, getting error: typeerror: cannot read property 'saveurl' of undefined controller.js angular .module("app.alerts.alertview") .controller("alertviewscontroller", alertviewscontroller); alertviewscontroller.$inject = [ "$scope", "$location", "alerthistory" ]; function alertviewscontroller($scope, $location, alerthistory) { alerthistory.saveurl($location.search()); } service.js (function () { "use strict"; angular .module("app.alerts.alertview") .service("alerthistory", alerthistory); alerthistory.$inject = [ "$cookiestore"]; function alerthistory ($cookiestore) { return { saveurl: function (urlobj) { var array ...

Differentiate which keyboard (not key) was pressed in Javascript -

this question has answer here: capture events of 2 or more keyboards in javascript/web browser 1 answer i have 2 usb keyboards plugged in. how can determine 1 pressed? i can use keycode events don't see getting read on keyboard used. gamepads, on other hand, have index gamepad in navigator's list used. i'm looking that. how can determine 1 pressed? you can't. keyboradevent doesn't contain such information.

iOS: get response from PHP -

i post , data to/from mysql database php. want response string. for example: a user wants login in app. before storing data , proceed i'll have check if username/password pair exists in database. @ibaction func login(sender: anyobject) { let request = nsmutableurlrequest(url: nsurl(string: "http://example.com/checklogin.php")!) request.httpmethod = "post" let poststring = "username=\(username.text!)&password=\(password.text!)" request.httpbody = poststring.datausingencoding(nsutf8stringencoding) } this post username , password checklogin.php file: <?php $root = realpath($_server["document_root"]); include "$root/config.php"; $username = $_post['username']; $password = $_post['password']; $statement = $pdo->prepare("select * contact username = :username , password = :password"); $statement->execute(array('username' => $userna...

php - Regex to match words and acronyms in camel case string -

Image
i need regular expression capture word parts of string camel case , might have acronym in it. in other words, want split camel case string words , acronyms. for example: someabcwords ... has 3 capture groups some abc words so far i've found regex: ((?:^|[a-z])[a-z]+) but won't handle acronyms , match 'some' , 'words'. one way solve capture abbreviations added negative lookahead. [a-z][a-z]+|[a-z]+(?![a-z]) sample

php - PHPExcel Orphan/Widow, getRowDimension -

i having issue saving pdf file phpexcel , creating widow/orphans data. i know of function create page breaks, $objphpexcel->getactivesheet()->setbreak( 'a10' , phpexcel_worksheet::break_row ); but know if there function know current height of range of cells. i have found references "getrowdimension" in functions $objphpexcel->getactivesheet()->getrowdimension('10')->setrowheight(100); but cannot find documentation on function. know if can calculate height of chosen row and/or take range of rows? also, there function calculate usable space between header , footer of each page? or should calculate page margin? thank you, nick $objphpexcel->getactivesheet() ->getrowdimension('10') ->getrowheight(); will return row height specified row. height in "points", 1 point equivalent of 1/72 of inch (or 0.35mm). value of 0 indicates hidden row; while value of -1 default value, 12.75pt (about...

c# - How to Inlcude default warning icon into pictureBox -

i want set picture box default visual studios warning icon. so, want use this: messageboxicon.warning and format use instead of system icon below: this.pictureboxwarning.image = system.drawing.systemicons.warning.tobitmap(); the reason want consistency reasons. making custom dialog box , want similar default 1 use in our program dialog box. simply save image of icon, resize if needed, set image

c++ - Customize style in QtQuick -

Image
this question has answer here: how apply style textfield in qml? seems “style” attribute isn't available 1 answer i'm working qt5.7, qtquick2.7 , qtquick.controls 2.0. wanted custom progressbar property "style" not accepted. if has fixed similar problem same versions.. thanks lot! see customizing progressbar documentation example, , this post background information on subject.

grails - GORM Stale object exception -

while inserting record domain object getting error: row updated or deleted transaction (or unsaved-value mapping incorrect) stacktrace follows: org.hibernate.staleobjectstateexception: row updated or deleted transaction (or unsaved-value mapping incorrect) we have simple domain : user{ string uid string firstname string lastname } while doing : def user=new user(uid:"testuser", firstname:"test", lastname:"user") we getting above error.

sh - Unix-- get 3rd field sum from a file -

i have file 5 fields 10 rows of data, want sum of 3rd fields in file. sample: a,b,1,4,5 c,d,3,4,6 f,h,4,y,j o/p: 1+3+4= 8 my solution cut 3rd field using cut command , write file , using awk calculate sum. is there alternative way? i think need: awk -f, '{ sum += $3 } end {print sum}' filename

IllegalStateException when trying to setFillColor using Apache POI XSLF -

i'm trying set background fill color pptx file using apache poi xslf library. code looks this: xslfslidemaster defaultmaster = ppt.getslidemasters().get(0); xslfslidelayout layout = defaultmaster.getlayout(slidelayout.blank); xslfbackground background = layout.getbackground(); background.setfillcolor(color.black); which results in exception in thread "main" java.lang.illegalstateexception: ctshapeproperties not found. @ org.apache.poi.xslf.usermodel.xslfshape.getsppr(xslfshape.java:240) @ org.apache.poi.xslf.usermodel.xslfsimpleshape.setfillcolor(xslfsimpleshape.java:549) i've tried calling on slidemaster's background, layout's background, , slide's background , result in same error. this fixed in poi 3.15-beta2 via #59702 . the "problem" ooxml properties or poi implementation or xmlbeans schemas is, similar attributes colors stored below different schema types , old code didn't cover parent nodes. patch introduced del...

c# - How to read a Mongo Document and save it to an object? -

i need read fields in documents mongo. filtered out document using filter.eq() method how can find , store field in document? code: public void human_radiobutton_checked(object sender, routedeventargs e) { upload human = new upload(); //opens connection database , collection var filter = builders<bsondocument>.filter.eq("name", "human"); race_desc description = new race_desc(); description.desc = convert.tostring(filter); desc_textbox.text = description.desc; however, doesn't work since didn't grab fields, document. how can read field called 'a' , store object? thanks when define filter using builders<bsondocument>.filter here, merely define filter can use/execute in query. storing sql string in string variable. what missed here executing filter , retrieve data. according mongodb c# driver doc : var collection = _database.getcollection<bsondocument>("restaur...

excel - Generate new worksheet based on column data for LARGE spreadsheets -

i have spreadsheet 800k rows , 150 columns. i'm attempting create new worksheets based on contents of column. so, example if column y has many elements ("alpha", "beta", "gamma", etc.) i'd create new worksheets named "alpha", "beta", "gamma" contain rows original have respective letters. i've found 2 scripts work smaller spreadsheets, due size of particular spreadsheet, don't work . here 2 scripts have tried: sub parse_data() dim lr long dim ws worksheet dim vcol, integer dim icol long dim myarr variant dim title string dim titlerow integer vcol = 1 set ws = sheets("sheet1") lr = ws.cells(ws.rows.count, vcol).end(xlup).row title = "a1:c1" titlerow = ws.range(title).cells(1).row icol = ws.columns.count ws.cells(1, icol) = "unique" = 2 lr on error resume next if ws.cells(i, vcol) <> "" , application.worksheetfunction.match(ws.c...