Posts

Showing posts from March, 2015

ruby - Simple array sort and capitalize -

new ruby , trying stuff. code below convert array string while sorting , display sorted results. i'm struggling use of capitalize method caps sorted words. the_data = ["dog", "cat", "fish", "zebra", "swan", "rabbit", "horse", "albatros", "frog", "mouse", "duck"] puts "\nthe array:\n" puts the_data puts "\n" puts "\nthe sorted array, capitalized:\n" to_display = the_data.sort.join(("\n").capitalize) puts to_display you can use array#map capitalize each word of array to_display = the_data.sort.map(&:capitalize).join("\n") # => "albatros\ncat\ndog\nduck\nfish\nfrog\nhorse\nmouse\nrabbit\nswan\nzebra" if want capitalize letters, can use upcase to_display = the_data.sort.map(&:upcase).join("\n") # => "albatros\ncat\ndog\nduck\nfish\nfrog\nhorse\nmouse\nrabbit\nswa

vba - sorting range based on other column values in Excel 2010 -

Image
i have excel sheet contain data below: what need sorting range d2:e10 based on column values we need result this: is there method allow that? (we recommend not use macro if possible) the closest solution no macros is select column , d use conditional fomat -> highlight cells rules --> duplicated values now douplicted values cell color chaned select range a2:b7 , custom sort using cell color, not colored cells @ bottom do same range d2:e10 hope you

.net - Inherit and add properties to child class -

i can inherit class, , add properties new class... good. class class1 property string end class class class2 inherits class1 property b string end class dim mytest new class2 mytest.a = "bleh" mytest.b = "bah" how add properties child class inside class inheriting? class class3 property string class class3_1 property c string end class end class how create new class enherits class3, add property class3_1, inside new enherited class? new edit actual non working code public class testclass public class class1 property x string property firstchildclass new class1_1 public class class1_1 property string end class end class public class inherited_class1 inherits class1 public class class1_1 '///// warning here use "shadows" keyword.. not work... takes away warning, still cant access property b when using new instance of class propert

c# - Font not reflected while converting html to word document -

i have website in c#asp.net 4.0. here using html open xml code , dll. for doing going following steps:- 1) first open existing word doc copy paragraph having font "arial". 2) parse html html word conversion code using htmltoopen xml dll. and c# code here :- protected void btnexporttoword_click(object sender, eventargs e) { string readtext = string.empty; const string filename = "c:\\temp\\exporttodocnew1.docx"; try { htmlfile = "<html><head><style type=\"text/css\" media=\"screen,print\">"; htmlfile += " .divpagebreak { page-break-after: always; display: block; clear: both;}"; htmlfile += " table,td{border:1px solid black;border-collapse:collapse;}"; htmlfile += "</style></head><body><div class=\"divpagebreak\">" + "<p>&nbsp;<

python 2.7 - Mongodb with very high CPU rate -

when ran following code , killed immediately(that means abnormally exit), cpu rate of mongodb go extremely high(around 100%): #-*- encoding:utf-8 -*- import threading import time import pymongo single_conn = pymongo.connection('localhost', 27017) class simpleexamplethread(threading.thread): def run(self): print single_conn['scrapy'].zhaodll.count(), self.getname() time.sleep(20) in range(100): simpleexamplethread().start() \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ virt res shr s %cpu %mem time+ command 696m 35m 6404 s 1181.7 0.1 391:45.31 mongod \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ my mongodb version 2.2.3. when mongodb worked well, ran command "strace -c -p " 1 minute giving following output: % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 33.50 0.322951 173 1867 nanosleep 33.19 0.319950 73

java - Listview with pull to refersh Scroll down to last item when adding header-view -

