Posts

Showing posts from September, 2013

javascript - How to get shown.bs.modal to trigger when the modal uses a remote URL -

the problem i cannot shown.bs.modal fire correctly when modal generated passing in remote url. in following code hidden.bs.modal consistently work. the code $('#my_modal').on("shown.bs.modal", set_up_modal); $('#my_modal').on("hidden.bs.modal", tear_down_modal); $('#my_modal').modal({ remote: target_url }); set_up_modal = function() { console.log('up') }; tear_down_modal = function() { console.log('down') }; what have tried i have read docs . i have tried changing .on read more $('body').on("shown.bs.modal", '#my_modal', saa.set_up_modal); has produced no change (again hidden.bs.modal works). update i have added console.log($._data( $('#my_modal')[0], "events" )); , can confirm shown being bound object, not getting called. i have tried using show.bs.modal instead, works need elements visible on screen want them. found temporary solution p

perl error: 'use of uninitialized value in concatenation (.) or string' using hash -

i have tab-delimited file: abc.txt. has data like: pytul_t015270 protein of unknown function pytul_t015269 protein of unknown function pytul_t015255 protein of unknown function pytul_t015297 protein of unknown function i creating parser takes abc.txt , 2 other files input , parses files calling different subroutines package: utility.pm the subroutine parse abc.txt defined in package, utility.pm goes follows: use strict; sub readblast{ $filename = shift; %hash; %genenamehash; open pred, $filename or die "can't open file $!\n"; while (my $line=<pred>) { chomp $line; #print $line,"\n"; (my $gene,my $desc) = split /\t/, $line; $hash{$gene} = $desc; } close(pred); return %hash; } and parser.pl script, uses hash follows: my %blast=&utility::readblast($argv[2]); $mrna(keys %{ $featurehash{$scaffold}{$gene}}){ $desc = $blast{$mrna}; } here $featurehash hash made file. , $mrna has key values of file abc.txt

indexing - What is the best way to get a content object's position in the parent? Plone 4 -

i traversing folders content items within them. use portal_catalog brains searched on paths. brains have access metadata, , brain.getobject() return actual object. have gotten parent object brain.getobject().aq_parent. want object's position in parent. @ first tried brain.getobject().getobjpositioninparent(), , afterwards, realized getobjpositioninparent() attribute accessible index data. idxdata = catalog.getindexdataforrid(brain.getrid()) sjson = json.dumps( idxdata ) l = brain.getobject() lupdate = {'path': '/'.join( l.getphysicalpath()), 'meta_type': l.meta_type, 'title':l.getrawtitle(), 'remoteurl': l.getremoteurl(), 'json':sjson} when printed out screen, see of items within dict returned catalog.getindexdataforrid call. problem of objects, getobjpositioninparent() empty array ([]). on page http://developer.plone.org/searching_and_indexing/query.html , appears value should integer. made me wonder if have go creat

node.js - Uploading file with express -

i trying make simple file server able save file using express: var app = express(); app.use(express.bodyparser({uploaddir:'./uploads'})) app.post('/upload', function(req, res, next) { console.log("uploading file"); req.on('data', function(raw) { console.log('received data: ' + raw); }); req.on('end', function() { console.log('file uploaded'); res.send(200); }); }); i getting empty file in "uploads" folder. what missing? maybe silly question new node.js. edit : more information... i sending client: post /upload http/1.1 connection: close content-length: 42 content-type: multipart/form-data; boundary="mime_boundary_572b1a2b457d3267" cookie: session.id=b268b12e-0c05-11e3-8702-7a7919510927 host: localhost:8080 transfer-encoding: chunked client 3 received message: e4 --mime_boundary_572b1a2b457d3267 content-disposition: form-data; name="test1.

javascript - Getting the script tag using getElementsByTagName inconsistent across browsers -

i have following code: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script> <script> $(document).ready(function(){ var script_obj = document.getelementsbytagname('script') alert(typeof script_obj); }); </script> when run in firefox (v21) , chrome (v29) object result, in safari (v5) function . why this?! in rest of script i'm iterating through script_obj .src data, count function determines length of haystack (i.e. script_obj ) has check returns false if haystack not array or object , failing in safari. there way can instead of using document.getelementsbytagname('script') ?! document.getelementsbytagname() returns nodelist . although nodelist not array, have length property array. don't need special count number of items in it. not sure count function doing, can this: > var script_obj = document.getelementsbytagname('script'); >

java - Is it appropriate in the MVC pattern to use the builder pattern in the View part -

public class addformconcretebuilder extends formbuilder { private jdatechooser datechooser; private insertproducer producer; private dataobject dataobject; private jtextfield assetname; private jtextfield financial; private jtextfield location; private jcombobox custodian; private jcombobox type; private jcombobox retentionperiod; private jcombobox maintenancesched; private jcombobox confidentiality; private jcombobox integrity; private jcombobox availability; private jcombobox classification; private jbutton btnconfirm; private jbutton btnback; private arraylist<dataset> insertlist = new arraylist<dataset>(); private int assetid = generatenewassetid(); private panelmanager panelholder; /** * @wbp.parser.entrypoint */ @override public void buildcomponents() { panelholder = new panelmanager(); comboboxmanager combomodelcreator= new comboboxmanage

javascript - Can I add a delay in between 'click' and 'addClass' in jQuery? -

this question has answer here: delayed addclass/remove class function not working 2 answers can add delay before addclass method? this doesnt seem working me. $("#btn").click(function dostuff(){ $("#myobj").show(); $("#myobj").animate({left: "15"}); $(".secondobj").delay(1000).addclass('glow'); $(".thirdobj").addclass('topglow'); )}; thanks $("#btn").click(function dostuff(){ $("#myobj").show(); $("#myobj").animate({left: "15"}); settimeout(function () { // wait 1 second , add class $(".secondobj").addclass('glow'); }, 1000); $(".thirdobj").addclass('topglow'); });

csv - convert 2.7E+11 to number in php -

this question has answer here: convert exponential number decimal in php 4 answers convert exponential whole number in php [duplicate] 1 answer i have csv file , in fields , numbers not saved correctly. should phone number 2.7e+11. csv file generated ebay.

matlab - How large matrix can be fit into Eigen library? -

i working on large scale data 300000 x 300000 matrix may interest. hard process in matlab due "out of memory" error decide use eigen. there restriciton eigen in matrix size? the dense matrices in eigen stored in contiguous block of memory, cannot exceed 2 gb in 32-bit application, if you're running 32-bit application, allocation start crash matrices half size, around 10,000x10,000. see example this duplicated question . the same issue happen other libraries, since you're bounded ram, not library. yet, if big matrix has vast majority of 0 in it, can resort sparsematrix . if matrix isn't sparse, may store on disk, you'll terrible performance when manipulating it.

Using App Engine Python application as proxy to PHP application -

during past 2 years have built app engine application in python. possible use php on app engine. use off-the-shelf php applications such wordpress, mediawiki , phpbb python application. user should transparent of 2 applications (python or php) using particular page. consider python application main application of programming. because have more experience python , because have written lot of reusable code app engine. currently approach build proxy in python maps http requests this: http://www.yellow.com/blog/* http://phpapp.appspot.com/wordpress/client1/* http://www.yellow.com/community/* http://phpapp.appspot.com/phpbb/client1/* yellow.com domain mapped python application. http://www.blue.com/wiki/* http://phpapp.appspot.com/mediawiki/client2/* http://www.blue.com/* http://phpapp.appspot.com/wordpress/client2/* blue.com domain mapped python application. besides blog, community or wiki, there lot of url's don't require php. these url's handled

ios - Make UICollectionViewCell appear in center of UICollectionView -

i have cells dynamically added uicollectionview . change inset of these cells appear in center of uicollectionview . because more cells added cell height changes (it single row uicollectionview ). - (uiedgeinsets)collectionview:(uicollectionview*)collectionview layout:(uicollectionviewlayout *)collectionviewlayout insetforsectionatindex:(nsinteger)section { // method used center when 1 tile entered else use standard no inset if (self.wordarray.count == 1) { cgfloat newwidth = (self.tilecollectionview.bounds.size.width - self.tilecollectionview.bounds.size.height); return uiedgeinsetsmake(0, (newwidth / 2), 0, (newwidth/2)); } else { return uiedgeinsetsmake(0, 0, 0, 0); // top, left, bottom, right } } how reference uicollectionviewcell current height, of cells shaped same (just height/width changes when more added continue fit 1 row. once have reference cell height, can add like: self.tilecollectionview.bounds.size.height - cellheight /

c# - Disappearing nodes in TreeView -

after attempting add data that's typed textbox (scanidbox) , clicking addbutton, rootnode seems disappear, , treeview blank. i'm not sure i'm doing wrong here, i'm new windows forms , treeviews. i'm trying add parentnode if item's length 8 , childnode if item's length 9. don't want root node disappear, want items 8 characters long parent node under root node , want other items child nodes of added parent node. how can accomplish this? public class nodes { public treenode rootnode = new treenode(); public treenode parentnode = new treenode(); public treenode childnode = new treenode(); } public void scan_form_load(object sender, eventargs e) { _boxnumberrepository = new boxnumberrepository(); nodes _rootnode = new nodes(); _rootnode.rootnode.text = "scan id"; boxandfilelist.nodes.add(_rootnode.rootnode); text = "scan form"; acceptbutton = a

android - Adding loading spinner on Action Bar while the WebView loads? -

i developing android app. using webview render html page stays blank while page loads. want add loading spinner in action bar user knows loading , not blank. please can guide me how that. my existing code - package com.pranavsethi.dpsrkp; import android.annotation.targetapi; import android.app.actionbar; import android.app.activity; import android.content.intent; import android.net.uri; import android.os.build; import android.os.bundle; import android.view.keyevent; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.webkit.downloadlistener; import android.webkit.webview; import android.webkit.webviewclient; public class achievements extends activity{ private webview mwebview; @targetapi(build.version_codes.honeycomb) @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.webvew_client_layout); actionbar actionbar

javascript - How to load an external js file as plain text and assign to variable as a string -

really sorry if dumb question can't seem work. title says trying load external js file , assign variable plain text. project simple js "compiler" stitches number of js files , minifies them one. using $.get() method , appending response string. the problem js file handles above needs included in final minified file. can load in other files , stitch them fine when load main file sourcing js file seems evaluate , overwrite , stops process. for time being have got around problem loading in copy .txt file means have keep 2 files date isn't ideal. i found this article refers javascript loaded via script tags in head. any appreciated. happily post code not sure bits useful. update: should have mentioned project needs run entirely client side can't use php/.net pages. files i'm loading in on same domain though. try use ajax.get() : var script; $.get('script.js', function(data) { script = data; }); for ajax.get() work inside doma

Merge Two Arrays in R -

suppose have 2 arrays, array1 , array2, like array1 45 46 47 48 49 50 1.0 1.5 1.3 1.2 0.9 1.1 array2 45 46 47 48 49 50 2.5 5.5 4.5 5.8 1.5 8.4 and want merge them data frame looks like: 1.0 2.5 1.5 5.5 1.3 4.5 1.2 5.8 0.9 1.5 1.1 8.4 the numbers 45 50 don't matter. array1 <- c(1.0,1.5,1.3,1.2,0.9,1.1) array2 <- c(2.5,5.5,4.5,5.8,1.5,8.4) result = cbind(array1, array2) in case don't want see column names or row names (as posted in question), should following: result = as.matrix(cbind(array1, array2)) dimnames(result) <-list(rep("", dim(result)[1]), rep("", dim(result)[2])) you get: > result 1.0 2.5 1.5 5.5 1.3 4.5 1.2 5.8 0.9 1.5 1.1 8.4

javascript - testing rewriting a simple loop with an immediate function -

Image
i'm not sure why i'm getting error on following snippet (adapted javascript closure inside loops – simple practical example ): var funcs = {}; (var = 0; < 3; i++) { // let's create 3 functions funcs[i] = (function(n) { // , store them in funcs console.log("my value: " + n); // each should log value. })(i); } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } it seems should run ok; know don't get. here errror get: thx help you need return function, rather result of function. try: funcs[i] = (function(n) { return function() { console.log("my value: " + n); } })(i); example: > var funcs = {}; (var = 0; < 3; i++) { funcs[i] = (function(n) { return function() {console.log("my value: " + n);} })(i); } (var j = 0; j < 3; j++) { funcs[j](); } value: 0 value: 1 value: 2

.htaccess - Rewrite specific sub domain to SSL based? -

i use apache 2 on debian 7. i have online tool installed @ let's say: tool.myurl.net i have wildcard ssl certificate for: *.myurl.net i configured virtualhost in apache listen tool.anotherurl.com using serveralias . but not have valid ssl certificate url. so need rewrite rule redirect http://tool.myurl.net https://tool.myurl.net not when people visit http://tool.anotherurl.com . is possible? if understood correctly want redirect https sub domain tool.myurl.net rule should it: rewriteengine on # if https not being used force https rewritecond %{https} !=on # because want force domain rewritecond %{http_host} ^tool\.myurl\.net$ [nc] rewriterule ^ https://%{http_host}%{request_uri} [l,r=301]

How to check (in C/C++ code) if Openssl is installed on my computer? -

i check if have openssl installed using c/c++ code. possible? mean, there macro, or portable way of doing this? thanks the following work on windows , linux: #ifdef win32 libhandle = loadlibrary( libraryname ); #else libhandle = dlopen( libraryname, rtld_local | rtld_now ); #endif

jsp - shared event in java -

hi wondering how can shared event in java let me explain u want first got controller class methods static class trafficcontroller { public static void controltraffic() { // //>> want notify action done } } in other side got listener class trafficlistener{ public static void watchnewtraffic() { //does when new traffic appears } } have 1 idea how can deal i have found there observer , observable need implement method of observer have found propertychangelistener useless in case because have static methods first, should remove static modifier trafficlistener.watchnewtraffic() method. otherwise, cannot have multiple listeners. better yet, should make trafficlistener interface: interface trafficlistener { void watchnewtraffic(); } each class wants listener needs implement interface. can maintain collection of listeners in trafficcontroller class: class trafficcontroller { private sta

sql server - SQL Transaction not working -

i using below sql delete records , insert customers table inside transaction. if there error in insert statements, seeing error message , when try execute select * customers , not displaying result set. , when close ssms window, showing there uncommitted transactions. wish commit these transactions before closing window? after click ok, results getting displayed table. so, there locking mechanism taking place while using transaction. use cmsdb; begin try begin tran t1; delete customers print @@trancount -->prints 3 since there 3 records insert customers insert customerd --> error here insert customers commit tran t1; end try begin catch print 'hi' --> not printing select @@trancount --> not resulting if @@trancount > 0 rollback tran t1; -- error message declare @err nvarchar(1000) set @err = error_message() raiserror (@err,16,1) end catch go message (3 row(s) affec

api - How to display markers in groundOverlay map? -

i can manage display image overlay on map. new problem occurs - can't add marker on it. googled while no luck. tried search , mimic example on documentation , nothing appears right. here's code : <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script> function initialize() { var newark = new google.maps.latlng(xx.xxxxx,xx.xxxxx); var imagebounds = new google.maps.latlngbounds( new google.maps.latlng(xx.xxxxx,xx.xxxxx),//sw new google.maps.latlng(xx.xxxxx,xx.xxxxx)//ne ); var mapoptions = { zoom: 20, center: newark, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); var oldmap = new google.maps.groundoverlay( 'images/floor_plan_trans_rotated.gif', imagebounds); oldmap.setmap(map); } /*m

cocos2d iphone - How to stop a character from going out of the screen? -

i'm making game ninja supposed go , down. wrote method button problem when ninja @ top of screen (landscape) still goes when touch button so, did -(void)uppressed:(id)sender { if(cgpointequaltopoint(ninja.position, ccp(0,280))) { id standstill = [ccmoveby actionwithduration:0 position:ccp(0,0)]; [ninja runaction:standstill]; }else { id moveup = [ccmoveby actionwithduration:.1 position:ccp(0,80)]; [ninja runaction:moveup]; } } and problem still exists. help? i.e when ninja @ (0,280), want button nothing you testing equality. if condition true if ninja @ {0, 200} . try instead: if (ninja.position.y < 280) { // no need run action ninja.position = cgpointzero; // should stop potentially running (move) action [ninja stopallactions]; } else ...

javascript - jQuery slider infinite scrolling not working -

i'm trying create simple infinite scrolling jquery slider. problem after reaching 3rd image, slider goes first, going through other images. here code: jsfiddle $('#rightarrow').click(function() { currentposition = currentposition+1; slidercontrols(currentposition); $('#combined').animate({ 'marginleft' : slidewidth*(-currentposition) }); }); i want make infinite cycle. after 3rd image should first same animation. creating infinite cycle not easy might think. create infinite slider, have append new elements @ end of slider, when reaches end. items append @ end can removed front best performance. as there many infinite scroll plugins around, might want try one: http://megahitmag.com/free-infinite-scrolling-jquery-plugins/

linux kernel - Make a system call to get list of processes -

i'm new on modules programming , need make system call retrieve system processes , show how cpu consuming. how can make call? why implement system call this? don't want add syscall existing linux api. primary linux interface userspace , nobody touches syscalls except top kernel developers know do. if want list of processes , parameters , real-time statuses, use /proc . every directory that's integer in there existing process id , contains bunch of useful dynamic files ps , top , others use print output. if want list of processes within kernel (e.g. within module), should know processes kept internally doubly linked list starts init process (symbol init_task in kernel). should use macros defined in include/linux/sched.h processes. here's example: #include <linux/module.h> #include <linux/printk.h> #include <linux/sched.h> static int __init ex_init(void) { struct task_struct *task; for_each_process(task) pr_inf

python - Invalid MIDI message Data when I'm trying to send Control Change Messages -

i'm using pygame.midi library send midi messages (control change messages, not notes). idea send output (from python program) input of program. >>> import time >>> import pygame.midi midi >>> midiout = midi.output(3) >>> midi.init() >>> midiout = midi.output(3) >>> midiout.write_short(0x74,124,0) portmidi call failed... portmidi: `invalid midi message data' type enter... as can see, i'm sending 0x74,124,0. i'm taking numbers rakarrack (the application want control) implementation chart: http://rakarrack.sourceforge.net/midiic.html what doing wrong? midi status bytes (the first byte of message) must have high (0x80) bit set. linked chart bit confusing, i'm guessing 0x74 data byte , must preceded proper status byte. >>> import pygame.midi midi >>> midi.init() >>> midiout = midi.output(0) >>> midiout.write_short(0xb0, 0x74, 124) some basic midi documentati

javascript - collapsing vertical menu while using css tables -

i have 3 column layout made css tables each column can fill browser perfectly. first column menu , need hide / move left on click , middle column fill in space. should not move out of screen leave little bit exposed user can click area have animate in. heres fiddle... http://jsfiddle.net/vjmfq/ right noticed first column wont move unless either display:none content inside or animate content width 0px(but want column little exposed dont want eliminating content). i tried animating inner contents width down when animate width comes in both sides, trick wouldnt work, example , inner content should butt against right side of first column if use float:right messes content in middle column, content in first row against side using margin-left...and if animate width down doesnt animate left side, width gets smaller both sides @ same time. $(document).ready(function() { $(".two").click( function(event){ event.preventdefault(); if ($(this).hasclass("isdown") ) {

jquery - hide only when i click outside -

i don't want hide when click input. http://jsfiddle.net/bthnh/1/ $("body").click(function() { $(".search-input").hide(); }); $("#search").click(function () { $(".search-input").toggle(); event.stoppropagation(); }); $(document).click(function (event) { //alert(event.target.classname); if(event.target.classname != 'search-input') { $(".search-input").hide(); } }); $("#search").click(function (event) { event.stoppropagation(); $(".search-input").toggle(); }); http://jsfiddle.net/cmacu/bthnh/4/

javascript - Show/Hide after a div created dynamically -

i use code show/display edit link when mouse hovers on start div. div can created dynamically , when it's created code below doesn't work. $(".start").hover( function() { timeclock.utils.displayedit(this) }, function() { timeclock.utils.hideedit(this) }); i tried code below doesn't work , looks wrong. how can implement $(document).on('hover'.....) hide/show edit link shown above? $(document).on("hover", ".start", function() { timeclock.utils.displayedit(this) }, function() { timeclock.utils.hideedit(this) }); hover() shortcut binding mouseenter , mouseout handlers. second example doesn't work because on() doesn't take 2 functions that. bind multiple handlers @ once using delegated events this: $(document).on({ mouseenter: function () { timeclock.utils.displayedit(this);

c# - How to output Json string as JsonResult in MVC4? -

this seems simple must over-thinking it. tl;dr; how can modify code below return json object contained in string rather string happens contain json? public actionresult test() { var json_string = "{ success: \"true\" }"; return json(json_string, jsonrequestbehavior.allowget); } this code returns string literal containing json: "{ success: "true" }" however, i'd return json contained in string: { success: "true" } slightly longer version i'm trying prototype external api calls , want pass results through "api" fake response now. json object non-trivial - on order of 10,000 "lines" or 90kb. don't want make typed object(s) contents of 1 json response can run through deserializer - out. so basic logic in controller is: call externall api store string result of web request var (see json_string above) output results json (not string) using jsonresult producing method json()

android - How can I refresh the content of my SherlockFragment? -

i using sherlockfragment displays data database in listview. in list view, possible delete items using onitemlongclicklistener() . now, after deleting content db, have refresh list view. how can that? thought, helpful have refreshview() method. possible have such method inside sherlockfragment class? if so, can me code? thanks!

javascript - Chaplin/Backbone issue - "Add" event not fired when adding item to the collection -

i'm building test application myself, learn more coffeescript, backbone, brunch.io , chaplin js, i'm stuck , can't figure out i'm doing wrong. this code in todo-view.coffee: view = require 'views/base/view' todoitemview = require 'views/todo/todo-item' todoitemmodel = require 'models/todo/todo-item-model' todoitemcollection = require 'models/todo/todo-collection' # site view top-level view bound body. module.exports = class todoview extends view # template data stuff container: 'todo-container' tagname: 'ul' classname: 'todo-list' template: require './templates/todo' # create custom initialize method initialize: -> super # create new backbone collection dummy data store @collection = new todoitemcollection() # store dummy data in collection data = ["working", "studying", "gym", "sleep"] todoitem in data @c

google chrome - How do you expand all elements in the WebKit Inspector elements view? -

is there way expand elements in elements view of chrome webkit inspector? if hold ctrl + alt windows (just opt on mac) while clicking on arrow of element want expand, expand , of children expand. so, if ctrl + alt click on <html> tag, should expand entire page. this link lists keyboard shortcuts chrome dev tools, including one.

sql server - How can I enforce that a record be a child of only one record when it can be a child of several tables? -

i'm brainstorming how restructure contact information of database. know, phone numbers can linked person (cell phone), family (home phone), organization/business, etc. logically, phone number phone number phone number. there's no real difference between cell phone number , home phone number. , person can have multiple cell phones, family can have multiple phone lines, , organization can have many many phone lines. normally, when designing tables, means there should single phone number table. , should link in 1 many persons or families or organizations. rub is, how enforce phone record owned single parent record, whether record person record, or family record, or organization record? the 2 ways i've figured out kludges, in opinion. want elegant solution. the first create 3 tables, personphones, familyphones , organizationphones. you've got 3 tables mission store same data. the second create single phone table weird structure. have phone number, nulla

c++ - How to memset a 2D arrray? -

i want memset 2d array 0. here's code.. giving me seg fault; bool **visited=new bool*[m]; for(int i=0;i<m;++i) visited[i] = new bool[m]; i have tried memset(visited, 0, sizeof(visited[0][0]) * m * m); , memset(visited, 0, sizeof visited); , nonw of works , gives me segfault. how do that? your array not contiguous since not multi-dimensional array. it's array of arrays, known jagged array. so, rows can, , will, disjoint. hence you'll need call memset on each row. bool **visited=new bool*[m]; for(int i=0;i<m;++i) { visited[i] = new bool[m]; memset(visited[i], 0, sizeof(visited[i][0]) * m); } although, can't refrain pointing out should using c++ features rather writing appears c use of new operator.

How to access CloudControl config.free CONFIG_VARS -

how access cloudcontrol config.free config_vars? as not documented here comes answer: if ($credfile = getenv('cred_file')) { $credfilecontents = file_get_contents($credfile); if ($credfilecontents !== false) { $creddata = json_decode($credfilecontents, true); $value = $creddata['config']['config_vars']['my_var']; } } that means within cred_file config addon has corresponding array/secction config contains array/section config_vars contains vars.

Bootstrap button sizes not working? -

Image
here 3 different button sizes: <div class="btn-group btn-small"> <button class="btn btn-small btn-success" href="#" type="button">approve</button> <button class="btn btn-small btn-danger" href="#" type="button">deny</button> </div> <div class="btn-group"> <a class="btn btn-mini btn-success" href="#">approve</a> <a class="btn btn-mini btn-danger" href="#">deny</a> </div> <div class="btn-group"> <a class="btn btn-success" href="#">approve</a> <a class="btn btn-danger" href="#">deny</a> </div> all 3 of result in this: why btn , btn-success , btn-danger , btn-group work, not btn-mini/small/etc? bootstrap changed names of buttons v2.3 v3.0 : 2.3 --> 3.0

VBA Excel Generate Unique Pages From Template and List -

i have been working on sometime (i not experienced in vba @ all), keep getting errors here are. setup: simplicity purposes have 2 worksheets in workbook. first, "daily order", list of products, each row being different product (approx. 1,000), each column indicating different information product (ie id, cost, weight, etc). second, "template", pricing template that, when given product information, generate pricing table. objective: create vba macro loop through each row of "daily order" worksheet , each row make copy of template sheet , append information new sheet. what doesn't work: sub generatepricebook() dim rw range dim temp worksheet dim ws worksheet dim daily worksheet set daily = worksheets("daily order") set temp = worksheets("template") temp.activate each rw in daily.rows temp.copy after:=sheets(sheets.count) set ws = sheets(sheets.count) ws.name = rw.value ws .range("a6&q

language agnostic - What is a better algorithm than brute force to separate items in overlapping categories? -

Image
i have arbitrary set of items (dots below), , number of categories overlapping in arbitrary way (a-c below). test determine whether it's possible each item assigned single category, among ones belongs to, such each category ends @ least number of items. so example, may require a, b, , c can each claim one item. if we're given 4 dots below, showing possible easy: stick items in list, loop through categories, , have each category remove item has access too, , long each category able remove 1 item, pass test. now suppose remove blue dot , repeat test. can assign yellow a, red b, , green c, , again pass. it's hard codify solution: if follow previous method (again no blue dot), suppose starts removing green dot. if b removes yellow dot, we'll fail test (since c can't remove red dot), whereas if b removes red dot, c can still take yellow , pass. one solve brute force iterating through every possible assignment of items categories, checking see if condition

iphone - Is it possible to interject your own audio once the ios media library has taken over? -

i wondering if possible insert own audio once ios media library has taken on in app? example: playing piece of audio after every song says number of songs you've listened day. i know because framework there many things let do. this should doable. start, can add class observer of mpmusicplayercontrollernowplayingitemdidchangenotification informed when song in ipod library changes. there, can tell ipod library pause, play track, , resume music playback afterwards. [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(somesel:) name:mpmusicplayercontrollernowplayingitemdidchangenotification object:nil]; [[mpmusicplayercontroller ipodmusicplayer] pause]; // play sound [[mpmusicplayercontroller ipodmusicplayer] play];

PHP, MySQL - how to parameterize timestamp comparisons -

i have $year , $month, , need select records timestamp after 1 year/month , before year/month where m.id = :magazineid , t.ischargedback false , t.`timestamp` >= str_to_date(:year'-08-01', '%y-%m-%d') , t.`timestamp` < str_to_date('2013-09-01', '%y-%m-%d') just started sub'd out 1 of year entries , query stopped finding rows. how 1 supposed parameterize this? did try using: `t`.`timestamp` between "$date1" , "$date2"? mysql between you might want try instead of using str_to_date, converting date timestamp

linux - Jenkins job failed due to tests failed. Source code for tests include AWT GUI tests, how to use Xvfb plugin -

environment - linux. << log on machine me (c123456) , " sudo su - jenkins " language - java project structure src/java -- java source code test/java -- junit unit tests src/java-test -- integration tests build system - gradle build.gradle sourcesets definitions: sourcesets { main { java { srcdir 'src/java' } } test { java { srcdir 'test/java' } } integrationtest { java { srcdir 'src/java-test' } } } lets checked out source code project "projectabc" somewhere. when run "gradle clean build", runs fine on local machine (windows win7 desktop) using cygwin session. java compile , test run successful. when run "gradle clean build" on linux terminal i.e. using putty session, fails during test task java compile part successful. when run "gralde clean build -x test", works (as excluding test task call).

javascript - Images are not scaling on Foundation -

i have been playing around zurb foundation framework on site: http://www.maxi-muth.de/test/zurb/ i used foundation template: http://foundation.zurb.com/page-templates4/grid.html it seems has problems scaling images. using chrome displayed fine . in firefox images @ landing page overlapping each others (/they displayed in original size (which not happening in original foundation template) same happening foundation thumbnails used here: http://www.maxi-muth.de/test/zurb/shortcodes what need get (back?) the automatic scaling? i think it's no real solution (because still original file size used), adding max-width of 100% images, suit parent.

Ridge regression in matlab -

i have doubt ridge regression in matlab. have mentioned @ http://www.mathworks.com/help/stats/ridge.html , ridge regression mean centers , make std equal 1 predictors. however, see doesn't. e.g. let x be 1 1 2 1 3 5 1 9 12 1 12 50 let y be 1 2 3 4 it doesn't normalization of xs 0 mean , unit variance. clarifications what's going on? mean ridge should normalization of data i.e x 0 mean , unit variance , calculate coefficients. expecting ridge(y,x,0,0) give me result of r=inv(x'*x)*x'y r takes x , y normalized the output must same, ridge regression makes calculation more stable numerically (less sensitive multicollinearity). == update == now understand better ask :) documentation says: b = ridge(y,x,k,scaled) uses {0,1}-valued flag scaled determine if coefficient estimates in b restored scale of original data. ridge(y,x,k,0) performs additional transformation. you've set both third , fourth

javascript - Hide/Show div, how to change tag within script -

i have simple working script shows , hides div. the problem cannot set tag id or class , set element selector not want. can change within js allow me set class can show/hide on click. fiddle http://jsfiddle.net/dxway/2/ $("p").click(function () { $("div").slidetoggle("slow"); }) p { border:0 none; font-size:2em; background:transparent; } div { display:none; width:400px; height:200px; background:#f5f5f5; } <p>hello</p> <div class="div">hello</div> were trying create accordion? jsfiddle <div id="portfolio"> <div class="portfolio-img"> <a class="togglebtn">click me!</a> <div class="content">lorem ipsum dolor sit amet, consectetur adipisicing elit. inventore accusamus porro modi ut itaque ipsum natus explicabo vero sequi beatae libero voluptatibus sit culpa debitis tempore!

ruby - How do you properly incorporate logging support? -

i'm building ruby gem (silently) consumes few third party apis. i'd offer users of gem ability turn on debug mode causes gem emit information it's doing. what patterns/rules/common solutions implementing sort of feature? what libraries should used? what considerations should give dev vs prod environments? where should send debug info? (log file?, stdout etc) any examples should at?

box api - Add groups as collaborator -

i trying add group collaborator of folder using box.net api can't. i not having issues add users, couldn't add groups. i doing it: {id: "group_id"} getting "not found" error. i checked group , folder id , both correct. did face issue before? there can me this? appreciate it. thanks in advance, regards, marcelo you have group administrator on box enterprise in order manage groups. may need ask box admin add co-admin, , give "manage groups" permission.

mysql - Inverse of Inner join (Intersect) with multiple foreign keys -

hi want opposite of intersect 2 tables. i have sale table , purchase table. want purchases ids not included in sales table. sale table sale_id (pk) product_id (fk) purchase_id (fk) purchase table product_id (fk) purchase_id (pk) select distinct purchase_id , product_id purchase inner join sale using (purchase_id, product_id); here example: if run above code, result. purchase_id product id 1 1 1 2 1 4 2 1 2 3 now want get: purchase_id product id 1 3 2 2 in short want inverse of above code. in advance. okay, think understand better now. this should return entry in purchase have no matching entry in sales. select `purchase`.`purchase_id`, `purchase`.`product_id` `purchase` left join `sale` on `sale`.`purchase_id` = `purchase`.`purchase_id` , `sale`.`product_id` = `purchase`.`product_id` `sale`.`sale_id` null order `purchase`.`purcha

javascript - Update value of onClick dynamicly -

i'm adding quantity-field orderform adding of item card done way: function updatearchive(id,quant) { jquery.ajax({ type: "post", url: "' . gbc_plugin_url . '/includes/gb-order.php", data: { "gbid": id , "qtty": quant }, success: function(data){ alert("' . __('item added successfully!', 'gbcart') . '"); }, error: function(data){ alert("' . __('this item exists!', 'gbcart') . '"); }, }); } the quantity of items put cart set "quant", well, here's problem: the function "updatearchive" started following command: <td class="basket"><a href="#" class="gb-button" onclick="updatearchive(125,5); return false;">' . __('auf die bestellliste', 'gbcart') . '</a><

jquery - Closing custom selectbox when opening a new one -

i've decided make working jsfiddle example make easy suggestions. i have custom button toggles down list. functions <select> input can styled way i'm needing. need write logic jquery close other open select boxes if go click new one. i have every other scenario of needing close select box taken care. code below. jsfiddle: working example here can modify js close .not() select box being clicked? if using active status classes target active selectbox , close down, proceed rest $(this).children('.btn.select').click(function(){ $('.active').next('.options').slideup('regular'); // close active 1 if ($(this).next('.options').is(':hidden')){ $(this).next('.options').slidedown('regular'); $(this).addclass('active'); } else { $(this).next('.options').slideup('regular'); $(this).removeclass('active'); } retu

ruby - Saving custom fields in devise User model in rails 4 -

i made devise user model , added additional fields it. when create , account works fine, email, pw , pw conf. i want allow user go edit page , fill in optional additional fields. but, when submit, saved nil. class registrationscontroller < devise::registrationscontroller before_action :configure_permitted_parameters, if: :devise_controller? def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_in){ |u| u.permit(:email, :password) } devise_parameter_sanitizer.for(:sign_up){ |u| u.permit(:name, :username, :about, :email, :password, :password_confirmation)} devise_parameter_sanitizer.for(:account_update){ |u| u.permit(:name, :username, :about, :email, :password, :password_confirmation) } end def update self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key) if resource.update_with_password(user_params) if is_navigational_format? flash_key = update_needs_confirm