Posts

Showing posts from August, 2015

android - Making list items width adjust dynamically to occupy the whole list width size -

basically i'm trying achieve pull few strings server, , create buttons number of strings, buttons must occupy whole screen (horizontally). problem each time different data items width must dynamic i've tried put weights items doesn't work. possible achieve such thing list? edit: <android.support.v7.widget.recyclerview android:id="@+id/gametypelist" android:layout_width="match_parent" android:layout_height="wrap_content"/> this item: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="0" android:layout_weight="1" android:layout_height="match_parent" android:orientation="vertical"> <button android:fontfamily="sans-serif" android:layout_width="wrap_con

Convert SOAP multiref to java Object -

may please me transform following soap request data java collection, have tried not getting expected result. may see reference below in second part have transformed java soap request. <multiref id="id1" soapenc:root="0" soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:map" xmlns:ns2="http://xml.apache.org/xml-soap" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <item> <key xsi:type="soapenc:string">orderincrementid</key> <value xsi:type="soapenc:string">ord-4426</value> </item> <multiref href="#id3"/> </multiref> <multiref id="id3" soapenc:root="0" soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:map" xmlns:ns3=&

mysql - PHP generate ticket for queue system and able to reset the ticket number on the next day -

i want use php make simple queue system ticket generate when customer choose option. main requirements are: generate ticket number format (eg. c0001, e0001), alphabet represent different option customer choose. able reset number next day (staff click reset button). each records need stored in mysql. below got, got 2 table (ticket_id , ticket) , 1 trigger: ticket_id create table `ticket_id` (`ticket_id` int(5) not null) engine=innodb default charset=latin1; ticket create table `ticket` (`ticket_id` int(5) not null, `ticket_name` varchar(5) not null default '''0''', `ticket_type` varchar(25) not null, `ticket_time` datetime not null ) engine=innodb default charset=latin1; trigger create trigger `tg_ticket_insert` before insert on `ticket` each row begin insert ticket_id values (null); set new.ticket_name = concat('a', lpad(last_insert_id(), 4, '0')); end newticket $query = "insert ticket (ticket_type, ticket_t

php - Parse feed media group with array of children -

i have xml feed: <item> <title>title</title> <media:group> <media:content url="http://example.it/image.jpg" type="image/jpeg"> <media:thumbail url="http://example.it/image.jpg" type="image/png"/> <media:credit>credit</media:credit> </media:content> <media:content url="http://example.it/image2.jpg" type="image/jpeg"> <media:thumbail url="http://example.it/image2.jpg" type="image/png"/> <media:credit>credit2</media:credit> </media:content> </media:group> </item> this php code read it: $rss = new simplexmlelement($url); foreach ($rss->channel->item $item) { $title = $item->title; } no problem reading "title" item, how can read "url", "thumbnail", "credit" each m

html - 100% width in three-column layers? -

having html: <div class="images_portfolio panel-widget-style"> <a href="imagelink"><img src="x.jpg" alt="" /></a> <a href="imagelink"><img src="x.jpg" alt="" /></a> <a href="imagelink"><img src="x.jpg" alt="" /></a> <a href="imagelink"><img src="x.jpg" alt="" /></a> <a href="imagelink"><img src="x.jpg" alt="" /></a> <a href="imagelink"><img src="x.jpg" alt="" /></a> <a href="imagelink"><img src="x.jpg" alt="" /></a> <a href="imagelink"><img src="x.jpg" alt="" /></a> <a href="imagelink"><img src="x.jpg" alt="" /></a> <a href="imageli

javascript - php file_get_contents working but need to set URL paths to CSS and JS -

i have following: if (isset($_get['orderid'])){ echo file_get_contents("http://www.tuffnells.co.uk/podlookupresults.aspx?__eventtarget=&__eventargument=&__viewstateguid=7ca82b1d-b722-4cdc-b74a-b338d8577ffa&__viewstate=&__eventvalidation=%2fwedaaevvxd1oyelevemr0vhcmypaome%2fdwqd43eodzej3p%2fm4u4pgxq6tlupsjfqzqbazffj%2f1lmlglyhfagz1yhzm8bjowvgaj8c3e%2b2bvmpt91kjxchjnasonqdi2zfsuasuvzpithildcdtilhcjncqg4cxrbv5vpfqbeogs2x52ad%2feb%2byr%2bej68pan2ciykze%3d&ctl00%24ctl16%24tbheadersearch=search..&ctl00%24maincontent%24tbaccountref=01484267&ctl00%24maincontent%24tbconsignmentref=".$_get['orderid']."&ctl00%24maincontent%24tbdestpostcode=".$_get['postcode']."&ctl00%24maincontent%24btndopodlookup=search+again"); } which once have working use ajax pull here testing it, think need set paths js , css files pulls through /scripts/ /css/ etc... there way apply in front of them tuffnells.co.uk/ don

