Posts

Showing posts from January, 2013

video - Sorting Youtube API result from playlist -

i have been struggling youtube's api v3 , can't work in way want. goal load latest videos selected playlist website. problem the oldest videos in response. to load playlist request following api uri: https://www.googleapis.com/youtube/v3/playlistitems here example of request (just click execute): http://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlistitems.list?part=id%252csnippet%252ccontentdetails%252cstatus&playlistid=plou2xlyxmsikgo-dgliijqnz6l3g8uv4b&_h=1& how can sort result , latest videos first? can't find in docs , have been googling without luck. there no point api if can't sort result. way load videos keep loading next page token insane. any idea? sounds basic problem can't find solution... the current api doesn't have sorting option listing playlist items, if inserting items programmatically, can specify position value when inserting make new videos appear @ top of list. if it's else adding vi

AngularJS animate data bind and change with timer -

i make animation data binding, when change. i make javascript , ng-repeat , ng-class , addclass, removeclass images, want make tittle. this working ng-repeat, ng-class: <div id="product-images" ng-repeat="img in producto.imagenes"> <img ng-src="{{img.url}}" ng-class="{active: mainimageurl==img.url}" class="producto img-responsive"> </div> in controller have $timeout change mainimageurl , have animation() return function addclass: , removeclass: (this working fine). what directive recomend me same tittle or paragraph? can not find how this. my miniproject in angular 1.2 thanks in advanced.

c# - Sqlite DB querying takes a long time WP8 -

i building windows phone 8 app using sqlite.net using link reference:- http://developer.nokia.com/community/wiki/how_to_use_sqlite_in_windows_phone there database in project being seeded in isolated storage. database contains 1 table has 26k entries. i trying connect database in mainpage.xaml.cs follows:- protected override void onnavigatedto(system.windows.navigation.navigationeventargs e) { base.onnavigatedto(e); using (sqliteconnection db = new sqliteconnection(app._dbpath)) { db.gettableinfo("iwmcemeteries"); try { list<iwmcemeteries> cemeterieslist = db.table<iwmcemeteries>().tolist<iwmcemeteries>(); messagebox.show("number of elements in table " + cemeterieslist.count); } catch (exception ex) { debug.writeline(ex.message); } } } the problem takes long(over 25 seconds) message dialog show up. i tried alternate method run

javascript - Cached Messages showing in wrong order SignalR -

