Posts

Showing posts from March, 2015

google scripts onedit -> email trigger for range produces an email for each edit -

i know happening by-design i'm trying figure out how people deal - tried few different approaches think i'm not thinking right way ( i'm more of bash scripter :) ). i have google sheet script onedit on range of cells: if cell in range edited, email sent. good! now, if edits, 5 cells in range, 5 emails sent. bad! so seems need way have each script run "know" each other , send email after amount of time after first cell edited? i looked @ clue setting flag prevent other edits... https://developers.google.com/apps-script/articles/sending_emails#section2 i have imagine common thing figure out it's not coming me. thanks guys ideas, jl use script propertiesservice save timestamp. example script below send email once day. https://developers.google.com/apps-script/reference/properties/ var settings = propertiesservice.getscriptproperties(); var lasteditemaildate = settings.getproperty('lasteditemaildate'); var today = new date().t

java - Spring HttpMessageConverter for only one Controller? -

i'm aware of , comfortable using spring message converters automatically convert objects controller returns into, e.g. json. however, haven't been able find information applying particular message converter only one of several controllers in app. basically, have 1 particular piece of app show audit log entries, , ever viewed admin, doesn't need pretty. i'd write quick httpmessageconverter takes list<auditentry> , returns string html table of entries, else in app user-facing , gets sent on json. possible? didn't see mention of in docs read. if is, what's magic xml? the @requestmapping anotation has produce produces producible media types of mapped request, narrowing primary mapping. so in case of json have in produce - "application\json" when want return html can use "text\html" , use modelandview of spring-mvc

java - Mapreduce Hbase file not found exception -

i trying populate data hbase using mapreduce time , again throwing following exception :- 15/04/29 21:35:37 warn mapreduce.jobsubmitter: hadoop command-line option parsing not performed. implement tool interface , execute application toolrunner remedy this. 15/04/29 21:35:38 info mapreduce.jobsubmitter: cleaning staging area file:/home/hduser/hadoopdir/mapred/staging/hduser2144453758/.staging/job_local2144453758_0001 exception in thread "main" java.io.filenotfoundexception: file not exist: hdfs://localhost:54310/usr/lib/hbase-0.98.12-hadoop2/lib/hbase-protocol-0.98.12-hadoop2.jar the jar given in path , provided nodes. still keeps on giving error. appreciated. command :- $ hadoop jar hbase-bulkimport.jar org.apache.hadoop.conf.configuration.driver /user/466708/workexample/ output/ nbafinal2010 logs:- 15/04/29 21:35:37 warn mapreduce.jobsubmitter: hadoop command-line option parsing not performed. implement tool interface , execute application toolrunner re

javascript - Hiding dynamically generated divs on 'Click Event' -

i working on project have created 4 divs dynamically, first "display:block". when click next, second div "display:block" , 1st, 3rd, 4th "display:none"; problem when click next button fast 2 times - 2 divs "display:block" , both seen on screen. have tried following code, fed of this. there way control show-hide of dynamically generated divs? <script> /* first check 1 div must show on click of 4 clickable buttons - failed .. ;( */ $(document).ready(function(){ $('span#backpage').click(function(){ var alpha1 = $('div.ui-formwizard-content').css('display','block'); $('div.ui-formwizard-content').css('display','none'); alpha1.css('display','block'); }); $('span#nextpage').click(function(){ var alpha1 = $('div.ui-formwizard-content').css('

vhdl - Floating point to fixed point coversion -

i'm creating hardware module using fixed point computations. input floating point, , wish convert floating point input fixed point (q8.8). i've been trying use david bishops library ( http://vhdl.org/fphdl/ ) floating points , fixed point. works in simulation, not when synthesize it. e.g. in following code output y routed ground when synthesized. library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; library ieee_proposed; use ieee_proposed.fixed_float_types.all; use ieee_proposed.fixed_pkg.all; use ieee_proposed.float_pkg.all; entity sigmoid port ( clk : in std_logic; x : in float32; y : out sfixed(15 downto -16) ); end sigmoid; architecture behavioral of sigmoid signal size : sfixed(15 downto -16); begin set_c: process(clk) begin if rising_edge(clk) y <= to_sfixed(x, size); end if; end process; end behavioral; from i've been reading on various for

android - How to use the camera with images? -

Image
i want make application contains image , background can use device camera. know how launch camera not how put image forward. example application: https://play.google.com/store/apps/details?id=com.kat.police.photosuit.montage anybody know tutorial explaining how or code? i have searched can not find perhaps because english not good. in advance please check example: http://examples.javacodegeeks.com/android/core/ui/surfaceview/android-surfaceview-example/ and use layout activity_main.xml <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.javacodegeeks.androidsurfaceviewexample.androidsurfac

javascript - Have a pop up window when clicking on an image -

sometime in websites see when click on edit image, pop window appears. in pop window, there may example, check box list, or can attach file,... , there , ok or return button. how can implement kind of window? should use javascript? know website tutorial? when implementing dialogs / popups in past, have used jquery dialogs. can find documentation here jquery dialogs: https://jqueryui.com/dialog/ .

javascript - Highcharts X-axis labels on the side -

Image
i'm using highcharts, , used able labels on side.. it's not working now, missing something? the red arrow want labels in following example http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/bar-basic/ this code i'm using, add series in dynamic way. credits: { enabled: false }, chart: { type: 'bar' }, xaxis: { categories: ['jan', 'feb'], labels: { enabled: true, } }, yaxis: { min: 0, max: 100, title: { text: 'score', align: 'high' } }, plotoptions: { bar: { datalabels: { enabled: true }

ios - AFNetworking showing unsupported URL for http get operation? -

right using latest afnetworking library perform http operation getting unsupported url error message but when same, hitting in browser getting data https://abc.xyz.com/status?id={"request":["123"," 456"]} afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; [manager get:baseurlwithstatusinformation parameters:statusid success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"json: %@", responseobject); } failure:^(afhttprequestoperation *operation, nserror *error) { nslog(@"error: %@", error); }]; so here baseurlwithstatusinformation https://abc.xyz.com/status?id= and statusid {"request":["123"," 456"]} i.e. dictionary containing array. seems parameters should be: @{@"id": @"{\"request\":[\"123\",\" 456\"]}"} and baseurlwith

mysql - using the condition if in a function -

i created function using "if..else if", in order cover field , extract characters , store them in column: delimiter | create function mettre (s varchar(2000)) returns varchar(10000) deterministic begin declare str varchar(2000); declare str1 varchar(2000); declare str2 varchar(2000); declare str3 varchar(2000); declare tofind varchar(2000); declare co varchar(2000); set co=''; set str=''; set str1=''; set str2=''; set str1 =substring(trim(substring_index(s,'du',-1)),1,3); set str2 =substring(trim(substring_index(s,':',-1)),1,3); set str =substring(trim(substring_index(s,'sur',-1)),1,3); if (str in ('zag','tun','toz','tat','sos','sil','sfx','sbo','rnc','bar','bej','biz','bsc','gab',&#

How to call .dll coded in vb6 from AutoHotkey Script? -

i need call .dll file autohotkey can not while can access dll vb6 follows //spacecalculator.dll dim obj new spacecalculator.calculate msgbox obj.getdata("shapes",2,100,100); i want call autohotkey follows throws error -3/-4. .dll in root folder of script. dllcall("spacecalculator.dll\getusagedata","str","shapes","float",2,"float",100,"float",100) your vbscript uses com. autothing uses dynamic linking. says. vbscript, jscript, , component object model (com) vbscript , jscript may embedded in script via windows scripting autohotkey, provides access com. also, com may used directly via dllcall demonstrated @ www.autohotkey.com/wiki/index.php?title=com_wrappers.

javascript - Unknown provider: $routeParamsProvider -

i'm going through angularjs phonecat tutorial , while application seems behave correctly when click through manually, 1 of unit tests failing step 8 . using karma , i'm getting following console output: chrome 42.0.2311 (windows 7) phonecat controllers phonedetailctrl should fetch phone detail failed error: [$injector:unpr] unknown provider: $routeparamsprovider <- $routeparams the relevant part of unit test file (controllersspec.js) looks this: describe("phonecat controllers", function () { describe('phonedetailctrl', function () { var scope, $httpbackend, ctrl; beforeeach(inject(function (_$httpbackend_, $rootscope, $routeparams, $controller) { $httpbackend = _$httpbackend_; $httpbackend.expectget('phones/xyz').respond({ name: 'phone xyz' }); $routeparams.phoneid = 'xyz'; scope = $rootscope.$new(); ctrl = $controller('

regex - Match any number (or negitive number) except '-0' -

i have followin regex match number between 1 , 4 didgets in length, - character if desired. ^[-]?\d{1,4}$ however, i'd exclude list of possible matches -0 . i've tried following, seems break everything. ^[-]?(?!-0)\d{1,4}$ how can achieve goal? just put excluding group before : ^(?!-0)-?\d{1,4}$ note don't have put minus sign between brackets.

c# - Why not reveal the type and identity of the source to the client? -

on page 220, c# language specification version 5.0 says: it important ... ensure result of query expression never source object itself, reveal type , identity of source client of query. why problematic reveal type , identity of source client of query? as example, query expression of form from c in customers select c translates customers.select(c => c) instead of customers . in above case, seems me returning customers client returning results of customers.select(c => c) . why isn't it? though robert mckee's answer plausible , raises interesting point, not primary issue had in mind when writing section of specification. issue had in mind this: class c { private list<int> mylist = new list<int>(); // code in c can add items list. public ienumerable<int> items { { return item in mylist select item; } } } suppose have c in hand. should able write code? ((list<int>)c.items).add(123); the

c - What is the purpose of LVCOLUMN.cchTextMax and LVITEM.cchTextMax? -

i have tried set values of lvcolumn.cchtextmax , lvitem.cchtextmax random value (less corresponding string length) , worked, did work mistake or these fields not necessary set? i have seen examples not use these fields, example: http://www.codeproject.com/articles/9148/c-functions-to-insert-columns-items-and-subitems-i the documentation lvitem structure has following on cchtextmax member: this member used when structure receives item attributes. ignored when structure specifies item attributes. example, cchtextmax ignored during lvm_setitem , lvm_insertitem . read-only during lvn_getdispinfo , other lvn_ notifications. unless using structure retrieve item information, member ignored. when receiving data have pass pointer buffer psztext , , communicate size through cchtextmax member. this common pattern throughout windows api, same structure used set , query values. semantics of individual members depend on direction. other common structures, used in sim

ruby on rails 4 - ActiveRecord nested value update fails -

i trying update product please see code below. can't seem update category. welcome. product model: class product < activerecord::base belongs_to :category accepts_nested_attributes_for :category def category_name category.try(:name) end def category_name=(name) category.find_or_create_by(name: name) if name.present? end end category model: class category < activerecord::base has_many :products end products controller: class productscontroller < applicationcontroller def index @products = product.all end def show @product = product.find(params[:id]) end def edit @product = product.find(params[:id]) end def update @product = product.find(params[:id]) @product.update(products_params) redirect_to @product end private def products_params products_params = params.require(:product).permit(:name, :category_id, category_attributes: [:category_name]) end end you creating sette

r - Creating a subset array -

all. long story short: i have dataset on 60000 entries. one variable based on individual (location), 10 different categories. overall satisfaction, out of score of 1 10. however, of categories contain either word rural, or word urban. what compare overall mean of cases contain word rural in location variable, , cases contain word urban in location variable. i have used work-around, create additional column in initial dataset in excel finds word rural or urban in location column , returns either rural or urban depending found, i'm sure there must way strictly using r. is possible? thank you! create dummy data: set.seed(1) foo <- data.frame( loc=sample(c(paste0("rural",letters[1:5]),paste0(letters[10:14],"urban")), 100,replace=true), xx=rnorm(100)) now sounds want grepl() grep keywords, , by() calculate means by keyword: > with(foo,by(xx,grepl("urban",loc),mean)) grepl("urban", loc): false [1]

c# - Accessing a property in a LINQ WHERE statement by name -

just wondering whether possible. have various linq queries against entity framework context, like: iqueryable<metadata> metadatalist = context.metadata.asqueryable(); metadatalist = metadatalist.where(md => md.metatagfilter1.equals(keyvaluemetatagfilter.metatagvalue, stringcomparison.invariantcultureignorecase)); metadatalist = metadatalist.where(md => md.metatagfilter2.equals(keyvaluemetatagfilter.metatagvalue, stringcomparison.invariantcultureignorecase)); metadatalist = metadatalist.where(md => md.metatagfilter3.equals(keyvaluemetatagfilter.metatagvalue, stringcomparison.invariantcultureignorecase)); as see, identical except property being used: metatagfilter1, metatagfilter2, metatagfilter3. instead of repeating on , over, write method 'filter' can call like: metadatalist = metadatalist.filter("metatagfilter1"); metadatalist = metadatalist.filter("metatagfilter2"); metadatalist = metadatalist.filter("metatagfilter3&

java - LinkedHashMap LRU Cache - Determine what values are removed? -

background information you can make lru cache linkedhashmap shown at link . basically, just: extend linked hash map. provide capacity parameter. initialize super class (linkedhashmap) parameters tell capacity, scaling factor (which should never used), , keep items in insertion/reference order. override removeeldestentry remove oldest entry when capacity breached. my question this pretty standard lru cache implementation. 1 thing can't figure out how how notified when linkedhashmap removes entry due not being used enough. i know can make removeeldestentry provide form of notification... there way retrieve element removed cache right when new 1 inserted (put) underlying map? alternatively, there way query last item removed cache? is there way retrieve element removed cache right when new 1 inserted (put) underlying map? the removeeldestentry notified of entry removed. can add listener method calls if want make dynamically configurable. from ja

angularjs - Two way binding in a directive that triggers a watch even after the data changes again? -

i'm writing directive lookup value list of data , display value. why when click change data button in plunkr example not change result? i've tried $watch fires once. plunk: http://plnkr.co/edit/9a3z0kmm8eabngyv1nmh?p=preview for example, here usage: <lookup-binder lookup="lookuplist" find="data.id" result="lookuplist.description"></lookup-binder> here directive looks like: app.directive('lookupbinder', function() { return { restrict: 'e', scope: { lookup: '=', find: '=', result: '=' }, controller: function($scope){ console.log('controller fired'); }, link: function(scope, element, attrs, tabsctrl) { console.log('link fired') scope.$watch(scope.find, function(newvalue, oldvalue) { console.log('watch fired'); var el = _.find(scope.lookup, { id: scope.find }); if(el !

r - lm grouping by categorical variables (factors) -

this question has answer here: applying function lm() 2 answers i've got following table , i'd love data frame lm slopes each industry. years 1999 - 2012 each industry , i'm looking slope of each industry in new table. > head(mmfpdatad) year industry index 1 1999 farms -0.02352551 2 2000 farms 0.04081992 3 2001 farms 0.02435490 4 2002 farms 0.01056180 5 2003 farms 0.04876939 6 2004 farms -0.01805118 using mtcars example data, try: mtcars$slope <- ave(mtcars$mpg, as.factor(mtcars$gear), fun = function(x) lm(x ~ seq_along(x))$coef[[2]]) which gives slope per gear: mtcars mpg cyl disp hp drat wt qsec vs gear carb slope mazda rx4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 0.6860140 mazda rx4 wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 0

objective c - UIImage at end of UITextView -

i have uitextfield, @ end of textfield want add uiimage. when put uiimageview on top of uitextfield, uiimageview (duh!) visible in top of uitextfield. what code need write @ end of text uitextfield uiimageview appears? no code needed, add proper constraints on interface builder. command-click image , bind text field, select horizontal (or vertical) spacing popup list.

javascript - node, unit-testing and mocking with sinon -

so using test suite of chai, rewire, sinon, , sinon-chai test node javascript. first time trying set use pointers. function trying test looks : userroles.get = function(ccurl, namespace, environment, cctoken, authpath) { var crowdcontrol = new crowdcontrol(ccurl, namespace, environment, cctoken, authpath); return q.promise(function(resolve, reject) { crowdcontrol.get().then(resolve).fail(reject).done(); }); }; inside document exports userroles. have initial set working fine, having troubles mocking test function. i'm trying mock new crowdcontol part attempt looks : https://jsfiddle.net/d5dczyuk/ . so i'm trying out testhelpers.sinon.stub(crowdcontrol, "userroles"); to intercept , stub var crowdcontrol = require('./crowdcontrol'); then running userroles.get; console.log(crowdcontrol); and seems stub not being called ( logs it's stub not has been called). need stub crowdcontrol.get() too, trying simple part workin

r - Isolating specific numeric values in text -

i have significant amount of text trawl through on text csv file of various properties find square metre numeric value of properties is. example: string <- "this wonderful 120 sqm flat stunning view" i know can use following extract numeric value: sqm <- as.numeric(gsub("\\d", "", string)) which returns numeric vector of '120', should. however, wondering if there more sophisticated way accomplish this, given there other irrelevant numeric values in text? is there way search 'sqm' , return numbers precede it? many comments. i believe regex lookahead should work: library(stringr) ## string <- "this wonderful 120 sqm flat stunning view" re <- "((\\d+)(?=\\s?sqm))" ## r> str_extract(string, perl(re)) [1] "120"

mysql - Merging and converting rows to columns -

i have list of data happens have been set this: entryid fieldid value 100 1 john 100 2 smith 100 3 usa 101 1 jane 101 2 doe 101 3 usa the way works is, when "ticket" created, assigns entryid data in ticket, each field has it's own fieldid. first name fieldid of 1, last name 2, etc. need able create view this: first name last name country john smith usa jane doe usa i need able in mysql, , not sql or excel, other similar problems have addressed. i found answer own question, post here future users. website explains how asking for: http://stratosprovatopoulos.com/web-development/mysql/pivot-a-table-in-mysql/

java - multithreading and JDBC -

i use java , oracle , want use 2 threads read records result set : first thread retrieve records , second read these records.but code obtained first record idea please? public class javaapplication13 { public static volatile boolean finished =false; public static void main(string[] args) throws ioexception, interruptedexception { final pipedwriter writer=new pipedwriter(); final pipedreader reader = new pipedreader(); reader.connect(writer); //thread2: afficher final thread thread2=new thread("lire") { public void run(){ try{ while(!finished) { int l=reader.read(); system.out.println(l); } }catch (exception e) { e.printstacktrace();} } }; //thread1:récupére de la base final thread thread1=new thread("db"){ public void run(){ try{ class.forname

android - Aessing public variable in java -

i have create public variable in fouractivity , access in finalactivity class value of variable show 0. have been create getrandomnumber function in fouractivity class return integer. public int i; i=getrandomnumber(); // accessing variable in finalactivity class through way fouractivity fouractivity=new fouractivity(); int randomnumber=fouractivity.i; toast.maketext(finalactivity.this,"random number" +randomnumber ,toast.length_short).show(); i not static, therefore when write : fouractivity fouractivity=new fouractivity(); int randomnumber=fouractivity.i; you uninitialized value of i new fouractivity instance created. i=getrandomnumber(); updated difference isntance of fouractivity .

c - error in finding the longest common sub sequence between two strings -

#include <stdio.h> #include <string.h> int m,n,a,c[20][20]; char x[15],y[15],b[20][20]; void print_lcs(int i,int j) { if(i==0 || j==0) return; if(b[i][j]=='c') { print_lcs(i-1,j-1); printf("%c",x[i-1]); } else if(b[i][j]=='u') print_lcs(i-1,j); else print_lcs(i,j-1); } void lcs() { int i,j; m=strlen(x); n=strlen(y); for(i=0;i<=m;i++) c[i][0]=0; for(i=0;i<=n;i++) { printf("0\t"); c[0][i]=0; } printf("\n"); for(i=1;i<=m;i++) { printf("0\t"); for(j=1;j<=n;j++) { if(x[i-1]==y[i-1]) { c[i][j]=c[i-1][j-1]+1; b[i][j]='c'; printf("%dc\t",c[i][j]); } else if(c[i-1][j]>=c[i][j-1]) { c[i][j]=c[i-1][j]; b

transitiondrawable - Transition Drawable for actionbar in Android -

is possible use transition drawable actionbar , how? should use xml like: <xml version="1.0" encoding="utf-8"/> <transition xmlns:android="http://schemas.android.com/apk/res/android"/> <item android:drawable="@drawable/first_image"/> <item android:drawable="@drawable/second_image"/> </transition> but how continue here? yes, possible. can without xml, create transitiondrawable in code: drawable firstimage = getdrawable(r.drawable.first_image); drawable secondimage = getdrawable(r.drawable.secondimage); transitiondrawable transition = new transitiondrawable(new drawable[] { firstimage, secondimage}); after set transition background actionbar: getsupportactionbar().setbackgrounddrawable(transition); and start transition: transition.starttransition(1000); also can set transition background toolbar.

sql - SELECT statement with multiple where conditions not running in .NET winform application -

i have complex select query run within winform application. query runs in sql server , times out/short circuits/something when use query in application. select q.ordnum gisqc..qc_orders q inner join tod..currentorders new on q.ordnum = new.ordnum inner join gisqc..cloneorders c on c.newordnum = q.ordnum inner join tod..currentorders old on c.origordnum = old.ordnum (q.week = '2015.17') , (new.ordstat = 'c') , ((new.fldzne in ('c', 'b', 'cx', 'bx', 'x') , old.fldzne not in ('c', 'b', 'cx', 'bx', 'x')) or (new.fldzne not in ('c', 'b', 'cx', 'bx', 'x') , old.fldzne in ('c', 'b', 'cx', 'bx', 'x')) or (new.fldzne 'a%' , old.fldzne not 'a%') or (new.fldzne not 'a%' , old.fldzne 'a%') or (new.fldzne 'v%' , old.fldzne not line 'v%') or (new.fldzne not 

java - Trying to make ImageView full size in Dialog doesn't work -

i'm using fragments , full size image mimagereport when tap on imageview on fragment. second layout test.xml (for dialog). i'm getting image url using picasso but problem image doesn't appear on new dialog (mimagereport). don't know how link imageview test.xml image want in full screen in fragment... here code. reports.java : public class reports extends fragment { public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { super.oncreate(savedinstancestate); if (container == null) { return null; } view view = inflater.inflate(r.layout.reports, container, false); butterknife.inject(this, view); final dialog nagdialog = new dialog(getactivity(),android.r.style.theme_translucent_notitlebar_fullscreen); nagdialog.requestwindowfeature(window.feature_no_title); nagdialog.setcancelable(false); nagdialog.setcontentview(r

command line - Get a file from TFS without creating workspace (Using commandline) -

i want specific file tfs server without creating workspace. found similar solution here . seems view command not working me. have tried below command. ./tf view -s: http://tfs.com:8080/tfs/wtqa '$/myproject/test.txt' > /test-view/test.txt but says "an argument error occurred: command 'view' unknown." this might sound obvious, have checked being run ./tf? try ./tf /? and ensure correctly identifies team foundation version control tool, , lists available commands, "view" being 1 of them. you should able run tf view -s:http://tfs.com:8080/tfs/wtqa /output:test.txt '$/myproject/test.txt'

VBA-Word Extend Revision to the whole word -

i'm analyzing revised documents. have change tracking enabled, , contain many revisions. these documents required have revision on whole word, not part of it. revisions used qa, cannot flag revised words not revised. must make words have revised letters words revised, cannot touch other words. i want automate this. figured this: dim wrdrange range each wrd in thisdocument.words set wrdrange = wrd if wrdrange.revisions.count <> 0 wrdrange.text = wrdrange.text end if next wrd it's working half way, every time encounters revised word (partially or fully), make avery other word revised (there revision count of 1 on them). so question how can fix this. also, i'm not @ sure best way perform task. feel isn't. if can offer direction, i'll gladly follow (i not approach - specially iterating through every word). i found solution. 1 word flagged revision flagging next 1 revision because include trailing whiteaspace. shortened

javascript - Brunch: How to correctly deal with AMD and vendor code? -

i amd-like syntax modules management in js. i'm trying figure out how can use require.js brunch. want achieve: all vendor code should concatenated in 1 file. exported vendor symbols should available in global scope(since 3rd-party code excpect find there). i want use require.js or almod module management. the problem if load require.js of vendor scripts trying define anonymous module. here code snipped backbone reference: if (typeof define === 'function' && define.amd) { define(['underscore', 'jquery', 'exports'], function(_, $, exports) { //... }); } as result, require.js complains anonymous module definition. this why wrapping of vendor code disabled default in brunch. many vendor scripts have umd or own way of exposing api incompatible generic module wrapping, work out of box amd structure if left alone. what may want organize vendor scripts separate directories ones need wrapping brunch , ones do

Android action bar autosrollable title -

i'd create app settitle function @ actionbar but, strings bigger actionbar width, , want use autoscrollable function title. i try create style actionbar: <style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <item name="android:actionbarstyle">@style/myactionbar</item> <!-- support library compatibility --> <item name="actionbarstyle">@style/myactionbar</item> </style> <!-- actionbar styles --> <style name="myactionbar" parent="widget.appcompat.actionbar.solid"> <item name="android:background">@drawable/ab_background</item> <item name="android:titletextstyle">@style/actionbartitlestyle</item> <!-- support library compatibility --> <item name="background">@drawable/ab_background</item> <item n

Login Functionality in MVC c# application with NHibernate -

will tell how can apply login functionality in mvc application nhibernate. please build controller , related view functionality. in controller can have method check authentication, create new user , set proper roles. view can simple using textboxfor() razor control on client side , viewdata dictionary client server data transfer. model can class based entity using nhibernate. general implementation of mvc can used web application.

javascript - Closure compiler export Typescript classes and functions -

Image
i trying use closure compiler advanced mode on typescript generated classes no success. there has accomplished such things. typescript class class testdata { blogname: string; cachetimeout: number; copyrightholder: string; constructor(blogname: string, cachetimeout: number, copyrightholder: string) { this.blogname = blogname; this.cachetimeout = cachetimeout; this.copyrightholder = copyrightholder; } addblog(value: string): boolean { console.log('add blog'); return true; } validate(): boolean { console.log('all valid'); return true } } var mytestdata = new testdata("name",22,"cpyright"); generated code var testdata = (function () { function testdata(blogname, cachetimeout, copyrightholder) { this.blogname = blogname; this.cachetimeout = cachetimeout; this.copyrightholder = copyrightholder; } testdata.prototype.addblog = function (value) { console.log('add blog'); return tr

checkbox - VBA multiple checkboxes to control multiple pivot tables -

again need little appreciate. basically, on dashboard page have couple of checkboxes control numerous of pivot tables in background. i have checkboxes called "definite", "tentative", "pending,", ... , corresponds values in pivot fields. and have numerous of pivot tables called: "hidden_1" or "hidden_2" in different sheets same structure. my idea if checked "definite", selected in pivot pivot tables in fields called "status". if "unchecked" checkbox, pivots react. to used code create before , working well: sub checkbox1() application.screenupdating = false on error resume next dim pt pivottable, wks worksheet each wks in activeworkbook.worksheets each pt in wks.pivottables pt if .name = "hidden_1" or .name = "hidden_2" .pivotfields("status").currentpage = "definite" end if end next pt

ruby on rails - Unable to get $rootscope object on pageload in angularjs -

i using ng-token-auth , devise token-auth. when user gets logged in stores user.id in $rootscope this controller app.controller('myctrl', function($rootscope,myfactory){ console.log($rootscope); console.log($rootscope.user.id); }) the output first is: object {$id: 1, $$childtail: object, $$childhead: object, $$prevsibling: null, $$nextsibling: null…} output 2nd is: undefined but when expand first output contains user.id user: object configname: "default" email: "abc@gmail.com" id: 3 provider: "email" signedin: true status: null uid: "17d851ed-4" proto : object the reason might you're trying access property, not yet assigned (maybe promise being resolved or something?). to make sure, add debugger statement in controller , see if actual user property @ given moment. to defer action use user.id , try following: app.controller( 'myctrl', function( $rootscope, myfactory ) {

node.js - Mongoose Async Call Issue with Find Query -

i have var movierecommendation being populated data coming mongo db. issue mongoose movie.findone() call asycn call not allowing me final populated movierecommendation need send response. exports.getrecommendation=function(req,res){ var movierecommendation = []; var id=req.params.id; console.log('----- user recommendation - ' + id); var url = 'http://52.8.48.113:8080/recommender-server/recommender/v1/recommendations/'+id+'.do'; //make http request request({ url: url, json: true }, function (error, response, recommendations) { // res.json(recommendations); if (!error && response.statuscode === 200) { recommendations.foreach(function(entry) { **movie.findone({'id':parseint(entry.itemid)},function(err, moviedata){** entry.movie = moviedata; movierecommendation.push(entry); //console.log('rec', movierecommendation); console.log(

angularjs - Remove index.html from URL. Works when served from other server -

i'm hoping kind enough , able me: i have $location.html5mode(true) & $locationprovider.hashprefix() both set , when run simple web server app's dist folder index.html removed url. but when serve web-app container http://localhost:8080/ui/index.html i've tried setting various settings in jetty.xml, wab's web.xml, etc, no affect. i'm little light in specifics our configuration quite complex. however, suggestions appreciated. thanks, keir

asp.net mvc - MVC ASP .NET - Generating PDF file -

i have c# application in mvc 4 , asp.net. what want do, push button in razor view, sends model controller. here want create pdf-file , return view. user can save or open pdf in browser. not want save file on server, memory only. i have tried google find examples of this. come lot itextsharp. can't find examples of code show need. the pdf created of data model. need change fonts , size of fonts + place these want in pdf-file. need place photos (logo) @ top or bottom. there button sends file persons email. great if re-use code that. does have libraries or examples of how this? in advance thanx. edit: after lot of googling, found example strip down can use. have tried single line of text, think can build on need. @ least able change fonts. must see if can place content want. here code create file user can save on device: public actionresult createpdf() { memorystream workstream = new memorystream(); document doc = new document(pagesize.a4);

rest - Spring HATEOAS: Only show links when paging without serializing the resource/entity -

according spring hateoas guide , list of resources serialized in way each resource shown content , links: { "content": [ { "price": 499.00, "description": "apple tablet device", "name": "ipad", "links": [ { "rel": "self", "href": "http://localhost:8080/product/1" } ], "attributes": { "connector": "socket" } }, { "price": 49.00, "description": "dock iphone/ipad", "name": "dock", "links": [ { "rel": "self", "href": "http://localhost:8080/product/3" } ], "attributes": { "connector": "plug" } } ], "links": [ {

css - Truncate responsive image in Bootstrap media-body (Media object) in Firefox -

Image
in firefox browser (ver. 37) responsive images ( class="img-responsive" ) in media-body element ( bootstrap, media object ) truncate (cropped). example in chrome browser good, , image reduced. sample code: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/> <div class="container"> <div class="media"> <div class="media-left"> media-left </div> <div class="media-body"> <img src="http://lorempixel.com/output/city-q-g-1920-300-10.jpg" class="img-responsive" /> media-body </div> </div> </div> preview firefox (problem!): preview chrome (everything good): i know bug responsive image in tables on firefox [ https://bugzilla.mozilla.org/show_bug.cgi?id=975632] every solution

emacs - How to define multiple character parenthesis in SMIE -

i copied the code in gnu manual smie. indent of begin , end works fine. (defvar sample-smie-grammar (smie-prec2->grammar (smie-bnf->prec2 '((id) (inst ("begin" insts "end") ("if" exp "then" inst "else" inst) (id ":=" exp) (exp)) (insts (insts ";" insts) (inst)) (exp (exp "+" exp) (exp "*" exp) ("(" exps ")")) (exps (exps "," exps) (exp))) '((assoc ";")) '((assoc ",")) '((assoc "+") (assoc "*"))))) but when try add class / endclass , module / endmodule below, new added pairs not indent @ all. when enable show-paren-mode . not highlighted begin , end does. (defvar sample-smie-grammar (smie-prec2->grammar (smie-bnf->prec2 '((id) (inst ("begin" insts "end&

combinatorics - Combinatorial optimization (tell which and how many) -

i have problem given k types of object need assign number of them each of elements of group. instance this: object types: a, b, c, d places: 1, 2, 3, 4 simple trial combination: place | object type | amount ---------------------------- 1 | | 3 2 | | 1 3 | d | 2 4 | c | 5 the evaluation of each combination produces number want minimize. mainly part confuses me need choose objects list , tell amount of them. from background i'd try put problem genetic algorithm, wonder if there better suited solve this. any guidance appreciated.

winforms - Find CPU Usage at the moment C# -

i have developed following code sample using online example.but didn't give me percentage of cpu usage. performancecounter rcpucounter; performancecounter rramcounter; public void resourcescpu() { rcpucounter = new performancecounter(); rcpucounter.categoryname = "processor"; rcpucounter.countername = "% processor time"; rcpucounter.instancename = "_total"; string cpu = getcurrentcpuusage(); } public string getcurrentcpuusage() { string value1 = rcpucounter.nextvalue() + "%"; return value1; } and then, changed getcurrentcpuusage() method below.it gave me value cpu usage. public string getcurrentcpuusage() { string value1 = rcpucounter.nextvalue() + "%"; thread.sleep(500); string value2 = rcpucounter.nextvalue() + "%"; return value2; } i know possible have different cpu usage in

visual studio - C programming (beginner help) Ascii table -

hi need c programming . need write ascii table without numbers : 0, 7-10 , 13 . between every char "\t" , after every 10 chars skip line . code : void ascii() { int i; (i = 0; <= 255; i++) { if (i == 0) { printf("\t"); } if (0 == % 10) { printf("\n"); } printf("%d = %c\t", i, i); } return; } why codes excluded? wouldn't better exclude non-printable codes? isprint that. #include <ctype.h> if (isprint(i)) printf("%d = %c\t", i, i); if want exclude particular codes, can use same technique isxxx functions: char is_print[256] = { 0,1,1,1,1,1,1,0,0,0,0,1,1,0,1,1, /* 0 in pos 0, 7-10 , 13 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,

python - How to select n-1 column in a dataframe -

we need select n-l column n column in dataframe using python have tried method sample code x = dataframe1[['col1,col2......n']] is there other way around if have pandas dataframe df column names ['col1', 'col2', ...] can like: df.ix[:,'col2':] # select col2, col3, ... or df.ix[:,:'col4'] # select col1, col2, col3 , col4

msbuild - Azure Cloud Service continuous integration with existing ccproj profile -

Image
how continuous integration work using publish settings profile in our cloud project? when using default tfvccontinuousdeploymenttemplate.12.xaml , publish ignores of profile settings. doesn't use correct storage account , publishes staging environment. here settings development publish profile: here current state of our build definition: "path deployment settings" sounds correct only azure websites . how publish using profile settings specified in .azurepubxml file? ci template tfvccontinuousdeploymenttemplate.12.xaml not use publishing profile. relevant settings (deployment slot, storage account name, ...) configured in 6. deployment > deployment > windows azure deployment environment /p:targetprofile=development specifies service configuration (selects correct .cscfg file), not publishing profile. if need configure additional features example remote debugging, have add additional msbuild parameters in 2. build > 5. advanced