How to pre-load SASS custom utilities (variables and mixins) with webpack -

i loading utilities , assets in base.scss so @import "_variables"; @import "_mixins"; ... i have tons of modules in application , doing many changes in these modules. so importing base.scss in header of each of scss files causing trouble , seems redundant. tried using sass's includepaths didn't resolves @import declarations. there way can auto import utilities without having @import manually in each file? this loader job https://github.com/shakacode/sass-resources-loader adding webpack config sassresources: [ './path/to/vars.scss', './path/to/mixins.scss' ] update check implementation out in action in this boilerplate

Facebook comments plugin not showing up in WordPress -

i created facebook app id directed on @ https://developers.facebook.com . used id generate comments social plugin code blog looks this: <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/sdk.js#xfbml=1&version=v2.7&appid=1789276651307619"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <div class="fb-comments" data-href="<?php the_permalink(); ?>" data-width="600" data-numposts="5"></div> the modification made generated code little php generates post's url dynamically ( <?php the_permalink(); ?> ) in last line. added exact snippet in theme's single.php file. however, when page loads, see fb comments plugin should bi

java - Alljoyn sample app resources -

after going through several documents on allseen website, found outdated git hub links. there download links download sdks android , linux. there download available onboarding app android? you might use dashboard android app onboard alljoyn devices. git clone repo sources: git clone https://git.allseenalliance.org/gerrit/contributed_applications/dashboard.git or download apk cdn at: http://mirrors.kernel.org/allseenalliance/alljoyn/15.04/dashboard_01_01_5.apk hope helps

linux - is there a way to control the extraction of key frame using ffmpeg -

the situation 8 frames default threshold scenecut detection.as key frames not representive enough .so want turn down threhold more key-frames.but use -g , -sc_threshold arguments in command(reference: how control key-frame generation of ffmpeg? ) ,it donot work well.i still same 8 frames without change.any ideas? you output iframes list , use script. $ ffprobe -show_packets -print_format compact input.mkv 2>/dev/null | egrep -n flags=k | cut -d: -f 1 > iframes

cakephp - date beetween and query giving error -

