Posts

Showing posts from August, 2015

html - Using jQuery to display multiple maps in an iframe -

i trying create contact page on bootstrap framework have row split 2 columns. on left hand side have column containing iframe loads google map. on right hand side have column containing 4 offices addresses. default iframe loads map of head office default. i want able click on 1 of offices , iframe content change display relevant mapping information. the html on page follows :- <section id="contact-info"> <div class="center"> <h2>how reach us?</h2> <p class="lead">lorem ipsum dolor sit amet, consectetur adipisicing elit</p> </div> <div class="gmap-area"> <div class="container"> <div class="row"> <div class="col-sm-5 text-center"> <div class="gmap"> <iframe id="gmaps" frameborder="0"

android - NavigationDrawer activity doesn't keep keyboard's state on orientation change -

i created sample project using android studio: create new project -> navigation drawer activity. in testing purposes, content fragment contains single edittext widget. in androidmanifest have line main activity: android:windowsoftinputmode="stateunchanged|adjustresize" odd behavior: if launch app in portrait mode, open soft keyboard (by tapping on edittext ) , rotate device landscape mode... keyboard disappears reason. if create same project no navigationdrawer (just activity + fragment) keyboard remains visible (as expected stateunchanged property). did know reason of such behavior? want keep keyboard expanded after switching landscape mode (if opened in portrait). can track keyboard state , via special flag restore visibility when needed programmatically, know. wonder why native tools don't work navigationdrawer .

jquery - an unwanted page refresh when executing simple query code -

this question has answer here: prevent link reload page 5 answers i want learn jquery can't figure out why page keeps refreshing right after on-click event done. the goal code change background of divresult. works split seconds before page refreshed. tried on different browsers , different computers think it's code. this jquery code: $(document).ready(function(){ $('#button').on('click',function(){ var kleur = "#" +$('#text').val(); $('#divresult').css({'background-color': kleur}); }); }); and html file: <!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <script src="jquery_javascript_library_v1.11.3.js"></script> <script src="script.js"></script> <link href=

Does Visual Studio 2015 RC work in parallel with Visual Studio 2013 -

i'm having question since month , i'm not able test it, want ask here if have met situation. since there no official release of new visual studio 2015 , it's on rc ,i'm interested in know if vs 2015 , vs 2013 work together? code "infected" if both sides commit together? in advance! in theory yes, in practice no (or @ least results may vary). vs designed side side installations. consultants common have multiple versions of vs installed match environment of client. that being said, rc pre release software , bugs expected. nobody can guarantee won't have problems. vs huge , complex codebase. throw in number of permutations of possible plugins , extensions environment conditions , there chance of breaking. because didn't blow on else's system doesn't mean won't have problems. when installed vs 2015 ctp6 few months ago broke install of vs 2013 on same machine. vs 2015 ctp6 installed without error trying "login&qu

templates - Liferay structure. Image not uploaded in IE 8-10 -

have simple structure template web content display: <dynamic-element datatype="image" fieldnamespace="wcm" indextype="keyword" name="image_1" readonly="false" repeatable="false" required="false" showlabel="true" type="wcm-image" width=""> <meta-data locale="en_us"> <entry name="label"> <![cdata[image 1]]> </entry> <entry name="predefinedvalue"> <![cdata[]]> </entry> <entry name="tip"> <![cdata[]]> </entry> </meta-data> </dynamic-element> and template: <#if image_1.getdata()?has_content > <div><img alt="image 1" src="${image_1.getdata()}" /></div> try upload image, ie freezes without error. works in other browsers. idea?

Sort list from a specific index value in python -

i want sort python list specific index. here want achieve. consider list al = [1,2,4,3] want is, start last index, go , swap number smaller last index, i.e 2 @ index 1. list [1,3,4,2] but, after swapping want sort sub-list after swapped index. instead of [1,3,4,2] want [1,3,2,4] there way in python sort sub-list? right if use sort method particular index example: al[2:].sort() creates new list instead of changing same. you use sorted() on slice , assign result slice: al[2:] = sorted(al[2:])

php - Send Notification when new post is published in wordpress -

