Posts

Showing posts from February, 2012

building - How do I populate and associative array using php and mysql -

how add elements below array? /// build cross reference array parent company names of subcategories/// $newarray = array(); $comp_names = "select company_name, company_id pe_company_access"; $name_results = mysql_query($comp_names, $dbcnx); while ($row5 = mysql_fetch_assoc($name_results)) { $newarray = array($row5["company_id"] => $row5["company_name"]); } print_r($newarray); thanks, george i say, should go with: while ($row5 = mysql_fetch_assoc($name_results)) { $newarray[$row5["company_id"]] = $row5["company_name"]; } that way have company_id key of associative array, , company_name value. if want have sub arrays, indexed 0 based index, need following: while ($row5 = mysql_fetch_assoc($name_results)) { $newarray[] = array($row5["company_id"] => $row5["company_name"]); }

regex - Javascript string.match refuses to return an array of more than one match -

i have string expect formatted so: {list:[names:a,b,c][ages:1,2,3]} my query looks in javascript: var str = "{list:[names:a,b,c][ages:1,2,3]}"; var result = str.match(/^\{list:\[names:([a-za-z,]*)\]\[ages:([0-9,]*)\]\}$/g); note: recognize regex pass "ages:,,,", i'm not worried @ moment. i expecting back: result[0] = "{list:[names:a,b,c][ages:1,2,3]}" result[1] = "a,b,c" result[2] = "1,2,3" but no matter seem regular expression, refuses return array of more 1 match, full string (because passes, start): result = ["{list:[names:a,b,c][ages:1,2,3]}"] i've looked through bunch of questions on here already, other 'intro' articles, , none of them seem address basic. i'm sure it's foolish i've overlooked, have no idea :( so difference in how global flag applied in regular expressions in javascript. in .match , global flag ( /g @ end) return array of every incident regular ...

ruby on rails - Uknown attributes error nested attributes -

i keep getting unknown attributes error, though have tried of similar answers question here. trying update council , property attributes join table council history using nested form, when try load view form error please advice think might doing wrong new rails , programming. error started put "/properties/6/build/council" 127.0.0.1 @ 2013-08-19 17:35:45 +0100 processing properties::buildcontroller#update html parameters: {"utf8"=>"✓", "authenticity_token"=>"wbwqaxtbioqzglkhurstqs+cfd/xveutxnj0jwntsa0=", "property"=> {"council_history_attributes"=>{"council_id"=>""}}, "commit"=>"create council history", "property_id"=>"6", "id"=>"council"} property load (0.3ms) select "properties".* "properties" "properties"."id" = ? limit 1 [["id", "6...

regex - Matching regular expression only at beginning of line in MATLAB -

i have string spans multiple lines. line breaks lf, in example of "hello world" has line break between "hello" , "world": some_bytes = [104 101 108 108 111 10 119 111 114 108 100]; some_string = char(some_bytes); disp(some_string) i want match sequence "wo", if occurs @ beginning of line. using regular expression idx = regexpi(some_string,'^wo'); returns empty array. doing wrong? ^ , default, matches @ beginning of string. can activate multiline mode using (?m) search flag: idx = regexpi(some_string,'(?m)^wo'); alternatively, can supply option 'lineanchors' . see documentation .

Not returning from accept when trying to listen to bluetooth communication - Android -

i'm trying establish bluetooth communication between android phone/tablet (4.0.3), , bluetooth device, earring reader (destron fearring dtr3e, in case want know, don't suppose do). i paired phone reader (the reader has pairing passcode on tag) bluetooth settings, bluetooth on of course, , i'm trying listen reads device, means of bluetoothserversocket. problem accept call never returns, doing wrong. communication done using rfcomm. code: private class acceptthread extends thread { private final bluetoothserversocket mmserversocket; public acceptthread() { // use temporary object later assigned mmserversocket, // because mmserversocket final bluetoothserversocket tmp = null; try { // my_uuid app's uuid string, used client code string uuid = "00001101-0000-1000-8000-00805f9b34fb"; tmp = bluetoothadapter.listenusinginsecurerfcommwithservice...

