Posts

Showing posts from April, 2010

Adding rows and columns on button clicks bootstrap -

i have requirement user should able add rows , columns dynamically in bootstrap table. on button click new row , other button click new columns should appear. similarly on button click of '-', row needs deleted , other button click, column needs deleted. i new bootstrap 3. guidance of great help!! you can use jquery that, here's simple example : https://jsfiddle.net/1okx6pja/ html : <button onclick='add()'> add </button> <table> <tr> <th>content</th> <th>delete</th> </tr> <tbody> <tr> <td>something</td> <td> <button onclick='rm()'> remove </button> </td> </tr> </tbody> </table> javascript : function rm() { $(event.target).closest("tr").remove(); } function add() { $("table").append("<tr><td>new thing</...

apache spark - zeppelin "r interpreter not found" -

i have installed local apache zeppelin using link examples in same installation show usage of r when run of them get: "r interpreter not found" . strange same installation shows example notebook of "r notebook" not contain zeppelin interpreter!!? when click "interpreters" tab not see r interpreter. saw there project zeppelin r don't it. how come same zeppelin installation has r notebook examples not work? why need clone repository named zeppelin r ? isn't r bundled zeppelin ?? as of 2016 apr 6th apache zeppelin has r support in master branch . it's not part of latest 0.5.6 release, need build zeppelin following simple build instructions git clone https://github.com/apache/incubator-zeppelin.git mvn clean package -dskiptests here can find more information pre-requests r , rspark support available additional requirements r interpreter are: r 3.1 or later (earlier versions may work, have not been test...

Read all rows from excel (.xls) and then insert into database (PHP) -

can provides me step or whole code read data excel file (.xls) , insert records database? thank in advance, use phpexcel library. see documentation examples . /** include path **/ set_include_path(get_include_path() . path_separator . '../../../classes/'); /** phpexcel_iofactory */ include 'phpexcel/iofactory.php'; $inputfilename = './sampledata/example1.xls'; echo 'loading file ',pathinfo($inputfilename,pathinfo_basename),' using iofactory identify format<br />'; $objphpexcel = phpexcel_iofactory::load($inputfilename); $sheetdata = $objphpexcel->getactivesheet()->toarray(null,true,true,true); var_dump($sheetdata);

php - jquery to load a new page and post data from an on change event -

i building website identify parts based on 10 different measurements. wanting my onchange event first drop down box 2 things. first, need post selection php variable on next page. second, want function load next page give me drop down list shows options have same measurement first list. building 10 pages keep adding on sql statement generates drop down list. not sure how send jquery post php variable, , how load new page. new programming, trying keep not complicated. here basics of code. <html> <head> <script type = "text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <script type='text/javascript'> function get() { var lengthdata = $('#filter').serialize(); $.post('spline.php', lengthdata, function(output){ $('#list').html(output); ...

three.js - focus camera on THREE.Geometry vertices -

i want focus camera on three.geometry, 1 vertex @ time , transition camera next vertex of same geometry how should accomplish 1 & 2? i created fiddle. http://jsfiddle.net/5oajajpd/ the function move camera goes through each vertex , sets camera position. transition animation can set x,y, , z properties through jquery animate function, or animation lib of choice. the move camera function triggered interval. in sphere example spiral around , around sphere forever. var = 0; function movecamera() { var point = mesh.geometry.vertices[i]; var coeff = 1 + altitude / rad; camera.position.x = point.x * coeff; camera.position.y = point.y * coeff; camera.position.z = point.z * coeff; camera.lookat(mesh.position); i++; if (i > mesh.geometry.vertices.length) { = 0; } }

Select a word by cursor and get its position in Qt/C++ -