im using signalr create reporting system. used started project had develop suit needs. system should display messages have been wrote other users when new user logs in , showing in muddled order , 1 section of message( goal) undefined. wondering how fix message should show. should this: chelsea vs arsenal (3) - (0): bla bla bla but shows this: bla bla blachelsea vs arsenal: undefined code follows: server side: public void sendmessagetoall(string goal, string username, string message) { // store last 100 messages in cache addmessageincache(goal, username, message); // broad cast message clients.all.messagereceived(goal, username, message); } } javascript function registerclientmethods(chathub) { // calls when user logged in chathub.client.onconnected = function (id, teamnames, allusers, updates) { $('#hdid').val(id); $('#hdusername').val(teamnames);

java - how to recompile the 3rd party jars using lower version -

i stuck issue because of lower version of java. using eclipse, set compiler level 1.5 version , using jars ojdbc.jar jxl.jar but throwing following error. suspecting jars compiled higher version may thats reason error. java.lang.unsupportedclassversionerror: bad version number in .class file @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(unknown source) @ java.security.secureclassloader.defineclass(unknown source) @ java.net.urlclassloader.defineclass(unknown source) @ java.net.urlclassloader.access$100(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ java.lang.classloader.loadclassinternal(unknown s

ruby on rails - How to check rspec code coverage -

i'm working on first simple rails app. , did homework should before else - rspec tests. delayed in purpose because of no experience wasn't sure , how rspec tests. have tests models , controllers , it's time me think how tests covers code. then found rake stats , shows me that: +----------------------+-------+-------+---------+---------+-----+-------+ | name | lines | loc | classes | methods | m/c | loc/m | +----------------------+-------+-------+---------+---------+-----+-------+ | controllers | 214 | 161 | 4 | 29 | 7 | 3 | | helpers | 12 | 12 | 0 | 1 | 0 | 10 | | models | 17 | 13 | 2 | 0 | 0 | 0 | | mailers | 0 | 0 | 0 | 0 | 0 | 0 | | javascripts | 29 | 3 | 0 | 1 | 0 | 1 | | libraries | 0 | 0 | 0 | 0 | 0 | 0 | | helper specs |

c# - Sizing code in a form resize event does not work -

i have problem sizing form in form size event. trying avoid situation form goes off screen when user un-maximises form , form cannot resized (as corner off screen). although can't seem reproduce situation. anyway came code out of situation should ever occur again. problem form height not set when form un-maximized, although the code in if statement reached. 1 time when running application top , left properties got corrupted , both became -32000. again came code prevent causing problem. here code, note width fixed: public partial class mainform : form { rectangle sr; formwindowstate wp; public mainform() { sr = system.windows.forms.screen.primaryscreen.bounds; maximumsize = new size(width, sr.height); wp = windowstate; } private void mainform_activated(object sender, eventargs e) // positions form { top = properties.settings.default.top; if ((top > sr.height - 80) || (top < 0))

jquery mobile - How to check if jQM popup fits user's viewport? -

so i've managed add scrollbars large jqm popups css('overflow-y', 'scroll') . how only when popup larger user's viewport? i'm trying jquery-visible plugin can't respond: http://jsfiddle.net/mmrnq/124/ $('#test-button').on('click', function(e) { $('#confirmdialog').popup('open'); // https://stackoverflow.com/questions/20791374/jquery-check-if-element-is-visible-in-viewport if(!$('#confirmdialog').visible(true)) { alert('popup not visible - add overflow scrolling'); $('#confirmdialog').css('overflow-y', 'scroll'); } }); you can use overflow-y: auto this makes scrollbar visible when needed. updated fiddle update: you can make content of popup scrollable titlebar remains in view: #confirmdialog .ui-content { overflow-y: auto; } $('#confirmdialog').on({ popupbeforeposition: function() { var maxheight = $

javascript - jQuery and live webcam video streaming -

i'm trying build application people can have own rooms , stream video webcam, other people can see them. trying approach red5, can't integrate php i'm trying jquery now. far i've tried 3 plugins: http://www.scriptcam.com/docs.cfm , it's closest want ( has one-to-many videochat ) can have 5 viewers. http://jqueryvideo-player.com said has option stream video webcam haven't found on docs. https://github.com/infusion/jquery-webcam can't find way allow many people see webcam view. and know there's lot more, neither of them allow broadcasting. there way jquery? edit: trying html5 ( http://www.html5rocks.com/en/tutorials/getusermedia/intro/ example ) error "getusermedia() not supported on browser". i've tried on opera 18.0 , on chrome 32.0.1700.102 m don't know why doesn't work. using getusermedia() api native alternative assuming browsers targeting support it. here: http://caniuse.com/#feat=stream . might want g

Rails partial dates -

my table has release_date column saves in format 2002-02-01 in model have validates_date :release_date, :allow_blank => true in new view have following <%= f.label :release_date, class: "control-label" %> <%= f.date_select :release_date, :start_year => date.current.year, :end_year => 1970, :include_blank => true %> with gives 3 separate drop downs selecting date. what want partial date selectable when user knows year, or month , year. thought might work appropriate allow_blank tags in doesn't if select , month , year leave day blank doesn't save date db @ all. how can allow partial dates? preferably saving same format used existing data isn't invalid. in show view call release_date this <%= @miniature.release_date.strftime("%d %b %y") unless @miniature.release_date.blank? %> i able display whole date when available , if not have appear feb 2002 or 2002 where that

wordpress - Change WooCommerce Product-Page Layout -

i'm trying customize woocommerce product-page design. i using woocommerce.php page , use <?php woocommerce_content(); ?> provide content on there. so want customize layout of <?php woocommerce_content(); ?> base of design. how change or customize that? how access <?php woocommerce_content(); ?> layout? thanks the page design can edited in wc-template-functions.php page. can found in woocommerce/includes folder.

c - Display string with newline characters in GtkTextView -

i used code display string gtktextview object: btsel(database, word, meaning, 50000, &rsize); //b-tree gtk_text_buffer_set_text(buffer, meaning, -1); problem showed entire string without parsing newline characters, result ended this: nguyễn\nanh\ntuấn at first thought prolem use of unicode characters, tried using following code test if true: strcpy(buffer, "nguyễn\nanh\ntuấn"); gtk_text_buffer_set_text(buffer, meaning, -1); and time result was: nguyễn anh tuấn after hours searching google in vain, ended here. pls me, , thank in advance (^^ my bad english.

java - Steps to resolve the imports in eclipse? -

firstly, have seen several question related issue seems questions might steps ahead of understanding. i new java , consider myself self learning beginner. face problem import . need because import linked use of nice , powerful function(s), fail if import not work , end not using that. the message is, e.g. "the import com.google can not resolved". i have been using eclipse in ubuntu. after trying of given solutions without being able view them in proper context, have messed eclipse environment , trouble still there. can kindly show me complete steps of doing these imports in eclipse java? for using 3rd party jars need add jars in build path. follow following step right click project click build path click libraries tab then add external jar now give path of jar location

minify - Javascript Closure Compiler Error Trailing Comma? -

when minifying javascript in handy tool google called closure compiler gives following error (and doesn't minify thing): number of errors: 1 jsc_trailing_comma: parse error. ie8 (and below) parse trailing commas in array , object literals incorrectly. if targeting newer versions of js, set appropriate language_in option. @ line 389 character 1 in all.js theme : 'default', // theme of slider (default, theme1, theme2, t... where fault , needs changed fix error? $(window).load(function(){ jquery('#slider1').autoslider({ theme : 'default', // theme of slider (default, theme1, theme2, theme3) width : '960', // width of slider, 100% auto full width, set 0 take width of largest image autohideplaybtn : true, // the fault (for fear of rewording closure compiler error says) ie8 , below cannot parse object literals , array literals have trailing comma. var obj = { a: 1,

php - wp_session variables being overwritten by $_POST -

i trying post form $wp_session working fine - when perform again overwrites array have put there in first place, need arrays carry on building collection / shopping basket. my form: <form class="form1" method="post" action="" id="form1"> <fieldset> <ul> <label for="name">exercise id</label><span> <input type="text" name="exerciseid" placeholder="exercise id" class="required" role="input" aria-required="true"/></span> <label for="name">exercise reps</label><span> <input type="text" name="sets" placeholder="sets" class="required" role="input" aria-required="true"/></span> <label for="name">exercise reps</label><span> <input type="text" n

html - Upload form works/doesn't work depend on? -

Image
i have unusual occurence. i have form this: <input type="file" name="public[]" multiple="multiple" /> in computer (win7, firefox) works fine, can upload muliple images pressing ctrl , select photos. customer told me can select 1 photo. has win7 , winxp. depend on browser? i have mozilla/5.0 this browser version issue, not support multiple tag. here post talking this

console - Bukkit How do I get a argument from a string? -

i'm trying make plugin detects when people chat "#say " broadcast message arguments. need know how arguments string. please help. main: package com.gong.say; import org.bukkit.bukkit; import org.bukkit.chatcolor; import org.bukkit.plugin.java.javaplugin; public class main extends javaplugin{ string saymessage = chatcolor.green + "your message has been said!"; public void onenable() { bukkit.getlogger().info("[bukkitapienhancer] plugin started!"); bukkit.getpluginmanager().registerevents(new chatlistener(this), this); } public void ondisable() { bukkit.getlogger().info("[bukkitapienhancer] plugin disabled!"); } } chatlistener: package com.gong.say; import org.bukkit.event.eventhandler; import org.bukkit.event.listener; import org.bukkit.event.player.asyncplayerchatevent; public class chatlistener implements listener { main plugin; public chatlistener(main plugin) {

Google PHP Client API: Insufficient Permission -

i have php code use google php client api use drive service. <?php require_once 'google/client.php'; require_once 'google/service/drive.php'; const client_id = '[myclientid]'; const service_account_name = '[myserviceaccounid]'; // make sure keep key.p12 file in secure location, , isn't // readable others. const key_file = './[myprivatekey].p12'; // load key in pkcs 12 format (you need download // google api console when service account created. $client = new google_client(); $client->setapplicationname("google drive sample"); $key = file_get_contents(key_file); $client->setclientid(client_id); $client->setassertioncredentials(new google_auth_assertioncredentials( service_account_name, array('https://www.googleapis.com/auth/drive'), $key) ); $client->setclientid(client_id); if ($client->getauth()->isaccesstokenexpired()) { $client->getauth()->refreshtokenwithassertion(); } // js

c - How do I dynamically allocate memory for the field of a struct? -

i have hash structure: typedef struct _td_ { int size; /* size of v */ alg v; /* table elements */ } td; and list structure: typedef struct cellista{ void *info; struct cellista *next; } tcelulag, *tlg, **alg; and structure info points: typedef struct cuv{ int frecv; char *s; }word; somewhere inside program want allocate memory char *s this: tlg aux; … ((word*)(aux->info))->s=strdup(str); and gives me warning " assigment makes pointer integer without cast ...why? you calling malloc() , you've not declared malloc() including <stdlib.h> . default, functions assumed return int you're supposed declare function before using it. because have not included <stdlib.h> , assigning int char * pointer. hence warning "assigment makes pointer integer without cast".

php - CodeIgniter base_url() not working in 000webhost.com -

i've uploaded web project using php codeigniter in 000webhost.com , works fine. but there problem though. function base_url() not working. why? you need load url helper in controller $this->load->helper('url') another better way autoload helper. edit config/autoload.php .

objective c - iOS - pop a view controller by panning on the left edge, navigation bar disappears -

so ios 7 introduced new feature can pop view controller panning on left edge. here problem: have 2 view controllers, , b, connected push segue. both of controllers have navigation bars (by embedding in navigation controller). navigation bar in b hidden once user enters b's scene, , can shown if user taps on scene. if user pans on left edge of b while navigation bar hidden, navigation bar in hidden well, means there no way user return further a. there way enforce show navigation bar regardless of b has hidden bar or not? or there easy way prevent pan gesture taking effect? read this post suggested way of preventing pan, can't locate property in storyboard. edit: disabled interactive pop gesture recognizer solved half of problem. other half if click button on child view controller navigation bar when navigation bar disappearing, navigated parent view controller without navigation bar. tried calling [self.navigationcontroller setnavigationbarhidden:no] in viewwillappear

php - How to add wordpress widget widget to static Sidebar via code? -

i'm making wordpress site, , have static sidebar, , wondering how add plugin widget said sidebar. here sidebar code: <div id="sidebar"> <div class="sidebar-entry sidebar-both"> <ul> <?php the_widget( 'wp_widget_search' ); ?> </ul> </div> <div class="sidebar-entry sidebar-left"> <h2> <?php _e('categoies'); ?></h2> <ul> <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?> </ul> </div> <div class="sidebar-entry sidebar-right"> <h2> <?php _e('archives'); ?></h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> </div> <div class="sidebar-entry sidebar-right"> <ul>

ruby on rails - making two routes on page -

i working on web app. have 2 languages on it. i have default root page, root :to => "home#index" on english (e.g www.test.com/en/home). now, after clicking on other language on page, example russian, switch page www.test.com/en/home www.test.com/ru/home load different page on language selected , automatically become home page. first idea create controller this, since rails knowlege on lower level, assume thats not do. any suggestions? -michael i excepted want multi language app, routes.rb may bellow: # config/routes.rb scope ':locale' root :to => "home#index" end better informations can find on 2.5 setting locale url

java file int array read -

i want array of integers file .but when array unwanted zeros in array size 10 , there 5 integers in file(18,12,14,15,16). how remove zeros. code is: import java.io.file; import java.io.ioexception; import java.util.arrays; import java.util.scanner; public class txtfile { public static void main(string[] args) { // todo auto-generated method stub file infile=new file("h:\\documents\\javaeclipseworkplace\\readtextfile\\src\\txt.txt"); scanner in=null; int []contents = new int[10]; int i=0; try { in=new scanner(infile); while(in.hasnextint()){ contents[i++]=in.nextint(); } system.out.println(arrays.tostring(contents)); } catch(ioexception e){ e.printstacktrace(); } finally{ in.close(); } } } output is: [18, 12, 14, 15, 16, 0, 0, 0, 0, 0]. this because allocate array of size 10, , values initialized 0 default. read 5 values file, , overwrites first 5

javascript - jQuery only ignoring a click trigger during a trigger chain. -

i have following code: $( "#check-button" ).on( "click", function() { $("#button_cart").click(); $('.checkout-button').click(); }); i have jquery click event. want , on clicking check-button, first line inside function updating cart ( reloads page) , second line inside function checkout button, takes me next(checkout) page. but here first event firing. because page reloaded on "button-cart" clicking? how solve it? that's correct. second click working in kind of limbo between click , load , wont see it. the solution "handle" reload event, put between "" because event can't handled ( far know) can make hacks. first, why reloading page? adding new content? in case call click in content added load handler $(document).ready();

javascript - How to add an element to the jquery.shapeshift grid -

i want append , element grid created jquery.shapeshift. documentation says trigger rearrange once element added. i've tried nothing. doing wrong? see example http://jsfiddle.net/lnysc/1307/ $(".container").shapeshift({ mincolumns: 3 }); $("a").click(function(){ $(".container").append("<div></div>"); $(".container").trigger("ss-event-arrange"); }); many thanks the div added way not recognized container child yet should tell container div added child treated so. know there should way it, try reshapeing container calling $(".container").shapeshift() again, example: $(".container").shapeshift({ mincolumns: 3 }); $("a").click(function(){ $(".container").append("<div></div>"); $(".container").shapeshift(); }); here example: http://jsfiddle.net/lnysc/1501/

google chrome app - Delete Javascript blobs? -

i'm having heck of time getting rid of these stupid things. i've got couple of chrome apps deal lots of media files; 1 of them able use bunch of "delete"s , window.url.revokeobjecturl stopped them building in chrome://blob-internals/ , other one, nothing seems help. missing something? know when i'm done damn thing, there seems nothing can do. specifically, i'm using file object in block this: ref.file(function(f) { // stuff... // , i'm done! delete f }); here's actual source of app: https://github.com/pkulak/photo-importer and here's 1 think solved problem, knows: https://github.com/pkulak/drive-slideshow this looks have memory leak. javascript doesn't have "delete" in sense you're talking about, garbage collects properties , variables become orphaned. delete operator 1 such way achieve - removes definition of property object . using delete correctly means using on property, not var iabl

javascript - AngularJS Routing not doing anything not working -

i have following phonecat tutorial combined angular seed project. come problem, can't routing work / load, no errors occur , seems fine. can't seem get, basic redirect work. i'm lost do. here app.js think error is 'use strict'; var elgrossisten = angular.module('elgrossisten', [ 'ngroute', 'elgrossistencontrollers' ]); elgrossisten.config(['$routeprovider', function($routeprovider) { $routeprovider. when('/search', { templateurl: 'partials/elnrlist.html', controller: 'searchelnrctrl' }). otherwise({ redirectto: '/search' }); }]); controller var elgrossistencontrollers = angular.module('elgrossisten', []); elgrossistencontrollers.controller('searchelnrctrl', function ($scope) { $scope.elnrs = [ {'elnr': '10150135', 'avgprice': '18.75', 'lastupdated': '01-

dictionary - Python script to use coordinates from one file and add values from matching coordinates in another file -

i have original set of genomic coordinates (chrom, start, end) in tab delimited bed file. have additional tab delimited bed files contain of original genomic coordinates plus numerical value associated each of these coordinates. these coordinates can show multiple times in bed file different numerical value each time. need final bed file contains each of original genomic coordinates summed number of values found associated specific coordinate. examples of files i'm working below. original file: chr1 2100 2300 chr2 3300 3600 chr1 2560 2800 other bed file: chr1 2100 2300 6 chr2 3300 3600 56 chr1 2100 2300 10 needed output file: chr1 2100 2300 16 chr2 3300 3600 56 chr1 2560 2800 0 i need write python script this, i'm not sure best way is. def fetch_data(filename1, filename2): lines = [] data = {} open (filename1) f: lines = f.readlines() line in lines:

Error message: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 -

i in first class of java programming , 1 of assignments given create value string displays in reverse order separated commas. know missing simple, after hours of trying don't know going wrong? my code works, keep getting error message: exception in thread "main" java.lang.arrayindexoutofboundsexception: -1 @ ip2_jolley.ip2_jolley.main(ip2_jolley.java:148) three, two, 1 java result: 1 this code using: string[] f = {"one", "two", "three"}; if (f.length > 0) system.out.print (f[2]); (int = 1; < f.length; i--){ system.out.print(", " + f[i]); } you start loop int = 1 , reduce 1 every loop result in being lower 0. instead of using int = 1 , want use int = f.length edit what wanted this: string[] f = {"one", "two", "three","four","five"}; //start @ f.length - 1, continue until there no item left (int = f.length-1; >= 0; i--){

javascript - Copy to clipboard in bootstrap 3 -

i want add "copy clipboard" button on website. site uses bootstrap 3 framework. want button work "copy clipboard" button used here: http://twitterbootstrapbuttons.w3masters.nl/ i tried incorporate code: http://jsfiddle.net/t2uxr/ , have had no success it. javascript: $("a.copy").on('click', function (e) { e.preventdefault(); }).each(function () { $(this).zclip({ path: 'http://www.steamdev.com/zclip/js/zeroclipboard.swf', copy: function() { return $(this).data('copy'); } }); }); css: body { padding: 20px } html <hr /> <h5>these copy clipboard links working...</h5> <p><a href="#" data-copy="http://test.one.com/" class="copy">copy original link</a></p> <p><a href="#" data-copy="http://test.two.com/" class="copy">copy medium link</a></p> <p><a href="#&

oracle - SQL Package Syntax Error -

i having problem locating error on tapi built "project table". syntax error because not compile, posted code , errors below... if lead me in right direction appreciated. code create or replace package body "project_tapi" -------------------------------------------------------------- -- create procedure table "project" procedure "ins_project" ( "p_startdate" in date default null, "p_projid" in number, "p_empno" in number default null, "p_projname" in varchar2 default null ) begin insert "project" ( "startdate", "projid", "empno", "projname" ) values ( "p_startdate", "p_projid", "p_empno", "p_projname" ); end "ins_project"; -------------------------------------------------------------- -- update procedu

html - Use jquery to make chat boxes float like facebook -

i'm trying make chat script facebook, problem when delete chat box , there place left empty, want example have 3 chat boxes , when delete first 1 want second 1 replace first 1 , third 1 replace second 1 , on. how create chat boxes: function createchatbox(chatboxtitle,minimizechatbox) { if ($("#chatbox_"+chatboxtitle).length > 0) { if ($("#chatbox_"+chatboxtitle).css('display') == 'none') { $("#chatbox_"+chatboxtitle).css('display','block'); restructurechatboxes(); } $("#chatbox_"+chatboxtitle+" .chatboxtextarea").focus(); return; } $(" <div />" ).attr("id","chatbox_"+chatboxtitle) .addclass("chatbox") .html('<div class="chatboxhead" onclick="javascript:togglechatboxgrowth(\''+chatboxtitle+'\')"><div class="chatboxtitl

matlab - Seperable convolution using 1D FFT vs 2D FFT -

i trying use matlab convolve image gaussian filter using 2 methods: separable convolution using 1d fft , non-separable convolution using 2d fft. i'm expecting separable convolution faster. however, not small images, larger ones 2d faster. i'm not sure if it's problem implementation or if it's because don't have concept quite right. here code: img1 = randi([1,256],128,128); % create gaassian filter rf1 = fspecial('gaussian', [1 128], 1.0); cf1 = transpose(rf1); gf1 = cf1 * rf1; rc1 = round(conv2(img1, gf1, 'same')); rc1 = fft2dconv(img1, gf1); rc2 = fft1dconv(img1, rf1, cf1); function o = fft1dconv(img, rowf, colf) % zero-pad imgsize = size(img); rsize = size(rowf); csize = size(colf); img = padarray(img, [imgsize(1)/2, imgsize(2)/2]); rowf = padarray(rowf, [2*imgsize(1)-rsize(1), 2*imgsize(2)-rsize(2)], 'post'); colf = padarray(colf, [2*imgsize(1)-csize(1), 2*imgsize(2)-csize(2)], 'post'); % seperable convolu

javascript - is document.getElementsByClassName faster than looping through the nodes? -

i working on script chrome extension have check if items exist in division. , standing before dilemma having. let's first want check classnames, tags data-ng attributes , img nested directly in tag. either using: var first = node.getelementsbyclassname('classnameofinterest'); var second = new array(); var temp = node.getelementsbytagname('a'); for(var = 0 ; < temp.length ; a++){ if(temp[a].hasattribute('data-ng')){ second.push(temp[a]); } }temp = false; var third = new array(); temp = node.getelementsbytagname('img'); for(var = 0 ; < temp.length ; a++){ if(temp[a].parentnode.nodename == 'a'){ third.push(temp[a]); } }temp = false; or going through elements of possible interest, , check them 3 conditions right away, this: var nodes = node.getelementsbytagname("*"); var first = new array(); var second = first; var third = first; for(var = 0 ; < nodes.length ; a++){ if(nodes[

Why this quicksort code doesnot work... (c) -

#include <stdio.h> #include <stdlib.h> void quick(int *a,int left,int right,int k); void print(int *a); void swap(int *a,int x,int y); int indexpivot,n,tmp; int main() { int i,a[50],k; printf("\n\n\n size??\t\t"); scanf("%d",&n); for(i=0;i<n;i++){ printf(" %d. element...\t",i+1); scanf("%d",&a[i]); } printf("\n 1 or 2 ");//another method 1 important now,not 2 scanf("%d",&k); printf("\n first appearance "); print(a); quick(a,0,n-1,k); printf(" \nmedium element: %d\n ",a[(n)/2]); print(a); } //always putting first pivot void quick(int *a,int left,int right,int k){//k method,not used here int pivot,i,j; if(k==1){ indexpivot=left; pivot=a[indexpivot]; } /*else{

Three.js Transparency Errors With Multiple Particle Systems Sorting -

Image
i have 2 three.particlesystem systems particles have textures alpha transparency, 1 using additiveblending (fire texture), other uses normalblending (smoke texture) , use simple custom vertex , fragment shaders. each particlesystem has "sortparticles = true" , independently work perfectly, when both types of particles overlap first particle system (fire texture) has similar transparency depth error associated "sortparticles = false" (see image). it seems first particle system not rendering properly, because particles being drawn before others when particles other system behind them, resulting in transparency artifacts. perhaps 1 possible solution sortparticles somehow sort both systems. possibility? there "global particle sort flag" of sort or way force sortparticles span both systems? another more involved solution use single sorted particlesystem somehow vary both texture , blending mode per-particle. possible? have clue of how done in shad

javascript - Youtube Player API Difference (Chromeless vs IFrame) - Which is better? -

so have scoured web on information on how embed youtube players actual detailed tutorials seem extremely sparse or non existent. in addition, although there documentation found on google site seems confusing novice on how implement either leads me question. seems there 2 players, iframe player , chromeless player uses swf embed. have gone ahead , provided examples of both: iframe player (using angular): http://plnkr.co/edit/h5vnlphoaa2n6zsfsj5p?p=preview chromeless player : http://plnkr.co/edit/epz9uxdz1uiiv4lgb0vw?p=preview my question is, difference? advantage of using 1 on other? 1 have more backwards compatibility browsers? mobile support? chromeless player seems require less code run of code runs out of box included "swfobject.js".in addition seems chromeless player not work on ios devices due flash requirement. correct? addendum : can see iframe , chromeless player same besides fact can click on iframe youtube player pause while chromeless player can contr

Is it possible to use function in MongoDB $where clause? -

i need find out if possible use function in $where clause string this: db.mycollection.find( "this.name == 'xyz' || function() {return 1>0;} || this.name == 'abc'" ); thanks in advance. i'm not quite sure you're trying do, put checks in single function that's value of $where : db.mycollection.find({$where: function() { return this.name == 'xyz' || 1>0 || this.name == 'abc'; }});

javascript - crypto-js throws compile error in Unity -

i working on app stores user passwords in plain-text. after bit of research, decided opt sha3 crypto-js library accomplish task. downloaded sha3 rollup , placed (unmodified) in same folder scripts intended use in. unity, however, throws compile error: assets/scripts/startmenu/sha3.js(7,46): bce0043: unexpected token: ,. googling error yields various issues syntacticly incorrect code. research led me believe crypto-js go-to implementation js, doubt there's issue library. unity differ greater in it's js implementation? missing? unity not using javascript, unityscript. unityscript , javascript different languages; it's marketing move call "javascript" in unity. of differences can found here , here . if advice switch on c#.

vb.net - How to handle second condition in If Else statement -

how handle second condition in if else statement, if statement working second condition not working(elseif), there wrong condition declaration? try if val(textbox7.text.trim.split(".")(1)) >= 60 textbox7.text = val(textbox7.text.trim.split(".")(0)) + 1 & "." & val(textbox7.text.trim.split(".")(1) - 60) & " " & format(now, "mm/dd/yyyy") textbox3.text = val(textbox3.text.trim.split(".")(0)) & "." & val(textbox3.text.trim.split(".")(1) - 60) & " " & format(now, "mm/dd/yyyy") elseif val(textbox7.text.trim.split(".")(1)) >= 100 textbox7.text = val(textbox7.text.trim.split(".")(0)) - 1 & "." & val(textbox7.text.trim.split(".")(1) - 45) & " " & format(now, "mm/dd/yyyy") textbox

Restrict access to admin menu pages in wordpress -

i trying find way limit access admin menu pages specific admins. far have managed hide pages admins not primary admin if enter url page,they directed page. add_action( 'admin_init', 'my_remove_menu_pages'); function my_remove_menu_pages() { global $user_id; if ( current_user_can( 'administrator' ) && $user_id !== 1 ) { remove_menu_page( 'admin.php?page=settings' ); remove_menu_page( 'plugins.php' ); //remove_menu_page( 'authorhreview' ); } } i have been doing lot of reading can't seem come solution. awesome.thanks in advance. do not pass role name current_user_can(), not guaranteed work correctly.. see : https://core.trac.wordpress.org/ticket/22624 function appthemes_check_user_role( $role, $user_id = null ) { if ( is_numeric( $user_id ) ) $user = get_userdata( $user_id ); else $user = wp_get_current_user(); if ( empty( $user ) ) return false; return in_array( $role, (array)

Android SQLite Exception no such column while inserting -

i'm having problem inserting values table. did 2 tables same principle third 1 causing troubles :/ episode class public episodes (int eid,int seasonid,string episode,string date,string comment, float rating ) { this.episodeid = eid; this.seasonid = seasonid; this.episode = episode; this.date = date; this.comment = comment; this.rating = rating; } episodes e1 = new episodes(01, 01, "e1", "2012-01-12", "randomcomment01", 5); dbmanager.addepisode(e1); my dbdesigner class public class dbdesigner extends sqliteopenhelper { private static final string database_name = "seriesimdb.db"; public static final string table_series = "table_series"; public static final string column_id = "id"; public static final string column_name = "name"; public static final string column_genre = "genre"; public static final string column_rating = "rating"; public static f

jquery - Div inside custom scrollbar content does not work properply -

i inserted div (.test) custom scrollbar plugin. default, width , height 100%. html <div class="container default-skin"> <div class="test">asdasd</div> </div> css .container { position:absolute; width:100%; height:100%; top:0; box-sizing: border-box; overflow: hidden; } .test { float:left; width: 100%; height:1500px; background:red; } problem consists of several elements. a) .test div not working properply percentages, works pixels. b) if using position:absolute in .test div, scrollbar content disappears. c) similar problems percentages or positioning in div. my question: how can fix problems? want put .test div center of page. that, need float , margins options (they not working). also, in future use percentages, so, how can avoid problems in future? i created demo in jsfiddle. check it first, think have layout positioning issue , that's why scrollbars messed up. without knowing intrinsics of scr

wordpress - How to customize a footer on a Child Theme -

i using child-theme in wordpress. code add child theme's php or css file customize footer displays dynamic copyright date next name of website in hyperlink centered on each page. probably parent theme using has hook display copyright information. find hook , update in functions.php of child theme. furthermore, easy provide solution if have mentioned name of parent theme using.

c# - Reference point for lines in list view -

i trying show lines on canvas,those lines vary in y axis position ,so created itemscontrol , binded dictionary has y value , text display on line . my problem line getting displayed (x1,y1)(x2,y2) point reference individual item's origin want each line take y axis distance canvas origin point. <canvas margin="0,8,0,8" height="374" width="150" > <itemscontrol itemssource="{binding path=ypointsdictionary margin="0"> <itemscontrol.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <line x1="0" y1="{binding value}" x2="150" y2="{binding value}" strokethickness="2" stroke="yellow" strokedasharray="2,2" /> <label content="{binding key}" foreground="yellow" /> </stackpanel> </datatemplate>

mobile safari - Framework7 starter page "pageInit" NOT WORKING -

anyone using framework7 create mobile website? found great , tried learn myself, meet problem, after create app, want on starter page initialization , here, starter page index.html, , set data-page="index", write below: $$(document).on('pageinit', function (e) { var page = e.detail.page; // in browser console, no "index page" logged if (page.name === 'index') { console.log("index page"); }); // changed other page other index, works // browser logged "another page" if(page.name === 'login') { console.log('another page'); } }); anyone can help? thank much. i have encountered same problem before. pageinit event doesn't work initial page, pages navigate to, work index page if navigate other page , go index page. so see 2 options here: just not use pageinit event index page - make initialization once (just make sure put javascript af

java - Eclipse IDE doesn't recognize mysql driver -

this has been extremely frustrating, since i've been on forums , have followed directions, far can tell. i trying create connection local mysql database. first downloaded mysql driver http://dev.mysql.com/downloads/connector/j using platform independent tar (i'm on ubuntu). placed resultant jar new folder created project call /lib, , right-clicked , selected "add build path". shows referenced library. for code, doing typical things do: try { class.forname("com.mysql.jdbc.driver"); string db_url = "jdbc:mysql://localhost/project"; connect = drivermanager.getconnection(db_url, "user", "password"); statement = connect.createstatement(); resultset = statement.executequery("select * database.table"); while (resultset.next()) { int id = resultset.getint("id"); string name = resultset.getstring("name"); system.out.println("(id: " + id