Forcing git to merge add/add "conflicts" -

ages ago installed moodle tarball , have been customizing in private git repo ever since (mostly via modules, i'm not 100% sure never changed base code). want integrate upstream repo in way let me updates while preserving change history, , notify me if i've made changes conflict base code. my problem when try merge in remote repository, git doesn't understand 2 repos contain same code, , treats every file add/add conflict. want make git merge these anyway, , leave actual conflicts me deal with. what i've done far: git add remote moodle git://git.moodle.org/moodle.git git fetch moodle git checkout -b upstream_sync v2.2.1 # tag version on repo based (it seemed prudent sync'd first, start pulling down later updates; maybe that's not necessary, though?) git merge master example output git merge (i see every file): auto-merging admin/process_email.php conflict (add/add): merge conflict in admin/process_email.php i go git mergetool , review eve...

java - Multiple Jbutton and ActionListener using inner class -

there 2 buttons app. 1 randomly changing color when clicked , other changing label in app. the problem although i've write sepreate actionlistener classes , registered them correspondence methods respectively. every time click "change label" button, color changes well. what's going on here? package my; import java.awt.*; import java.awt.event.*; import java.util.arraylist; import javax.swing.*; public class simplegui3c { jframe frame; jlabel label; public static void main(string[] args){ simplegui3c gui = new simplegui3c(); gui.go(); } public void go(){ frame = new jframe(); frame.setdefaultcloseoperation(jframe.exit_on_close); jbutton labelbutton = new jbutton("change label"); labelbutton.addactionlistener(new labellistener()); jbutton colorbutton = new jbutton("change circle"); ...

vb.net - Use Shell32.dll on mix of XP, Vista, Win7 via XCOPY deploy -

i'm trying use shell32.dll unzip simple compressed file. have reference shell32.dll shows interop.shell.dll on development pc (win7 64.) push exe updates out via file copy central location , .dll well. the program fails on xp using same file installed on pc. tried using shell.dll xp \windows\system renamed interop.shell.dll guess simple - gets error cannot load when try invoke dll. i'm open way of doing unzip uses dll agnostic platform. i've used 7zip via process.start() i'd avoid having install/update program on clients. is there common denominator shell32.dll use run on win os on/after xp? or have create separate build each os if use shell32.dll? thanks! function unzip(filepathofzip string, destinationfolder string) boolean try dim sfile string = filepathofzip ' requires referenc windows.system.shell32.dll dim sc new shell32.shell() if io.directory.exists(destinationfolder) io.directory.delete(destinationfolder,...

c++ - How to infer translate, shear, etc from manual matrix operations? -

while reading code ucmerced's tripath toolkit, came across these float xmin, xmax, ymin, ymax; float mat[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; thelct->get_bounds ( xmin, xmax, ymin, ymax ); glmatrixmode ( gl_modelview ); glloadidentity (); float width = xmax-xmin; float height = ymax-ymin; mat[0]=mat[5]=mat[10]= 1.8f * (1 / (width > height ? width : height)); glmultmatrixf ( mat ); mat[0]=mat[5]=mat[10]= 1; mat[12]=-(xmin+w/2); mat[13]=-(ymin+h/2); glmultmatrixf ( mat ); in first transformation, first 3 diagonal 1 's in matrix multiplied factor. limited knowledge of identity matrix, appears scaling factor. the second transformation, however, don't understand: mat[12]=-(xmin+w/2); mat[13]=-(ymin+h/2); glmultmatrixf ( mat ); first of all, don't know means change indices 12 , 13 in such matrix. i'm trying figure out reading wikipedia page on transformations, guess don't have enough math-related domain knowled...

heroku - Error running foreman to fire up a Node.js app -

i trying run foreman on mint vm setup. purpose of learning node. using heroku , guide myself setup have hit road block when try , start foreman. the error message is: 14:51:09 web.1 | started pid 10739 14:51:09 web.1 | exited code 1 14:51:09 system | sending sigterm processes sigterm received any great! if following guide use on heroku instance skip steps required setting on other boxes. default heroku instances have node.js installed, there no need set on box prior deploying , launching first application. to install node.js on linux mint. following: install required tools sudo apt-get install g++ curl libssl-dev apache2-utils sudo apt-get install git-core clone , make latest version of node.js git clone git://github.com/ry/node.git cd node ./configure make sudo make install go working directory project , run following: npm install foreman start your node.js application example should working on local vm. to sample node app testing lo...

dll - Load a class dynamically in C# -

i trying load class (say class1:interface ) without knowing name assembly. code looks this: assembly = assembly.loadfrom("mydll.dll"); type t = (type)a.gettypes()[0]; (interface) classinstance = (interface) (clasactivator.createinstance(t); based on articles found online , msdn, gettypes()[0] suppose return class1 (there 1 class in mydll.dll). however, code returns class1.properties.settings . line 3 creates exception: unable cast object of type 'class1.properties.settings' type namespace.interface'. i not know why , how fix problem. the assembly can hold more 1 type (you have settings.settings file in dll, creates class under hood in settings.designer.cs file), first class in code in case turned out settings class, need go through types , search ones have interface need. assembly asm = assembly.loadfrom("mydll.dll"); type[] alltypes = asm.gettypes(); foreach (type type in alltypes) { // scan objects not abstract , implemen...

c# - Move data to next cell on click when repopulating a grid after update -

populate grid view , on cell click populate text box on cell click event like, private void dgvcompany_cellclick(object sender, datagridviewcelleventargs e) { int = dgvcompany.selectedcells[0].rowindex; id = dgvcompany.rows[i].cells[0].value.tostring(); txtcompanyname.text = dgvcompany.rows[i].cells[1].value.tostring(); txtcontactname.text = dgvcompany.rows[i].cells[2].value.tostring(); txtcontactpersonphone.text = dgvcompany.rows[i].cells[3].value.tostring(); txtaddress.text = dgvcompany.rows[i].cells[4].value.tostring(); txtcity.text = dgvcompany.rows[i].cells[5].value.tostring(); txtphone.text = dgvcompany.rows[i].cells[6].value.tostring(); cbisactive.checked = convert.toboolean(dgvcompany.rows[i].cells[7].value); } here id string variable after populating text box edit , save update , refill grid previous method like, public void fillcompanyinfo()...

jpa - JPQL LEFT JOIN: is the collection member variable condition evaluated against all members? -

suppose have jpql query this: select p parent p left outer join p.children child p.children empty or child.x = 'y' i parent instances returned in of following cases: the parent has no children the parent has @ least 1 child x equal y according jpa specification, should query above want? or must drag out exists -and-subquery-and- in machinery? yes, query want, no matter jpa implementation. don't see room doubt, although can feel don't like: table children joined twice. in imho jpa implementation should make 2 db queries if needed in order return correct data.

Why is there no $interval in AngularJS? -

angularjs has $timeout service acts convenience wrapper around settimeout. why there no equivalent setinterval? since $timeout calls scope.apply after each call can expensive. creating simple interval can decide watches , apply calls needed keep clean. for example, if interval running once every minute check if user's values had changed , optionally saving if values had been changed since last check. depending on how write code, may never need update web page, interval can without triggering update. that doesn't answer question directly of why $interval isn't provided default, suspect because since simple create own specific requirements, better leave open enhance, instead of providing default implementation complex, or inflexible.

Forcing type parameter to implement specific method in java generics -

is there way force type parameter in java generics implement equals method? example, wrote class: public class bag<item> implements iterable<item> has contains method, uses item.equals method. want make sure passed object in generics implement equals method. you make abstract base class called itembase , make equals abstract , have item extend itembase . public abstract class itembase { @override public abstract boolean equals(object o); } public class bag extends itembase this force implementing itembase implement equals

android - Nested Fragment with backstack Resume -

Image
in application there several fragment s in activity , maintaining backstack these fragment . okay, there nested fragment among them. when put backstack , again resume in pressing button, fragment looks overllaping previous content (child fragment). normal view: this screenshot of overlapping view (when resume fragment): you can difference second one's text more deep (that means child fragment overlapping) how can avoid that? code nested fragment: public class competitiveprogramming extends sherlockprogressfragment implements onchapterselectlistener, onsubchapterselectlistener { view mcontentview; static public list<chapter> chapterlist = new arraylist<chapter>(); private processtask processtask = null; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); this.setretaininstance(true); } @override public view oncreateview(layoutinflater inflater, viewg...

c# - Catch if own UserControl is clicked or not -

i writing wordsearch game windows phone 8. screen http://kepfeltoltes.hu/130804/j_t_k_www.kepfeltoltes.hu_.png this game window, , rectangles own usercontrols. here definition of rectangles, in xaml: <grid x:name="layoutroot" background="transparent"> <rectangle x:name="kitoltoszin" stroke="white" width="100" height="100" strokethickness="3" radiusx="10" radiusy="10" horizontalalignment="center" verticalalignment="center"> <rectangle.fill> <solidcolorbrush color="gray"/> </rectangle.fill> </rectangle> <textblock x:name="betu" width="70" height="70" fontweight="bold" fontsize="42" foreground="white" horizontalalignment="center" ve...

javascript - Select one checkbox row only in datatables -

i want able select 1 checkbox @ time in datatables. in example below, multiple rows can selected. how can go allowing 1 row selected @ time? http://datatables.net/examples/api/form.html you use radio buttons instead of checkboxes. example: <input type="radio" name="fieldname" value="check1" /> <input type="radio" name="fieldname" value="check2" /> <input type="radio" name="fieldname" value="check3" /> <input type="radio" name="fieldname" value="check4" /> the "name" attribute groups radio buttons together, "value" attribute differentiate them.

Rounding down numbers to set points with PHP -

i have basic 5 star rating system based on user submissions. depending on rating, particular image shown. $user_rating contains rating number 1 decimal place. there 'star' images 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0 in file names. i need whatever number contained in $user_rating rounded down nearest value above , stored in new variable $star_rating . numbers can never rounded up. if $user_rating 4.9, $star_rating should 4.5. can me achieve this? thanks edit - using returns original value - in case 3.8 $star_rating = $user_rating; function roundtohalf($star_rating) { $temp = $star_rating * 10; $remainder = $star_rating % 5; return ($temp - $remainder) / 10; } function rounddowntohalf($number) { $remainder = ($number * 10) % 10; $half = $remainder >= 5 ? 0.5 : 0; $value = floatval(intval($number) + $half); return number_format($value, 1, '.', ''); } define("endl", ...

java - how to get a region out of an image? -

lets use black key jpg image layout in java code. there easy way region out of image can use region.contains() ontouchlistener? i've looked them , there isn't any. ask because im making piano app , regions of images use black/white keys. rather use image, try rendering piano keys yourself, , check if input in black key regions render, rather using image. if want use image, define black regions within image hand. detecting regions in image difficult problem, 1 don't want such simple purpose. if had many images, or had might worth headache presumably don't... don't worry it.

Tcl proc to output a list or array -

i new tcl arrays. question follows. i have rectangle box 2 rows r1 , r2. each of these rows has 8 different values. want return these 16 values (x , y coordinates) either in text file or list output proc. read earlier posts tcl proc cannot output array unless use dict. so, try draw picture u can understand question better. r1 x1y1 x2y2 ... x8,y8 r2 x9,y9 ... x16, y16 expected output when run proc either on command prompt or in file dummy values example $> (1,2) (2,3) (3,4) ....... (7,8) (9,10) (10,11) ......... (15,16) so tried , getting results need. hardcoded 2 rows. want make able detect how many rows there , accordingly output number of rows. proc getpointlist {rect_boundary rowoffset coloffset rowincr colincr } { set cordlist $rect_boundary set xl [lindex $cordlist 0] set yl [lindex $cordlist 1] set xh [lindex $cordlist 2] set yh [lindex $cordlist 3] set list "" ; {set y [expr {$yh - $coloffset}]} {...

Dynamic columns on WPF -

Image
assume have datagrid : first column constant. others come database. in columns display name of football players example , below them display statistics them . what control suggest use ? if suggest datagrid how create columns , rows , connect them data source ? any code example appreciated. the functionality looking typically called pivot table or matrix. see dynamic data matrix wpf example of how in wpf. edit: if not trying pivot, rotate 90 degrees, there rather answer on how that, too: wpf horizontal datagrid . use couple of layouttransforms rotate whole thing, set rotate cells normal.

UITableview cell subview larger height then cell -

@all hello its quite interesting problem have. have subviews can larger in height cell height (its required design). example cell "a" height 40 while subview height= 70. i can show larger subview when cell goes off screen (i scroll top) subview disappear (obvious) result. gives undesired effect larger subview before extends cell "b" beneath container cell disappear. i have tried set cell background transparent in willdisplaycell delegate method no luck. below related method if wants see - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *myidentifier = @"myidentifier"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:nil]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:myidentifier] autorelease]; cell.selectionstyle = uitableviewcellselectionstyle...

How do i make Python count how many letters are in a word? -

i have lab programming class , need know how make python count how many letters in word excluding spaces. can me out? have far. def na(): name = raw_input("what name? : ") count [char] na() sum(c.isalpha() c in name)

php - how can i upload images in Codeigniter -

i have problem when upload images in codeigniter, have controller upload images :- public function index() { $this->load->model('blog'); $type = "text"; if (isset($_post['post'])) { if (isset($_post['type']) && $_post['type'] == "image") { $type = "image"; } if (strlen($_files['inputupprofile']['name']) > 0) { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '2048'; $config['encrypt_name'] = true; $this->load->library('upload', $config); if (!$this->upload->do_upload('inputupprofile')) { $error = $this->upload->display_errors(); if (is_array($error)) { foreach ($error $er) { ...

PyCharm doesn't recognize Buildout dependencies -

Image
i have simple project buildout , django , have imported pycharm. however, after enabling buildout support in project settings, pycharm complains can't find django. project, when built buildout, works fine, pycharm not seeing buildout project properly. any ideas on how fix this? this problem because not have interpreters set out straight. check see have dependencies installed. picture can demonstrate:

.net - How to pass a value to a C# generic? -

in c++ templates have feature can pass value argument template of function . how can same in c#? for instance, want similar following: template <unsigned n> struct factorial { enum { result = n * factorial<n - 1>::result; }; }; template <> struct factorial<0> { enum { result = 1; }; }; but in c#. how can this? by way, actual need them involves generating classes on demand (with few static values changed), presented code example. c# generics not c++ templates in way. work types , not values.

database design - MySQL Normalize or Denormalize -

i'm building php app prefill third party pdf account forms client data, , getting stuck on database design. the current form has 70 fields, seems far many set individual columns, (ie company/trust information) not relevant depending on type of account client requires. i've tried normalize seems there lot of joins, , require several sub queries things multiple addresses. it means ton of queries check if rows exist or not when updating decide if script needs insert, delete or update, whereas if in 1 row, update each time. not sure if helps here list of of fields: id, account_type, account_phone, account_email, account_designation, account_adviser, account_source, account_complete, account_residential_unit_number, account_residential_street_number, account_residential_street_name, account_residential_street_type, account_residential_suburb, account_residential_state, account_residential_postcode, account_postal_unit_number, account_postal_street_number, acco...

ios - Pausing a NSTimer/Stopwatch -

this question has answer here: adding pause functionality nstimer 1 answer in project working on need have stopwatch pause , continue. far of basic functions work, have not been able find way pause timer , re-start it. fyi, have checked other postings , didn't work. code: .h: #import <uikit/uikit.h> #import <avfoundation/avfoundation.h> @interface timer : uiviewcontroller <avaudiorecorderdelegate, avaudioplayerdelegate> { avaudiorecorder *recorder; avaudioplayer *player; } @property (weak, nonatomic) iboutlet uibutton *recordpausebutton; @property (weak, nonatomic) iboutlet uibutton *stopbutton; @property (weak, nonatomic) iboutlet uilabel *stopwatchlabel; -(ibaction)recordpausetapped:(id)sender; -(ibaction)stoptapped:(id)sender; @end .m: #import "timer.h" @interface songideasrecording () @property (strong,...

.htaccess - rewrite rule, no clue -

i redirect pins?board=10000011 to view_photos.php?album=10000011 10000011 being id dynamic, therefore no clue in title of question, not know how grab , use inside rewrite rule. have tried with: rewriterule ^([a-za-z-0-9-_.]+)/pins?board= $1/view_photos.php?album=$2 it seems don't know i'm doing i'm asking help. you can't match against query string in rewrite rule. need use %{query_string} var in rewrite condition: rewritecond %{query_string} ^board=(.*)$ rewriterule ^/?([a-za-z-0-9-_.]+)/pins$ /$1/view_photos.php?album=%1 [l,r=301]

osx - "brew install osm2pgsql" failed -

i'm using mac , want install osm2pgsql import osm data postgresql . i execute brew install osm2pgsql in terminal. (i have executed brew update ). here output: ==> downloading https://github.com/openstreetmap/osm2pgsql/archive/v0.82.0.zip downloaded: /library/caches/homebrew/osm2pgsql-0.82.0.zip ==> ./autogen.sh ==> ./configure --with-proj=/usr/local/opt/proj checking fork... yes checking xml2-config... /usr/bin/xml2-config checking xml2 libraries... yes checking zlib compression library... no configure: error: required library not found read this: https://github.com/mxcl/homebrew/wiki/troubleshooting and here output of executing brew doctor : warning: unbrewed dylibs found in /usr/local/lib. if didn't put them there on purpose cause problems when building homebrew formulae, , may need deleted. unexpected dylibs: /usr/local/lib/libmonoposixhelper.dylib /usr/local/lib/libsffilemonitor.32.dylib /usr/local/lib/libsfipc.32.dylib /usr/local...

html5 - Adding custom backgrounds to D3.js bar graph -

Image
i'm new d3.js , i'm building bar graph in d3.js. i'm trying make background 3 different colors break x axis distinct 3 zones (low, medium, , high). figure should appending <g> elements i'm not sure how place them in case. the site here : not sure if providing more of code help this answer based on josh suggested in comments thought i'd add code since had deal mouseover , created challenges too. one thing worth mentioning there isn't z-index svgs have put new background shades in first , chart bars (which why have give rectangles bar chart new name, per josh's suggestion) svg.append("rect") .attr("y", padding) .attr("x", padding) .attr("width", 200) .attr("height", h -padding*2) .attr("fill", "rgba(0,255,0, 0.3") .attr("class", "legendbar") svg.append(...

delphi - Is it possible to register the same class / interface multiple times in Spring4D? -

i'm playing around spring4d framework , think it's pretty cool. i'm trying achieve following globalcontainer.registercomponent<tperson>.implements<iperson>('normal'); globalcontainer.registercomponent<tperson>.implements<iperson>('testdata').delegateto( function: tperson begin result := tperson.create; result.setfirstname('bob'); result.setsurname('smith'); end ); with tperson/iperson having obvious definitions. regardless if try person := servicelocator.getservice<iperson>('normal'); or person := servicelocator.getservice<iperson>('testdata'); i bob, possible or doing wrong? this fixed in latest version of spring4d

objective c - When do iOS apps reach the end of main()? -

i new objective-c . know objective-c programs start main method . should end after time, ios applications keep on running when reach end of method. can please explain? that because run loop created when line run: int retval = uiapplicationmain(argc, argv, nil, nil); the run loop processes incoming events (button presses, mouse movements, timers, network activity, etc. loop never terminates. way app terminated either os or exit() function terminates app wherever called. should never call exit() function in ios os should handle app termination in background.

java - Detecting if a mouse is wireless -

i trying detect whether wireless mouse present on computer. program run in background. prefer in java if goes beyond java's capabilities can use language. can please me started? (this seems google-able question cannot find anything) start here: http://www.ibm.com/developerworks/library/j-usb/index.html [^] read on here: http://today.java.net/pub/a/today/2006/07/06/java-and-usb.html [^] and check out project: http://jusb.sourceforge.net/ [^] these might little close extract specification of hardware. dont know if can check whether hardware wireless or not, computer has nothing it..

java - How to edit the Scroll Bar -

i have jtable in jscrollpane i'd change of scrollbar bit better looking; 'custom design'. maybe put image user can drag instead of default thick blue bar. possible? the main thing i'd change thickness of bar. application uses small window , scrollbar looks thick. any appreciated. edit: thanks responses far. found this; answers answer, in part: java scrollbar thickness unfortunately cannot provide sample @ current moment, should this the basicscrollbarui class allows modify different features of typical jscrollbar , such various different colors, sizes, , shadow effects. should looking for. idea supposed override installdefaults method , modify protected fields liking. but, if want fancy, highly suggest looking javafx due amount of customizability supports, 1 being css styling (which should helpful you).

python - Lightweight cross-platform way to prompt for a file -

i found built-in , easy way prompt system-specific nice open file dialog: import tkinter tkfiledialog import askopenfilename tk_root = tkinter.tk() tk_root.withdraw() result = askopenfilename( filetypes=[("foos", "*.png")], ) however, way heavy dependency in terms of size. i'm packaging app py2exe , app 7 megabytes bigger having include tkinter . surely there must simpler way prompt native file dialog works on windows, mac, , linux? if you're developing pygame app, there's project called pygame utilities has cross-platform support file dialogs, among many other things. appears lightweight. doesn't documented, though. if download package, run setup.py file in docs directory generate documentation.

oauth 2.0 - Google OAuth2 Service Accounts API Authorization -

i'm trying authenticate server app through google's service account authentication but, reason, not pushing through. in api console , created project, enabled service need (admin sdk), , created service account , web application api access. when use web application access credentials able authenticate , retrieve user records. using service account authentication keep giving me login required message. "error": { "errors": [ { "domain": "global", "reason": "required", "message": "login required", "locationtype": "header", "location": "authorization" } ], "code": 401, "message": "login required" } i forgot add, testing php client library. public function init() { $client = new google_client(); if (isset($_session['access_token'])) { $client->setaccesstoken($_session['access_token']); } $...

node.js - Run several asynchronous functions in parallel -

i have 1 object contains 2 different methods var samp { m1: func1, m2: func2 } depending on number of keys want call 3 function parallely im using following code runs serially. switch (samptype) { case "m1": { return new func1(); break; } case "m2": { return new func2(); break; } default: { } } how can execute methods parallely in node.js? on helpful check out async.parallel . write: async.parallel( [ function ( callback ) { // code }, function ( callback ) { // code } ], function ( error, results ) { // both done } );

Converting jQuery live to on with find -

how convert use jquery .on .live: var $elementhelper = $('.inline_docxdiv [class^="element_helper"]'); $elementhelper.find('.display-explanation').live('click',(function() { //code here })); i tried , didn't work: var $elementhelper = $('.inline_docxdiv [class^="element_helper"]'); $(document).on('click', $elementhelper.find('.display-explanation'), function () { //code here }); try $(document).on('click', '.inline_docxdiv [class^="element_helper"] .display-explanation', function () { //code here });

javascript - Backbone View shouldn't have same data in different instances but does -

i have backbone view has following code within render function (note 3 console.log(that.ticketselector.attributes); ): if(typeof this.ticketselector === 'undefined') { // todo: first fetch tickets this.ticketselector = new datatable({ collection: that.model.tickets, icon: "ticket", title: "tickets", customclasses: ["ticket", "subject-selector"], columns: [ {text: 'name', modelkey: "name", col: 1}, {text: 'date', modelkey: "date", col: 2}, {text: 'owner', modelkey: "owner", col: 3}, {text: 'description', modelkey: "description", col: 4} ] }); this.$('.subject-selectors').append(this.ticketselector.$el); this.ticketselector.render().resize(); } else { this.ticketsel...