Posts

Showing posts from March, 2013

android - Facebook notification issue -

i create application send notification login app. notifications showing in notification tab when open facebook in web browser.but notification not showing in facebook native android app install in our device. can 1 please me how resolve it? currently, apps on facebook.com can use app notifications. notifications surfaced on desktop version of facebook.com. source: https://developers.facebook.com/docs/games/notifications

java - Getting an executable jar file to run after creation from netbeans -

Image
i have few jar files included in application have added librarys in net beans these can read , used i have tried create executable file in netbeans clean , build , have necessary properties in build packaging set, when try double click jar created nothing happens. supposed run jar main class now tried go cmd terminal , there using: java -jar myapp.jar i have added 3 different jars including sqlite-jdbc3.8.7, absolutelayout, miglayout but returned was: exception in thread "main" java.lang.runtimeexception: not load sqlite jdbc driver @ myapp.database.databaseconprovider.<init>(databaseconpr ovider.java:18) @ myapp.presenter.apppresenter.<init>(apppresenter.java :32) @ myapp.main.main(main.java:17) caused by: java.lang.classnotfoundexception: org.sqlite.jdbc @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(nati

Uncaught Error: Bootstrap's JavaScript requires jQuery with requirejs -

i getting error says jquery not defined. bootstrap.js:8 uncaught error: bootstrap's javascript requires jquerybootstrap.js:8 (anonymous function) bootstrap v3.3.0 jquery javascript library v2.1.3 requirejs require.config({ shim: { 'backbone': { deps: ['underscore', 'jquery'] }, 'backbone-validation': { deps: ['backbone', 'jquery'] }, 'jquerymx': { deps: ['jquery'] }, 'bootstrap': { deps: ['jquery'] } }, paths: { 'jquery': '/public/js/lib/jquery-2.1.3', 'jquerymx': '/public/js/lib/jquerymx-3.2.custom', 'bootstrap': '/public/js/lib/bootstrap', 'handlebars': '/public/js/lib/handlebars-v2.0.0', 'underscore': '/public/js/lib/underscore', 'backbone': '/public/js/lib/backbone', 'backbone-validation': &#

python - How to timeout when I use subprocess -

this question has answer here: using module 'subprocess' timeout 25 answers i use sub.popen in python2.7 but, python3 has timeout but, python2.7 can't it. it snippet. proc = sub.popen(['some command', 'some params'], stdout=sub.pipe) try: row in proc.stdout: print row.rstrip() # process here result = str(row.rstrip()) count += 1 if count > 10: break except: print 'tcpdump error' proc.terminate() how set timeout it. based on this blog post code couple of changes can use threading.thread: from threading import thread subprocess import pipe, popen def proc_timeout(secs, *args): proc = popen(args, stderr=pipe, stdout=pipe) proc_thread = thread(target=proc.wait) proc_thread.start() proc_thread.join(secs) if proc_thread.is_alive()

Does Rethinkdb support thousands of tables? -

does rethinkdb support creating/managing thousands of tables? usecase: tenant managed tables, without preknown schema. edit for future ref: https://github.com/rethinkdb/rethinkdb/issues/1861 that should work, rethinkdb wasn't designed use case , there's per-table memory overhead of 12mb, may need lot of memory on server.

ios - To Click Button Pass Json Data To Other ViewCont``roller Tableview -

i developing ios app..click on button pass json array other uiviewcontroller tableview show data in tableview..in tableview array data pass on nsdictionary , use dictionary object. error [__nscfdictionary objectatindex:]: unrecognised selector sent instance 0x7b115560']...thanks in advance // button click bbauthordetailviewcontroller *bbauthordetail =[[uistoryboard storyboardwithname:@"main" bundle:nil]instantiateviewcontrollerwithidentifier:@"bbauthordetail"]; [bbauthordetail setselectiontype:bbselectionauthorname]; _serverobj = [[server alloc]init]; [_params setobject:_addetailsobj.authordetail forkey:@"author"]; [_serverobj bbauthornamewithparams:_params]; // bbauthordetail.data=resultsarray; //nsindexpath *indexpath = [bbauthordetail.tableview indexpathforselectedrow]; bbauthordetail.data = [resultsarray objectatindex:indexpath.row]; nslog(@"%@",resultsarray);

Hide thumbnails in jssor silder -

i using jssor slider .i have requirement, used images gallery thumbnails . when clicked on external button thumbnails should hide , image should align centre in slider , arrows should align left , right slider. if know how set slider height , width according window size please me. your slider made of 'outer container', 'slides' container , 'thumbnail navigator' container. can adjust layout dynamically. refefence: http://www.jssor.com/development/tip-arrange-layout-adjust-size.html you can scale slider while window resizes, please note jssor slider keeps aspect ratio. reference: http://www.jssor.com/development/tip-make-responsive-slider.html

mercurial - Unversion a TortoiseHg repository -

i not expert version control systems, have tortoisehg (mercurial) repository unversion (remove version control), , possibly start new version control history on afterwards. when try right-click repository in explorer window, under "tortoisehg" menu option there no option unversion or export repository. tried "forget", gives me error message describe in next paragraph. the reason want remove repository version control tortoisehg gives me error message when try refresh working folder. says: "failed refresh", , lists file "no match" message. can't commit or merge local etc. repository has been untouched half year. think might have used older version of tortoisehg on previously. if want "unversion" entire repository delete .hg directory in top level. leave files untouched, remove every trace of mercurial history. needless say, not reversible process.

magento - WYSIWYG Editor cms page media list not display -

Image
wysiwyg editor cms page media list not display image exist on media/wysiwyg/ . check flash player updated or not if not updated updated it. check files loaded browser/js.phtml , /browser/content.phtml , check permission of media folder 777

Android: How can I call a method after a view touched -

i want call method after button touched , call method after touch finished, possible? try code may you yourbutton.setontouchlistener(new ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { if(event.getaction() == motionevent.action_down){ // want return true; } return false; if(event.getaction() == motionevent.action_up){ // want return true; } return false; } });

amazon web services - How can I retrieve more than 50 Autoscaling Groups via Python Boto -

hello , in advance help... i trying use boto retrieve list of autoscaling groups in account. have 164 autoscaling groups boto script retrieving first 50 in similar fashion console. #!/usr/bin/python boto.ec2.autoscale import autoscaleconnection conn = autoscaleconnection('abcdefghijklmnopqrs', 'tuvwxyz/abcdefghijklmn') agroups = conn.get_all_groups() print agroups any ideas how can pull entire list of groups? boto not automatically handle paging of results describeautoscalinggroups api call many other calls. have handle paging yourself. import boto.ec2.autoscale c = boto.ec2.autoscale.connect_to_region('us-east-1') # or whatever region want all_groups = [] rs = c.get_all_groups() all_groups.extend(rs) while rs.next_token: rs = c.get_all_groups(next_token=rs.next_token) all_groups.extend(rs) at end of loop, all_groups should contain of autoscaling groups. can come more elegant way of doing should work , gi

CCActionCallBlock usage in Cocos2d Swift -

Image
i used below cocos2d-swift code, giving 1 error. see below image. var calbck = ccactioncallblock.actionwithblock({ self.showglasseffect() }) ccactioncallblock var seq = ccactionsequence.actions(move, delay, calbck, nil) ccactionsequence how use ccactioncallblock in cocos2d swift ? you need use: var seq = ccactionsequence.actionwitharray(arr) ccactionsequence

clone - jQuery Cloning Parent Element -

i'm wanting clone parent element. i've managed clone contents of element. $(this).parents('.row').clone(); this returns contents of .row, how may clone .row element? fiddle - give last input value what don't include you're using .html() in jsbin code, what's returning inner part of row. to "combat" this, use temporary container , .html() on container: $('<div>').append($(this).parents('.row').clone()).html(); http://jsbin.com/fesicaqotu/1/edit?js,output another, perhaps better option, use .outerhtml on dom element , forget clone altogether: self.parents('.row')[0].outerhtml; http://jsbin.com/buhekitiju/2/edit?js,output

pi - How to get the most decimal precision in C -

i calculating pi in program using indefinite series of terms. when display resulting calculation overall accuracy of pi not want. believe there problems in conversion specifications or primitive types using. here getting: pi: 3.141594 here want: pi: 3.14159265358979323846 here code pi calculation method: //global variables // variables hold number of threads , number of terms long numofthreads, numofterms; // variable store pieces of pi being calculated each thread double pitotal = 0.0; // use indefinite series of terms calulate pi void calculatepi(){ // variable store sign of each term double signofterm = 0.0; // variable to index of loop variable long k; #pragma omp parallel num_threads(numofthreads) \ default(none) reduction(+: pitotal) private(k, signofterm)\ shared(numofterms) (k = 0; k <= numofterms; k++) { if (k == 0) { signofterm = 1.0; } // sign of term else if (k % 2 == 0)

ruby - ActiveRecord in Rails 4 without environment specific databases -

i want know if there way of using activerecord without environment specific databases (development, test, production). the reason using mongodb main database (mongoid), need access external oracle database , use active record. the problem when enable active record in application.rb: require 'active_record/railtie' it tries connect development database (which won't exist). is there way around this? thanks try requiring active record, this: require "active_record" and load database.yml file manually this: activerecord::base.configurations = yaml.load_file(file.expand_path('../database.yml', __file__)) then can remove development, test , production databases database.yml .

java - FilteredRowSet is not showing results -

i working on example using filteredrowset , trying run query, filter results using predicate object. here code: import javax.sql.rowset.filteredrowset; import oracle.jdbc.rowset.oraclefilteredrowset; public class example { public static void main(string[] args) throws sqlexception, ioexception { try (filteredrowset rs = new oraclefilteredrowset();) { rs.seturl("jdbc:oracle:thin:@localhost:1521:xe"); rs.setusername("dbuser"); rs.setpassword("dbpassword"); rs.setcommand("select * employees"); rs.execute(); string name[] = {"user1", "user2"}; rs.setfilter(new userfilter("lastname", name)); while(rs.next()){ string lname= rs.getstring("lastname"); system.out.println(lname); } } } } here predicate class: import javax.sql.

java - Algorithm to truncate string and eliminate duplicates (case insensitive) -

i have set of strings meet following constraints case sensitive max character length of 10 i want convert these strings following new constraints valid (instead of previous constraints) case insensitive max character length of 5 suppose initial set of strings follows city, city, city, city, city, city, city, city, city, city, city i have partial algorithm maps these strings following cit, cit1, cit2, cit3, cit4, cit5, cit6, cit7, cit8, cit9, cit10 this done using following logic consider first string common prefix count number of matches in rest of strings (case insensitive match). in current case 10 determine number of characters required suffix. in current case since need generate suffices 1 through 10, need reserve 2 characters suffix truncate common prefix (max characters - number of characters suffix). in current case (5 - 2) i.e 3 characters generate strings concatenating truncated common prefix , suffix using above able map old set of strings

php - Insert value to URL path -

i have site content different market locations, setting cookie users location. if user tries going landing page directly insert market location url. for example, if user tries going www.mysite.com/packages update url www.mysite.com/tampa/packages i have cookie set called "market", , code trying, isn't working. <?php switch ($_cookie['market']) { case "tampa": $url = $_server['request_uri']; switch (true) { case strstr($url, 'packages'): $currenturl = str_replace('/packages','/tampa/packages/',$url); return $currenturl; break; } break; // etc other markets } is php right approach this? there better solution work? thank in advance help. you need use header() function reload webpage new url so: instead of: return $currenturl; do: header('location: '.$currenturl); be sure there's no output browser before doing though.

java - NullPointerException when calling mocked method -

i try mock final method ( readchar of class datainputstream): myclasstest @runwith(powermockrunner.class) @preparefortest(datainputstream.class) public class myclasstest { @test public void testmymethod() throws ioexception { datainputstream mockstream = powermockito.mock(datainputstream.class); mockito.when(mockstream.readchar()).thenreturn('a'); system.out.println(mockstream.readchar()); // ok (print 'a') assert.assertequals('a', myclass.mymethod(mockstream)); } } myclass public class myclass { public static char mymethod(datainputstream dis) throws ioexception { return dis.readchar(); // npe raises } } it works when calling mocked method in testmymethod() in mymethod() nullpointerexception raises, why? edit : the complete failure trace : java.lang.nullpointerexception @ java.io.datainputstream.readchar(unknown source) @ test.test.myclass.mymethod(myclass.java:8) @

html - textbox.value not working in javascript -

the following simple javascript code set value textbox. but, doesn't seem work. not able find flaw. also, javascript working in ie , not in chrome/firefox. how out of trouble? <!doctype html> <html> <head> <script type="text/javascript"> function reportvalue() { var form = document.getelementbyid("billgen"); var radioarray = form["time"]; var months; for(var i=0;i<radioarray.length;i++) { if(radioarray[i].checked) { months = radioarray[i].value; break; } } if(months == "1") { e=31*100; form["total"].value = e; //document.getelementbyid("total").value = e; => not working return true; } e

Visual Studio C Programing LNK1104 Error -

Image
follow steps opened new c project: http://www.youtube.com/watch?v=oqk0tp6mq6q first time running not error error. no application not running in background

c++ - QObject::connect: No such signal(classname)(signalname)(atribure) -

i have problem. great when compile, slots don't work. after application starts, outputs qobject::connect: no such signal cmatrix::readytodraw(ww) . tested it, slot drawfunction() doesn't work. can't debug because of segmentation fault. header.h class cmatrix:public qobject { q_object public: int **m_pmatrix; const short int m_size=4; public: cmatrix(); bool checkfields(); void setfield(); signals: void readytodraw(cmatrix *ww); public slots: void movedown(); void movetop(); void moveleft(); void moveright(); }; class mainwindow : public qwidget { q_object public: mainwindow(qwidget *parent = 0); ~mainwindow(); private slots: void drawfunction(cmatrix *a); public: qpushbutton* buttop; qlist<qlabel*> lbllist; }; main.cpp #include "header.h" #include <qapplication> int main(int argc, char *argv[]) { qapplication a(argc, argv); mainwindow w; cmatrix *ww=new cmatrix;

java - Creating files on disk from a jar -

my problem whenever run program eclipse or intellij can create many files in specific folder when create jar creates 1 file no matter how many times call method this. in detail feature of program allows user create file in folder jar executed from. done through class containing static fields , methods. fields in class are: private static stringbuilder sb = new stringbuilder(); private static formatter formatter = new formatter(sb); private static bufferedwriter bw; private static string filesfolderpath; first path jar: private static string getjarpath() throws unsupportedencodingexception { url url = printhelper.class.getprotectiondomain().getcodesource().getlocation(); string jarpath = urldecoder.decode(url.getfile(), "utf-8"); string path = new file(jarpath).getparentfile().getpath(); return path; } then set path folder want files put in , create folder through static block in class code executed once when class first used: static {

android - Compare a value with all the values in arraylist in java -

in case arraylist contains user define timings like{12:23,15:40,17:17...}. how can print message when system time equal user timings. first make array below code string s = "{12:23,15:40,17:17...}"; string newstring = s.replace("{").replace("}"); int size = stringutils.countoccurrencesof(newstring , ","); string[] arraystring = new string[size]; now compare for(int i=0; i<size; i++){ if(yoursystemtime.equals(newstring.split(",")[i])){ toast.maketext(context, "equal", toast.lenght.short).show(); } }

python - How to randomize the order of radio buttons in pyqt -

im making quiz , want radiobuttons in different positions. ive got working extent in random order in first question stay in order rest of quiz. want randomize every time. class multiplechoice(qtgui.qwidget): showtopicssignal = pyqtsignal() def __init__(self,parent=none): super(multiplechoice, self).__init__(parent) self.initui() def initui(self): self.questions=[] self.questionum = qlabel() self.questioninfo = qlabel() self.correctanswer = qradiobutton() self.incorrectans1 = qradiobutton() self.incorrectans2 = qradiobutton() self.incorrectans3 = qradiobutton() self.correctanswer.setautoexclusive(true) self.incorrectans1.setautoexclusive(true) self.incorrectans2.setautoexclusive(true) self.incorrectans3.setautoexclusive(true) layout = qvboxlayout(self) layout.addwidget(self.questionum) layout.addwidget(self.questioninfo) randomnumber = randint(0,3) if randomnumber == 0: layout.addwidget(self.correc

java - ImageView setBackround inside the activity dynamically -

inside drawabale folder have these images: levelone, leveltwo, level three. i need set imageview according inputted string follows: levelindicatorimageview = (imageview) findviewbyid(r.id.levelindicatorimageview); string tempo="r.drawable.level"+levelreached; drawable replacer = getresources().getdrawable(tempo); int sdk = android.os.build.version.sdk_int; if(sdk < android.os.build.version_codes.jelly_bean) { levelindicatorimageview.setbackgrounddrawable(replacer); } else { levelindicatorimageview.setbackground(replacer); } levelindicatorimageview.invalidate(); now inside levelreached variable have needed level (one, two, three) need set image r.drawable.leveltwo etc... how possible please? getdrawable doesn't work tempo (needs int) thanks help! you have 2 options: option 1: simply use switch-case correct drawable, set background image would // level drawable resource id int imageres = r.draw

c - Swapping within an Array of user inputs -

i here advice on how continue program. homework assignment , idea have method called int is_sorted(int array[], int length); these pre , post conditions. precondition: array array of integers of length length. postcondition: returns true if array in sorted(nondecreasing) order, or false otherwise. so far have been able put user input array , how long should be. #include <stdio.h> #include <math.h> int is_sorted(int array[], int lenght); int is_sorted(int array[], int lenght) { int swap; int smallest; int index = 0; scanf("%d", &lenght); int list[lenght]; int i; (i = 0; < lenght; i++) { scanf("%d", &list[i]); } return 0; } int main() { } how go asking user input swap 2 elements @ time within given array? the final product should similar this: sample run: user input in bold 4 <- length array should be. 1 1 1 2 <- user input these 4 numbers.

hibernate - Grails 2.5 & SpringAcl: aclCacheManager bean not accessible -

after migrating 2.4.x last 2.5.0 release, i've changed params hibernate in datasource: cache.region.factory_class = 'org.hibernate.cache.ehcache.singletonehcacheregionfactory' and config.groovy: grails.cache.enabled = true grails.cache.clearatstartup = true grails.hibernate.cache.queries = false beans.cachemanager.cachemanagername = 'springcachecachemanager' beans.cachemanager.shared = true in resources.groovy, ehcache bean set this: ehcache(ehcachefactorybean) { bean -> cachemanager = ref("springcachecachemanager") cachename = "cache" eternal = false shared = true diskpersistent = false memorystoreevictionpolicy = "lru" maxentrieslocalheap = "10000" timetoidleseconds = "120" timetoliveseconds = "120" maxentrieslocaldisk = "10000000" diskexpirythreadintervalseconds = "120" } th

sprite kit - Swift SpriteKit SKPhysicsJointPin -

i'm trying implement rope in swift spritekit , add physics it, position all, won't attach, when hit play fall except first 1 "holder". here code: // create rope holder let chainholder = skspritenode(imagenamed: "chainholder") chainholder.position.y = self.frame.maxy - chainholder.size.height chainholder.physicsbody = skphysicsbody(circleofradius: chainholder.size.width / 2) chainholder.physicsbody?.dynamic = false //chainholder.physicsbody?.allowsrotation = true chains.append(chainholder) addchild(chainholder) // add each of rope parts in 0...5 { let chainring = skspritenode(imagenamed: "chainring") let offset = chainring.size.height * cgfloat(i + 1) chainring.position = cgpointmake(chainholder.position.x, chainholder.position.y - offset) chainring.name = string(i) chainring.physicsbody = skphysicsbody(rectangleofsize: chainring.size) //chainring.phy

Matlab error in ode45 or fourth-order Runge-Kutta method to solve a system of coupled ODEs -

i beginner @ matlab programming , runge-kutta method well. i'm trying solve system of coupled odes using 4th-order runge-kutta method project work. here problem... g = 1.4; g = 1.4; k = 0; z = 0; b = 0.166667; syms n; x2 = symfun(sym('x2(n)'),[n]); x1 = symfun(sym('x1(n)'),[n]); x3 = symfun(sym('x3(n)'),[n]); x4 = symfun(sym('x4(n)'),[n]); x5 = symfun(sym('x5(n)'),[n]); k1 = [x2 * x1 *n *(1 - z * x2)*(x1 - n) - 2 * x3 * n *(1 - z * x2) - x4^2 * x2 *(1 - z * x2)- g *x3 *x2 ]./ [( g * x3 - (x1 - n)^2 * x2 *(1 - z * x2)) * n]; k2 = [x2 * (1 - z * x2)*(x1 * x2 * ( x1 - 2 *n)*( x1 - n) + 2* x3 * n + x4^2 * x2 ) ]./ [( g * x3 - (x1 - n)^2 * x2 *(1 - z * x2)) * n * (x1 - n)]; k3 = [x3 * x2 * (2 * n * x1 - n)^2 * ( 1 - z * x2) + g * x1 * (x1 - 2 *n)* (x1 - n) + x4^2 * g]./ [( g * x3 - (x1 - n)^2 * x2 *(1 - z * x2)) * n * (x1 - n)]; k4 = [x4 * ( x1 + n)] ./ [n * (x1- n)]; k5 = - [x5] ./ [n * (x1- n)]; f = @(n,x) [k1; k2; k3; k4; k5

solaris - Programatically implementing tail -f in pure C -

i'm trying implement solution in pure c monitor new entries made log file records high volume of requests web service. i tail -f, change in log file results in process getting new changes instantly. this needs run on solaris 10, unfortunately. i know question has been asked , answered in other threads , none of solutions acceptable situation 1) solution must not require super user access in way. enterprise production environment, no superuser access available me on system, can't install driver. 2) log file large. parsing entirely, repeatedly new changes not acceptable. it seems me if can run tail -f non-privileged user, should able same programmatically same user. realize nice hack pipe output tail -f process, though cleaner. this straightforward - read, , if read 0 bytes, wait specified time. illustration (open own files , improve buffer , error handling taste). have edited show error handling , seeking last lines should occur, , fixed position of sle

javascript - Confusing paths when using D3 and topojson? -

a bit of forewarning: still novice d3. right now, i'm following along mike bostock's let's make map guide, instead of uk, i'm using map of electoral districts in alberta, canada. after altering bostock's code load in own topojson alberta data, here appears . i've spent lot of time trying figure out whether i'm not spotting error in code, or if there's possibly kind of error in geodata, i've been unable narrow down problem might lie. based on other questions on here, suspicion might have projection, perhaps having difference in way bostock representing uk versus need represent alberta properly, @ loss when comes that. one thing note error pops in js console: error: invalid value <path> attribute makes me question if there's amiss in topojson data, when pull same data mapshaper, map shows without error. thus, i'm kind of stuck , unsure of how proceed. kind of help/direction appreciated, thanks! there's wrong geo

geolocation - MySQL Distance Query -

i have query tries objects around radius of 5 km. there 1 object a, gets results, if calculate distance of center , object coordinates around 10.772 km. why results? center (berlin) loc_lon: 13.406290000000013 loc_lat: 52.524268 object coordinates (data inside table "objects") long: 13.260820 lat: 52.485661 convert center coordinates radians: $loc_lon = $loc_lon / 180 * m_pi; $loc_lat = $loc_lat / 180 * m_pi; query: select id, title, loc_lat, loc_lon objects ( 6368 * sqrt(2*(1-cos(radians(loc_lat)) * cos(0.9167214137999) * (sin(radians(`loc_lon`)) * sin(0.23398390097719) + cos(radians(`loc_lon`)) * cos(0.23398390097719)) - sin(radians(loc_lat)) * sin(0.9167214137999)))) between 0 , 5

php - Parameter expected warning -

i have following warning when run code: call_user_func() expects parameter 1 valid callback, function 'db_connect' not found or invalid function name the code: require_once("mo_object.php"); class mo_model extends mo_object { private $con; static function db_query($qry) { $this->db_connect; return $qry; } function db_connect() { $con = mysqli_connect($rconf['host'],$mo_conf['usr'],$mo_conf['password'],$mo_conf['da tabase']); } } why can't run db_connect function correctly? thanks. if class , these functions both in same class, try this: static function db_query($qry) { $this->db_connect(); return $qry; } public function db_connect() { $con = mysqli_connect($rconf['host'],$mo_conf['usr'],$mo_conf['password'],$mo_conf['database']); }

wordpress - Adding custom sizes to Media Uploader to select it when inserting new image -

Image
i building custom theme , trying customize sizes list of media library,but did not work me, i`m using code in codex add_image_size( 'custom-size', 220, 180, true ); add_filter( 'image_size_names_choose', 'my_custom_sizes' ); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'custom-size' => __( 'your custom size name' ), ) ); } note: i`m using wordpress 4.1 :) the image size name doesn't match in array_merge function 'your-custom-size' => __( 'your custom size name' ), should be 'custom-size' => __( 'your custom size name' ),

android - Error with onPreferenceChange -

here file getting error getsummary() in preference cannot applied (java.lang.charsequence) on preference.getsummary(listpreference.getentries()... , error same getsummary() (java.lang.string) on else statement. public class settingsactivity extends preferenceactivity implements preference.onpreferencechangelistener{ @override public void oncreate(bundle savedinstancestate) { addpreferencesfromresource(r.xml.pref_general); bindpreferencesummarytovalue(findpreference(getstring(r.string.pref_location_key))); bindpreferencesummarytovalue(findpreference(getstring(r.string.pref_units_key))); super.oncreate(savedinstancestate); } private void bindpreferencesummarytovalue(preference preference){ //set listener watch value change preference.setonpreferencechangelistener(this); //trigger listenter preferences current value onpreferencechange(preference, preferencemanager .getdefaultsharedpreferences(preference.getcont

Error inserting chart in google sheet -

i have following code allows me create bar chart var chart = charts.newbarchart() .setdatatable(datatable) .settitle("rain per month"); sheet.insertchart(chart.build()); unfortunately, error saying "cannot find method insertchart(chart)". it seems sheet.insertchart function must take embeddedchart. how can turn chart embedded chart insertchart function take it? regards crouz the methods using adding charts uiapp . add chart google sheet use syntax: var chart = sheet.newchart() .setcharttype(charts.charttype.bar) .addrange(sheet.getrange("a1:b4")) .setposition(5, 5, 0, 0) .setoption("title", "dynamic chart") .build(); sheet.insertchart(chart); this code taken here on google app scripts documentation. also, datatable class used create charts when adding charts html or uiapp . if wanted add chart spreadsheet if user had clicked insert > chart , have use getrange draw data. if you're drawing da

python - Read in a file that has multiple grades, each separated by a comma, and prints out the computed average -

question: complete following program, reads in file has multiple grades, each separated comma, , prints out computed average. is, write functions getgrades(): , calculateaverage(): def main(): grades = getgrades() #get file name containing grades #and return contents of file avg = calculateaverage(grades) #separate grades numbers , compute #the average print("the calculated average is:", avg) main() i have inserted given function , wrote new program, little bit confused, getting error. please help! def getgrades(): filename = input("please enter file name: ") openfile = open(filename, "r") readfile = openfile.readlines() return readfile def calculateaverage(n): totalgrades = [] in (n): split = list(map(int, i.split(","))) totalgrades += split avg = sum(totalgrades)/float(len(totalgrades)) return avg def main(): grades = getgrades()

java - JavaFX Scene Graph modification for Responsiveness Indicator -

Image
it bad practice big jobs on ui thread if do, big jobs cause program hang (not accept user input or render new data) until job finished. i looking add widget our code base indicate developers when have committed taboo. idea, , 1 i've seen on number of other applications, have component moving @ constant speed, such bar twirling on screen. such tool, if developer working , accidentally more computationally difficult expected on ui thread, spinning bar become choppy, indicating him, when functional testing, needs implement mechanisms cause job executed elsewhere. one odd requirement on code should non-existent in production builds, , present in dev builds, since widget not users, developers. i jumped canvas objects , wrote quick component spins teal bar. idea if big job dumped on ui thread, bar stop spinning (since fx job queue wont continue dispatching) , bar jump forward, rather rotate smoothly (as when program @ rest). below screen-shot of first implementation: (noti

math - How to normal-scale using threejs to make objects 'thicker' or 'thinner' -

i'm trying figure out how extrude loaded .obj object make "thicker". think i'm looking way scale object not anchor point scaling each polygon normal. a classic example take "ring" object. if scale normal scale methods gets bigger center want ring become thicker/thinner. called 'normal scale' in cinema 4d. here's example code of have, , isn't giving me expected result. var objloader = new three.objloader(); var material = new three.meshlambertmaterial({color:'yellow', shading:three.flatshading}); objloader.load('objects/gun/m1911.obj', function (obj) { obj.traverse(function (child) { if (child instanceof three.mesh) { child.geometry.computevertexnormals(); child.material = material; } }); obj.material = material; obj.scale.set(7, 7, 7); scene.add(obj); }); scalegeo: function (geo, ratio) { (var = 0; < geo.faces.length; i++) { var facei = geo.face

ExtJS Form Displaying description when i chose a material from combobog -

in extjs form adding , editing data want add field not send kind of data, display user when chooses id combobox. now works fine, it's i'm playing code, , want learn new stuff. i'm getting data table has material primary key , description of key. this.brand = ext.create('ext.data.store', { fields: ['material','description'], autoload: true, proxy: { type: 'ajax', url: 'sku/load', reader: { type: 'json', root: 'data' } } }); now when i'm adding new item table , choose combobox { xtype: 'combobox', fieldlabel: 'material sku', name: 'mate_fk', store: this.brand, querymode : 'local', di

javascript - Why are there several alerts popping up at the same time? -

i'm trying make donut clicker game, supposed similar cookie clicker. when select item shop, confirm supposed pop confirm want buy item. i've made clicking easier in code below. (you might want make code full screen) question is, why confirm pop ups appear multiple times in row? in code, there one confirm when click item, don't know causes it. $(document).ready(function() { tacoclick(); }); function tacoclick() { //hide items $(".item").hide(); //defining store items var clickbonus1 = { price: 6, amount: 25, }; var clickbonus2 = { price: 75, amount: 10, }; var clickbonus5 = { price: 150, amount: 5, }; var autoclick = { price: 500, amount: 1, }; var autobonus1 = { price: 700, amount: 10, }; var autobonus2 = { price: 1000, amount: 10, }; var autobonus5 = { price: 1200, amount: 5, }; var laser = { price: 2500, amount: 1, }; var battery = { price: 1500, amou

vote - Rails: How to increment counter_cache? -

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::: solved ::: was able figure out counter_cache on vote model , use in topics. updated question below. once topic model had votes_count, had put in view , update counting in controllers. turned out pretty simple. finding information not, should others out, in confusing glory. go way way down answer. cheers :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::edit::: :::see below history::: this edit original post. i'm close have, before try gem solution. used comment_cache on vote model don't know how increment cache. class vote < activerecord::base belongs_to :topic, :counter_cache => true end and called topic.votes.size in view , shows count without active record enumerable. <td><%= pluralize(topic.votes.size, "vote"