Posts

Showing posts from March, 2010

ios - Observer being added after postNotification ONLY on iPhone 4S -

i have functional code works on ios >8.0 iphones >5 , ipads, pass information , call function via observers/notifications, on iphone 4s doesn't work. through debugging, found out only while running on iphone 4s observer gets added after notification gets posted. this happening on devices , on simulator, on ios 8 , 9, respectively. code: **postnotification** override func viewdidload() { super.viewdidload() self.registercells() uiapplication.sharedapplication().statusbarstyle = .lightcontent self.collectionview.delayscontenttouches = false nsnotificationcenter.defaultcenter().addobserver(self, selector: "footerupdatecontentsize:", name: "footerupdatecontentsize", object: nil) nsnotificationcenter.defaultcenter().addobserver(self, selector: "seasonupdatecontentsize:", name: "seasonupdatecontentsize", object: nil) self.loaddetailtvshow() } func registercells() { self.collectionview.regist...

printwriter - I keep only getting these compiling answers in 3 methods. JAVA -

please ignore sloppy coding. i'm pretty new java , trying project school. can't find causing error decrossdiscipline.java:455: error: unreported exception filenotfoundexception; must caught or declared thrown printwriter outputfile = new printwriter(filename); ^ decrossdiscipline.java:533: error: unreported exception filenotfoundexception; must caught or declared thrown printwriter outputfile = new printwriter(filename); ^ decrossdiscipline.java:623: error: unreported exception filenotfoundexception; must caught or declared thrown printwriter outputfile = new printwriter(filename); ^ 3 errors this program getting errors in. please help. feel need pair of eyes spot problem me. import java.util.scanner; import java.io.*; public class decrossdiscipline { public static void main(string[] args) throws ioexception { scann...

bash - Need a script to split a large file by month that can determine year based off order of the logs -

i need split large syslog file goes october 2015 february 2016 , separated month. due background log retention, format of these logs similar to: oct 21 08:00:00 - log info nov 16 08:00:00 - log info dec 25 08:00:00 - log info jan 11 08:00:00 - log info feb 16 08:00:00 - log info this large file result of initial zgrep search across large amount of log files split day. example being, user activity on network across multiple services such windows/firewall/physical access logs. for previous request, used following: gawk 'begin{ m=split("jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec",mth,"|") } { for(i=1;i<=m;i++){ if ( mth[i]==$1){ month = } } tt="2015 "month" "$2" 00 00 00" date= strftime("%y%m",mktime(tt)) print $0 > filename"."date".txt" } ' logfile output file examples (note add "%d" day not time: test.201503.txt test.201504.txt test.201505.txt test.2015...

PHP "include" fails (redux) -

sorry "php include" chapter searching on gives 90,000 entries , feel i've read 1/2 of 'em. i'm resurrecting web page wrote 9 years ago on win 2000 pro. since i've ported ubuntu 10.0, windows 7 , published online through 2 different hosting sites. i'm on ubuntu 14.04 , cannot php "include" command work. code follows: <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <title>main menu movietime.php</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> </head> <?php error_reporting(e_all);?> <body background="wood.gif"> <form method="post"> <input type="hidden" name="hiddenn" value="hide & "> <hidden name="hidden" value="well hid"> </form> <?php include dirname(__file__).'menu.php'; ?> ...

javascript - AngularJS provider not working as per styleguide -

i'm following john papa's angular1 styleguide , trying implement provider. the provider per document looks this, angular .module('blocks.router') .provider('routerhelper', routerhelperprovider); routerhelperprovider.$inject = ['$locationprovider', '$stateprovider', '$urlrouterprovider']; /* @nginject */ function routerhelperprovider($locationprovider, $stateprovider, $urlrouterprovider) { /* jshint validthis:true */ this.$get = routerhelper; $locationprovider.html5mode(true); routerhelper.$inject = ['$state']; /* @nginject */ function routerhelper($state) { var hasotherwise = false; var service = { configurestates: configurestates, getstates: getstates }; return service; /////////////// function configurestates(states, otherwisepath) { states.foreach(function(state) { $stateprovider.st...

Android Button always takes two clicks to fire onClick() -

i have relativelayout inside of scrollview contains button , textviews , edittexts. in xml layout file, defining android:onclick takes 2 clicks of button fire event. button gets focus on first click , fires onclick event on second click. have tried setting focusable , focusableintouchmode both false behavior doesn't change. here layout file: <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".densityactivity" > <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview ... <textview ... <textview ... <edittext ....

android - Recyclerview only load Image when itemview is shown -

i load images in itemviews of recyclerview if itemview shown. tried in adapter far: if (holder.itemview.isshown()) { log.e("shown", "yes " + position); } if (holder.itemview.isfocused()) { log.e("focused", "yes " + position); } if (holder.itemview.hasfocus()) { log.e("hasfocus", "yes " + position); } and tried in fragment add onscrolllistener recylcerview: recyclerviewsearchgif.addonscrolllistener(new recyclerview.onscrolllistener() { @override public void onscrolled(recyclerview recyclerview, int dx, int dy) { super.onscrolled(recyclerview, dx, dy); } @override public void onscrollstatechanged(recyclerview recyclerview, int newstate) { super.onscrollstatechanged(recyclerview, newstate); } }); but don't know how use case. su...

sql server - How can I include a Temp Table in a SQL Function -

i have sql server 2014 server linked oracle server. want use temp table in function return dataset oracle database , use function return results using regular t-sql. since rather new close getting error message msg 156, level 15, state 1, procedure getbond, line 37 incorrect syntax near keyword 'begin'. i have posted function code here: set ansi_nulls on go set quoted_identifier on go alter function [dbo].[getbond] (@warcontrolid bigint) returns varchar(max) begin --create temp table declare @tsql varchar(max) declare @warrantbail table ( wr_invl varchar(5), wr_warr_ctl varchar(10), wr_bail varchar(50), wc_bail varchar(50) ) select @tsql = 'select * openquery(rmsprod2,''select tiburon.wrmast.wr_invl, tiburon.wrmast.wr_warr_ctl,tiburon.wrmast.wr_bail,tiburon.wrwchg.wc_bail tiburon.wrmast left join tiburon.wrwchg on wrwchg.wc_wr_chain = wrma...

angularjs - Angular 2: Create drop-down list with array of dictionaries -

this question has answer here: angular2 - error if don't check if {{object.field}} exists 1 answer i'm using options tag in angular 2 populate dropdown list. dropdown list populating correctly datetest1.json , however, when iterating thru values of given key in .json file, it's having trouble populating drop down list. what's correct way in angular 2 populating dropdown list datetest.json example below? *.component.html when retrieving datetest.json: exception: typeerror: cannot read property 'month' of undefined in [dateattributeslist.month in *component@63:22] <option *ngfor="#m of dateattributeslist.month" [value]="m">{{m}}</option> datetest.json: [ {"month": ["dec", "jan", ...]}, {"day" : ["1","2"...]} ] *.component.html when ret...

ember.js - Ember Transaction has no method add -

i'm attempting create ember transaction commit single model backend api. coffeescript: comic = app.comic.createrecord(title: @get('comictitle')) transaction = comic.get('store').transaction transaction.add(comic) transaction.commit() which gives javascript error: uncaught typeerror: object function () { return ds.transaction.create({ store: }); } has no method 'add' i've googled various different ways use ember transactions, i'm not sure i'm going wrong. i'm using latest version of ember data. the coffeescript js translation may not happening correctly. try changing to transaction = @get('store').transaction() i have found implicit method invocation in coffeescript trips in ember occasionally.

java - Password Access with Multiple Instances -

i designing application require users first login , access several secure web pages. plan on using aws along aws load balancer , expect several aws instances of application running. "best practice" persisting security credentials across several web pages , several instances? user login , navigate through several secure web pages. presume aws load balancer round-robin redirecting each https request different server instance. how each instance know user has logged in? also, how keep secure pages secure external access? platform linux, java, , spring-boot. i presume aws load balancer round-robin redirecting each https request different server instance. that's default elb behavior, can enable sticky sessions on elastic load balancer lock user specific back-end server, @ point http session stored on 1 server keeps track of user's authentication state. how each instance know user has logged in? they don't, unless configure shared ses...

c# - Flights: find lowest price flight combinations -

Image
a destination may have 2 connected flights, example for frankfurt boston frankfurt-london (at 08:00-10:00, 14:00-18:00 etc.) flight number fl1, fl2 london-boston (at 10:00-12:00, 16:00-20:00 etc.) flight number lb1, lb2 each flight may have classes such a, b etc. (from cheap expensive) i have cartesian such of combinations: fl1/a - lb1/a (fl1 being flight number / being class) fl1/a - lb1/b fl1/b - lb1/a fl1/b - lb1/b ... fl2/b - lb2/b what should present @ end screen lowest price flight each destination combination: fl1/a - lb1/a fl1/a - lb2/a fl2/a - lb1/a fl2/a - lb2/a how can achieve linq query/queries? what should find lowest priced flight i have destination , flight classes: class destination { list<flight> flights } and class flight{ list<string> @classes; //such a,b,c,d,e string flightid; } so far can have flatten list of flights with: var flights = destination.selectmany(d=>d.flights); ...

How to make colormap effect in javafx? -

i'd apply effect 8-bit image, associate each 8-bit input colour output 32-bit colour. applying effects replaces input colours associated. i implement rewriting image bitmap programmatically. i'm afraid hamper efficiency. best implement such functionality effect. how done? one possibility (if understand correctly you're looking for) use writableimage indexed pixel format . here example of simple animation updates index value changes, , sets pixels of image each time. seems pretty efficient, though there may more efficient ways achieve you're trying do. import javafx.animation.animation; import javafx.animation.keyframe; import javafx.animation.keyvalue; import javafx.animation.timeline; import javafx.application.application; import javafx.beans.property.doubleproperty; import javafx.beans.property.simpledoubleproperty; import javafx.scene.scene; import javafx.scene.image.imageview; import javafx.scene.image.pixelformat; import javafx.scene.image.wri...

javascript - Angularjs share methods between controller -

i have application displays news feed in 1 page (home page) , in displays feed user alone (user profile page). both pages , behave in same way. change in content due different urls called. how solve in angularjs? i have home controller has methods/logic used display home page. now need have 1 more controller calls other url , same thing home controller. i thinking of parent controller , 2 controllers. looks in angularjs controller inheritance determined dom structure. in case 2 different pages. cant create dom style inheritance. i confused on how solve without duplicating code in both controllers. i happy add more details question if needed. went through number of google results couldn't figure out how this. a service (not controller) should own domain model, , provide model api rest of application (usually controllers) use. i suggest @ least 2 services, 1 newsfeed, , 1 profile, , maybe 1 more shared functions (these functions can passed collection,...

sql server - SQL Having aggregate function? -

i have table students , evaluations. necessary return number of repetitions ratings without min , max number of repetitions grade. when i'am runnig query: select [grade], count([grade]) [number of repetitions] [test].[dbo].[evaluation] group grade i have result , ok, how show query withuout min , max number of repetitions.(in case 6 - 120 , 10 - 4) grade number of repetitions 6 120 7 35 8 93 9 25 10 4 i tried wtih having on way, not work. message in sql: "cannot perform aggregate function on expression containing aggregate or subquery" select [grade], count([grade]) [number of repetitions] [test].[dbo].[evaluation] group grade having count([grade) > (select min(count([grade])) [test][dbo].[evaluation] group grade) , having count([grade) < (select max(count([grade])) [test][dbo].[evaluation] group grade) thank much. ...

python - <type 'exceptions.NameError'> -

trying create web application (using mysql , python) list of hiking trails in ma. want display names of trails in db on 1 page , cannot figure out why nothing display: ################################################################################ def getallhikes(): """ middleware function read database. returns list containing records of trails have in table. """ # connect db conn, cursor = getconnectionandcursor() # prepare sql sql = """ select name hiking """ # run sql cursor.execute(sql) # fetch results data = cursor.fetchall() # clean cursor.close() conn.close() return data ################################################################################ def showallhikes(data): '''produce table showing trails, 1 per row.''' print(''' here popular trails have on file: <table> <tr> <td>%s</td> <td>%s</td> <td>%s...

unix - How to use ubuntu command line to find a holiday? -

how use ubuntu command find date of mother's day (second sunday of may) in 2017? since -v doesn't work on ubuntu, works on mac. lets second sunday of may : fhenri@machine:~$ date -v1d -v5m -v+1y -v+2w -v-sun dim 14 mai 2017 22:56:28 cest you should @ man date more examples , find out if need particular sunday or fix day i running on macos (freebsd based) , did not realized date not uniform across *nix system. on ubuntu, revealed bit more difficult here how go vagrant@ubuntu:~$ firstofmay=$(date -d '05/01/2017') vagrant@ubuntu:~$ firstsunday=$(date -d "$firstofmay" '+%y-%m')-$(( 8 - $(date -d "$firstofmay" '+%u') )) vagrant@ubuntu:~$ secondsunday=$(date -d "$firstsunday + 1 week" '+%y-%m-%d') vagrant@ubuntu:~$ echo $secondsunday 2017-05-14 first initialize 1st of may base date then format of first sunday month: day 7 based , $(date -d "$firstofmonth" '+%u') day number ...

javascript - Callback not working properly -

html <div class="expand"> <span>▲</span> </div> js $(".expand").click(function(){ if ($(this).children().text()=="▼") { $(this).children().fadeout("fast",function(){ $(this).children().text("▲"); }); // callback? $(this).children().fadein("fast"); //woks } else { $(this).children().fadeout("fast",function(){ $(this).children().text("▼"); }); // callback? $(this).children().fadein("fast"); //works }; $(this).parent().parent().find(".words, .readings").slidetoggle("fast"); //works }); i tried debugging putting alert('') in callback, nothing popped up, guess i'm making simple mistake here. basically, ▼ should fade out , when fades out (callback), should turn ▲, , fade in, that. pretty standard seen everywhere if ask me. or i'm doing wrong...

c# - wpf datagrid foreground binding to item's property programmaticaly -

i have wpf datagrid control runtime generated columns. itemssource set generic list of examineexampledatagriditem : public class examineexamplesdatagriditem { public list<string> predictiveattributevalues { get; set; } public string decisiveattributevalue { get; set; } public string examinedattributevalue { get; set; } public brush examinedattributevaluecolor { // if set debug point here, i'll there, makes no sense { return decisiveattributevalue == null || examinedattributevalue == null ? brushes.black : decisiveattributevalue.equals(examinedattributevalue) ? brushes.green : brushes.red; } set { } } } when binding fields datagrid instance, works fine except coloring: list<examineexamplesdatagriditem> items = new list<examineexamplesdatagriditem>(); // several columns, works fine (int = 0; < _attributetypeset.predictiveattributetypes.count;...

can not find and count text with hypen in the name using awk -

using below awk seem returning incorrect count. ids ( input ) - in name not found though in file searched. not sure not right in command. thank :). input sept12 sept5-gp1bb sept9 hla-drb1 hla-drb5 file chr16 4837470 4837656 sept12 chr16 4837536 4837656 sept12 chr22 19711038 19711157 sept5-gp1bb chr22 19711038 19711157 sept5-gp1bb chr22 19711366 19711997 sept5-gp1bb chr22 19711367 19711997 sept5-gp1bb chr22 19711367 19711997 sept5-gp1bb chr17 75398130 75398795 sept9 chr17 75471590 75471995 sept9 chr17 75478215 75478427 sept9 chr6 32487136 32487438 hla-drb1 chr6 32489671 32489961 hla-drb1 chr6 32551875 32552165 hla-drb5 current output 2 ids found sept5-gp1bb missing hla-drb1 missing hla-drb5 missing desired output 5 ids found awk (missing.awk) begin { fs="[[:space:]]+|-" } nr == fnr { seen[$0]; next } $4 in seen { found[$4]; delete seen[$4] } end { print length(found) " ids found" (i in seen) print " missing" } awk -f missin...

java - Returning a remainder -

@test public void testcheckdigit() { zipcode z7 = new zipcode (12345); assertequals(5, z7.getcheckdigit()); zipcode z8 = new zipcode (01234); assertequals(0, z8.getcheckdigit()); zipcode z9 = new zipcode (11234); assertequals(9, z9.getcheckdigit()); zipcode z10 = new zipcode (10044); assertequals(1, z10.getcheckdigit()); } public int getcheckdigit() { while(zipcode > 0) { digitcheck = digitcheck + zipcode % 10; zipcode = zipcode / 10; digitcheck = digitcheck % 10; } return digitcheck; so whenever run test supposed return number make individual numbers added in zipcode clean division of 10, when supposed return 9 returns 1 instead. going wrong code?

amazon web services - How to combine Cognito User Pools with external providers like Facebook? -

so far cognito has identity pools support external providers facebook. now there cognito user pools - love use. but can't figure out how support both - cognito user pools , external providers facebook. it seems identity pools , user pools separated things , can't see how put them together. so in short, want users able either sign in facebook or user pools. anybody has idea if possible? you can add cognito user pool identity provider in cognito federated identity pool. steps: (1) create user pool, note down user pool id , app client id (2) navigate cognito federated identity console. (3) when creating/editing federated identity pool, expand "authentication providers" (4) click cognito tab (5) enter user pool id , app client id. then use cognito user pools use amazon, facebook, google, twitter, or oidc provider. this blog post should help: http://mobile.awsblog.com/post/txgnh1aukdrzdh/announcing-your-user-pools-in-amazon-cognito

sql - ActiveRecord conditional count -

in application, i'm trying sort items views within last 10 days. i'm using impressionist gem, creates model called impression , records every view here. i've managed piece of code: @items = item.joins("left join impressions on impressions.impressionable_id = items.id , impressions.impressionable_type = 'item'") .select("count(distinct(ip_address)) counter, impressionable_id, items.title, items.id, items.image") .group('items.id') .order("counter desc") .page(params[:page]) .per_page(9) this sorts items total unique views. however, want count impressions have been made within last 10 days. led me add where method such: time_range = (time.now - 10.days)..time.now @items = item.joins("left join impressions on impressions.impressionable_id = items.id , impressions.impressionable_type = 'item'") .selec...

Pure JavaScript - Timed Animation - Consistent height? -

i have created script animates height of element in 500ms. the timer works fine struggling make height increase consistently. how animate height smoothly within time period? jumps @ moment. i want replace following smarter: self.startheight + 5 i imagine has speed , elapsed time? https://jsfiddle.net/zrm7xena/1/ (function () { 'use strict'; var animator = {}; animator.endheight = 200; //the end height animator.interval = null; //create variable hold our interval animator.speed = 500; //500ms animator.startheight = 0; //the start height animator.animate = function (el) { var self = this, starttime = date.now(); //get start time this.interval = setinterval(function () { var elapsed = date.now() - starttime, //work out elapsed time maxheight = self.maxheight; //cache max height //if elapsed time less speed (500ms) if (elapsed < self.speed) { ...

calculating a percentage from a value C# -

i'm trying output percentage value imputed textbox. here code; int firstnumber; double mydouble1 = 0.15; int myint1 = (int)mydouble1; int.tryparse(housevalue.text, out firstnumber); int answer; answer = (firstnumber) * (myint1); prem1.text = answer.tostring(); the problem when run app , enter value calculate, answer 0. cant seem display correct amount 0.15% of value. try this: change answer int double : int firstnumber; double mydouble1 = 0.15; if (int.tryparse(housevalue.text, out firstnumber)) { double answer = firstnumber * mydouble1; prem1.text = answer.tostring(); // may want round/format }

vaadin - OptionGroup addValueChangeListener CheckBox -

vaadin 7.6.5. trying figure out why value change listener fails in below case? checkbox observing addvaluechangelistener optiongroup. @theme("vaadindemo") public class vaadindemoui extends ui { @webservlet(value = "/*", asyncsupported = true) @vaadinservletconfiguration(productionmode = false, ui = vaadindemoui.class) public static class servlet extends vaadinservlet { } @override protected void init(vaadinrequest request) { final verticallayout layout = new verticallayout(); layout.setmargin(true); setcontent(layout); optiongroup group = new optiongroup(); group.additem("01"); group.setitemcaption("01", "one"); group.additem("02"); group.setitemcaption("02", "two"); group.additem("03"); group.setitemcaption("03", "three"); group.addvaluechangelistener(new...

c# - MVP - Should a Presenter have one overall model or multiple models? -

i using mvp structure project in c#. had imodel interface contained crud operations, have since split number of model interfaces (e.g. inotebookmodel, icategorymodel, iitemmodel etc.) each contain crud operations. would better have overall model has crud methods delegate appropriate specific models (e.g. create(string type)) or holds references each specific model in presenter? if having multiple models bad way it, how can pass down appropriate parameters model objects can created/updated? each object requires different information. having different models not bad way it. this surely make design more complex increase app's maintainability. if you're building app needs evolutionary in future upgrades, seperate model several models. in case want add different entity app. maybe books assigned persons, add ipersonmodel interface , 3 other interfaces (inotebookmodel, icategorymodel, iitemmodel) remain intact. however, if application simple , want favour rapid...

ios - UITableViewCell not shrinking to wrap UIImageView -

i have tableview first element fixed aspect ratio header image. embedded uiimageview inside uitableviewcell's content view. desired outcome entire cell adopting size of image. tried couple of things, first of all, pinning 4 edges of uiimageview parent content view , setting aspect ratio desired value (2h 3w). setup aspect ratio constraint gets ignored , image view takes height of cell, shrinks asset. next, tried remove bottom constraint. result, aspect ratio respected, cell height larger of image view. my question is, can make cell shrink wrap height of image view using auto layout? can make cell shrink wrap height of image view using autolayout? yes can, there trick. uitableviews have fixed height cells. if want variable height must implement uitableviewdelegate method - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath; if cell constraints setup (and mean if instead of cell had uiview, it's size defined it...

c++ - I am to create a simple Command Interpreter that allows user to input commands like in any command line, but error occurs after 2 arguments -

command line / output enter command: mkdir 1 enter command: touch one/file one/other one/more error: bad address enter command: ^z c++ source code int main(int argc, char *argv[]){ int rs; int count = 0; pid_t pid; char input[100]; char* temp; char* arg[6] = { (char*)0, (char*)0, (char*)0, (char*)0, (char*)0, (char*)0 }; //command arg1 arg2 arg3 arg4 null while(true){ cout << "enter command: "; cin.getline(input, 100); for( temp = strtok(input, " "); temp; temp = strtok(null, " ") ) { arg[count++] = temp; } pid = fork(); if(pid == -1){ perror("error"); exit(exit_failure); } if(pid == 0){ /*child process*/ /*if(count < 2){ rs = execlp(arg[0],arg[0],arg[1],null); cout << "arg[0]: " << arg[0] << "arg[1]: " << arg[1] << endl; ...

r - Combining value 'A' to 'B' to form one value as C -

i'm working in r , wanted combine values follows: i have 2 variables i've created, a = c(1,2,3) b = c(4,5,6) and make new value 'c' have output: c [1] 1 2 3 4 5 6 my question how 1 in r? many in advance! here easiest way it a = c(1,2,3) b = c(4,5,6) c <- c(a,b) c even though unnecessary, write function you function_to_combine_vectors <- function(vector_1, vector_2){ new_vector <- c(vector_1, vector_2) return(new_vector) } c <- function_to_combine_vectors(a, b) print(c)

SoftLayer - How to resolve ResourceTableIds from recently ordered services -

starting account service , calling getnextinvoicetoplevelbillingitems , can fetch active billing items, including ordered in current billing cycle. tacking on object mask contains invoiceitems[createdate,hostname,domainname,resourcetableid,notes] allow fetch associated invoice items, including invoice line ordered within cycle. let object id can pull virtual guest or bare metal details (among other things). however, resourcetableid blank (null) newly created services. other fields filled out properly, id of system or service missing. else created outside billing cycle have resourcetableid returned. is there alternative way resolve resourcetableid billing items returned getnextinvoicetoplevelbillingitems ? unfortunately, there no exists alternative way resolve "resourcetableid", because item invoice has null value generated new order, in moment resources have yet determined or assigned (hardwareid) item invoice. updated 1: { "allowcancel...

emacs - Some strangeness with agda-mode for Agda 2.5.1 -

so other agda enthusiasts, release of new version of agda, cabal-force-installed latest , greatest. however, after compiling , setting-up agda-mode (the new one), emacs giving me strange settings. i no longer have include dirs menu when attempt customize agda, i've circumvented using program args menu , adding --include-dir=<stuff> . however, colour scheme bothersome. in literate agda file, outside of \begin{code} , \end{code} coloured salmon-red , want black in older versions. i've played around highlight settings, not change. advice appreciated! thank-you! edit : removal of include-dirs no error, change log under emacs section mentions , more.

:polymorphic/:through ActiveRecord associations (Rails 3.2) -

i have tag system can apply various taggable s. want able query them transparently, in accepted solution here: habtm polymorphic relationship i want able say, example, show me post s, page s, video s, etc. tagged 'foo'. pretty straighforward. complications: the different kinds of taggable s not polymorphic in oo sense, through polymorphic associations. there is taggables table guarantee uniqueness of taggable_id (the primary key in posts , etc.). tag s, not surprisingly, have many-to-many relation taggable s, , associated through map_tags table. models: class tag < activerecord::base has_many :map_tags has_many :tagged, :through => :map_tags end class maptag < activerecord::base belongs_to :tags belongs_to :tagged, :polymorphic => :true end class post < activerecord::base has_many :map_tags, :as => :tagged has_many :tags, :through => :map_tags # other taggables set end questions: i guess first questions ought be...

php - How to pass parameters permanently javascript function -

how make function work whenever element created clicked uses parameters function in actual click event. function createlink(text, parentelement) { var = document.createelement('p'); var linktext = document.createtextnode(text); a.appendchild(linktext); temp1 = text.replace("/","-"); temp2 = res1.replace("/","-"); a.onclick = gospecificprev(temp2,linktext); parentelement.appendchild(a); var br = document.createelement('br'); parentelement.appendchild(br); } the parameters in questions in line: a.onclick = gospecificprev(temp2,linktext); being temp2 , linktext.

Android: Avoid duplicate entry when supporting both ACTION_GET_CONTENT and ACTION_OPEN_DOCUMENT -

Image
http://developer.android.com/guide/topics/providers/document-provider.html states: action_open_document not intended replacement action_get_content. 1 should use depends on needs of app: use action_get_content if want app read/import data. approach, app imports copy of data, such image file. use action_open_document if want app have long term, persistent access documents owned document provider. example photo-editing app lets users edit images stored in document provider. this indicates apps provides files should support both intent types. but when app supports both action_get_content (by having activity matching in intent filter) , action_open_document (by implementing document provider), shown twice when e.g. attaching a file gmail. due file picking ui showing both document providers , action_get_content matchers (the latter being shown further down below divider). is possible avoid duplicate showing of app avoid confusing users? see below screenshot , box entry sh...

How to convert String to BigInteger representation and back in Java? -

let's suppose have string , let's call foo . string can contain value, letters, numbers, special characters, utf-8 special characters, such á , on. instance, might real value: "Érdekes szöveget írtam tegnap, 84 ember olvasta." i have following 2 methods: public biginteger tobiginteger(string foo) { //returns biginteger value can associated foo } public string frombiginteger(biginteger bar) { //returns string value can associated bar } then: string foo = "Érdekes szöveget írtam tegnap, 84 ember olvasta."; system.out.println(frombiginteger(tobiginteger(foo))); //output should be: "Érdekes szöveget írtam tegnap, 84 ember olvasta." how can achieve this? thanks the following code expect: public biginteger tobiginteger(string foo) { return new biginteger(foo.getbytes()); } public string frombiginteger(biginteger bar) { return new string(bar.tobytearray()); } however don't understand why need , interest...

performance - GC in Java 8 get obviously slower compare to Java 7 -

i have server 72 gb memory running, use java 7 parallel gc , heap size in 25g. after switch java 8, particular task slower. task read file around 15gb in memory, , update relevant data in db. takes around 1 hour finished job, after java 8, becomes 1.5 hours. i tried: increase heap size 50gb => not help change gc algorithm parallel cms, becomes slower (1.8 hour) so not sure can start have look, java library run task still compiled in java 7 not sure if relevant? after switch java 7, performance came back. to compare/find gc issue, it's better enable gc logging: -xx:+printgcdetails -xx:+printgctimestamps -xloggc:logs/gc.log and use gcviewer parse/visualize gc log files. useful if gather gc log , attach question. in theory (and practice), java 8 faster java 7. mentioned java writes data db. may worth analyze resource consumption of both, may db root cause.