i have small qt/c++ application qtextedit uploads text. want able select separate word cursor , position in text. for example, in following sentence: "it sunny day". if select word 'sunny', int 4, placed @ 4th position in sentence. how can achieve that? you'll have : get field's text qstring using qtextedit::text() method use qtextedit.textcursor()->selectionend() know selection ends. use qstring::mid substring 0 end of selection use qstring::count know how many spaces contains. give access word's position. something like: textedit.text().mid( 0, textedit.textcursor()->selectionend() ).count( ' ' )+1; hope helps. that's minimal, you'll want deal partial word selection or others relevant corner case.

javascript - Why is extending an extended view not working in ember.js? -

i trying create modal view , have base class modals need , extending more specific functionality. plansource.modal = ember.view.extend({ isshowing: false, hide: function() { this.set("isshowing", false); }, close: function() { this.set("isshowing", false); }, show: function() { this.set("isshowing", true); } }); plansource.addjobmodal = plansource.modal.extend({ templatename: "modals/add_job", createjob: function() { var container = $("#new-job-name"), name = container.val(); if (!name || name == "") return; var job = plansource.job.createrecord({ "name": name }); job.save(); container.val(""); this.send("hide"); } }); i render with {{view plan...

python - Making async calls from an async library? -

the toy script shows application using class dependent on implementation not asyncio-aware, , doesn't work. how fetch method of myfetcher implemented, using asyncio-aware client, while still maintaining contract _internal_validator method of fetcherapp? clear, fetcherapp , abstractfetcher cannot modified. to use async fetch_data function inside fetch both fetch , is_fetched_data_valid functions should async too. can change them in child classes without modify parent: import asyncio class asyncfetcherapp(fetcherapp): async def is_fetched_data_valid(self): # async here data = await self.fetcher_implementation.fetch() # await here return self._internal_validator(data) class asyncmyfetcher(abstractfetcher): def __init__(self, client): super().__init__() self.client = client async def fetch(self): # async here result = await self.client.fetch_data() # await here return result class asyncclient: ...

swift - Does using IF LET act like closure -

let's assume function calculate() takes 30 seconds return int update/edit: neglected mention let's assume on background thread , not main thread. calculate() -> int{ let anint = ...//task takes 30 seconds complete return anint } if using if let conditionally bind value of calculate variable below: if let theintiwant = calculate() as? string { print("the value want is: \(theintiwant)") } will if let function closure, theintiwant not evaluated until calculate() returns value? trying understand when need use closure asynchronous tasks , not sure need in case. this has nothing closures, nor have said calculate being asynchronous. nor has if let ! question has threads . the rules simple enough. must not block main thread length of time. if calculate() has ability return value after 30 seconds of work, must called only on background thread . if, having called it, want result involves properties, interface, or other non-thread...

Taking input from a file until EOF is found in java -

this question has answer here: how create java string contents of file? 27 answers i want take input file using scanner class in java. file format follows: name: sample.txt type: txt comment: odyssey of ulysses dimension: 3 eof what want read above lines until eof file , store value contained in line 'dimension' in variable x. new java , can't understand how using scanner class. tried small code fragment below failed : scanner in = new scanner(new file("sample.txt")); string line = ""; int x; in.nextline(); in.nextline(); in.nextline(); what additional things need add desired input? example read using scanner import java.io.file; import java.util.scanner; public class readingfilesclass { public static void main(string[] args) { try { scanner in = new scanner(new file("sa...

javascript - Validation error not showing in right place -

Image
i have appended select box dynamically inside td tag using jquery , assigned class required-entry when submit form validation not showing on right place. appended code. var addrow = '<tr class="item"><td><select onchange="getprice(this)" id="selectbox-'+counter+'" name="pid[]" customerid="'+customer+'" class="required-entry required-entry select">'; addrow +='<option value="">select product</option>'; (i = 0; < valuearray.length; i++) { addrow +='<option value="'+valuearray[i]+'">'+textarray[i]+'</option>'; } addrow +='</select></td><td style="width:50px"><input type="number" id="qty-box-'+counter+'" class="qty-box" max="1000" min="1" value="1" name="it...

java - How to create and add data to Table 3 without adding data to Table 1 and Table 2 in hibernate -

i new hibernate , not able find out way of situation have. kind of many many relationship difference want data inserted in table 3 , not in table 1 & table 2. table 1 , table 2 has data present. current requirement: table 1 has user id, first name, last name (already exists) table 2 has document id, document name, document content (already exists) table 3 should have user id , document id both table 1 & table 2 has data prepopulated. if user views document, want make entry in third table without persisting or updating in table 1 & table 2. want maintain data on documents viewed user when user logged off , login can show him docs unread. best use of hibernate in situation? you don't need update people nor document table. hibernate able add entries third table (the join table) if configure right. annotate collection @manytomany , make sure working entities db instead of creating new ones: load person db load document db put document list of person...

jdbc - Connecting to a SQL Server 2000 db from Java -

i receiving error did see on site, novice java coder think flubbed implementation of solution. i getting message "sql server version 8 not supported driver. clientconnectionid:602d619d-c033-41d0-9109-80f56e3ab9b3" i using eclipse mars 1 database sql server 2000, downloaded sqljdbc.jar microsoft site suggested earlier question. loaded c:\temp , added classpath , rebooted. code snippet reads: package texaslampconversion; import java.sql.*; import java.io.bufferedreader; import java.io.file; import java.io.filereader; import java.io.filewriter; import java.io.ioexception; public class texaslampconversion { public static void main(string[] args) { // todo auto-generated method stub string host = "jdbc:sqlserver://servername\\instancename"; string uname = "*********"; string upass = "*********"; connection conn = null; try { conn = drivermanager.getconnection(host, una...

merge - How can i stop context sensitive help from opening Help if that particular child isn't installed? -

finally got working in merged scenario. if there topic doesn't exist, since child .chm hasn't been installed in directory, why open anyway blank topic when f1 pressed on control? there mapping , in redirect file , alias file when child .chm installed (this in master). want not open if child .chm doesn't exist. how can accomplish this? or @ least open default topic etc?

php - Wordpress Advanced Custom Fields display field not working in loop -

i using advanced custom fields wordpress. have custom post type called videos has 2 fields - video_link , video_artist . i can call , output video_link field, cannot seem display ' video_artist ' field using code below... <?php $posts = get_posts(array( 'post_type' => 'videos', 'posts_per_page' => -1 ) )); if( $posts ): ?> <?php foreach( $posts $post ): setup_postdata( $post ) ?> <?php echo wp_oembed_get( get_field( 'video_link' ) ); ?> <?php the_title(); ?> <?php the_field('video_artist'); ?> </div> <?php endforeach; ?> <?php wp_reset_postdata(); ?> <?php endif; ?> in fact, line... <?php the_field('video_artist'); ?> ...breaks site , displays nothing @ after appears. no html of kind. it's more or less same code your, tested, , works fine as @admcfadn said, note...

php - IPN message returning INVALID -

i'm trying make website on need facilitate paypal's ipn technology. however, though use sample code implementing ipn listener, cannot seem make work. sample code is: <?php // config: enable debug mode. means we'll log requests 'ipn.log' in same directory. // useful if encounter network errors or other intermittent problems ipn (validation). // set 0 once go live or don't require logging. define("debug", 1); // set 0 once you're ready go live define("use_sandbox", 1); define("log_file", "./ipn.log"); // read post data // reading posted data directly $_post causes serialization // issues array data in post. reading raw post data input stream instead. $raw_post_data = file_get_contents('php://input'); $raw_post_array = explode('&', $raw_post_data); $mypost = array(); foreach ($raw_post_array $keyval) { $keyval = explode ('=', $keyval); if (count($keyval) == 2) $mypost[$...

css - Making a square div with inheritance or sth? (no js) -

is there way read width , set height same value ? know trick viewportheight[vh] , [vm], won't work here. you can utilizing fact in padding-bottom: 100% percentage percentage of width, , not height. setting pseudo-element padding-bottom: 100% change height according width. content can in absolutely position layer. (i've added little hover animation demonstrate changing width changes height) .container { position: relative; width: 100px; } .container:hover { width: 150px; transition: width 2s; } .container::before { display: block; padding-bottom: 100%; content: ''; } .content { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: red; } <div class="container"> <div class="content"> </div> </div>

TeamCity REST API - List builds based on build parameters -

i've added configuration parameter build configuration on team city instance called "client". this parameter supplied every build, , can viewed under header user defined parameters , actual parameters on agent in parameters tab given build (along other parameters e.g. build.number, teamcity.project.id etc). i can access parameter build - server:port/httpauth/app/rest/builds/id:xxx/resulting-properties/client let's went builds client google. have build configuration id if helps any. i've searched high , low in documentation. possible? you can use following request: http://teamcity/app/rest/builds/?locator=property:(name:<name>,value:<value>),lookuplimit:1000 the search restricted 1000 recent builds otherwise request can quite slow , loading server.

angular - Create a detail view under a parent route -

you surely know heroes sample angular 2 tutorial: https://angular.io/resources/live-examples/toh-5/ts/plnkr.html when click 1 of 4 top heroes /dashboard url detail/id url. that whole dashboard component switched detail component fine! what have changed url changes /dashboard /dashboard/detail/id so in route config change path: '/detail/:id', to path: '/dashboard/detail/:id', that works when dashboard url changed /dashboard/detail/:id url makes no sense anymore. i configure detail route depending 'parent' route. how can this? i've changed routing show how can done, see plunkr . in general done using non-terminal routes , child routers. { path: '/dashboard/...', name: 'dashboard', component: dashboardcomponent, useasdefault: true }

c++ - opencv imshow show gray in Opencv 3.1 -

opencv imshow showing gray image. #include "stdafx.h" #include <opencv2\opencv.hpp> using namespace cv; using namespace std; int main() { videocapture cap; mat frame; cap.open(0); while (true) { cap >> frame; imshow("test", frame); waitkey(30); } return 0; } i upgraded windows insider preview 14316 , stopped working after think. i checked if camera work in skype, , did. tried code on computer , worked. any ideas?

c# - Getting CORS to work with Web API and SignalR -

been having difficult getting signalr , cors working asp.net web api v2 using owin authentication. it seems though can can either cors working signalr or web api not both. configuring cors via code trying add headers via web.config did not work me. below configuration method startup.cs public void configuration(iappbuilder app) { app.usecors(corsoptions.allowall); httpconfiguration httpconfig = new httpconfiguration(); configureoauthtokengeneration(app); configureoauthtokenconsumption(app); configurewebapi(httpconfig); app.usewebapi(httpconfig); } with above configuration the web api works . able authenticate , call api methods client. however, error when client attempts reach signalr scripts. notice cors error no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:8080' therefore not allowed access. in second error message. http://localhost:49834/signalr/ne...

sql - Conversion failed when converting the nvarchar value 'AAAR78509883' to data type int -

i have nvarchar column in 1 of tables have imported access. trying change int. move new table. the original query: insert members_exams_answer select ua.members_exams_id, ua.exams_questions_id, ua.members_exams_answers_value, ua.members_exams_answers_timestamp members_exams me full join useranswers1 ua on me.members_exams_username = ua.members_exams_id full join exams_questions eq on eq.exams_questions_id = ua.exams_questions_id this throws error: conversion failed when converting nvarchar value 'aaar78509883' data type int. i have tired: select convert (int, useranswers1.members_exams_id) useranswers1 and select cast(members_exams_id integer) int_members_exams_id useranswers1 and select cast (members_exams_id int) useranswers1 all result in same error conversion failed when converting nvarchar value 'aaar78509883' data type int. your problem systemic data has le...

Xpages: Java method using OpenNTF ODA not saving document -

i have adopted openntf oda java in xpages. great far, , think have touched surface. i calling java method , want save document. method getting called, , not seeing errors, document never updated. the document getting "saved" disappears views. import lotus.domino.notesexception; import org.openntf.domino.*; import org.openntf.domino.utils.factory; import org.openntf.domino.database; import org.openntf.domino.session; import java.io.serializable; public class build implements serializable { private static final long serialversionuid = 1l; public void process1(string docid) { try { system.out.println("got here."); session session = factory.getsession(); database thisdb = session.getcurrentdatabase(); database pcdatadb = session.getdatabase(thisdb.getserver(), "scoapps\\pc\\pcdata.nsf", false); document thisdoc = pcdatadb.getdocumentbyunid(docid); item itm = thisdoc.replaceitemv...

sh - shell script works but drop error "line[8] expected argument [" -

i have shell script works (does want do,finds if listed user online), each time drop error "line[8] expected argument [". i've tried using == same thing. there's code: #!/bin/sh truth=0; until [ $truth -eq 1 ] i; isthere=$(who here | awk '{print $1}' | grep $i) if [ $isthere = $i ] #(8 line here) echo "found user: "$isthere". program close."; exit 0; fi done echo "user not found, retrying after 3sec..."; sleep 3; done thank you , time. looks $isthere or $i empty. should quote them: if [ "$isthere" = "$i" ] in other news: semicolons useless; semicolon not statement terminator , statement separator , along newline.

class - Toggle modal with vanilla javascript -

i'm used working jquery i'm trying vanilla javascript. have link when clicked reveal account modal. i want change class of modal when clicked 'modal-visible'. works expected, when click link again close modal, need class change 'modal-hidden'. i wondered if me that. perhaps needs toggle instead? var accountmodal = document.getelementbyid("account-modal"); document.queryselector('#account-photo').addeventlistener('click', function(e) { e.preventdefault(); accountmodal.classlist.add('modal-visible'); accountmodal.classlist.remove('modal-hidden'); accountmodal.setattribute('aria-hidden', 'false'); }); <a id="account-photo" href="/customer" tabindex="0" aria-expanded="false">account</a> <div id="account-modal" class="modal-visible" aria-label="account information" aria-hidden="false">ac...

c++ - passing argument 2 of 'memcpy' discards 'volatile' qualifier from pointer target type -

i have volatile char * start_address; pointing register sections (might change due hardware behavior). need read , using: memcpy ( result_p, // starting address of destination start_address, // starting address of source result_len // length of payload ); i getting warning: passing argument 2 of ' memcpy ' discards ' volatile ' qualifier pointer target type is safer way read sections or better way use memcpy , prevent warning? memcpy incompatible volatile objects, , mismatched pointer type in function signature helping point out you. memcpy may copy in order, in unit size, read parts of source multiple times, write parts of destination multiple times, etc. on other hand, volatile expresses intent sequence , number of accesses object must in abstract machine. if want copy volatile arrays, need write own copy loop looks naive memcpy , , use right volatile type pointer in loop.

ios - FBSDKAppInviteDialog, restarting the app when leaving -

i'm inviting friends use application through fbsdkappinvitedialog provided facebook sdk. let invitedialog:fbsdkappinvitedialog = fbsdkappinvitedialog() if(invitedialog.canshow()){ let content = fbsdkappinvitecontent() content.applinkurl = nsurl(string: "xxxxxxxx") content.appinvitepreviewimageurl = nsurl(string: "xxx") invitedialog.delegate = self invitedialog.fromviewcontroller = self invitedialog.content = content invitedialog.show() } and delegate methods: extension invitefriendsemailviewcontroller: fbsdkappinvitedialogdelegate{ func appinvitedialog(appinvitedialog: fbsdkappinvitedialog!, didcompletewithresults results: [nsobject : anyobject]!) { } func appinvitedialog(appinvitedialog: fbsdkappinvitedialog!, didfailwitherror error: nserror!) { }} everything working except when invitations sent (successfully), i'm redirected @ initial uiviewcontroller of storyboard.. don't know...

swift - Receive scrollViewDidScroll and UIGestureRecognizer touch event simultaneously -

i have uiscrollview uipangesturerecognizer attached it. on drag, want trigger gesture recognizer, or scrollviewdidscroll , or both in single drag. gesture recognizer, however, steals touch event, scrollview can't scroll. is there way send single touch event scrollviewdidscroll and gesture recognizer? (i tried subclassing scrollview , overriding gesturerecognizer(uigesturerecognizer, shouldrecognizesimultaneouslywithgesturerecognizer:uigesturerecognizer) , no effect, assume because scrollviewdidscroll doesn't rely on gesture recognizer.) it turns out collectionview has pangesturerecognizer property. problem solved.

for loop - Perl questions regarding unpack() and the v flag in printf() -

i trying accomplish following: for arbitrary perl string (whether or not internally encoded in utf-8, , whether or not has utf-8 flag set), scan string left right, , every character, print unicode code point character in hex format. make myself absolutely clear: not want print utf-8 byte sequences or something; print unicode code point every character in string. at first, have come following solution: #!/usr/bin/perl -w use warnings; use utf8; use feature 'unicode_strings'; binmode(stdout, ':encoding(utf-8)'); binmode(stdin, ':encoding(utf-8)'); binmode(stderr, ':encoding(utf-8)'); $text = "\x{3b1}\x{3c9}"; print $text."\n"; printf "%vx\n", $text; # prints following console (the console utf8): # αω # 3b1.3c9 then have seen examples, without reasonable explanations, made me doubt solution correct, , have got questions regarding own solution examples. 1) perl's documentation v flag in (...)printf says: ...

ruby on rails - rspec controller testing with devise -

i'm using devise + rspec + factory + shoulda , having trouble controller specs. i've read bunch of articles , docs couldn't figure out best way log_in user , use user instance. task nested under user index route /users/:user_id/tasks , task belongs_to :assigner, class_name: "user" , belongs_to :executor, class_name: "user" at moment following code both tests fail. best approach sign_in user , use in controller tests? the error message first one: failure/error: expect(assigns(:tasks)).to eq([assigned_task, executed_task]) expected: [#<task id: 1, assigner_id: 1, executor_id: 2, .....>, #<task id: 2, assigner_id: 3, executor_id: 1, ......>] got: nil (compared using ==) the error second one: failure/error: { is_expected.to respond_with :ok } expected response 200, 302 tasks_controller_spec.rb require "rails_helper" describe taskscontroller describe "when user signed in" describe ...

java - why Tomcat check file integrity -

when download tomcat, installation guide says "you must verify integrity of downloaded files". want know, why? we never check file integrity hand when download file internet, tomcat, need it. tomcat have special reason? you should verify integrity of file download on internet; attacker may have modified in nefarious ways. verifying signature ensures you have entire file it wasn't tampered with.

visual studio - Trouble Automatically Restoring Nuget Packages Xunit and Newtonsoft.Json -

i'm working on performing nuget migration create common package directory across solutions. wrote script rid of nuget config files, target files, hint paths (this should not needed nuget automatic package restore), , couple of other things in project , solution files. have 1 nuget config file. the migration worked expected part. ran issues xunit , newtonsoft.json packages. example, projects not find xunit package , visual studio showed following error: "the type or namespace 'xunit' not found (are missing assembly reference?" way able fix reinstall xunit package running following command: update-package –reinstall xunit when reinstalled xunit hint paths added in project files , following code added app.config file: <dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversio...

hyperlink - How would I make a reversed working link? -

i've seen before, it's link placed in backwards form, , when click it goes site, correct way round. ideas? assuming you're using html, same way you'd make regular link. put url backwards inside of <a> element. <a href="http://google.com/">/moc.elgoog//:ptth</a>

git - Adding SSH Keys to remote servers -

i know people suggest way add deployment key remote server, may checkout private git repo. i've been trying deploy application capistrano keep getting failures ssh keys believe when attempting checkout repository application linked to. i have tried agent forwarding think might better adding deployment key each remote server , adding key repository. how best go doing this? i'm looking few simple commands run off against each remote server. i think yo want copy users' public keys server , add'em ssh, right? to need following: copy keys server copy machine remote machine: scp key_name.pub git@serverip:key_name.pub then cat authorized_keys file cat key_name.pub >> .ssh/authorized_keys

android - Navigation View Multiline Text -

i have app navigation view drawerlayout. add programmatically items in menu because receive information on network. sometimes, item name can long , cut off having ellipsize icon "..." does have idea on how have multiline menu items? thanks override design_navigation_menu_item.xml android support design library , modify things need (set android:ellipsize="end" , android:maxlines="2" ) your res/layout/design_navigation_menu_item.xml should this: <?xml version="1.0" encoding="utf-8"?> <merge xmlns:android="http://schemas.android.com/apk/res/android"> <checkedtextview android:id="@+id/design_menu_item_text" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:drawablepadding="@dimen/design_navigation_icon_padding" android:gravity="center_verti...

javascript - Douglas Crockford says we should use that=this. So why do some JS developers disagree? -

if watch enough douglas crockford videos on youtube, you'll see outer this stuff like var = this; $('p').each(function(){ that._textpieces.push($(this).text()); }); which why same. yet know js developers consider shoddy , instead use bind , other ways use more language features , yet make code more unreadable because reader has go more work figure out this means in exact context in used. first off: several commenters have noted, it's preferred use .bind() in es5 , arrow functions in es6. there once dark age before .bind() , evidenced the compatibility table @ bottom of mdn page ; crockford of age. can see .bind() polyfill (also on mdn page), rolling own completely standards-correct .bind() non-trivial compared simple var = this; - it's not unreasonable latter. of course, i'm not crockford, have no idea thought process way when :) with in mind, trick come in handy on occasion. example, d3 has selection.each() function, cal...

How do I get the percentage value next to row in SQL Server? -

i have following query returns top 50 sum(detailtins) records. need have column show percentage of sum(detailtins) on records in table not first 50. what need modify in following query? also using sql server 2008 r2 cannot use over partition by function. with cte ( select id, name, city, state, sum(detailtins) sumtins feedrpts (rpttimeframe between @begindate , @enddate) , ((@value = 'tn' , state = 'tn') or (@value = 'oos' , state <> 'tn') or (@value = 'all')) group id, name, city, state ) select top 50 * cte order sumtins desc you can introduce variable calculate total sum, , use variable calculate percentage: declare @totaltins int select @totaltins = sum(detailtins) feedrpts (rpttimeframe between @begindate , @enddate) , ((@value = 'tn' , state = 'tn') or (@value = 'oos' , state ...

terminal - C - fprintf and printf inside loops don t print to screen -

i discovered function fprintf can used print screen. i have minimal below, doesn t output screen. why? #include <stdio.h> int main(void) { int i,j,k; for(i=0;i<4;i++) { for(j=0;j<0;j++) { for(k=0;k<3;k++) { printf("test\n"); fprintf(stderr, "test\n"); } } } return 0; } i running ubuntu 14.04 , compiling code follows: gcc main.c -o main why should print anything? 1 of loops has impossible condition: for(j=0;j<0;j++) ^--- since j starts @ 0 , can never less 0 , loop exits without ever executing body.

java - cannot convert to required type [org.springframework.security.core.userdetails.UserDetailsService] for property 'userDetailsService': -

hello s first time using spring security. can please me! here console : grave: exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beancreationexception: error creating bean name 'authenticationctrl': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private org.springframework.security.authentication.authenticationmanager tn.talan.project003.authenticationctrl.authmanager; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'authenticationmanager': cannot resolve reference bean 'org.springframework.security.authentication.dao.daoauthenticationprovider#0' while setting constructor argument key [0]; nested exception org.springframework.beans.factory....