right now, sending notification android application users when new post created in wordpress. issue that, sends notification when draft created , post updated. condition should put send notification when new post published ? here code, located in wp-admin/includes/post.php function _wp_translate_postdata( $update = false, $post_data = null ) { if ( $update) $post_data['id'] = (int) $post_data['post_id']; $post_id = $post_data['id']; global $wpdb; $sel2 = mysql_query("select * gcm_users"); while($data1 = mysql_fetch_assoc($sel2)) { $key = $data1['gcm_regid']; include_once '../blogdroid/config.php'; include_once '../blogdroid/gcm.php'; $gcm = new gcm(); $sel = mysql_query("select * ".$wpdb->prefix."posts id='$post_id'"); $data = mysql_fetch_assoc($sel);

javascript - Should I be concerned if my website is linked to an external Style Sheet -

this question has answer here: why should use google's cdn jquery? 5 answers at point in website needed timer looked free jquery countdown timer , found 1 : example after integrating model page inside ide (vs2010) payed attention css , js files not stored locally in project folder, still linked external sources, , had me thinking : suppose find way download these file locally use them, or should use them way ? , should concerned if may change or desperate @ point in future ? best practices in case ? here example of html code : .... .... <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"> <script type="text/javascript" src="

msdropdown - How to make option selected? -

i'm trying set value dropdown after ajax call. i have tried below set option value. odropdown.set("selectedindex", 2); though value selected in hidden original select box not showing on msdropdown select box. anyone know how select option after ajax call? if cannot see elements odropdown.refresh(); and before: odropdown.set("selectedindex", 2); resolve problem? :p

Is there any java Deque that implements maxlen, like python collections.deque? -

python's collections.deque has maxlen argument, such that [...] deque bounded specified maximum length. once bounded length deque full, when new items added, corresponding number of items discarded opposite end. [...] i have been looking class implements deque interface in java, same. public arraydeque(int numelements) looks numelements initializes deque size, doesn't enforce max length. probably not. linkedhashmap has facilities build cache eviction policies, might overkill want. extend deque , add custom logic ;-) edit: class myfixedsizedeque<t> extends arraydeque<t> { private int maxsize; public mydeque(int size) { this.maxsize = size; } @override public void addlast(t e) { this.addlast(e); if(this.size() > maxsize) this.removefirst(); } } my java little rusty, , might want overload few more methods (or switch composition rather inheritance) hope idea...

how to increase max number of process for Solaris 10 x86 server? -

we have test server hosts lots of test applications. when there lots of process (or threads) running, found new process or thread cannot created: for c program: "cannot fork, resource unavailable" for java program: throws exception "outofmemory, unable create native thread" i think due hard limit maximum number of process. tried set ulimit -n 255085 . ulimit shows below: core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited open files (-n) 90000 pipe size (512 bytes, -p) 10 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 255085 virtual memory (kbytes, -v) unlimited but doesn't work. tried run many processes @ same time different users , stops same error @ same time. therefore, think there "limit" whole system regardless users logged i

java - How to search for classes annotated with a given annotation in IntelliJ? -

Image
i have project many classes have 1 , same simple name, decorated different annotations. for example: package com.example.base; @default public class classname { } and package com.example.country; @somecountryspecific public class classname extends com.example.base.classname { } there many classes these within project , ejb injected within other classes' constructors/setters. in intellij, when want navigate class, can type class name , ide finds classes , gives list of options. can imagine lists consists of more 15-20 different classes , navigating , finding desired 1 difficult. however, open class, has name equal classname and annotated annotation (like @somecountryspecific ). is possible in intellij? please note renaming sub-classes not option. it's not elegant or convenient, might you're looking (?). can use file mask , "text find" search annotations in files named pattern.

knockout.js - knockout adding new properties to already existing view model -

there knockout model: var custommapping = { update: function (options) { var result = ko.mapping.fromjs(options.data); var self = this; self.computetest = ko.computed(function () { return "test" + self.newobs(); }); return result; } }; var model = function() { var self = this; self.test = ko.observable(); self.init = function() { // create ajax call // in success mapping ko.mapping.fromjs(data, custommapping, self); //this mapping should update existing model - adding new observables , computed } ko.applybindings(self, $("#id")[0]); } var m = new model(); m.init(); so: 1) have knockout model. within functions defined , list of observables. 2) knocokut binding called before data came server. 3) model data loaded using m.init() . this should call custom mapping , create new observables (based on data server), computed variables. however,

Photoshop's spot-color channel mixing algorithm -

Image
photoshop seems have special mode blending spot-color channels. let's @ example: blending full opacity red #ff3c1f full opacity cyan #1cd4c6. if create 2 spot-color channels solidity 0% , set colors #ff3c1f , #1cd4c6 , fill them black #91550d: now, know combining colors complex problem that's not well-posed ( see related question ). result photoshop gives gets close reality of time me. can me understand how photoshop blending? i have read on adobe forums it's multiplicative blending in cmyk. tried reproduce layers, getting #7d4339: i know cmyk device-dependent i've tried lots of various profiles none worked spot-color channels. screenshot using u.s. web coated (swop) v2 profile. i tried multiply blend in lab , in rgb, further off. i appreciate insight on whatsoever. thanks!

Chef Server return 404 for all knife and chef-client request -

i trying setup chef-server , chef-client automatic deployment of packages on virtual machines run on openstack. i following instructions on https://docs.chef.io/install_server.html . version of package chef-server 12.0.8, on ubuntu 14.04 server (chef-server-core_12.0.8-1_amd64.deb). several attempts have been made, clean machine, , same result, older chef-server version (12.0.3, believe). user gets created, organization gets created. i've pulled chef client directly chef site, via install.sh script provided (12.3.something). symptoms: knife ssl check returns success, however: knife client list returns http error 404: error: object looking not found ... 404 - not found sorry, can't find looking for. doesn't matter if run server directly, or machine (knife bootstrap fails, install manually). server (fqdn: chef.cluster.internal) resolvable machines, , server_url used client.rb/knife.rb. self-signed certificate pulled everywhere needed. nginx access logs

android - ImageView: scale too large images down, don't scale too small images up -

i guess title says want do: i have imageview , when image display has been loaded web (with uil ) want a. have image scaled down fit imageview if image larger imageview b. not scale image rather display in it's original size when image smaller imageview bot no problem android:scaletype="fitcenter" for a. , android:scaletype="center" for b. is there possibility combine two? option 'manually' compare size of imageview , size of loaded bitmap each other , set scaletype accordingly? edit: uil config: public static final displayimageoptions uiloptions = new displayimageoptions.builder() .resetviewbeforeloading(true) .bitmapconfig(bitmap.config.rgb_565) .imagescaletype(imagescaletype.in_sample_int) .cacheinmemory(true) .cacheondisk(true) .build(); imageloaderconfiguration = new imageloaderconfiguration.builder(this) .threadpoolsize(2) .defaultdisplayimageoptions(v

android - Lock screen media control for custom Media player -

i using own custom mediaplayer rather android native mediaplayer ,can use mediasessioncompat lock screen media control? yes, can use mediasessioncompat custom media player,it works bridge between application , system providing media metadata , media controls, wont limit in way in how play media.

Not found view doesn't work on Pyramid using traversal -

i'm using pyramid (1.5.7) + traversal , following documentation i've tried possible ways " not found exception view " working. from pyramid.view import notfound_view_config,forbidden_view_config, view_config @notfound_view_config(renderer="error/not_found.jinja2") def not_found_view(request): request.response.status = 404 return {} @forbidden_view_config(renderer="error/forbidden.jinja2") def forbidden_view(request): return {} using contexts: from pyramid.view import view_config pyramid.httpexceptions import httpforbidden, httpunauthorized @view_config(context=httpnotfound, renderer="error/not_found.jinja2") def not_found_view(request): request.response.status = 404 return {} @view_config(context=httpforbidden, renderer="error/forbidden.jinja2") def forbidden_view(request): return {} i'm using scan mode, i've tried adding custom function configuration: def main(globals, **s

Google Drive API - LIST method doesn't work for newly created files in App Data Folder -

i'm android developer. i'm using google drive java api access files in hidden application data folder. since 14 may 2015, list method doesn't return newly created files. in web interface "hidden data size" 0. files created correctly (response 200 ok, file created), can't list them. using list method 2 years , fine until tomorrow. after few hours files listed list method, want access them after create. when save files visible data folder fine, problem hidden application data folder. please me? regards this caching issue app folder content affected list queries. we've rectified issue should no longer see issue. reporting. writes not affected.

ios - How to Populate UITextView with value from UIPickerView? -

how populate uitextview value selected uipicker view. user selects category uipickerview , value displayed on uitextview. you need implement delegate of uipickerview -(void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component{ // write code here // yourtextfield.text = [yourarray objectatindex:row]; }

python - Is Filestorage storage.read() open the file in binary mode? -

i have looked source , documentation of werkzeug, it's specified mode it's opened. since default open mode normal file text mode, brings me question. earlier, had problem save data=storage.read() largebinary type in sqlalchemy, error saying: can't convert unicode byte type. yes, files opened in binary mode. see default_stream_factory() function source : def default_stream_factory(total_content_length, filename, content_type, content_length=none): """the stream factory used per default.""" if total_content_length > 1024 * 500: return temporaryfile('wb+') return bytesio() so either temporaryfile() object opened in wb+ mode (write , read, binary), or in-memory bytesio object.

.net - XtraGrid Disable repository item button on specific cell's mouse move -

Image
i want disable buttonedit editor cell whenever mouse entered in other specific cell. how can achieve functionality? like, whenever mouse hovers on ammar cell remove button must disabled in 1st , 3rd row. note: select column repositoryitembuttonedit column. this mousemove event: private sub gridviewlevel1_mousemove(sender object, e mouseeventargs) ' view @ current point. dim view baseview = gridcontrol.getviewat(e.location) ' retrieve information on current view element. dim basehi basehitinfo = view.calchitinfo(e.location) dim gridhi gridhitinfo = trycast(basehi, gridhitinfo) 'get field value dim fieldname string = gridhi.view.getrowcellvalue(gridhi.rowhandle, gridhi.column) dim row datarow = nothing if not gridhi nothing lblhitinfo.text = fieldname row = gridhi.view.getdatarow(gridhi.rowhandle) else end if end sub in way, got datarow next? it not absolute clear me try achive, t

java - Jenkins Windows Slave JNLP connect error -

i trying configure jenkins slave on windows vm , keep running service. did following steps went jenkins master slave , downloaded jnlp slave agent , installed it. got connected on jenkins logs in master. , small window show connected came too. jnlp agent connected /10.xx8 <===[jenkins remoting capacity]===>slave.jar version: 2.51 windows slave slave connected , online after installed service jenkins user use. on closing small connected window on slave following error failing obtain https://my netowrk.com/computer/windows%20slave/slave-agent.jnlp?encrypt=true java.net.connectexception: connection refused: connect @ java.net.dualstackplainsocketimpl.connect0(native method) @ java.net.dualstackplainsocketimpl.socketconnect(unknown source) @ java.net.abstractplainsocketimpl.doconnect(unknown source) @ java.net.abstractplainsocketimpl.connecttoaddress(unknown source) @ java.net.abstractplainsocketimpl.connect(unknown source) @ java.net.plainsocket

javascript - Is it possible to change z-index for a child element of a div even with some workarounds or hacks? -

i have 2 divs, need visually placing parent div on top (covering) child div. i read other questions, aware child on different flow, understand solution place parent , child on same level, nevertheless interested know if there workaround/hacks make trick. i targeting latest version of chrome , firefox, solution css3 welcome. notes: i need keep z:index on parent. in real code parent transparent, need grab user interecation. child cannot hidden, must visible. http://jsfiddle.net/qn3n4ynw/1/ <div id="parent"> <div id="child"></div> </div> #parent { position:absolute; width:100px; height:100px; background-color:red; z-index: 100; } #child { position:absolute; width:50px; height:50px; background-color:green; z-index: 1; } remove z-index #parent , change z-index of child -1 demo here #parent { position:absolute; width:100px; height:100px; background

javascript - Can not download html with phantomjs -

i have 3 different files in project , layout is phantomjs -->phantomjs.js -->phantomjs.exe index.php index.php: $phantom_script = dirname(__file__). '\phantomjs\phantomjs.js'; $response = exec ('\phantomjs\phantomjs.exe' . $phantom_script); echo $response; phantomjs\phantomjs.js var webpage = require('webpage'); var page = webpage.create(); page.open('http://www.google.com', function(status) { console.log(page.content); phantom.exit(); }); your usage oh phantomjs correct according documentation. http://phantomjs.org/api/webpage/property/content.html php exec method returns last line only. maybe line white space. http://php.net/manual/fr/function.exec.php you shall have seond parameter &$output, sent reference. array containing entire output. a problem may face later, content need evaluated before try read s dom document content. using example innerhtml of html tag, ie: $('html').html(); if p

exrm - When to use compile-only dependencies in Elixir -

when appropriate specify dependency in deps in mix.exs , not runtime dependency in applications ? i thought applications actual applications need started before own application can started, run problem exrm wasn't putting jazz library (which think contains pure functions) release until included :jazz in applications . an otp application more component - bunch of modules , functions may (but need not) run processes. if otp app doesn't start own supervision tree, called library application. either way, if use of libs functions @ runtime, need specify runtime dep. in contrast, compile-time dependency ensures 3rd party code fetched , available locally (on dev/build machine). useful if 3rd party code magic outside of runtime. example own exactor or pure erlang meck mocking library. in first case exactor magic during compilation, while in second case need mocking library during tests.

python - Slug error in django -

i new django , learning basics. however, stuck slug module. hope find solution. in advance. while running migration command python manage.py makemigrations rango python manage.py migrate i keep getting error: django.db.utils.integrityerror: unique constraint failed: rango_category__new.slug models.py file from django.db import models django.template.defaultfilters import slugify class category(models.model): name = models.charfield(max_length=128, unique=true) views = models.integerfield(default=0) likes = models.integerfield(default=0) slug = models.slugfield(unique=true) def save(self, *args, **kwargs): self.slug = slugify(self.name) super(category, self).save(*args, **kwargs) def __unicode__(self): return self.name class page(models.model): category = models.foreignkey(category) title = models.charfield(max_length=128) url = models.urlfield() views = models.integerfield(default=0) def __unico

python - How to run an executable file contained in a text file(hex of exe) -

i have txt file containing hex of exe. read file in python, failed run .exe file. kind of appriciated... thanx import binascii def getexefile(): file1=input("enter exe file name(path):") open(file1, 'rb') f: content1 = f.read() bucket1=open("f1.txt", 'w') bucket1.write(str(binascii.hexlify(content1))) print(binascii .hexlify(content1)) bucket1.close() def getnonexefile(): file2=input("enter non-exe file name(path):") open(file2, 'rb') f: content2 = f.read() bucket2=open("f2.txt", 'w') bucket2.write(str(binascii.hexlify(content2))) print(binascii .hexlify(content2)) bucket2.close() getexefile() getnonexefile() print("end") dump temporary file; change it's permissions it's executable , run in subprocess example: from os import chown subprocess import check_call tempfile import namedt

unity3d - Is it possible to draw in Unity canvas like in html5 canvas? -

some time ago used html5 canvas draw animated background. look here... now try same effect in unity3d. found unity canvas element. after researches found tutorials how draw buttons, images, etc. so wondering if there possibility code unity canvas html5 canvas? i need functions like canvas.fillrect(0, 0, window.innerwidth, window.innerheight); or canvas.beginpath(); canvas.moveto(x, y); canvas.stroke(); but did not found in documentation. another possibility code texture this. think permanently changing texture of background plane requires many processing power? target platform android , ios. thanks in advance! the unity canvas root new ui system. not similar html5 canvas.

php - An error in SQL syntax -

the purpose of code extract data csv file , upload db. i can extract attributes each line file keeps showing error on sql query. here php file: <? $row = 1; $server="xxxxx"; $user="xxxx"; $password="xxxx"; $db="xxxx"; mysql_connect($server,$user,$password) or die('erreur au serveur'); mysql_select_db($db) or die('erreur db'); if (($handle = fopen('xxxx/articles.csv','r+')) !== false) { while (($data = fgetcsv($handle,";")) !== false) { $num = count($data); //echo "<p> $num champs à la ligne $row: <br /></p>\n"; $row++; ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; $produit =$data[$c]; $att = explode(";", $produit); $prod = $att[0]; echo 'id = '.$prod .'<br/>'; $code = $att[1]; echo 'code = '.$code.'<br/>'; $nom = $att[2]; echo 'nom = 

python - Pyramid Web Framework 1.6 - Simple multi page website -

hello have started try out pyramid 1.6a im trying create multipage site try , used framework. not sure im doing wrong cant page render such 0.0.0.0:1234/another-url can 0.0.0.0:1234/. below starter created using pcreate -s starter , __init__.py pyramid.config import configurator def main(global_config, **settings): """ function returns pyramid wsgi application. """ config = configurator(settings=settings) config.include('pyramid_chameleon') config.add_static_view('static', 'static', cache_max_age=3600) config.add_route('a', '/') config.add_route('b', '/b') config.add_route('c', '/c') config.scan() return config.make_wsgi_app() views.py pyramid.view import view_config pyramid.renderers import render, render_to_response pyramid.response import response pyramid.conf

jquery - Trying to do onmouseover/onmouseout effect -

i'm trying achieve "circle/layer" effect ( https://www.thinglink.com/ ) my jquery skills terrible :( i've done, far... html <body style="margin:0; padding:0;"> <div class="container"> <div class="bubble-container bubble-a"> <a class="gps_ring" href="javascript:void(0);"> <div class="dot">dot</div> </a> <div class="layer"> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p> </div> </div> <div class="bubble-container bubble-b"> <a class="gps_ring" href="javascript:void(0);"> <div class="dot">dot&l

css - CSS3 hexagonal button with border and rounded corners -

Image
i have image , has odd shape : flat hexagon borders , rounded corners. make css . have tried make css can expand dynamicaly longer text not working me. here image css : you can achieve shape 2 3d transformed pseudo elements : div { display: inline-block; position: relative; padding: 20px 50px; perspective: 30px; } div:after,div:before { content: ''; position: absolute; top: 0; width: 100%; height: 100%; z-index: -1; background: orange; border: 2px solid darkorange; box-sizing: border-box; } div:before { right: 50%; transform-origin: 100% 0; transform: rotatey(-10deg); border-radius: 10px 0 0 10px; border-width: 3px 0 3px 5px; } div:after { left: 50%; transform-origin: 0 0; transform: rotatey(10deg); border-radius: 0 10px 10px 0; border-width: 3px 5px 3px 0; } body{text-align:center;} <div>some text</div><br/><br/> <div>some longer text</div>

html - Using a different image for microdata that isn't displayed in the article? -

i'm working on website has bunch of articles. i'm looking find way add image invisible without putting inside hidden div. when users add article, there "main" image of specific proportions users upload (which i'd use microdata). there other images tossed in carousel upload. at moment way can microdata testing tool use image doing following: <div class="hidden"> <img itemprop="image" src="link/to/image.jpg" /> </div> what i'd use meta tag, doesn't seem work: <meta itemprop="image" content="link/to/image.jpg"> i haven't found relevant microdata, although open graph , twitter cards support meta tags images. know whether possible microdata or not, or whether "that" important? i don't want have hidden image adds load times if possible! you can use json-ld instead of microdata. that way add want in json data not displayed in page, reco

c# - Zedgraph zoom does not work properly on some Systems -

Image
i observed interesting other day , wanted know whether has clue why happening , how 1 fix issue. appears zooming using zedgraph has issues on systems leading zoom selection box being off mouse position (see screenshot) i think has todo high dpi screens not sure since sample size quite small. once happened on microsoft surface 3 pro , other time on lenovo y50-70 (both running windows 8.1). i tested other software tools knew use zedgraph in order see whether doing wrong effect same. ideas? i found issue being related dpi settings of screen in windows. if select else 100%, zedgraph (5.1.5) not able calculate zoom box correct. issue has been fixed in later versions of zedgraph (>= 5.1.7).

android - Why is `noinspection SimplifiableIfStatement` automatically added to the activity created through the wizard -

my activity created through wizard hash following code: @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } what piece of code here? //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } without //noinspection simplifiableifstatement , editor warns because simplified to: return id == r.id.action_settings; but that's not want here, need put in if later (e.g. launch settings activity).

php - Failed to load response data -

i'm working angular in front side , php in , request of getting list of objects seems fail each time list under 10mb , navigator shows message "failed load response data" in answer part of request, don't know if it's due configurations in php.ini or navigator (chrome)

database - Dynamic data for produkt list, search form select ,php mysqli -

i looking solution create dynamic data table print 3 variables mysqli database defined 3 select variables . the idea after make selection of categories want display , press button search refreshing page , sending variables . after table made. note : page within iframe , images have same name.jpg id them , list should render in horizontal rows , 4 columns row i think picture worth of thousand words add 1 of code now. picture link< image link (i dont have 10 reputation post images , lol) <head> <link rel="stylesheet" href="../css/style.css"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> <div id="search_wrapper"> <!-- color--> <li> <img class="img_search_bar" src="../img/search/color.jpg" /> <select> <option value="">all</option> <option value="">b

php - how to combine the two for each -

please me, make 2 foreach. , appearance double. <?php $_product = $this->getproduct(); if ($this->getitems()->getsize()) { $related_prods = mage::getmodel('catalog/product') ->getcollection() ->addattributetoselect('condition') ->addattributetofilter('entity_id', array('in' => $_product->getrelatedproductids())); foreach ($this->getitems() $_item) { foreach ($related_prods $related) { ?> <li class="item col-lg-12 border-ngisor"> <div class="col-lg-6"> <div class="product"> <div class="product-details"> <p class="product-name"><a href="<?php echo $_item->getproducturl() ?>"><?php echo $this->escapehtml($_item->getname()) ?></a></p&g

php - CakePHP with Stored Procedure -

i trying create stored procedure in cakephp. have created procedure in mysql , created global function in appmodel.php hit procedure. function in appmodel sprocedure. have 2 conditions might have variable return procedure or may have direct resultset eg. have created pagination. though shooting procedure not return result. function require modification? public function sprocedure($name = null, $inputparameter = array(), $outputparameter = array()) { $this->begin(); $parameter = ""; $outputparam = ""; foreach ($inputparameter $params) { $parameter .= $parameter == "" ? " '$params' " : ", '$params' "; } if (count($outputparameter) > 0) { foreach ($outputparameter $prm) { $outputparam .= $outputparam == "" ? " @$prm " : ", @$prm "; } } $parameter = ($outputparam)

javascript - JQM: Correct touch event to use for navigation, that does not fire on finger scrolling -

i building cordova application. i have page multiple navigation buttons on (16). nav buttons wrapped 2 buttons per line. causes page scrollable. i have issue when scroll page finger, button not fires. don't want event firing navigation code when "scroll" page. i have tried touchstart , touchend , tap . teh docs tap seems looking for, , seem handle scroll better, button stays hi-lited. never fires navigation code. markup: <div data-role="navbar"> <ul> <li><a href="#"> <div id="winebutton"> <img src="images/images/categories/wine.png" style="width: 45px; height: 45px;" /><br /> wine tasting </div> </a></li> </ul> </div> js code document.getelementbyid('winebutton').addeventlistener('ta

c# - Serialize List<Object> that property of list item is element name in XML -

i don't know if topic correct, if not please correct. far not sure search problem maybe question has been answered before. currently have following class (as example): [serializable] public class sample { public string { get; set; } public list<parameter> parameters { get; set; } } [serializable] public class parameter { public string name { get; set; } public string value { get; set; } } this structure have serialize following xml: <sample> <something>1234512345112345</something> <parameters> <name>value</name> <name>value</name> </parameters> </sample> so xml should contain property value of attribute "name" xml-element name. update 20.05.2015 have following xml content: <?xml version="1.0" encoding="utf-16" ?> <processdata> <id>123456</id> <idytpe>baseplate</idytpe> <state>fa

java - Error in running gwt project with maven dependency using kepler? -

i using kepler 4.3.2 , maven compiler plugin 3.1, gwt 2.6.1 plugin , java 1.7 , tomcat 7.0 using following steps. create gwt project configure maven prject. add dependency in pom.xml. add module name in *.gwt.xml file. select project->properties->project facets-> dynamic web 3.0 , java 1.7. update maven project. fixing warnings , errors. still having problem run project invalid thread excess java nullpointerexception. i want run project on jetty. going wrong?

c# - How to go from TextureImporterFormat to TextureFormat? -

it's unity3d specific question, thought i'd ask here since no usefull feedback in unity forums. in short; need corresponding textureformat textureimporterformat . i'm writing assetpostprocessor ; want alter textures after they're imported, , want compress them. so in onpostprocesstexture(texture2d texture) function want compress texture in textureformat defined in editor (in textureimporter ), if didn't in function. however, compression function ( editorutility.compresstexture() ) expects format of type textureformat , format can of type textureimporterformat . how 1 other? or how can avoid problem alltogether? i'm doing manually now, pain ass. since differs depending on version of unity, means change new unity update. :( i forgot question, kinda late thought should answer anyway. turns out misinterpreting results got. compression happens automatically after function. i had made test see if textures being compressed after using

javascript - site(using xml and xslt) is not opened in IE11 and mozilla but works in IE8. Please suggest the code of these files to get it worked in mozilla -

Image
i beginner in xml , xslt kindly help. this code works fine ie4 , ie8 not in mozilla , ie11. no error thrown site diaplays in text ## in stylesheet, remove xmlns="http://www.w3.org/tr/xhtml1/strict" . not belong in there puts result elements in namespace not defined w3c , therefore not known browsers. result html anyway , not xhtml (which use if wanted need make sure element , attribute names in lower case letters , namespace xmlns="http://www.w3.org/1999/xhtml" ). so removing xmlns="http://www.w3.org/tr/xhtml1/strict" best option.

ecmascript 6 - Is there a way to run es6 components, specifically promises and generators, in aws lambda functions -

es6 usage requires --harmony flag in node v0.12.3. is there way aws lambda function? these answers bit out of date. aws announced support node.js 4.3.2 runtime in april 2016. 4.3.2 supports es6. backwards compatible. more details available here: https://aws.amazon.com/blogs/compute/node-js-4-3-2-runtime-now-available-on-lambda/

javascript - Is it possible to override a module in CJS or NodeJS? -

i importing module in application using 'require'. , want change functionality of module in js file , starting step, if require module, changed chings should affect. possible achieve this? not exact this. //module1.js module.exports = function(p,q) { retrun p+q; } //app.js var change = require(./module1);// 'require'd here modify,actually there no dependency var dependency = require(./dependency1) //modifying module1 functionality // module.exports = function() {return p-q;} //dependency1.js var use1 = require(./module1) log(use1(8,3))// should result in '5' enter code here any ais highly appreciable. thankyou

ios - how to send push notification to offline users of xmpp -

we working on real time ios , android application using xmpp protocol , openfire server facing problem when user offline not message have send them push notification watsapp dint option in openfire after research got xep-0085 , got know can send push notification if user offline but dint have upload apple certificate send push notification can send push notification without certificate ? any appreciated it easier use parse or similar push notifications, can use both android , ios. another option expand systems functionality little bit, , add web service correlates application , sends pushes, can give more control on syncing.

jquery - Responsive resize content images -

i've got .content element on website contains main content. want able resize images when browser gets resized. i've made jquery function. first setimgdata() function called. loops images , sets original size data-w , data-h attribute. after resizeimg() called. based on original width , height image resized maximal content width (keeping aspect ratio). the problem data-* attribute doesn't set. because $(this) inside load function doesn't point content image. any ideas how can fix this? function setimgdata(callback) { $(".content img").each( function() { var img = $(this); var pic_real_width, pic_real_height; $("<img/>") .attr("src", $(img).attr("src")) .load(function() { pic_real_width = this.width; pic_real_height = this.height; $(this).data("w", pic_real_width); $(this).data(&quo

Is it true that every function in JavaScript is a closure? -

i understand every function in javascript first-class object , has internal property [[scope]] hosts binding records of function's free variables. however, there 2 special cases. is function created function constructor closure? function object created function constructor special, because [[scope]] may not refer lexical environments of outer functions, global context. example, var = 1; var fn = (function outer() { var = 2; var inner = new function('alert(a); '); return inner; })(); fn(); // alert 1, not 2. this unintuitive. called closure? if inner function doesn't have free variables, can closure formed when inner function created? example, // useless case academic study var fn = (function outer() { var localvar1 = 1, localvar2 = 2; return function() {}; })(); in case, fn refers empty function object created inner function. has no free variables. in case can closure formed? is function created function constru

c - All possible combinations of a word -

i in job interview , asked me generate list of possible permutations of given string . solution inefficient , guy interview me told me supposed use recursion. know question? this classic interview question, solution goes that: int permu(char* str, size_t len ,size_t index ) { size_t = index - 1; if(index == len) { printf ("%s\n",str); } while (++i < len) { swap (str,index,i); /* swap between index , */ permu(str, len ,index + 1 ); /* recorsion */ swap (str,index,i); /* swap between index , */ } return(0); } note, in code user should give 0 in index parmether better call function this: int permutations(char* str, size_t len) { return (permu(str, len ,0)); } static int permu(char* str, size_t len ,size_t index ) { //....}

IMFSourceReader - Decode and Re-sample audio in C# -

i looking decode , re-sample audio file using imfsourcereader in c#. for example: i want decode (mp3 wav) , re-sample bit rate (64kbps 192kbps) of following audio file - myaudiofile - 48khz - 64kbps.mp3 to - myaudiofile - 48khz - 192kbps.wav i trying decode mp3 wav specifying partial media settings in code below, not re-sampling decoded wav file: var filestream = ((mediafoundationreaderrtsettings) settings).stream; var bytestream = mediafoundationapi.createbytestream(filestream); var reader = mediafoundationapi.createsourcereaderfrombytestream(bytestream); reader.setstreamselection( mediafoundationinterop.mf_source_reader_all_streams, false); reader.setstreamselection( mediafoundationinterop.mf_source_reader_first_audio_stream, true); //create partial media type indicating want uncompressed pcm audio var partialmediatype = new mediatype(); partialmediatype.majortype = mediatypes.mfmediatype_audio; partialmediatype.subtype = settings.requestfloato

Video capture with background audio on Android -

i trying create app record videos playing background music. expected output captured video above mentioned music. i not sure whether rubbish question but, please suggest idea capture video background audio on android? my solution fine, try it: service android: import java.util.calendar; import android.app.service; import android.content.context; import android.content.intent; import android.graphics.pixelformat; import android.hardware.camera; import android.hardware.camera.camerainfo; import android.media.camcorderprofile; import android.media.mediarecorder; import android.os.bundle; import android.os.handler; import android.os.ibinder; import android.view.gravity; import android.view.surfaceholder; import android.view.surfaceview; import android.view.windowmanager; import android.view.windowmanager.layoutparams; public class backgroundvideorecorder extends service implements surfaceholder.callback { private windowmanager windowmanager; private surfaceview surfac

session - Updating PHP Shopping Card Data via $_SESSION -

i'm having trouble updating product quantity in shopping cart. use array, $productarray , store product_id , product_name , quantity , , product_price database. check if there product product id in $_session . if yes, update quantity, if not, merge $_session . the issue here i'm not able reach code checks product_id in session variable, hence keeps merging same product shopping cart instead of updating quantity. my code below. please let me know if there additional components should include post. thanks. case "add": if(!empty($_post["qty"])) { $productbyid = $db_handle->runquery("select * products product_id= " . $_get["pid"]); $productarray = array($productbyid[0] ["product_id"]=>array('product_name'=>$productbyid[0]["product_name"], 'product_id'=>$productbyid[0]["product_id"], 'quantity'=>$_post["qty"], 'product_price'=>$p

swift - Can I use the pattern matching operator ~= to match an enum value to an enum type with an associated variable? -

this question has answer here: how test equality of swift enums associated values 11 answers i compare enum value enum type without using switch. following code, example, works using ~= operator: enum myenum { case a, b } let myenum = myenum.a let isa = myenum ~= myenum.a isa equals true above. however, when try compare enum of enum type associated value, below, compile error binary operator '~=' cannot applied 2 myenum operands . enum myenum { case a, b(object: any) } let myenum = myenum.a let isa = myenum ~= myenum.a is there way work around error use ~= pattern matching operator? or recourse following syntax, in opinion more cumbersome: enum myenum { case a, b(object: any) } let myenum = myenum.a let isa: bool switch myenum { case .a: isa = true default: isa = false } thanks in advance input , suggestions!