Posts

Showing posts from April, 2014

How to define a list of functions of the same arity in Scala? -

How to define a list of functions of the same arity in Scala? - in various lisps, it's possible me create sequence of functions if they'd been normal values: class="lang-lisp prettyprint-override"> (def ops [+ - * /]) which can iterate through, again, if normal values: (doseq [op ops] // (doseq (op ops) (op <- ops) in scala (println (op 1 2 3 4))) now, i've tried few things in scala, of them failing: scala> list(+, -, *, /) <console>:1: error: illegal start of simple look list(+, -, *, /) ^ scala> list[double => double](+, -, *, /) <console>:1: error: illegal start of simple look list[double => double](+, -, *, /) ^ scala> list[double => double](+_, -_, *_, /_) <console>:8: error: not found: value * list[double => double](+_, -_, *_, /_) ^ <console>:8: error: not found: va

c# - How to emulate user connection to web page -

c# - How to emulate user connection to web page - i want emulate many users connection , emulate mane requests concrete site page c# code on site. how can this? site have shared ip. one of best load testing tools out there jmeter: http://jmeter.apache.org/ additionally, utilize visual studio load test built-in tool well: http://msdn.microsoft.com/en-us/library/ms182594.aspx c#

networking - How can i set the incoming buffer size for datagram packets in Emacs Lisp? -

networking - How can i set the incoming buffer size for datagram packets in Emacs Lisp? - i'm writing simple networking application in elisp uses make-network-process open listening socket. i'm listening udp (sock_dgram) packets, , using wireshark can see on network packets 199 bytes long. however, process filter in emacs returns string 195 bytes long! there buffer size need set somewhere? my crystal ball suggesting think 195 bytes 195 chars represented 199 bytes on wire because of dos-style cr/lf line-ends or utf-8 encoding or that. networking emacs elisp

Append JSON element to JSON array in file using Java -

Append JSON element to JSON array in file using Java - currently have next json array object in file(name.json). [{ "name":"ray", "value":"1" }, ] now want add together 1 more element in json array in file using java. this: [{ "name":"ray", "value":"1" }, { "name":"john", "value":"2" } ] one way read entire array file, append element array , write json file in java. not optimum way task. can suggest other way this? try this: 1 - create randomaccessfile object read/write permissions ("rw"); randomaccessfile randomaccessfile = new randomaccessfile("/path/to/file.json", "rw"); 2 - set file cursor position of char "]" long pos = randomaccessfile.length(); while (randomaccessfile.length() > 0) { pos--; randomaccessfile.seek(pos); if (randomaccessfile.readbyte() == &#

sapui5 - Pie chart not showing data correctly -

sapui5 - Pie chart not showing data correctly - my info model: { "userdata": { "firstname": "pieter" "history": [ { "clientid": 2, "distance": "130" }, { "client": 3, "distance": "300" } , { "client": 4, "distance": "430" } ] } } view <content> <viz:ui5.pie> <viz:dataset> <viz:ui5.data.flatteneddataset data="{/userdata/clockhistory}"> <viz:dimensions>

How to boxplot full sample AND subsamples together in R? -

How to boxplot full sample AND subsamples together in R? - i have reading scores 1 total sample , 10 subsamples (gender(2) race(5) = 10 combinations). want show 11 boxplots together. code below generates 10 boxplots lacks full sample's comparing boxplot. how can place 11 boxplots in same plot/graphic share title, x-axis, y-axis, etc.? ideally, how can place 10 subpopulation boxplots within 1 maximum-width population boxplot cuts across (is transparently layered over) 10 subpopulation boxplots allowing viewer graphically compare each subsample's 1q, median, , 3q of total sample? (see below illustration reddish boxplot represents total sample of hs1$read (1q: 44, median: 50, 3q: 60).) setup: hs1 = read.table("http://www.ats.ucla.edu/stat/data/hs1.csv", header = t, sep = ",") ## 10 boxplots (that wish combine 1 more representing total sample) boxplot( read ~ interaction(gender, race), data=hs1, las=2 ) boxplot( read ~ interactio

css - FIX: Ipad Mini HTML margin/padding with -

css - FIX: Ipad Mini HTML margin/padding with <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> - i had website with: <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> ...that applying unusual "margin-right: 30px"-like behaviour html dom element. removing fixed issue. declaring <doctype !html> already gives ie=edge, , i'm happy site not utilize chrome=1. contributing in case else encounters - wasted 6 - 7 hours of dev time on lastly week trying find it. html css internet-explorer

php - Need assistance with regexp and cyrillic -

php - Need assistance with regexp and cyrillic - i´ve got next problem i have regular look did not made myself: "|(?!<.*?)\b$old_text\b(?![^<>]*?>)|s" it wonderfully finds $old_text in $text but if $old_text illustration "ОртоЦентр" it wont find it i´m sure /b boundaries reffering regular look cyrillic alphabet so tried adapt \[wа-я]+$old_text\[wа-я]+ or \wа-я$old_text\wа-я also tried sth. using unicode range: |(?!<.*?)\x{0410}$old_text\x{042f}(?![^<>]*?>)| also tried cyrillic thing i´m sur i´m not using correct: "|(?!<.*?)\b{cyrillic}$old_text\b{cyrillic}(?![^<>]*?>)|si" maybe rather right direction ? hey dont work, can genius pls. assist me ? in advance update: "|(?!<.*?)\p{cyrillic}+\b$old_text\b(?![^<>]*?>)|si" update, heres php-code: $text = "bar foo <p> barfoo </p> foobar ОртоЦентр bar bar"; $old_text =

delphi - How to properly restore an FMX form? -

delphi - How to properly restore an FMX form? - minimizing fmx form menu bar button , restoring clicking on task bar icon bring form foreground, not activate window. form minimized "directly" rather applying animation "shrinks" window taskbar. forms onactivate event not fired. curiously, if patch windowproc , phone call showwindow sw_restore upon deactivation form restored after clicking taskbar icon. i'm not sure why. minimize animation still not fired though. procedure tform1.windowproc(var msg: tmessage); begin case msg.msg of wm_activate: if (msg.wparamlo = wa_inactive) showwindow(windowhandletoplatform(handle).wnd, sw_restore); end; msg.result := callwindowproc(orgwndproc, windowhandletoplatform(handle).wnd, msg.msg, msg.wparam, msg.lparam); end; i can observe behavior blank fmx hd form on windows 8. seems obvious bug me, there improve way work around ? i think got around modifying fmx.platform.win.pas file. in tplatformwin.c

javascript - Calculator Coding - adding fraction buttons -

javascript - Calculator Coding - adding fraction buttons - i got sample calculator javascript kit, , i'm trying modify add together fraction buttons (convert decimal fraction & vice versa, using numbers create fraction, illustration pressing 2 button pressing 4 , makes 2/4 or 1/2, , doing same number after partition symbol it's 2/4 divided 1/2. here's calculator code, head script , body itself. head <script language="javascript" id="calculator"> function addchar(input, character) { if(input.value == null || input.value == "0") input.value = character else input.value += character } function cos(form) { form.display.value = math.cos(form.display.value); } function sin(form) { form.display.value = math.sin(form.display.value); } function tan(form) { form.display.value = math.tan(form.display.value); } function sqrt(form) { form.display.value = math.sqrt(form.display.value); } fu

tsql - T-SQL Error: Incorrect syntax near '+' -

tsql - T-SQL Error: Incorrect syntax near '+' - i wanna create db, want read instancename since i'm using instance name folder name wrote code as: set @instancename = convert( varchar(50),serverproperty ('instancename')) if @instancename null begin set @instancename= 'mssqlserver' -- mssqlserver if default instance end declare @sql varchar(128) set @sql= 'create database [dpo_maindb] on primary ( name = n''dpo_maindb_data'', filename= n''h:\'+@instancename+'\sqldata\dpo_maindb_data.mdf'', size = 4mb , maxsize = unlimited, filegrowth = 10%) log on ( name = n''dpo_maindb_log'', filename = n''g:\'+@instancename+'\sqllogs\dpo_maindb_log.ldf'' , size = 2048kb , maxsize = unlimited , filegrowth = 10%) end' exec(@sql) but got error: wrong syntax near '+'. i tried many things still have problem. know can utilize + since i've used before du

Can I have common zookeeper for both storm and kafka -

Can I have common zookeeper for both storm and kafka - i have configured single node kafka zookeeper (port:2181) , want configure storm 2 node using single zookeeper. can utilize same zookeeper used kafka or can utilize separate zookeeper storm yes can .. same zookeeper cluster can used handling multiple application. setting zookeeper straight forwards in storm can specify list of zookeeper node , port storm.zookeeper.servers: - "localhost" storm.zookeeper.port: 2181 storm.zookeeper.root: "/storm" here sample file zookeeper apache-storm apache-kafka

java - How many times the ServiceLocator does do lookup operation in this case -

java - How many times the ServiceLocator does do lookup operation in this case - could please help me in understanding servicelocator class nowadays in our project this our servicelocator class public class servicelocator { private static servicelocator instance; private context initalcontext; private map cache; // homecoming singelton service locator public static servicelocator getinstance () throws servicelocatorexception { if (instance == null) instance = new servicelocator(); homecoming instance; } private servicelocator () { seek { this.initalcontext = new initialcontext(); this.cache = collections.synchronizedmap(new hashmap()); } grab (namingexception ex) { system.err.printf("error in ctx lookup"); } } public datasource getdatasource (string data

java - How do i rename a integer to a string -

java - How do i rename a integer to a string - how replace number user inputs selection actual corresponding string selection means in print line. import java.util.scanner; public class magicgame { public static void main(string [] args) { string name; int usercharacter; int armorchoice; int weaponchoice; scanner input = new scanner(system.in); system.out.println("please come in name"); name = input.nextline(); { system.out.println("please select character play:" + '\n' + "1 magic user" + '\n' + "2 fighter" + '\n' + "3 thief" + '\n' + "4 druid" ); usercharacter = input.nextint(); system.out.println("please select armor type:" + '\n' + "1 steel plate – armor class 10" + '\n' + "2 chain mail service – armor class 5" + '\n' + "3 leather armor – armor class 3" + '

My Git-Fu needs help. rm -r undo -

My Git-Fu needs help. rm -r undo - switched directories, though bunch of other changes on branch, rm -r entire app/ directory, i'm screwed. https://github.com/geerswitch/penbuilders/commit/20c5111364f0c8369669d2347d35f4b83371e6fb see branch there? see 2k+ deletions? suck @ git. i've tried resetting head, resetting previous commit hashes, , still, files aren't back. can save me? ls-files --deleted shows nothing, can see them in link above, , copy+paste if have to. the files still there, short of wiping entire github repository can them back. seek git revert : git revert 20c51 this create new commit reverses changes in commit 20c51 . safest approach since not rewrite of existing history. it's preferred approach if working collaborators. on other hand, if want "play fire" can git rebase --interactive 20c51~1 , edit offending commit(s). alter history , can cause lose existing work if not used carefully. git

python - for loop in unittest -

python - for loop in unittest - is there way tell python unittest execute assertion in method , show cases fails, instead of stop @ first failed. class mytestcase(testcase): def test_a(self): open('testcase.txt') ifile: iline in ifile: self.assertequal(iline, 'it test!') python 3.4 introduced subtest context manager. code like class mytestcase(testcase): def test_a(self): open('testcase.txt') ifile: iline in ifile: self.subtest(line=iline): self.assertequal(iline, 'it test!') the ugly way accomplish without subtest create self.assert* calls within try block, print errors caught, , raise assertionerror explicitly after loop if @ to the lowest degree 1 test failed. python unit-testing python-unittest

parse string in char format into an array list java -

parse string in char format into an array list java - say instance have string ie "my dog did foo" i want pass each character array list , perform operations according indexes. so need convert characters decimal values in case :- "my dog did foo" would translate next decimal representation:- 109 121 32 100 111 103 32 100 105 100 32 97 32 70 111 111 once done need send array list , compile string using sec number "121" the lastly number "111" , lets "97" , doing calculations numbers. so if these parsed arraylist index sec number in case "121" index1, index "111" in case index equal strings length.(the lastly char) means need determine index before. , 97 index 11. how can write statement convert string decimal char values, add together each char own index in array list , calculations based on indexes? been killing me on month! the next code terribly wrong illustrates intend do

Scala trouble with casting to generics -

Scala trouble with casting to generics - i tried write function different things according input type. example, this: def foo[t](inlist: list[string]): arraybuffer[t] = { val out: arraybuffer[t] = new arraybuffer[t]() inlist.map ( x => { val str = x.substring(1) out += str.asinstanceof[t] }) out } but if phone call function foo[long](new list("123","2342")) , arraybuffer string s, not long s. sorry noob question, want understand scala , generics. scala runs ontop of jvm, not know generics, , concrete type of generic not available @ runtime. so that, runtime equivalent of code def foo(inlist: list[string]): (arraybuffer[object]) = { val out: arraybuffer[object] = new arraybuffer[object]() inlist.map ( x => { val str=x.substring(1) out += str.asinstanceof[object] }) (out) } asinstanceof not convert strings longs, instead throw exception incompatible types. instead, should supply funct

perl - How can I see the places a function is being called in vim? -

perl - How can I see the places a function is being called in vim? - i have been using vim , ctags going on perl files. wondering following: there way/plugin can utilize can press key combination , able see places function called (as can jump definition of function or view list of functions same name in files of project ctags)? have read cscope not sure if usable perl or there solution scripting languages. maybe looking for: " lists lines containing word under cursor. type line number " followed <cr> jump corresponding line. nnoremap [i [i: xnoremap [i "vy:<c-u>ilist /<c-r>v<cr>: " same above 'defines' nnoremap [d [d: xnoremap [d "vy:<c-u>dlist /<c-r>v<cr>: then position cursor under word , type [i or [d . perl vim plugins

ios - UIGestureRecogniser key-value coding -

ios - UIGestureRecogniser key-value coding - i trying utilize key-value coding on uigesturerecogniser . line of code below crashes when tries set value. uigesturerecogniser compliant key-value coding protocol , alternatives can used? gesture.setvalue(nsvalue(cgpoint: draggedobjectoffset), forkey: "draggedobjectoffset") *** terminating app due uncaught exception 'nsunknownkeyexception', reason: '[ setvalue:forundefinedkey:]: class not key value coding-compliant key draggedobject.' the issue not uigesturerecognizer doesn't adhere key value coding protocol, it's doesn't take values key "draggedobjectoffset" . key value coding in many ways similar @property statements. can't assign arbitrary info arbitrary keys objects claim "key value coding-compliant". i suggest writing simple subclass accomplish task. ios swift uigesturerecognizer

Confluence giving weird exception "Invalid file name for use with -Xloggc" while running on ubuntu EC2 -

Confluence giving weird exception "Invalid file name for use with -Xloggc" while running on ubuntu EC2 - i have installed atlassian-confluence-5.6.3.tar.gz on ubuntu server hosted on amazon ec2. whenever trying start confluence after un-tarring above mentioned file showing like: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ run confluence in foreground, start server start-confluence.sh -fg executing current user if encounter issues starting confluence, please see installation guide @ http://confluence.atlassian.com/display/doc/confluence+installation+guide server startup logs located in /home/ubuntu/atlassian-confluence-5.6.4/logs/catalina.out using catalina_base: /home/ubuntu/atlassian-confluence-5.6.4 using catalina_home: /home/ubuntu/atlassian-confluence-5.6.4 using catalina_tmpdir: /home/ubuntu/atlassian-confluence-5.6.4/temp using jre_home: /usr using classpath: /home/ubuntu/atlassian-confluence-5.6.4/bin/bootst

html - bootstrap forbid new line displaying when browser resizes -

html - bootstrap forbid new line displaying when browser resizes - i'm using bootstrap 3 grid scheme layout webpage. how forbid .col-sm-4 show in new line? is, when user browser width changes, want horizontal scroll bar show overflowing content instead of automatically showing in next line. html twitter-bootstrap layout twitter-bootstrap-3

teamcity - Team City to deploy artifacts to external server -

teamcity - Team City to deploy artifacts to external server - i've tried taking on google how can done thought i'd post question anyway see best practice doing nowadays. we trying setup team city build deploy clients environment, we're generating artifacts zip file , plan (somehow) deploy clients uat, staging , live servers (which password protected). when build run executes nant script. from our network in office able remote uat box, can staging , live servers whilst on uat box. what best way of doing this? there useful resources can @ help me move forward? you can seek deployer plugin developed teamcity team. offers smb/ftp/ssh deploy options ssh exec option. teamcity

ruby - undefined local variable or method ` ' for main:Object -

ruby - undefined local variable or method ` ' for main:Object - sometimes, next causes unusual bug: > nil || 4 nameerror: undefined local variable or method ` 4' main:object > nil || [] nameerror: undefined local variable or method ` ' main:object what reason? you accidentally typing alt + space on mac, produces non-breaking space. ruby not consider whitespace, part of variable name. complains variable not exist. some people remap alt + space space in order prevent typo. i highlight invisible characters in text editor, notice typo immediately. ruby whitespace

java - getting user defined object instances from resultset -

java - getting user defined object instances from resultset - i have coding assignment in got stuck... i have business relationship table in need select unprocessed accounts; that's have done easy now assignment inquire me homecoming each business relationship in accounts array; got query so, how homecoming business relationship array(how fill in each unporcessed business relationship in resultset) accounts array homecoming defined function not allowed chnge. is way resultset: homecoming single row contain business relationship instance? we need utilize java 5 , not allowed implement 3rd party library p.s i have tried: account business relationship = (account) rs.getobject("id");` has classcast exception and account business relationship = (account) rs.getobject("id",account.class); has other exception i have read about: customized type mappings not sure after doing sugggest desired resuts and solution involves cre

javascript - angular, pass a scope into a function (passing scope as variable?) -

javascript - angular, pass a scope into a function (passing scope as variable?) - i'm trying pass scope function , can't seem work correctly. here's have - ng-click="clickfunction(scope1)" //the function $scope.clickfunction = function(passedscope){ passedscope = false; console.log($scope.scope1); so - it's prett straight forwards want pass in scope , set false in click. when log scope after changing hwever still says it's true. tried - $scope.passedscope what trying set $scope.scope1 = false. set in top of controller true , controls button nearby button having ng-disabled="!scope1", cant scope1 =!scope! on click because goes through modal confirm user wants finish runs modalinstance.result.then(function () { there need set passed scope false. phone call scope directly, i'm trying create function can utilize across multiple delete functions, trying pass scope needs changing false. i thinking pass sc

airplay - Re-enable mirroring on iOS -

airplay - Re-enable mirroring on iOS - in ios app need display custom content on external display (using airplay) mirroring screens on tv. presenting custom content utilize code multiple display programming guide ios , works well: while ipad in 'mirror' airplay mode i'm able show stuff on tv. however, documentation says6 to re-enable mirroring after displaying unique content, remove window created appropriate screen object. and part isn't working @ all. cannot destroy window utilize display content on external screen. here's code: - (void) destroysecondwindow{ if (secondwindow){ for( uiview* view in secondwindow.subviews ){ [view removefromsuperview]; } secondwindow.backgroundcolor = [uicolor clearcolor]; secondwindow.hidden = yes; // hide , delete window. [secondwindow removefromsuperview]; secondwindow = nil; } } as far unique content should displayed when 1

php - Laravel called from ROOT outsite the /public folder. Getting NotFoundHttpException -

php - Laravel called from ROOT outsite the /public folder. Getting NotFoundHttpException - i've searched through web solve problem non of solutions works me there, after couple of hours of struggling routing module i've decided inquire helping hand. problem i unable access laravel application outside /public directory. need type localhost\projects\laravel\public in browser want utilize url withour /public. main reason because utilize shared hosting , have no access apache configuration file i'm unable create vhost. background i've installed manually laravel framework under the: **c:\xampp\htdocs\projects\laravel** , used composer rest me. the routing has been set to: route::get('/', 'homecontroller@showwelcome'); in project root directory **c:\xampp\htdocs\projects\laravel** i've set .htacces file next content: <ifmodule mod_rewrite.c> rewriteengine on rewritebase /projects/laravel/ rewriterule ^

sql - How to compare two comma-separated strings, and return false untill and unless all values matched -

sql - How to compare two comma-separated strings, and return false untill and unless all values matched - suppose @v1 = p1;p2;p3;p4 @v2 = p1;p2;p3 @v3= p1;p2;p3;p4 i have compare values of @v2 , @v3 values of @v1. need function homecoming true if there match of values . in above example, homecoming true in case of @v3 , returns false in case of @v2. i trying write code..but not working. mentioning code here. select case when exists ( select 1 dbo.split(@v1) inner bring together dbo.split(@v2) b on a.item = b.item ) 1 else 0 end; how can possible in sql server? plz help. for value match can go equal operator: declare @v1 varchar(20) = 'p1;p2;p3;p4' declare @v2 varchar(20) = 'p1;p2;p3' declare @v3 varchar(20) = 'p1;p2;p3;p4' if @v1 = @v2 print 'v1=v2' else if @v1 = @v3 print 'v1=v3' if exists(select 1 dbo.split(@v1) inner bring together dbo.split(@v2) b on a.item = b.item) select

asp.net - marque will not displayed error comes as validation xhtml1.0 -

asp.net - marque will not displayed error comes as validation xhtml1.0 - this code shows error message validation xhtml1.0 transitional lement marquee not displayed .header { width: 100%; background-color: green; height: 80px; } <body> <form runat="server"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <marque behavior="scroll" direction="right"> <div class="header"> <a href="/default.aspx" ><img src="images/wave.gif" width="100" height="65" border="0" alt="home -- xefteri-articles web developers"/></a> </div> </marque> </td> </tr> </table> </form> </body> suggest suitable method you have written <marque> tag , <m

javascript - DOM element to corresponding vue.js component -

javascript - DOM element to corresponding vue.js component - how can find vue.js component corresponding dom element? if have element = document.getelementbyid(id); is there vue method equivalent jquery $(element) ? the proper way utilize v-el directive give reference. can this.$$[reference] . javascript dom vue.js

filtering - Fourier transform and LTI filter and frequency response in Matlab -

filtering - Fourier transform and LTI filter and frequency response in Matlab - i'm new matlab lti signal processing , wondering if can help i'm sure meant basic. i've spent hours , hours researching , obtaining background info , still cannot obtain clear path tackle these problems. far, scratch, have generated signal required , managed utilize fft function produce signal's dft: function x = fourier_rikki(a,t,o) fs = 1000; t = 0:(1/fs):1; = [0.5,0,0.5]; n = (length(a) - 1)/2; x = zeros(size(t)); f1 = 85; o1 = 2*pi*f1; k = 1:length(a) x1 = x + a(k)*exp(1i*o1*t*(k-n-1)); end f2 = 150; o2 = 2*pi*f2; k = 1:length(a); x2 = x + a(k)*exp(1i*o2*t*(k-n-1)); end f3 = 330; o3 = 2*pi*f3; k = 1:length(a); x3 = x + a(k)*exp(1i*o3*t*(k-n-1)); end signal = x1 + x2 + x3; figure(1); subplot(3,1,1); plot(t, signal); title('signal x(t) in time domain'); xlabel('time (seconds)'); ylabel('x(t)'); x = fft(signal); %dft of signal subplot(3,1,2); pl

Where are Windows XP default regional format values stored? -

Where are Windows XP default regional format values stored? - i complained wrong date time representation specific culture. can prepare issue changing values command panel > language or manually editing registry key hkey_current_user\control panel\international. i want prepare default values of regional formats can't find settings stored. possible sure regional formats correct? windows-xp regional-settings

Simple SQLiteDatabase usage in android -

Simple SQLiteDatabase usage in android - my purpose show lastly key_cash value in table_cb on mainactivity the mainactivity part work fine if not related getcash() method. could please tell me problems in getcash() method? this first time using sqlite, hard find answer. //table_cb has 2 columns (long)key_id , (integer)key_cash //cashbalancetable class description of database move info bundle com.example.money; public class cashbalancetable { private int id; private int cash; public cashbalancetable() {} public cashbalancetable(int id, int cash) { this.id = id; this.cash = cash; } public cashbalancetable(int cash) { this.cash = cash; } public void setcash(int cash) { this.cash = cash; } public int getid() { homecoming id; } public int getcash() { homecoming cash; } } //main activity public class mainactivity extends actionbaractivity {

ruby on rails - I can't cope with custom action in controller -

ruby on rails - I can't cope with custom action in controller - in tasks controller have action: def destroy_all current_user.tasks.destroy redirect_to root_path end my db schema looks below: create_table "tasks", force: true |t| t.string "content" t.boolean "done" t.datetime "created_at" t.datetime "updated_at" t.string "users_id" end and have relation: tasks belongs_to user , user has_many tasks. action destory_all want destroy current user's tasks. but when click: <%= link_to "delete all", { controller: 'tasks', action: 'destroy_all'}, method: 'delete' %> nothing happen. user still have tasks. log server console: started delete "/tasks/destroy_all" 127.0.0.1 @ 2014-10-04 23:29:27 +0200 processing taskscontroller#destroy_all html parameters: {"authenticity_token"=>"fvpdi6bcznxl

angular ui bootstrap - Trouble with active tab default using AngularJS, UI Boostrap, and UI Router -

angular ui bootstrap - Trouble with active tab default using AngularJS, UI Boostrap, and UI Router - when using ui boostrap tabset along nested sticky states created ui-router , ui-router-extras, have issue navigating tab's state via url select first tab along right tab. should activate tab state matches url route. here's tabset looks like: <div style="position:relative"> <tabset> <tab heading="dashboard" ui-sref="lms.dashboard" ui-sref-active="active"></tab> <tab heading="modules" ui-sref="lms.modules" ui-sref-active="active"></tab> <tab heading="messages" ui-sref="lms.messages" ui-sref-active="active"></tab> <tab heading="settings" ui-sref="lms.settings" ui-sref-active="active"></tab> </tabset> <div ui-view="dashboa

c# - Dispose works fine, but not on terminating -

c# - Dispose works fine, but not on terminating - i have class implements idisposable , because uses image resources ( bitmap class) gdi+. utilize wrapping gimmicky lockbits / unlockbits . , works fine, when phone call dispose() or using statement. however, if leave programme terminate without disposing, system.accessviolationexception . intuitively, think gc phone call dispose same way do, , object gracefully release resources, that's not happening. why? here's idisposable code: private bool _disposing = false; ~quickbitmap() { dispose(false); } public void dispose() { dispose(true); gc.suppressfinalize(this); } private void dispose(bool safedispose) { if (_disposing) return; savebits(); // private wrapper unlockbits bytes = null; // byte[] of image bmpdata = null; // bitmapdata object if (safedispose && bm != null) { bm.dispose(); // bitmap object bm = null; } _disposing = tru

java - Check if scanner input equals list that is converted to arraylist -

java - Check if scanner input equals list that is converted to arraylist - i have file bunch of strings in it. have converted whatever in file list. want create scanner scans user-input , returns true or false whether scanner input contains whatever in list (file). i have logic in head don't know syntax. i have come far. need help. in advance. public static void main (string [] args) throws exception { scanner scan = new scanner(new file("/users/greg/workspace/erlang/fred.txt")); arraylist<string> list = new arraylist<string>(); while (scan.hasnext()){ list.add(scan.next()); scanner scan2 = new scanner (system.in); system.out.println("enter"); string input = scan2.nextline(); // if input equals list / file - > sysout true . else > false } by help of amazing people on stackoverflow completed assignment. finished code , working perfectly:¨ public static void main(string[] a

How to create a custom JIRA Agile report? -

How to create a custom JIRA Agile report? - is possible create custom study sprint or epic study under reports tab in jira agile? if yes how can accomplish same? there tutorial it? i using jira 6.1.7 version jira agile plugin. you have several options: jirareports, cloud-based tool (supports jira agile) free-form reporting plugins eazybi or intelligent reports (both back upwards jira agile) plugins specific reports (search marketplace) for finish customization, can create plugin using html , java (report-specific plugin tutorial) jira jira-plugin jira-agile

spring data - Springdata MongoDB automatically generates and undesired unique index in subdocuments -

spring data - Springdata MongoDB automatically generates and undesired unique index in subdocuments - i , storing doc objects in mongodb repository ensuring barcode property unique across collection: @document(collection = "doc") public class doc { @id private string id; @indexed(unique = true) private string barcode; ... } i store docaudit collection stores lists of doc sub-documents: @document(collection = "docaudit") public class docaudit { @id private string id; private list<doc> docs; ... } as docaudit entries generated, same doc can nowadays in docs list of 2 or more docaudit entries. the @indexed(unique = true) on barcode property of doc object automatically generating mongodb indexes on doc.barcode (desired) , docaudit.docs.doc.barcode (undesired) what's best way avoid automatic generation of undesired index? alternatively, what's best way remove undesired index created? docaudit of cour

microcontroller - Clock on Atmega8 -

microcontroller - Clock on Atmega8 - i trying clock on atmega8. have 8mhz quartz. i utilize timer0 interrupt clock timeticks: /* settings */ #define tmr_reload 80 - 5 /* 8 khz / 80 = 100 hz */ #define tmr_cnt_max 100 /* 1hz internal counter */ /* internal variables */ static uint8_t tmr_cnt; inline void tmr0_init() { /* set clock source f_t0 = 8Мhz/1024 = 8 khz */ tccr0 = _bv(cs00) | _bv(cs02); timsk |= _bv(toie0); /* enable tmr0 interrupt on overflow*/ } isr (timer0_ovf_vect) { if (tmr_cnt == 0) clock_tick1s(); tmr_cnt++; if (tmr_cnt >= tmr_cnt_max) tmr_cnt = 0; tcnt0 -= tmr_reload; } the problem clock running fast or slow. calculated value set in tcnt0 register 80, in case clock running slow. when utilize 80-4 clock running slow. when utilize 80-5, it's fast. i don't know, how be??? update: settings following, problem still exists. /* settings */ #define tmr_reload 125 /* 31.25 khz / 125 = 250 hz */ #de

java - HttpUrlConnection and file issue -

java - HttpUrlConnection and file issue - sorry bring again. when first started develop android app, using httpclient. realized google officially made class deprecated latest version of android; encourage developer utilize httpurlconnection instead. i faced wall when tried upload file(jpeg) php server api hosted on gae. set lot of effort using multipart accomplish that. ended using next class. it's still not working unknown reason. php server api receives post info can't receive file. what`s wrong code? in case you're wondering, can verify has nil server using isset($_files["profile_picture"]) verify i've received it. here class: package net.xxxxx; import android.util.log; import java.io.bufferedinputstream; import java.io.bufferedreader; import java.io.file; import java.io.fileinputstream; import java.io.ioexception; import java.io.inputstreamreader; import java.io.outputstream; import java.io.outputstreamwriter; import java.io.printwr

ios - Epoch Unix Time Missing Few hours when the year is before 1970 -

ios - Epoch Unix Time Missing Few hours when the year is before 1970 - i have web service returns date of birth of people. issue having when year of birth around 1899 time looses few hours. however, more close gets 1970 gets accurate. there no issues when birth year after 1970. passed date - 1899-12-31 16:00:00 +0000 returning date - 1899-12-31 22:55:25 +0000 (added time difference of +0800) after 1970 fine] passed date - 1990-08-24 16:00:00 +0000 returning date - 1990-08-25 00:00:00 +0000 im using objective c jsondatestring passing string double datenumber = [[jsondatestring substringwithrange:nsmakerange(startposition, 1)] isequaltostring:@"-"] ? - [[jsondatestring substringwithrange:nsmakerange(startposition + 1, 13)] doublevalue] : [[jsondatestring substringwithrange:nsmakerange(startposition, 13)] doublevalue]; nstimeinterval unixtime = datenumber / 1000; //wcf send 13 digit-long value time interval since 1970 (millisecond precisio

parsing - Find Vertical spacing of text lines? -

parsing - Find Vertical spacing of text lines? - in itext know attributes of text can extracted: gs → graphics state word spacing character spacing font size but vertical spacing? example, in ms word 1 sets paragraph spacing {before/after paragraph, line spacing} , these generated resultant pdf. if these vertical spacing info needs recovered analyzing pdf file, there operator 1 should pay attending to? in adobe portable document format reference 1.3 1 might see th → horizontal spacing txty → move text rendering location respect start of line segment tlm → line matrix tm → text matrix tf → font ts → text rise but haven't found operator/meta info straight specifies vertical spacing of text. perhaps related how current text line tlm positioned? how location of tlm determined? parsing pdf itextsharp itext

three.js animation: Skeleton/Skinning vs Morph -

three.js animation: Skeleton/Skinning vs Morph - so after experimenting morph , skeletal animation (exporting blender), see skeletal files 10 times smaller morph files. seem skeletal improve option, wondering if there cons using it. specifically suspect takes much more processing animate skeleton rather morph. when 1 improve other? matter if im animating 100 models vs one? if skeletal take more processing, , host application online, decrease in bandwidth (due little file sizes) worth processing need @ run time? thanks input. indeed, skeletal animation takes more processing, because bones' matrices must calculated (in js) in every frame , uploaded gpu. while morph animation, interpolation can done gpu-side. memory-performance trade. when have many animations playing @ same time, processing indeed have cost. @ same time, however, several different morph animations have big filesizes. as mentioned. so depends on case. there fine points should take note of:

MS Access VBA data type mismatch in function -

MS Access VBA data type mismatch in function - i have database containing locations of water wells , ton of properties associated wells. tables linked well_id (name of well), "short text" info type, can tell. within database there existing queries i'm trying info (i don't want mess tables in case create error , mess up). i've created form user inputs utm coordinates easting , northing, search radius, clicks "search" button. upon clicking search, procedure creates recordset of [qryutm_nad83], calculates radial distance of each , if within specified search radius, stored in new [search_results] table using insert into. now, 1 time identified meeting search criteria well_id stored, , passed function searches through recordset of different query [qryformation]. query has one-to-many relationship there record each geologic layer, each having same well_id (i.e. each has multiple layers these layers have same well_id). need concatenate thes

cryptography - Serpent Sbox transformation -

cryptography - Serpent Sbox transformation - consider have sample key 15fc0d48 d7f8199c be399183 4d96f327 10000000 00000000 00000000 00000000 w-8 w-7 w-6 w-5 w-4 w-3 w-2 w-1 creating first k0 key schedule pair (k0,k1,k2,k3)=s3(w0,w1,w2,w3)=k0 using formula serpent key schdule wi=(wi-8 xor wi-5 xor wi-3 xor wi-1 xor phi xor i)<<<11 1) i=0 w0=w-8 xor w-5 xor w-3 xor w-1 xor 9e3779b9 xor 0<<<11=15fc0d48 xor 4d96f327 xor 00000000 xor 00000000 xor 9e3779b9 xor 0 <<<11=ec3eb632 2) i=1 w1=w-7 xor w-4 xor w-2 xor w0 xor 9e3779b9 xor 1<<<11=d7f8199c xor 10000000 xor 00000000 xor ec3eb632 xor 9e3779b9 xor 1<<<11=8eb0b5af 3) i=2 w2=w-6 xor w-3 xor w-1 xor w1 xor 9e3779b9 xor 2<<<11=be399183 xor 00000000 xor 00000000 xor 8eb0b5af xor 9e3779b9 xor 2<<<11=f2ecbd75 4) i=3 w3=w-5 xor w-2 xor w0 xor w2 xor 9e3779b9 xor 3<<<11=4d96f327 xor 0000

java - How to add classpath in an Android Studio project -

java - How to add classpath in an Android Studio project - i have android project android application depends on pure java library (and java library uses others compiled jars libraries). added dependencies, can build project, @ run time have classnotfoundexception error.i had add together the classpath environment variable path jars.is there way set classpath locally project only, using command line option java –classpath <path jars> in android studio run/debug configurations? in case haven't solved problem yet: place .jar (in case .jar) file anywhere in c: (i recommend place file in android project directory. example: c:/users//androidstudioproject/ open project in android studio. go to: file->new->new module on bottom, under "more modules", select "import .jar of .aar package", think 3rd alternative listed. click next, , next "file name" text field, notice little button text "...". click button, ,

html - Text inline with image rising to top of image, padding top won't work? -

html - Text inline with image rising to top of image, padding top won't work? - alright header of site i've little logo image, need 2 links spaced out through header. with 2 links in, works space them, they're way @ top , can't figure out how lower them? <div class="row"> <div class="header"> <img src="assets/caliweb.png" alt="cali logo"> </div> <p><a href="#">patents pending</a></p> <p><a href="#">partner us</a></p> </div> css .header p { display: inline; padding-top: 5%; padding-left: 10%; padding-right: 10%; } .header img{ float: left; padding-top: padding-left: 5%; padding-right: 10%; display: inline; } this tried, that's not working @ all, links below image. <div class="row"> <div class="header"&