$attdata= $attendeestable->find()->where( [ 'meeting_id =' => $meeting_id, 'email =' => $data['email'], 'created_at between ? , ?'=> array( $finaldate, $enddate ) ]) ->count(); error: call member function format() on non-object file /var/www/webinar.mj/vendor/cakephp/cakephp/src/database/type/datetimetype.php line: 104 the right way is $attdata= $attendeestable->find() ->where([ 'meeting_id =' => $meeting_id, 'email =' => $data['email'] ]) ->where(function ($exp, $q) use($finaldate, $enddate) { $exp->between('created_at ', $finaldate, $enddate); return $exp; }) ->count(); you can do $attdata= $attendeestable->find()->where( [ 'meeting_id =' => $meeting_id, 'email =' => $data['email'], 'created_at between :foo , :bar' ]) ->bind(':foo', $finaldate, 

Android: able to install app for unsupported Android version -

we're dropping support android 2.3 (api level 9) devices because of our users have newer android version on phones. i've updated minimum sdk version api level 14. android { compilesdkversion 23 buildtoolsversion "23.0.2" defaultconfig { minsdkversion 14 targetsdkversion 23 } } however i'm still able install app on android 2.3 devices manually (not store). expected behavior or doing wrong? couldn't find answer somewhere else. another strange issue lint doesn't detect correct api level. listview.setfastscrollalwaysvisible(true); this results in warning: call requires api level 11 (current min 9). current minimum 14. indicates me did wrong. tried cleaning , rebuilding project, restarting android studio. didn't work. can me out? edit based on sufians comment started fiddling around gradle files , came following solution. questions still remain. project structure looks this: android.gradle (top-le

java - Get substring starting after a given string -

caused by: com.some.packge.mycustomexception: blah, blah, blah how can sub-string of above string in such way blah blah part. tried below mycustomexception in substring. mainstring.substring(mainstring.indexof("mycustomexception")); you can this: mainstring = mainstring.substring(mainstring.indexof("mycustomexception:") + "mycustomexception:".length()); you should check if string contains mycustomexception: before that.

php - Error to connection at the database: Can't connect to local MySQL server through socket -

this question has answer here: can't connect local mysql server through socket '/var/lib/mysql/mysql.sock' (2) 31 answers error 2002 (hy000): can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock' (2) 64 answers i have realized database on hosting website , not on mac using mysql. use database signup/login in ios app. database using php code connecting. this php code: <?php header('content-type: application/json'); if($_post) { $nome = $_post['nome']; $cognome = $_post['cognome']; $email = $_post['email']; $dob = $_post['dob']; $password = $_post['password']; $c_password = $_post['c_password']; if($_post['email']) {

ios - Missing File After Removing Pods -

Image
after removed couple of pods, xcode shows 1007 warnings. it's missing pod files removed. here i looked many answers non of them helpful. solution in case? thank you! after tons of research, realize should refresh status in source control tab. since files deleted project hosted on github, have update repo otherwise project still asking old header files.

javascript - How to filter some consecutive elements from an array in AngularJS? -

if have array of names like names = ["muneeb", "roshan", "umar", "kamil", "shamseer", "ajay", "jasar"] and want filter array in way select 2 elements array has index of 3 , 4. how achieve angularjs ng-repeat? please advise. can use ng-if on index, like <div ng-repeat = "name in names track $index"> <div ng-if="$index === 3 || $index === 4">whatever want here</div> </div>

c - For loop runs an extra time than what is specified? -

so code takes in list of numbers , outputs consecutive rolling average of numbers. scanf function runs time put in zero. how can fix this? here have: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ int i,n; double numbers[100]; double previous[100]; double x[100]; double mean[100]; double old_average[100]; double new_average[100]; printf("total amount of numbers: "); scanf("%d\n", &n); (i=1; i<n+1; i++){ scanf("%lf\n", &numbers[i]); } old_average[1] = numbers[1] / 1; (i=1; i<n+1; i++){ new_average[i] = (((old_average[i] * (i)) + numbers[i+1]) / (i+1)); old_average[i+1]=new_average[i]; } printf("%lf\n", old_average[1]); (i=1; i<n+1; i++){ printf("%lf\n", new_average[i]); } //new_average[i] = (((old_average[i] * i-1) + numbers[i]) / i); //mean[j] = numbers[i] +

asp.net web api - Email in angularjs? -

This summary is not available. Please click here to view the post.

c++ - Inquiry on std::binary_search() -

i'm looking @ using std::binary_search() (from library) determine whether or not instance of exists in list. want know how works before begin using it. my understanding uses comparison (and user-defined structs/classes need access user-defined compare function) find out if instance of object exists within list/vector. according website ( http://www.cplusplus.com/reference/algorithm/binary_search/ ), range used is: [first, last) so not including last because have compare last against last + 1 ? also user-defined compare function's logic not matter long differentiates between properties within object/class. correct? for example, if struct/class consisted of following: coord { int x; int y; } i have make sure compare function differentiates (in manner, such greater-than/less-than comparison) x , y properties of elements , b in list/vector. std::binary_search() implemented common binary search algorithm, performs @ log2(n)+1 element comparison

.htpasswd - javascript authenticate with htpasswd and fetch json -

i have api generates json, problem password protected url, using apache htpasswd. how can authenticate , retrieve json javascript, since methods have tried give me access deined (i've been using http://username:passwd@urldotcom/path/to/stuff ) thanks i figured out how it. var = jquery.ajax({ type: "get", url: url, username: "user", password: "password" }); url variable declared earlier of format http:///path/to/json

php - How to integrate nodejs in codeigniter -

i want integrate node.js in codeigniter framework having confusion how execute node.js in codeigniter.i have knowledge codeigniter nodejs still quite new me. how integrate nodejs in existing website in codeigniter? any kind of highly appreciated. thanks in advance.

ios - didRegisterForRemoteNotificationsWithDeviceToken not called in ios8, but didRegister...Settings is -

i followed this thread , method didregisterforremotenotificationswithdevicetoken still not called : the documentation says : after call registerforremotenotifications method of uiapplication object, app calls method when device registration completes successfully didregisteruser appears well, not did register notif . here code in appdelegate (the app version 8.1) : - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { //register notif uiusernotificationtype usernotificationtypes = (uiusernotificationtypealert | uiusernotificationtypebadge | uiusernotificationtypesound); uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes:usernotificationtypes categories:nil]; [application registerusernotificationsettings:settings]; return yes; } - (void)application:(

javascript - Content is undefined when trying to work with a record in Ember -

i trying update record in ember store. when try this, returns following error: uncaught error: assertion failed: cannot delegate set('name', test) 'content' property of object proxy : 'content' undefined. the controller looks this: import ember 'ember'; export default ember.controller.extend({ model: null, event: { name: "test", id: "adfg8943224xcvsdf" }, actions: { editevent (event) { var event = this.store.find('event', event.id); event.set('name', event.name); event.save() } } }); the route looks this: import ember 'ember'; export default ember.route.extend(authenticatedroutemixin, { model () { return { event: this.store.find('event') } }, setupcontroller (controller, model) { controller.set('model', model); } }); the template triggers action, sending along object called event, has properties name , i

excel - VBA Userform a lot slower than without Userform -

i have created user-form in vba complete tasks done entering values in cells , clicking buttons run vba code. one of these tasks go through table , add date in table x months entered user. example date 1/1/15, user enters 5, new date 1/6/15. apologies cannot copy code work , not allowed too. however when task done entering x in cell , clicking button taking ~1.5 seconds complete. user-form doing exact same task exact (or more efficient) back-end code taking ~7 seconds. is able hazard guess why user-form taking longer?

Unix: Unexpected behavior of grep command with regex search -

i have grep command run daily find entry in huge logfile. this command works fine in our development environment. in our production environment, outputs response different entry in logfile. here's command: logentry=$(grep -m1 -op '.*(?<=reset\s).*' $log) actual entry in log file: ******reset counter:[total:1849766] [success:1849766] [insert:102] [update:1848861] [delete:803] [key:0] command output: ******reset counter:[total:1849766] 1 [insert:102] [update:1848861] [delete:803] [key:0] expected output: ******reset counter:[total:1849766] [success:1849766] [insert:102] [update:1848861] [delete:803] [key:0] what reason behind inconsistent behavior of grep command? thanks @ed morton comment. fix working fine. root cause: variable not quoted it's open globbing, word-splitting, , filename expansion , net result dependent on files in directory. solution: use echo "$logentry" instead , quote shell variabes unles

What's an xUnit runsettings equivalent? -

we have several environments had own run settings when used mstest. since microsoft abandoning mstest switching xunit. whether it's through runsettings or command line property, need way specify testrunparameters in xunit test. xunit have native way mstest or need come own solution?

Edit message portlet in liferay -

import java.io.ioexception; import javax.portlet.actionrequest; import javax.portlet.actionresponse; import javax.portlet.portletexception; import javax.portlet.portletpreferences; import javax.portlet.readonlyexception; import javax.portlet.renderrequest; import javax.portlet.renderresponse; import javax.portlet.validatorexception; import com.liferay.util.bridges.mvc.mvcportlet; public class greetingmessage extends mvcportlet { public static final string greeting = "greeting"; public static final string default_greeting = "hello! it's default greeting message"; @override public void render(renderrequest request, renderresponse response) throws ioexception, portletexception { portletpreferences preferences = request.getpreferences(); request.setattribute(greeting, preferences.getvalue(greeting, default_greeting)); super.render(request, response); } public void updategreeting(actionrequest request, actionresponse response

python 2.7 - How to keep a Tkinter widget on top of the others -

Image
i have code moves images left , right not want them appear on top of right border, draw rectangle. options in tkinter keep widget (in example rectangle) on top of other widgets (in code tile, image)? drawing rectangle , image on 1 canvas. i can image using 2 canvas trick, there other options/settings? thanks import tkinter tk # python2 import pil.image, pil.imagetk win = tk.tk() #create canvas canvas = tk.canvas(win, height = 500, width = 500) #create rectangle on right of canvas rect = canvas.create_rectangle(250, 0, 500, 250, width = 2, fill = "red") #create image sprite = pil.image.open("sprite.png") tilepil = sprite.resize((100, 100)) tilepi = pil.imagetk.photoimage(tilepil) tile = canvas.create_image(100, 100, image = tilepi, tags = "a tag") #place canvas canvas.grid(row = 1, column = 0, rowspan = 5) #move tile right. #the tile go on top of red rectangle. how keep rectangle on top of tile? canvas.coords(tile, (300, 100)) canvas.mainlo

Mysql trigger math calculation -

there 2 tables: 'replies' , 'posts' , trigger placed on 'replies' table. every time new entry placed in replies table, trigger checks if conditions true values in row on posts table matching id new entry. here have far: create table posts( p_id int unsigned not null auto_increment primary key, p_health int unsigned not null default 0, p_bump int unsigned not null default 0, p_time timestamp); create table replies( r_id int unsigned not null auto_increment primary key, r_to int unsigned not null, r_time timestamp); create trigger bump after insert on replies each row begin if posts.p_bump < 5 posts.p_id = new.r_to , (select count(r_to) replies r_to = new.r_to)%10 = 10 update posts set posts.p_bump = posts.p_bump + 1 , set posts.p_health = 0 posts.p_id = new.r_to; end if; end; insert posts() values(); insert replies(r_to) values(1); insert replies(r_to) values(1); insert posts() values(); insert replies(r_to) values(2); inser

java - How some apps track their own uninstall on android -

i found 360 security app after uninstall open page in browser. can on android versions (4, 5 , 6) , don't understand how. maybe have ideas? know same questions here , here , others still have no answers. it's not bug inotify framework because works on 4-th android. there no other processes listen same bug in new way, checked. had magic in lib "eternity.so" the app can specify broadcastreceiver action: "android.intent.action.package_removed" it called each time package removed, if app's own package. then, in receiver , app can check package removed , react accordingly. please mind different versions of system may treat differently, giving receiver varying amounts of time before app's process shut down. performed action should therefore quick , aimed on external target, sending action_view intent webpage url inside mentioned :-)

linux - Raspberry Pi Youtube Stream with ffmpeg: libx264 unknown -

i want use raspberry pi 3 youtube stream via usb camera. therefore, compiled , installed following tools: ffmpeg, libx264, libav-tools however, when running following code error libx264 encoder unknown : ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 -codec:v libx264 -b:v 700k -maxrate 700k -bufsize 700k -an -f flv rtmp://a.rtmp.youtube.com/live2/myyoutubecode i installed x264 via clone , make install using this guideline . how can check if encoder installed correctly? stuck 2 days on problem - please help! related hints (e.g. l ibavcodec-extra codec , type errors ) regarding problem unfortunately didn't further. thank you. the entire console output is: ffmpeg version n-81043-ga49ed9e copyright (c) 2000-2016 ffmpeg developers built gcc 4.9.2 (raspbian 4.9.2-10) configuration: libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 50.100 / 57. 50.100 libavformat 57. 42.100 / 57. 42.100 libavdevice 57. 0.102 / 57. 0.102

c++ - Identify whether a dll is built in debug or release with python -

is there way determine whether dll built in ms visual studio 2005 (c++) compiled in debug or in release with python ? i know vs able load dll , show manifest metadata stores information. python module able well? another option identify dll's dependencies on other dlls , debug-only ones e.g.: msvcr80 d .dll, if possible. pefile can parse pe executable. can find usage examples on project's page. regarding second part of question retrieve list of dll's dependencies (taken examples): import pefile path_to_dll = r"path_to_your_dll" pe = pefile.pe(path_to_dll, fast_load=true) # if pe file loaded using fast_load=true argument, need parse data directories: pe.parse_data_directories() entry in pe.directory_entry_import: print entry.dll in case got following output: kernel32.dll, msvcp80d.dll, msvcr80d.dll , advapi32.dll.

php - Add incremental parameter value to each post in wordpress query loop -

i'm trying combine several loops 1 , sort final results relevance. for former part, did this: // set variables $author_id = get_the_author_meta('id'); $tags_id = wp_get_post_tags($post->id); $first_tag = $tags_id[0]->term_id; $categories_id = wp_get_post_categories($post->id); // loop same author $by_author = new wp_query (array( 'author' => $author_id, 'posts_per_page' => '5' )); // add ids array if ($by_author->have_posts()) { while ($by_author->have_posts()) { $by_author->the_post(); $add[] = get_the_id(); } } // loop same tag $by_tag = new wp_query(array( 'tag__in' => $first_tag, 'posts_per_page' => '5' )); // add ids array if ($by_tag->have_posts()) { while ($by_tag->have_posts()) { $by_tag->the_post(); $add[] = get_the_id(); } } // loop same category $by_category = new wp_query(

google analytics - Send enhanced ecommerce data -

when land on confirmation page run following code. var purchaseobject = { 'id': $orderid, 'revenue': $total, 'shipping': $deliverycost }; if (couponcode.length) { purchaseobject['coupon'] = couponcode; } ga('ec:setaction', 'purchase', purchaseobject); ga('ec:send'); both sends generates error messages. plugin "ec" not have method "send". and error calling plugin method: {0: "ec:send"} i have added ga('require', 'ec'); in head , other events works don't why send not work. eec not have send method, set action e-commerce-data , send along next pageview (or other interaction). see example google documentation: // transaction level information provided via actionfieldobject. ga('ec:setaction', 'purchase', { 'id': 't12345', 'affiliation': 'google store - online', 'revenue': '3

php - How to upload PDF, DOC, DOCX file to mysql -

i created form uploads information database. @ point people can upload pdf, doc or docx files. how do code have? my upload.php <?php $servername = "localhost"; $username = "root"; $password = "usbw"; $dbname = "persons"; // create connection database $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } // address append - prepare sql statement , bind params $stmt = $conn->prepare("insert address (address_street, address_housenumber, address_zipcode, address_city, address_state) values (?, ?, ?, ?, ?)"); $stmt->bind_param("sssss", $straat, $huisnummer, $postcode, $stad, $provincie); $straat = htmlspecialchars($_post[straat]); $huisnummer = htmlspecialchars($_post[huisnummer]); $postcode = htmlspecialchars($_post[postcode]); $stad = htmlspec

java - What is the alternative to @RunWith(JMock.class)? -

we have moved java 1.7 , jmock.class deprecated. there alternative? seems website has been abandoned... you want junitrulemockery rule. public class testsomething { @rule public final junitrulemockery context = new junitrulemockery(); @mock private myinterface interface; @test public void testthething() { context.checking(new expectations{{ }}); // etc. } you'll need jmock-junit4 dependency on classpath... <dependency> <groupid>org.jmock</groupid> <artifactid>jmock-junit4</artifactid> <version>2.8.1</version> <scope>test</scope> </dependency>

jquery select2 - Is it possible to disable opening on key enter for select 2 (v 4.0.3) -

is possible disable opening on key enter select 2 (v 4.0.3). found somewhere can done options "openonenter: false", not work me. unfortunately, no. @ time of version 4.0.3 @ least. it's hardcoded: this.on('keypress', function (evt) { var key = evt.which; if (self.isopen()) { // skipped } else { if (key === keys.enter || key === keys.space || (key === keys.down && evt.altkey)) { self.open(); evt.preventdefault(); } } });

linux - Exception in thread "main" java.net.BindException: Address already in use -

i try install java http api on linux server. try execute command command pompt run service: java -dfile.encoding=utf8 -cp .:boilerpipe-1.2.0.jar:lib/nekohtml-1.9.13.jar:lib/xerces-2.9.1.jar:lib/langdetect.jar:lib/jsonic-1.2.8.jar exampleprogram then have error: exception in thread "main" java.net.bindexception: address in use @ sun.nio.ch.net.bind0(native method) @ sun.nio.ch.net.bind(net.java:463) @ sun.nio.ch.net.bind(net.java:455) @ sun.nio.ch.serversocketchannelimpl.bind(serversocketchannelimpl.java:223) @ sun.nio.ch.serversocketadaptor.bind(serversocketadaptor.java:74) @ sun.net.httpserver.serverimpl.(serverimpl.java:100) @ sun.net.httpserver.httpserverimpl.(httpserverimpl.java:50) @ sun.net.httpserver.defaulthttpserverprovider.createhttpserver(defaulthttpserverprovider.java:35) @ com.sun.net.httpserver.httpserver.create(httpserver.java:129) @ exampleprogram.m

How do I use the Google Calendar API client library for Ruby to get a list of calendar IDs for only my account? -

i'm trying create web application takes data google calendar account , puts on website uses own calendar program. don't want have user permission account every time run program, since user of account, , according https://developers.google.com/api-client-library/ruby/auth/service-accounts , https://developers.google.com/identity/protocols/oauth2 , seems way use service account. ideal option scenario? @ rate, set service account, generated json file credentials, , attempted create code return list of calendar ids can access of calendars: require 'google/apis/calendar_v3' require 'googleauth' require 'oauth' cert_path = gem.loaded_specs['google-api-client'].full_gem_path+'/lib/cacerts.pem' env['ssl_cert_file'] = cert_path env['google_application_credentials'] = 'c:\users\eric\desktop\tripleseat project\my project-6006a5b60113.json' def createserviceobject() service = google::apis::calendarv3::calendarser

c# - Byte comparison uses so much CPU -

well have function compare red, blue, green, , alpha pixels in image comparison loop comparing 2 images code: var o = 255 - c1.a; var t = tolerance < o ? o : tolerance; var b = aresimiliar(ref c1.b, ref c2.b, ref t); var g = aresimiliar(ref c1.g, ref c2.g, ref t); var r = aresimiliar(ref c1.r, ref c2.r, ref t); if (b && g && r) continue; [methodimpl(methodimploptions.aggressiveinlining)] private static bool aresimiliar(ref byte v1, ref byte v2, ref double tolerance) { var z = v1 - v2; var t = z > 0 ? z : -z; return t <= tolerance; } the problem uses cpu although no external code being used, , testing narrowed down code causes load. try instead var o = 255 - c1.a; var t = tolerance < o ? o : tolerance; if (aresimiliar(c1.b, c2.b, t) && aresimiliar(c1.g, c2.g, t) && aresimiliar(c1.r, c2.r, t)) continue; [methodimpl(methodimploptions.aggressiveinlining)] private static bool aresimiliar(byte v1, byte

ios - Why nonatomic is still used even though it might cause data error? -

this question has answer here: why properties said made nonatomic in objective c? [duplicate] 3 answers i've read through several explanation on differences between atomic , nonatomic. in this link , says: with "atomic", synthesized setter/getter ensure whole value returned getter or set setter, regardless of setter activity on other thread. is, if thread in middle of getter while thread b calls setter, actual viable value -- autoreleased object, -- returned caller in a. in nonatomic, no such guarantees made. thus, nonatomic considerably faster "atomic". nonatomic qualifier may cause access error when using setter , getter @ same time. what's point of using it, although it's faster atomic? performance. if declare properties atomic, accessors use locks ensure values retrieved , set. if don't need - sure 1 thre

theano - libcublas.so cannot open shared object file: No such file or directory in ipython and notebook -

the missing libcublas.so problem has been around time. common problem $path , $ld_library_path environment variable not set properly. , solutions command line scenarios have been posted in nvidia forum , here . but no specific solution has been out similar symptoms in ipython or notebook. here own work around. the problem still due environment variables: ipython , notebook cannot propagate settled $path , $ld_library_path . when happens, first thing check is import os; print(os.environ['path']); print(os.environ['ld_library_path']) most bin , lib paths not in these environs. to solve ipython, use sudo path=$path ld_library_path=$ld_library_path ipython when starting ipython. and notebook, add these lines end of jupyter_notebook_config.py : import os os.environ['path'] += ':/usr/local/cuda/bin' os.environ['ld_library_path'] = '/usr/local/cuda/lib64'

f# - How can I constrain a function to not accept partially applied functions -

i have serialization function feed data into, times miss argument data generating function, , result serialize partially applied function. json.net not throw this, provides nice empty object {} i constraint serialization function not accept partially applied arguments: let myserializer<'a when : 'a isnotafunction> (data:'a) : string = jsonconvert.serializeobject(data) so far have had no luck in finding way of doing this.

postgresql - delete schemas with prefix -

i want delete schema within database starts 'u_' , reason, keep getting on 200 schema created whenever try create , modify tables in pgsql . i tried using drop schema u_* cascade; but don't think wildcards work (will syntax error code here). know can schema names through select schema_name information_schema.schemata; but there on don't know do. want delete schema either empty or start "u_". this statement drop schemas names start u_ , contents: do $$declare s text; begin s in select nspname pg_namespace nspname 'u\_%' loop execute 'drop schema "' || quote_ident(s) || '" cascade'; end loop; end;$$; to drop empty schemas, use do $$declare s text; begin s in select nspname pg_namespace nspname not 'pg_%' , nspname <> 'public' loop begin execute 'drop schema "' || quote_ident(s) || '"&#

c# - Windows Forms OpenFileDialog, prevent opening instance if dialog already showing -

i have openfiledialog instance on class, this. public myclass { public openfiledialog dialog { get; set; } public myclass() { dialog = new openfiledialog(); } public void showdialog() { if (dialog.showdialog() == dialogresult.ok) { dostuff(dialog.filenames); } } } the issue if spam click button open dialog 3 times, dialog pop open once. once close first dialog, show additional 2 times. there way can detect if dialog showing prevent popping open? edit: using unity3d experience utilizing mono version of system.windows.forms. because of this, there isn't form "owning" dialog, unity game window. button pushed gui element inside game. thanks try: dialog.showdialog(this); assuming here this form contains button. should display dialog modal form it's owner preventing activating or using controls on form until dialog dismissed.

python - Pandas: Get an if statement/.loc to return the index for that row -

i've got dataframe 2 columns , i'm adding 3rd. i want 3rd column dependant on value of 2nd either returning set answer or corresponding index row. an example database below: print (df) amount percentage country belgium 20 .0952 france 50 .2380 germany 60 .2857 uk 80 .3809 now want new third column 'other' if percentage below 25% , name of country if percentage above 25%. i've written: df.['country']='other') df.loc[df['percentage']>0.25, 'country']=df.index unfortunately output doesn't give equivalent index; gives index in order: print (df) amount percentage country country belgium 20 .0952 other france 50 .2380 other germany 60 .2857 belgium uk 80 .3809 france obviously want see germany across g

InDesign automated XML merge and PDF creation without InDesign Server -

i have client has large product catalog built in indesign. has static sections mixed dynamic sections need data-merged periodically xml file generated db. they want able have single workstation, without owning indesign server or having indesign desktop launched, automatically merge latest xml file , generate pdf of entire catalog few user interactions possible (preferably automatically whenever xml file changes, or @ least click of button outside of indesign). is possible or without ids? can scripting set this? thanks in advance input have! i ended creating node.js gulp app listens xml input folder, downloads images referenced in xml, xslt, , launches indesign desktop. id startup script takes on , xml import, exports pdf, , closes indesign. the node app takes on again, listening pdf being placed, , uploads file web server. thank you, everyone, feedback.

c# - Prism 6: Multiple Views get data from one ViewModel -

so im working week prism , it´s great :) question now: can data 1 viewmodel multiple views (in cases 2 views). work viewmodellocator brian lagunas in webinar -> https://www.youtube.com/watch?v=zfby2nfykqy the example webinar: have views named viewa + viewb , viewmodels named viewaviewmodel + viewbviewmodel. want locator take viewaviewmodel both viewa , viewb. code viewa: <usercontrol x:class="mvvm_prism_mein_einfaches_beispiel.views.viewa" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:mvvm_prism_mein_einfaches_beispiel.views" xmlns:prism="http://prismlibrary.com/" prism:viewmodell

python - how to plot two barh in one axis? -

Image
these pandas series more 500 items,i pick top 10 , bottom 10 plot in 1 matplotlib axis,here picture draw manually: data here: bottom10 out[12]: 0 -9.823127e+08 1 -8.069270e+08 2 -6.030317e+08 3 -5.709379e+08 4 -5.224355e+08 5 -4.755464e+08 6 -4.095561e+08 7 -3.989287e+08 8 -3.885740e+08 9 -3.691114e+08 name: amount, dtype: float64 top10 out[13]: 0 9.360520e+08 1 9.078776e+08 2 6.603838e+08 3 4.967611e+08 4 4.409362e+08 5 3.914972e+08 6 3.547471e+08 7 3.538894e+08 8 3.368558e+08 9 3.189895e+08 name: amount, dtype: float64 top10.barh(top10.index,top10.amount,color='red',align='edge') bottom10.barh(bottom10.index,bottom10.amount,color='green',align='edge') now shows this, not want: . what right way plot? you can creating twiny axes, , plotting bottom10 dataframe on there. for example: import matplotlib.pyplot plt import pandas pd import numpy np # random data bottom10 = pd

Simple matrix calculation in Scala -

suppose i've got matrix of integers a , need create new matrix b b[i, j] sum of a[i, j] , neighbors. i define matrix array[array[int]] , write function foo calculate b this: type matrix = array[array[int]] def sumofneighbors(a: matrix, x: int, y: int): int = { val range = -1 1 val deltas = range.flatmap { dx => range map {dy => (dx, dy)} } .filter { case (dx, dy) => dx != 0 || dy != 0 } val withinbounds: int => boolean = x => x >= 0 && x < a.size val coords = deltas.map {case (dx, dy) => (x + dx, y + dy)} .filter {case (i, j) => withinbounds(i) && withinbounds(j)} coords.map{case (i, j) => a(i)(j)}.sum } def foo(a: matrix): matrix = a.zipwithindex map {case (row, i) => row.zipwithindex.map {case (x, j) => x + sumofneighbors(a, i, j)} } does make sense ? how simplify code ? your code make sense, there couple tools add make expandable, depen

c# - Azure Redis Cache max connections reached -

i using azure redis cache storing quick lookup data , cache read/connected 10 client applications. applications written in .net 4.6, , includes asp.net mvc web application, web api , few worker roles run in every 1 second. clients using stackexchange.redis connecting cache. however, intermittent timeouts , have observed in azure portal, max connections has reached 1000 (for pricing tier). since have 10 client applications , none of these multithreaded, create 1000 connections cache? are there best practices available can follow cache clients? this similar question: why connections azure redis cache high? here best practices recommend customers: set abortconnect false in connection string create singleton connectionmultiplexer , reuse it. sufficient scenarios. advanced scenarios may require creating multiple connectionmultiplexer objects per application, fine one. recommend following coding pattern shown here: https://azure.microsoft.com/en-us/documentation/art

Java 8 stream - cast list items to typ of subclass -

this question has answer here: java 8 stream - check if instanceof 3 answers i have list of schedulecontainer types , ins stream each element should casted type scheduleintervalcontainer . there way of doing this? final list<schedulecontainer> scheduleintervalcontainersreducedofsametimes final list<list<schedulecontainer>> scheduleintervalcontainerofcurrentday = new arraylist<>( scheduleintervalcontainersreducedofsametimes.stream() .sorted(comparator.comparing(scheduleintervalcontainer::getstartdate).reversed()) .filter(s -> s.getstartdate().withtimeatstartofday().isequal(today.withtimeatstartofday())).collect(collectors .groupingby(scheduleintervalcontainer::getstartdate, linkedhashmap::new, collectors.<schedulecontainer> tolist())) .values()); it's possible

replication - MySQL slave not using relay logs -

i have slave using tokudb tables, replicating master using innodb tables. master part of pxc, , slave, tokudb tables, uses regular percona server (not xtradb). when run replication multiple applications connecting master, seems slave server not using relay_log , hence causing replication issues show below: 2016-02-25 16:42:04 9604 [warning] neither --relay-log nor --relay-log-index used; replication may break when mysql server acts slave , has hostname changed!! please use '--relay-log=db-kdb-slave-6-relay-bin' avoid problem. 2016-02-25 16:42:05 9604 [warning] recovery master pos 552554502 , file mysqld-bin.001163. previous relay log pos , relay log file had been set 552554714, ./db-kdb-slave-6-relay-bin.002933 respectively. 2016-02-25 16:42:05 9604 [warning] storing mysql user name or password information in master info repository not secure , therefore not recommended. please consider using user , password connection options start slave; see 'start slave syntax