i have created 1 pull refresh listview when scroll or pull little bit have add header view. here custom listview class package com.app.refreshablelist; import android.content.context; import android.graphics.bitmap; import android.graphics.bitmap.config; import android.graphics.canvas; import android.graphics.drawable.drawable; import android.os.handler; import android.os.message; import android.util.attributeset; import android.view.layoutinflater; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; import android.view.viewconfiguration; import android.view.animation.animation; import android.view.animation.animationutils; import android.widget.imageview; import android.widget.linearlayout; import android.widget.listview; import android.widget.progressbar; import android.widget.textview; import com.app.xxxxxx.r; import com.google.android.gms.internal.el; public class refreshablelistview extends listview { boolean isscro

c# - Formatting issue with Importing data from a DataSet to an Excel Sheet -

i working data in dataset , trying import excel file using openxml in c# , successful in doing in dataset have columns of type datetime , integer , double code importing columns plain text , making impossible me sort them value on worksheet. using following code public void exportdataset() { try { string fromformat = "dd/mm/yyyy"; string toformat = "mm-dd-yyyy"; datetime newdate = datetime.parseexact(datetime.today.tostring(fromformat), fromformat, null); string filedate = newdate.tostring(toformat); string destination = @"z:\physical db data " + filedate + ".xls"; using (var workbook = spreadsheetdocument.create(destination, documentformat.openxml.spreadsheetdocumenttype.workbook)) { var workbookpart = workbook.addworkbookpart(); workbook.workbo

php - How to download multiple HTML tables to Excel using JavaScript -

i have page multiple html tables there...i need download html tables microsoft excel . current coding have can download first table need download tables. this javascript have used: <script type="text/javascript"> var tabletoexcel = (function() { var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/tr/rec-html40"><head><!--[if gte mso 9]><xml><x:excelworkbook><x:excelworksheets><x:excelworksheet><x:name>{worksheet}</x:name><x:worksheetoptions><x:displaygridlines/></x:worksheetoptions></x:excelworksheet></x:excelworksheets></x:excelworkbook></xml><![endif]--></head><body><table>{table}</table></body></html>' , base64 = function(s) { re

c# - new Thread() Parameterized start in WPF -

i've been doing in winforms forever : new thread((query_) => { functions.updateinsert(query_); }).start(query); but when try in wpf, ide tells me "delegate 'system.threading.threadstart' not take 1 arguments." is done differently in wpf? any appreciated. thanks! try using way : thread t = new thread(()=> functions.updateinsert(query)); t.start();

Use <?php as plain text in a .php file? -

i have this.php: <?php //some code ?> here goes text plain text. whenever use <?php in .php file precedes php code parsed , interpreted php. as may have guessed, file gives error , refuses run correctly. don't want use html entities result file isn't used html. options other storing string <?php in variable? generate programatically using string literal. <?php echo "<?php"; ?>

delphi - TTaskBar - Show another form with TaskBarButtons -

i use delphi xe6 : create taskbarbutton in taskbar. button linked on action make : tform2.create(nil).showmodal; the form2 showing without focus. , sometimes, complex form, new form appears behind application , have click anywhere see it. why haven't focus on new form created taskbutton ? (if click on simple button, new form have focus). code in mainform : unit unit1; interface uses winapi.windows, winapi.messages, system.sysutils, system.variants, system.classes, vcl.graphics, vcl.controls, vcl.forms, vcl.dialogs, unit2, system.actions, vcl.actnlist, system.win.taskbarcore, vcl.taskbar; type tform1 = class(tform) actionlist1: tactionlist; action1: taction; taskbar1: ttaskbar; procedure action1execute(sender: tobject); private { déclarations privées } public { déclarations publiques } end; var form1: tform1; implementation {$r *.dfm} procedure tform1.action1execute(sender: tobject); var formtest : tform2; begin try

javascript - How to apply transition effects between knockout amd components -

is possible have animated transition between components in knockout loaded using require? when state() changes, components faded/slid place? i have done similar things in past fadevisible, not appear work amd/require , new components api. ideas? :) registration // register knockout components ko.components.register('breadcrumb', { require: './modules/breadcrumb/breadcrumb' }); ko.components.register('splash', { require: './modules/splash/splash' }); ko.components.register('catalogue', { require: './modules/catalogue/catalogue' }); ko.components.register('requests', { require: './modules/requests/requests' }); usage <div id="main"> <breadcrumb></breadcrumb> <!-- ko if: state() === 'home' --> <splash></splash> <!-- /ko --> <!-- ko if: state() === 'catalogue' --> <catalogue></c

JPA Criteria: issue of querying properties of subclass -

i using hibernate 4.3.6.final, supports jpa 2.1. need build complex query based on user input. got rest done , working, still have problem. let's put metamodel or other solutions aside see how current problem can solved. the following class structure , relationships: class baseobject implements serializable { } class extends baseobject{ @onetomany(mappedby = "aref", fetch = fetchtype.lazy, cascade = {cascadetype.persist, cascadetype.remove, cascadetype.merge}, orphanremoval = true) private list<b> blist; } class b extends baseobject { @manytoone(fetch = fetchtype.lazy) @joincolumn(name = "aref") private aref; } //-------------note subclass of b------------ class c extends b { @onetomany(mappedby = "cref", fetch = fetchtype.lazy, cascade = {cascadetype.persist, cascadetype.remove, cascadetype.merge}, orphanremoval = true) private list<d> dlist; } class d { @manytoone(fetch = fet

apigee - Obtaining message processor ip -

we're trying add originating ip address target request , wasn't able find how access ip address of message processor. did find in documentation: system.interface.{interface_name} i'm not sure if yield want nor know correct interface_name be. in advance. please send email help@apigee.com name of org using , forwarded on send ip addresses of message processors.

java - How to add a button to a panel using a method and access it from the main? -

let's want create method adds button stackpane . want access button, exemple want add eventhandler main: public class test extends application { @override public void start(stage primarystage) throws parseexception { stackpane root = new stackpane(); addbutton(root); // here want add event handler b cannot access // b.addeventhandler(); scene scene = new scene(root, 300, 250); primarystage.settitle("hello world!"); primarystage.setscene(scene); primarystage.show(); } public void addbutton(stackpane sp){ final button b = new button("test"); sp.getchildren().add(b); } /** * @param args command line arguments */ public static void main(string[] args) { launch(args); } } since button local addbutton need have reference it. return reference of button addbutton method , use it. it better use way public bu

dictionary - Extend dict from key/values pair to key/value pair in Python -

mydict = {'121': ['adrian', 'alex', 'peter'], '122': ['john', 'vic', 'bill']} i want 'extend' dictionary each key/value pair consists of 1 value, instead of list. tried iterating mydict.keys() , mydict.values() , construct new dict, didnt work out (i'm quite new python3). want achieve: mynewdict = {'121': 'adrian', '121': 'alex', '121': 'peter', '122': 'john', '122': 'vic', '122':'bill'} based on comments above, here's how invert dict , allow multiple values each key: from collections import defaultdict mynewdict = defaultdict(list) staff_id, names in mydict.items(): name in names: mynewdict[name].append(staff_id) you might use defaultdict of set , add instead of list , append if order doesn't matter: from collections import defaultdict mynewdict = defaultdict(set) staf

Powershell v2 - The correct way to load an assembly as part of a module -

i have powershell (v2.0) script working on. one of first things loads module (runmysqlquery.psm1) includes (amongst other bits) function connect mysql database. import-module runmysqlquery.psm1 however, requires assembly mysql.data.dll loaded in order work. if place line: [void][system.reflection.assembly]::loadfrom("c:\powershell\modules\runmysqlquery\mysql.data.dll") at top of script (separate import-module entry), whole thing works fine. but want able load assembly @ same time module, don't have worry forgetting including assembly each time use module. i tried placing @ top of .psm1 file, didn't work. i added manifest file as: requiredassemblies = @("c:\powershell\modules\runmysqlquery\mysql.data.dll") this didn't work. am missing here, there proper way include assemblies part of module? n.b. error when hasn't loaded is: you cannot call method on null-valued expression can try assign varialbe beginig of modu

javascript - Create my own controls (play, pause, mute, seek) for JW-Player -

i'm using jw-player in web (written using angularjs , twitter bootstrap) . i want create own panel controls video, buttons such play/pause, mute/un-mute , seek bar. i saw in api documentation can control video functions. the buttons play/pause part easy... how create track bar change video position seek option? i can't find example how use seek option. thanks

ubuntu 14.04 - Cannot create a new device in AVD Device Definitions -

Image
i using ubuntu linux machine when code android applications. when start avd , want create custom device definition, nothing happens when click on "create device" button. remember possible in past, @ point stopped working. cannot determine when stopped working. the data on image bogus ones, definition should created. i have gone thru similar topics on se, have updated sdk components, new definition still cannot created. does have idea? out of ideas.

Android - Close popUpWindow when clicked outside of the view -

i have small problem popup window functionality.i close when user clicks outside of window.i have read lots of atricle on stackoverflow, not single articles helped me. have tried is, have tried popupwindow.setbackgrounddrawable(null); not worked me. layoutinflater inflater = (layoutinflater) this.getsystemservice(context.layout_inflater_service); view layout = inflater.inflate(r.layout.popupmenu_layout, (viewgroup) findviewbyid(r.id.popuplinearlayout)); pw = new popupwindow(layout, 300, 300, true); pw.showatlocation(layout, gravity.center, 0, 0); pw.setbackgrounddrawable(null); pw.setoutsidetouchable(true); //todo remove popup window when outside touched... if know article may me appreciate it.it posible features not working in emulator ? have emulator right now.(android 4.4.2) and if marcin's constructor deprecated, use pw.setbackgrounddrawable(new bitmapdrawable(getresources(),""));

New Facebook approval process , how to test ios app -

long time haven't developed facebook api , , have ios app using graph api upload image , status facebook working fine . problem can't test real users . seams app in kind of testing mode until approved . question how can approved before upload app appstore? go facebook profile click on manage app , myapp section on top choose app , left click status&review , on right hand side see button name start submission click on button.

java - Problems With SableCC Grammar File -

i seem having issues sablecc generating relevant lexer, node , parse stuff automatically generates grammar file. i'm not implementing abstract syntax tree @ moment. when try run sablecc grammar file below, following error: [41,33] redefinition of afunctionhead.id. have know idea problem is, seems in productions area. perhaps missing something? package grammar_specification; helpers digit = ['0'..'9']; letter = (['a'..'z'] | ['a'..'z']); underscore = '_'; plus = '+'; minus = '-'; mult = '*'; div = '/'; equals = '='; l_par = '('; r_par = ')'; l_curly = '{'; r_curly = '}'; unicode_input_character = [0..0xffff]; lf = 0x000a; cr = 0x000d; line_terminator = lf | cr | cr lf; input_character = [unicode_input_character - [cr + lf]]; not_star = [input_character - '*'] | line_terminator; not_st

Facebook Video Posts with the same OG tags looks different -

facebook seems change things fast.. existing questions have seen older facebooks "big image" posts, question (partially) related to. i'm testing facebook interaction including meta tags in page add youtube player og:video on page on site. all og tags validate , can post links , video embeded. problem while both facebook og debug tool , post understand title , description of page, post seems behave strangely when played compared youtube link. look @ differences here: http://imgur.com/a/kovkk i have tried combinations , order of og tags can think of, cannot seem same result page link youtube link. , since facebook debugger sees exact same values, can not see how interpreted differently..? here og debugger comparison: http://i.imgur.com/dqok8ag.png has else experienced this, or familiar inner workings of facebook? the pages used test these, although 1 on site might have changed when read this. solved it! behaviour triggered size of og-image, , if s

Get count and sum for each ip from mysql table -

im been looking generating ip address report 1 table , inserting have yet succeed or find resource allow me so. my ip table contains many duplicate ip's , sum(minutes) of minutes , count(name) each distinct ip ip name minutes 199.199.199.199 nick 23 199.199.199.200 nick 3 199.199.199.200 bob 34 199.199.199.201 bob 56 199.199.199.201 sue 12 199.199.199.202 sue 45 199.199.199.202 helen 65 199.199.199.202 helen 15 my current method following select distinct(distinct) ip `ip.ip_stats`; in php, add each of distinct ip addreses array $arr = array("199.199.199.199","199.199.199.200","199.199.199.201","199.199.199.202"); once array generated run through each in array foreach($arr $ip){ sql ="select count(name) cnt, sum(minutes) sum `ip.ip_stats` ip='$ip'"; $result = mysqli_query($con, $query); while ($row = mysqli_fetch_

javascript - Project organization and naming conventions -

this follow-up repeating module name each module component question. we've decided follow suggested in best practice recommendations angular app structure blog post angular project organization , naming conventions while building small internal application measuring connection quality. and we've got @ moment: $ tree -l 1 . ├── app-config-service.js ├── app-config-service_test.js ├── app-connection-service.js ├── app-connection-service_test.js ├── app-controller.js ├── app-controller_test.js ├── app-countdown-directive.js ├── app-countdown-directive_test.js ├── app-footer-directive.js ├── app-footer-directive_test.js ├── app-footer-service.js ├── app-footer-service_test.js ├── app-math-service.js ├── app-math-service_test.js ├── app-stats-directive.js ├── app-stats-directive_test.js ├── app-status-directive.js ├── app-status-directive_test.js ├── app-status-service.js ├── app-status-service_test.js ├── app-time-directive.js ├── app-time-directive_test.js ├── app.css

ios8 - ios 8 UILocalNotification missed, only sound -

i schedule local notification in app this: uilocalnotification * notification = [uilocalnotification new]; notification.applicationiconbadgenumber = 1; notification.repeatinterval = nscalendarunitminute; notification.firedate = date; notification.timezone = default_time_zone; notification.alertbody = alertbody; notification.alertaction = @"view"; notification.soundname = @"my_sound"; notification.userinfo = userinfodict; [[uiapplication sharedapplication] schedulelocalnotification:notification]; on latest version of ios 8 gm broken, can hear sound notification, there no alert, no messages in notification сentre , on. added - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions: .... if ([[uiapplication sharedapplication] respondstoselector:@selector(registerusernotificationsettings:)]) { //ios 8 uiusernotificationsettings* notificationsettings = [uiusernotificationsettings settingsfort

How to build witt django-mptt a query joining to any descendant of mptt hierarchy element? -

i want build django-mptt hierarchy of vegetables classes (fruit -> berries -> strawberry -> douglas strawberry) being last level variety. retailer stocks related leaf level, variety (golden apple, douglas strawberry...), consumers used ask upper level (apple, pear, orange, lettuce...). useful query wold "select retailers having stock product of 'strawberry' or children. let me illustrate example code: class vegetable(mpttmodel) : name = textfield(...) group = treeforeignkey('self', related_name='subgroups', null=true, default=none) class mpttmeta: parent_attr = 'group' def getretailers(self) : # here missing code class retailer(model) : name = textfield(...) vegetables = manytomany(vegetable, null=true) fruits = vegetable(name='fruit') pears = vegetable(name='pear', group=fruits) apples = vegetable(name='apple', group=fruits) goldenapples = vegetable(

How to get the last person who modified a file in Git? -

can find out modified given file last? can find out list of changesets affected given file? this command should give commits changed file diff. can see made commit. git log -p <filepath>

javascript - jquery class toggle not closing previous -

html <div class="wrap"> <div class="t1"> head 1 </div> <div class="t2"> hi </div> </div> <div class="wrap"> <div class="t1"> head 2 </div> <div class="t2"> hi2 </div> </div> jquery $(".t2").hide(); $(".t1").click(function(){ $(this).next(".t2").toggle(); }); i pressed first t1 t2 opening , when press second t1,first t2 should close still open http://jsfiddle.net/q539mqon/3/ you need hide in click handler var $t2s = $(".t2").hide(); $(".t1").click(function () { var $t2 = $(this).next(".t2").toggle(); $t2s.not($t2).hide(); }); demo: fiddle

Knockout.js mapping not updating -

i have table of records. whenever data server want update field in viewmodel. js: $(document).ready(function () { var data = json.parse($("#model").val()); var vm = new koviewmodel(data); ko.applybindings(vm); .... //ajax call -> update viewmodel { vm.loaddata(data); } }); var koviewmodel = function (data) { var self = this; self.items = ko.mapping.fromjs(data); }; self.getrecord = function (id) { var match = ko.utils.arrayfirst(self.items(), function (item) { return item.id() === id; }); if (match) { return match; } }; self.loaddata = function (data) { $.each(data.componentbases, function (i, item) { ko.mapping.fromjs(item, {}, self.getrecord(item.id)); }) }; }; html: <tbody data-bind="foreach: items"> <tr> <td data-bind="text: name"></td> <t

unity3d - Unity 2D use clones as independent gameobjects -

i'm making 2d unity game , in can move on 3 lanes , fire arrows affects specific lane. in order i'm changing layer of arrow prefab every time move 1 lane another. arrows change children of terrain on hit, when arrow prefab change layer, clone arrows same(even ones parented terrain in other lane) how can make arrows parented terrain not affected arrow prefab change of layer? thanks you you're changing prefab layer, if that's correct, you're changing every clone made prefab. if want change each lane's arrows themselves, should change clones directly, not prefab. maybe add 3 lists of arrows, 1 each lane, , each time fire arrow, have added list. can iterate on list changing every gameobject layer.

Django - Primary Key field related to foreign key -

Image
i want instances of feature model share foreign key have id. when new feature created, want auto-increment id. if take @ print feature table in database, each feature has foreign key (shapefile_id) , share same shapefile_id, have unique id (id_relat) i know if there better way handle have found far: class shapefile(models.model): filename = models.charfield(max_length=255) class feature(models.model): shapefile = models.foreignkey(shapefile) id_relat = models.positiveintegerfield(db_index=true) def meta(self): unique_together = (("shapefile", "id_relat"),) def save(self, *args, **kwargs): if not self.id_relat: #assign incremented id new feature self.id_relat = cal_id_relat(self.shapefile) super(feature, self).save(*args, **kwargs) def cal_id_relat(shapefile): ids_relat = feature.objects.filter(shapefile=shapefile).order_by('-id_relat').values_list('id_relat',flat=true) i

ios - Custom table view cell in Swift, without Storyboard -

i'm new learning ios development , swift language, , have been trying figure out how create custom uitableviewcell without use of storyboards/interface builder. i'd able accomplish in swift code. far, i've been able find ones make use of interface builder. what able create re-usable cell can instantiated in table view. understand should able create custom cell sub-views, whos data can set table view's incoming data. right? right have uinavigationcontroller embedded, sub-classed uitableviewcontroller . following other tutorials i've learned how create struct , prepare test data table view cell. that's far i've been able get. // table view controller class inventorylistviewcontroller: maintableviewcontroller { let viewtitle = "inventory" var inventoryitems = [inventoryitem]() override func viewdidload() { super.viewdidload() self.navigationitem.title = viewtitle.uppercasestring self.inventoryitems =

How to safely minify a JSON file in C? -

i've taken @ responses in can comments used in json? commenting json files, , general consensus either don't use data comments write comment , minify them i'd third approach if possible, seems googling json minifier other standard javascript 1 worthless approach problem. is there json minifier library c? strongly prefer not write 1 myself. thanks, most json libraries can both reading (decoding or parsing json) , writing (encoding or printing json). several have options (e.g. indent or not) printing. read json data, , print appropriate flags. should "minify" json for jansson library see flag json_compact json_dumpf (and, commented, json_decode_any json_loads )

javascript - select2-rails gem: installed assets and called function but dropdown not changing (TypeError: undefined is not a function) -

there several posts similar on have yet find 1 has answer checked correct. trying implement select2-rails gem in rails 3.2 app following instructions @ github page . bundled gem , included javascript , css files. added js function call 1 in sample code . select bar, however, isn't changing @ all. javascript include: # application.js //= require jquery //= require jquery_ujs //= require select2 //= require jquery-1.11.0.min.js //= require lightbox.min.js //= require parsley //= require ./jquery.datetimepicker.js //= require stripe/jquery.payment.js //= require_tree . css includes: # application.css.less /* *= require_tree . *= require select2 *= require select2-bootstrap *= stub active_admin */ my page form, trying replicate example: # new.html.haml =content_for :title, 'post job' = javascript_include_tag "https://js.balancedpayments.com/1.1/balanced.js" :javascript var _balanced_marketplace = "#{@balanced_marketplace}"; var _cate

sql server - SQL Trigger not executing -

i have simple sql trigger cannot work. code below. trying have trigger run if "vendid" column updated in table1. trigger should write hardcoded record inventory table shown below, not doing this. alter trigger [dbo].[table1_vendorid_modified] on [dbo].[table1] after update begin set nocount on if (update(vendid)) begin insert database1.dbo.inventory ( classid , crtd_user , lupd_datetime , lupd_user , vendid ) select '1', 'username', '9/10/2014', 'user1', '123456abcdef' end

What does this mean in a storm topology "storm Insufficient Capacity on queue to emit"? And how can I increase the queue size or fix this? -

i have storm topology running , message in debug logs 1 of bolts "storm insufficient capacity on queue emit". bolt sends message bolt on particular stream. next bolt trying write data db , hence slower. does mean next bolt's internal queue full , hence no more messages emitted? how can increase queue size? these messages re tried once next bolt has processed messages?

php - Where does Laravel store configuration for memcached session driver? -

the laravel docs specify can enable memcached session handler in app/config/session.php ; however, not specify memcached configured (such servers use). i see can configure memcached in app/config/cache.php , don't know if that's used cache driver or session handler well. yes, config in app/config/cache.php cache drivers is used session driver well. take @ vendor/laravel/framework/src/illuminate/session/sessionmanager.php . method creates instance of memcached session driver one /** * create instance of memcached session driver. * * @return \illuminate\session\store */ protected function creatememcacheddriver() { return $this->createcachebased('memcached'); } that method calling other method in same file /** * create instance of cache driven driver. * * @param string $driver * @return \illuminate\session\store */ protected function createcachebased($driver) { return $this->buildsession($this->createcachehandler($driver)

generate random phases between 0 and 2pi in excel -

i know how generate independently distributed phases between 0 , 2*pi in excel?i used formula =randbetween(0,2*pi()) in matlab can done angle = (2*pi) * rand(1,4) -to 4 phase ,but in excel?any appreciated in advance in excel should be =rand() * pi() * 2

ruby on rails - swagger_doc.json returns wrong swagger doc urls -

my https://x.y/api/swagger_doc.json returns this: {"apiversion":"0.1","swaggerversion":"1.2","produces":["application/xml","application/json","application/vnd.api+json","text/plain"],"apis":[{"path":"/ping.{format}","description":"operations pings"},{"path":"/ping_dev.{format}" notice path pointing /ping.{format} should point /swagger_doc/ping.json. because of swagger ui gives me error: unable read api 'friends' path https://x.y:443/api/ping.json i can access manually ping.json form https://x.y:443/api/swagger_doc/ping.json . content needed swagger ui: {"apiversion":"0.1","swaggerversion":"1.2","resourcepath":"/ping","produces":["application/xml","application/json","application/vnd.api+json","text/plain

java - How to capture request from REST call? -

how can capture request rest call? i using code smartystreets: https://github.com/smartystreets/liveaddresssamples/blob/master/java/liveaddressexample.java (i inserted auth id , auth token.) i tried using string stored in req , not correct. [edit] object request live on? as can see can see in example, opening new url connection, in way, think aren't complete "request object" can recover (that means object contains target, headers , content of message, etc), since managing separate connection, headers , content message, each of these, components of request, have separate, have 1 question info need not available in code?

javascript - GMail API access from chrome extension? 403 Forbidden -

i have application accesses google apis out of chrome extension via workflow outlined here. chrome extensions oauth tutorial the basics of workflow initialize oauth flow var oauth = chromeexoauth.initbackgroundpage({ 'request_url': 'https://www.google.com/accounts/oauthgetrequesttoken', 'authorize_url': 'https://www.google.com/accounts/oauthauthorizetoken', 'access_url': 'https://www.google.com/accounts/oauthgetaccesstoken', 'consumer_key': '{my_client_id}', 'consumer_secret': '{my_client_secret}', 'scope': 'https://www.google.com/m8/feeds/ https://apps-apis.google.com/a/feeds/emailsettings/2.0/ https://mail.google.com/', 'app_name': 'gmail plugin', 'callback_page': 'src/google-oauth/chrome_ex_oauth.html' }); upon installing extension, user taken dialog page authenticate , agree scopes ask for. here infer consumer ke

sql server - Query Performance Paradox: Unique Clustered vs Non-Unique Non-Clustered Index -

i have table my_table approximately 9 million rows. there in total of 38 columns in table. columns relevant question are: record_id : identity, bigint, unique clustered index record_created : datetime, non-unique & non-clustered index now run following 2 queries , naturally expect first 1 execute faster because data being sorted column has unique clustered index somehow executes 271 times(!) slower. select top 1 record_id my_table record_created >= '20140801' order record_id select top 1 record_id my_table record_created >= '20140801' order record_created the execution times 1630 ms , 6 ms, respectively. please advise. p.s. : due security policies of environment cannot see execution plan or use sql profiler . sql server has few choices make how perform query. could begin sorting items, leveraging indexes mentioned, , follow filtering out items don't match clause. however, it'

ios - Using .xib file as the custom camera overlayview -

i created cameraoverlayviewcontroller .xib file implement customized camera overlayview with. overlayview transparent background button select photo photolibrary , loads in mainviewcontroller following code: cameraoverlayviewcontroller* overlay = [[cameraoverlayviewcontroller alloc] initwithnibname:@"cameraoverlayviewcontroller" bundle:nil]; camerapicker.cameraoverlayview = overlay.view; however, nothing happens when pressed button on cameraoverlayview. no error messages, nothing. know what's going on here? below code in cameraoverlayviewcontroller file: - (ibaction)select:(uibutton *)sender { uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init]; [self dismissviewcontrolleranimated:yes completion:^{ [self presentviewcontroller:picker animated:yes completion:nil]; }]; picker.delegate = self; picker.allowsediting = yes; picker.sourcetype = uiimagepickercontrollersourcetypephotolibrar

javascript - How to remove element from HTML string? -

this doesn't seem working, uncaught type error on .remove() line: js: var str = $("a").html(); var $html = $.parsehtml(str); $("i",$html).remove(); $("div").html($html); html: <a href="#">hello <i>bob</i></a> <div></div> how work? you can clone a , change html code of clone , put clone inside div . fiddle . $(document).ready(function() { var clone = $("a").clone(); clone.find("i").remove(); $("div").html(clone); });

java - How do I draw a short line over a bar on an XYPlot using XYBarRenderer? -

Image
i'm using jfreechart , xyplot , xybarrenderer plot horizontal bar graph. need draw line on each bar in graph that's width of bar, (the red lines): those red lines aren't same size blue bars, fine, can't cover entire graph. i've been toying around answers posted this question , i've been trying use xybarrenderer.draw... , xybarrenderer.add... no avail. any appreciated! ideally in jfreechart create chart using dataset implements intervalcategorydataset interface , renderer can render both bars , median markers directly data. however, main implementation of dataset interface bit cumbersome use , there not renderer draws visual representation looking for. the next best thing (that can think of) use overlaid chart, allows median markers overlaid on top of bars - requires 2 datasets , 2 renderers. here result (the source code follows): /* ======================= * overlaidchartdemo1.java * ======================= * * copyright (c) 2