Posts

Showing posts from May, 2015

callback - WCF ServiceDebugBehavior IncludeExceptionDetailInFaults = true -

i have server/client wcf app calls client server , callbacks server client. i'm getting kind of error when try callback. info useless, give tip set exception detail in faults true see more details. i have dont know how include other behaviour since 1 allowed. servicemetadatabehavior smb1 = host.description.behaviors.find<servicemetadatabehavior>(); // if not, add 1 if (smb1 == null) smb1 = new servicemetadatabehavior(); smb1.httpgetenabled = true; host.description.behaviors.add(smb1); i want let know way i'm using callbacks. when client calls server, function in server stuff need , saves channel: callbacks = operationcontext.current.getcallbackchannel<iservicecallbackcontract>(); and when need call client server, use channel. not in function! i thought couldn't done saw in examples. maybe i'm doing wrong there , can c

mongodb - monogdb collection cleanup older than 12 hrs -

someone please suggest command cleanup mongodb collection events older 12 hrs. i need configure part of cronjob, , executing @ every 12.00 pm , 12.00 am. thanks, first, need store creation date , time in documents. create additional field, if not have it. having field collection, have 2 options: either running job cron, remove documents older 12 hr. smthing db.collection.remove({"createdat" : {$gt : date.now() - 43200000}}) create ttl index field, automatically cool things. db.collection.ensureindex( { "createdat": 1 }, { "expireafterseconds": 43200 } ) i prefer second solution.

c - child and parent process id -

just got confused parent pid value in child process block. program given below: int main(int argc, char *argv[]) { pid_t pid; pid=fork(); if(pid==-1){ perror("fork failure"); exit(exit_failure); } else if(pid==0){ printf("pid in child=%d , parent=%d\n",getpid(),getppid()); } else{ printf("pid in parent=%d , childid=%d\n",getpid(),pid); } exit(exit_success); } output: pid in parent=2642 , childid=2643 pid in child=2643 , parent=1 in "advanced unix programming" says child process can parent process id using getppid() function. here getting "1" "init" process id. how can parent pid value in child process block.. please me in getting output. i executed in "linux mint os" in "windriver" os not getting problem. program change behaviour according os? that's because father can / exit before so

How to POST a Javascript Variable (From Client Side) to PHP File (Server Side) with AJAX using JQUERY -

i have 2 files: edit.phtml , packed_data.php . want post js variable ( packed_dat ) packed_data.php file in order save later external text file. *in other words want save client-side variable packed_dat text file. ajax jquery call in code.* the problem although server informs me successful post, file test.txt not being created same folder, , no text data being saved. i have checked folder permissions, 0777. have tried firebug without telling me more. edit.phtml: <div class="content-header"> <table cellspacing="0"> <tr> <td style="width:50%;"><h3 class="icon-head head-products">manage maps</h3></td> <td class="a-right"> <button style="" onclick="senddata()" class="scalable save" type="button"><span>save</span></button> <button style="" on

javascript - send <form> information through 2 different Submit buttons, that calls the same function but need to know from which submit button came the call -

i'm sending information through 2 different submit buttons, calls same function need know submit button came call. i have form 'x' parameters i'm going send js function thats going validate data. after validate data need send data diferent js function depending on submit button press my form this: <form name="datos_configuracionrangos_tension_laboral" action="#" onsubmit="consultar_configuracionrangos('tension', 'laboral'); return false" method="post"> <button id="button" type="submit" name="graficar" value ="graficar">graficar</button> <button id="button2" type="submit" name="guardar" value ="guardar"> guardar configuraciones</button> </form>` one way allow script submit form, , use regular buttons. <button id="button" onclick="validateme(this)&q

python - duplicate table (identical) including primary key - using django south -

i'm using south data migration move data 1 table (between django apps) its moving data suppose but, problem not duplication primary key (id), instead creating new 1 (in new table) make sense.. but how can make new table identical, including id field (which default, not defined in models) using mysql create table using like in forwards part, insert old table new one. in backwards part drop new table. def forwards(self, orm): db.execute("create table new_table old_table") db.execute("insert new_table select * old_table") def backwards(self, orm): db.drop_table('new_table') hope helps.

image - Jekyll accessing page variables from CSS -

i'm trying set background-img in css.liquid file, , need yaml variables in page. how can that? have far: background-image: url({{ page.locales[page.default_locale][page.first_name] }}); i had this: background-image: url('{{ page.first_name }}{{ page.last_name }}.jpg'); only files yaml front matter section, , extensions .html , .markdown , .md , or .textile processed jekyll. you hack working saving css file 1 of extensions, , including yaml front matter section. seems pretty clumsy way it, , it'll make ugly code, might work.

scala: Error occurred during initialization of VM on Ubuntu 12.04 -

i tried work easy example of scala language. installed sbt successfully. when run sbt -h see message sbt: usage: sbt [options] -h | -help print message -v | -verbose runner chattier -d | -debug set sbt log level debug -no-colors disable ansi color codes -sbt-create start sbt if current directory contains no sbt project -sbt-dir <path> path global settings/plugins directory (default: ~/.sbt) -sbt-boot <path> path shared boot directory (default: ~/.sbt/boot in 0.11 series) -ivy <path> path local ivy repository (default: ~/.ivy2) -mem <integer> set memory options (default: 1536, -xms1536m -xmx1536m -xx:maxpermsize=384m -xx:reservedcodecachesize=192m) .... but when tried run in directory scala assignments (it's coursera course) caught error: nazar_art@nazar-desctop:~/scala/example$ sbt detected sbt version 0.12.1 starting sbt: invoke -help other options error occurred during initia

Loop all textbox and collect values in c# asp.net -

i'm trying list of strings database. for each string in list want add label & textbox page. on button submit want collect textbox value corresponding label value save database. i need retrieving values textboxes. what have far: panel1 on aspx page protected list<string> items = myclass.getitems(); protected void page_load(object sender, eventargs e) { generateitemstable(); } private void generateitemstable() { table table = new table(); table.id = "table1"; //placeholder1.controls.add(table); panel1.controls.add(table); foreach (var x in items) { tablerow row = new tablerow(); (int y = 0; y < 1; y++) { tablecell labelcell = new tablecell(); labelcell.controls.add(createlabel(x)); labelcell.cssclass = "tdlabel"; row.cells.add(labelcell);

function - jQuery, issue with slideToggle -

when mouse on div .test want div .box come above .test slidetoggle, , when mouse leaving .test want .box slidetoggle again. it's working when i'm moving mouse in top-left of .test doesn't seem work don't know why... my css is: .box{ z-index:2; position: absolute; } and jquery: box = function(el) { $('body').append('<div class="box"></div>'); var box = $('.box:last'); var postop = el.offset().top; var posleft = el.offset().left; box.hide().css({ 'left': posleft, 'top': postop }).html('azerty<br>azerty<br>azerty<br>azerty<br>azerty<br>azerty<br>azerty').slidetoggle(150); } boxstop = function() { var box = $('.box:last'); box.stop().slidetoggle(150, function() {box.remove();}); } $(document).on('mouseover', '.test', function() { box($(this)); }).on('mouseout', funct

ruby on rails - "Can't mass-assign protected attributes: admin" with sample_data.rake -

i'm going through michael hartl's tutorial , have sample_data.rake file. when try populate database "can't mass-assign protected attributes: admin" error. can fix adding ":admin" "attr_accessible" in "user.rb" file enables hack way becoming admin. how can resolve issue? sample_data.rake file namespace :db desc "fill database sample data" task populate: :environment admin = user.create!(name: "example user", email: "example@railstutorial.org", password: "foobar", password_confirmation: "foobar", admin: true) name = faker::name.name email = "example-#{n+1}@railstutorial.org" password = "password" user.create!(name: name, email: email, password: password, password_confirmation: password) end end user.

r - POSIXct to numeric using different timezones -

i think must not understand how posixct works, or something. far understand, seconds since epoch, epoch being standard time 1970-01-01 gmt. i take 2 posixct times 1 in est 1 in pst same absolute time. yet, when convert them numeric value, result different... point me doing wrong? > pst = as.posixct('2011-01-10 06:45:00', tz = 'pst') > est = as.posixct('2011-01-10 09:45:00', tz = 'est') > as.numeric(pst) [1] 1294641900 > as.numeric(est) [1] 1294670700 here session info: > sessioninfo() r version 2.13.0 (2011-04-13) platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] lc_ctype=en_us.utf-8 lc_numeric=c lc_time=en_us.utf-8 lc_collate=en_us.utf-8 lc_monetary=c lc_messages=en_us.utf-8 lc_paper=en_us.utf-8 lc_name=c\ lc_address=c [10] lc_telephone=c lc_measurement=en_us.utf-8 lc_identification=c attached base packages: [1] grid stats gr

mysql - filter in pivot table keys -

i'm trying filter using dynamic key pivottable. i have 3 tables, defined below. when don't use group by , query uses left join statement , results in this: example 1 http://maverabilisim.com/temp/issue1.jpg yellow bars to-columns , blue bar filter condition. i need return looking this: example 2 http://maverabilisim.com/temp/issue2.jpg using condition this: .... , v.key_id=1 (color=1) how build sql query reach result? my sql schema/test data: create table `ads` ( `id` int(10) unsigned not null auto_increment, `ads_title` char(80) null default null, primary key (`id`) ); create table `ads_keys` ( `id` int(10) unsigned not null auto_increment, `key` char(25) null default null , `inlist` int(1) unsigned zerofill null default null , primary key (`id`) ); create table `ads_values` ( `id` int(10) unsigned not null auto_increment, `ads_id` int(3) null default null, `key_id` int(10) null default null, `value` int(10

android - Inserting a bunch of data trough the Content Provider -

i inserted huge resultsets tables (i using sqlite) this: public void insertrsdata(resultset rs) throws sqlexception { this.mdb.begintransaction(); try { this.mdb.delete(database_table, null, null); while (rs.next()) { contentvalues cv = new contentvalues(); cv.put(row_id, rs.getint("id")); cv.put(row_name, rs.getstring("name")); date dnow = new date(); cv.put(row_date_upd, dnow.tostring()); this.mdb.insert(database_table, null, cv); } this.mdb.settransactionsuccessful(); } { this.mdb.endtransaction(); } } initially got data in resultset. transactions helping me insert bunch of records fast. now want use content provider in program, , thinking how implement methods it. so how should insert records in tables? one-by-one? can pass (if right way) resultset content provider insert records? override bulkinsert in contentpr

c# - How to generate new Rx events when I click on a listbox -

i have simple wpf application contains list of link. select few of them, add them "observable list" , subscribe it. observer callback download link, , proceed next 1 if of sleep. able update ui let user know item has been proceeded. could give me doing this many thanks. i use observable.fromeventpattern first convert list box of link selection events observable of uri. next, write extension method download link. public static iobservable<bool> downloadlink(this iobservable<uri> source) { return observable.create<bool>(observer => { return source .subscribe(onnext: async link => { using (var client = new system.net.http.httpclient()) { var result = await client.getstringasync(link); if (issuccess) observer.onnext(true); else observer.onnext(false);

c# - How can I do a Func<object[],Expression<Func<T,bool>>> dynamic? -

i working on doing .find(objects[] keys) method dynamically creates lambda function query database. basically want is: var mykeys = new guid("37ec1659-b35e-46c9-a7fc-e9802644ca1a"); iqueryable<t> database ; func<object[],expression<func<t,bool>>> objectfinder = createkeyexpression(typeof(t)); var foundobject = database.firstordefault(objectfinder(mykeys)); and private lambdaexpression createkeyexpression(type c1type) { parameterexpression instanceparameter = expression.parameter(c1type); parameterexpression keyparameters = expression.parameter(typeof(object[])); propertyinfo[] objectkeys = c1type.getkeyproperties().toarray(); var expr = expression.equal( expression.typeas( expression.property(instanceparameter,objectkeys[0]),typeof(object)), expression.arrayindex(keyparameters,expression.constant(0))); (int = 1; < objectkeys.length; i++) { expr = expression.andalso(expr, expression.equal(

r - twitteR ROAuth handshake error: not generating the PIN option -

this question answers questions related twitter roauth problems: twitter, roauth , windows: register ok, certificate verify failed twitter , roauth both worked in pc before. code chunk not generating pin option anymore. pops out following: twitcred$handshake(cainfo="cacert.pem") error: unauthorized previously twitcred$handshake(cainfo="cacert.pem") directs to: to enable connection, please direct web browser to: https://api.twitter.com/oauth/authorize?oauth_token=sevxcpch9rio5ppri8u8____ when complete, record pin given i tried code in spark rstudio server. code works (generating option enter pin, not generated in pc). code is: require(twitter) require(roauth) requesturl <- "https://api.twitter.com/oauth/request_token" accessurl <- "https://api.twitter.com/oauth/access_token" authurl <- "https://api.twitter.com/oauth/authorize" consumerkey <- "______________" consumersecret <- "__________

jquery - How would I store the number in an html form input as a javascript variable when a button is clicked? -

basically want when user types number in html form input field presses submit button, number stored in javascript variable. <input type="number" min="1" name="number"> var number = ? how javascript or jquery? thank you. here javascript solution, use until jquery comes built browser ( might aswell be, seeing it's the savior ) <form id="form"> <input id="number" type="number" min="1" name="number"> <button>submit</button> </form> var form = document.getelementbyid('form'); number = document.getelementbyid('number'); form.onsubmit = function() { var variable = number.value; alert( variable ); }; just assign submit handler, , value of input. my advice though, please not download jquery can store variable.

php - How get multiple values from first mysql table and use it in second query? -

table1 id | author | number_of_view | ---+--------------+----------------- 1 | john | 10 2 | jack | 20 3 | anna | 80 4 | neri | 100 below have php script checks mysql database table , gives badge users. script works prefectly. $from1=10; $to1=15; $from2=20; $to2=30; $query=mysql_query("select sum( number_of_view ) view_number, author `table1` group author"); while ($row= mysql_fetch_array($query)) { $view_number=$row['view_number']; $author=$row['author']; if ($viewnumber>$from1 && $viewnumber<=$to1) { echo "special user"; } elseif ($viewnumber>$from2 && $viewnumber<=$to2) { echo "plain user"; } } } but problem want $from , $to variable values database table: table2 id | badge | |to ---+

php - Looping through MySQL results and saving values to a $_SESSION -

i trying store each column name in database own $_session. example, column names column_one, column_two, column_three, column_four, , column_five. want these stored in $_session $_session['column_one'], $_session['column_two'], etc. trying in loop have not been successful. how setup loop achieve this? $query = "select * table user_id = $id"; $result = mysqli_query($dbc, $query); $num = mysqli_num_rows($result); if ($num == 1) { //user found while($row = mysqli_fetch_array($result, mysqli_both)) { $_session['user_id'] = $row['user_id']; } } something should work: while($row = mysqli_fetch_array($result, mysqli_assoc)) { foreach($row $column => $value) { $_session[$column] = $value; } } extra advice safeguarding against sql injection, following 2 lines: $id = mysqli_real_escape_string($dbc, $id); $query = "select * table user_id = '$id'"; update: thanks emiliogo

c - qsort() giving random results -

in above program, create array of pointers char using malloc , attempt sort "strings" using qsort. i'm getting incorrect results. more importantly, i'm getting different results every time run program. #include <stdio.h> #include <stdlib.h> #include <string.h> #define maxline 1000 #define maxchars 1000 int ballin_compare(const void *, const void *); int main(int argc, char *argv[]){ char *linebuffer, **pointbuffer; file *fp; int = 0; if(argc < 2 || (fp = fopen(argv[1], "r")) == null) return 1; linebuffer = (char *)malloc(maxchars); pointbuffer = (char **)malloc(sizeof(char *) * maxline); while(i < maxline && fgets(linebuffer, maxchars, fp) != null){ pointbuffer[i] = (char *)malloc(strlen(linebuffer)); strcpy(pointbuffer[i++], linebuffer); } free(linebuffer); qsort(pointbuffer, i, sizeof(char *), ballin_compare); fclose(fp);

python - Finding common characters -

q: best approach tackling problem? for example, if 2 values "chocolate" , "cockroach" function should return "choa" research: i have found find(),or making list witch helpful structuring function. code: having issues! value1 = input("please input word: ") value2 = input("please input second word: ") [how find similar letters in 2 words] print(similar_letters) example: please input word: hello please input second word: hey letters in word : 'he' perhaps meant common characters? use sets, long don't mind remove duplicates , change order of elements: s1 = set("chocolate") s2 = set("cockroach") "".join(s1 & s2) => "ahco"

android - Trouble Parsing XML Into SQLite Database -

the application working on parses data .xml file , stores database. however, upon each application launch, database grow in size number of table rows parsed data stored into. example, if parsed data took 3 rows store, each subsequent application launch increase database size of (in terms of rows) six, nine, twelve, , on , forth. what prevent table increasing in size upon each application launch. have tried resetting database each time, i'm not sure how correctly go or if solution should going for. i have view display database in entirety: public class qaview extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.qa_view); textview tv = (textview) findviewbyid(r.id.tvdata); qadatabase entries = new qadatabase(this); try { entries.open(); string data = entries.getalldata(); tv.settext(data);

python - Connect a message box to a button -

i want able click button , have message box display code generated. here's part of code: global s letters = [random.choice('bcdfghjkmpqrtvwxyyz') x in range(19)] numbers = [random.choice('2346789') x in range(6)] s = letters + numbers random.shuffle(s) s = ''.join(s) global code code = entry(state='readonly') def callback(): code = entry(state='readonly', textvariable=s) code.grid(row=0, pady=20) generate=photoimage(file='generate.gif') g = button(image=generate , command=callback, compound=center) g.grid(row=1, padx=206.5, pady=20) fixed few things comments: from tkinter import * import random root = tk() letters = [random.choice('bcdfghjkmpqrtvwxyyz') x in range(19)] numbers = [random.choice('2346789') x in range(6)] s = letters + numbers random.shuffle(s) s = ''.join(s) # rather use global variables, bad idea, can make callback creator function, takes formerly global variables ar

javascript - JQuery get the rest of the element's class name that starts with string "whatever-" -

i have js caches classes that's name starts "whatever-", $('[class^="whatever-"], [class*=" whatever-"]') but want rest of name, example in case of "whatever-9" want "9", don't know how it, can me? try this var check = "whatever-";          $('[class^="whatever-"], [class*=" whatever-"]').each(function () {     // array of class names    var cls = $(this).attr('class').split(' ');        (var = 0; < cls.length; i++) { // iterate on class , log if matches if (cls[i].indexof(check) > -1) {         console.log(cls[i].slice(check.length, cls[i].length)); }        }     }); this should work case when there more 1 class. there may cleaner ways of doing using filter method , bit of regex check fiddle a little cleaner using map var check = "whatev

javascript - Pitch detection on array of floating point numbers -

i'm doing voice recording in javascript, , storing recording array of signed floats. need determine (and ultimately, adjust) pitch on array? i've seen various algorithms c++, don't seem helpful in situation. downloaded , tried 1 see if convert parts of javascript: http://voicerecorder.codeplex.com/sourcecontrol/latest but did make recording louder, regardless of settings chose. i'm not going try provide exhaustive answer here, rather describe own findings discovered on journey of wrestling similar issues in audio programming. pitch detection if you're sound monophonic (as sounds is based on comment jeff), i've implemented pitch detection using auto-correlation techniques, because it's relatively simple compared other pitch detection algorithms. the idea, if you're unfamiliar, follows: slide sample on (with predetermined window size; in 1-sample increments) at each step, calculate absolute difference between original wave , sli

using method inside asyntask in android -

i have created 1 simple login application takes user name , password sqlserver..it works fine... i want during login process 1 progeress bar should displayed using asyntask... unaware use parameters in asyntask...if 1 plzz tell me how put method in doinbackground of asyntask , param should use.... my code is;..... public void save(){ initilize(); resultset rs = null; string mylog=id.gettext().tostring(); string mypass=pass.gettext().tostring(); try{ statement statement=connect.createstatement(); rs=statement.executequery("login '"+mylog+"', '"+mypass+"'"); }catch(exception e){ e.printstacktrace(); } if(mylog.equals("")||mypass.equals("")){ toast.maketext(getapplicationcontext(), "empty fields", toast.length_short).show(); } else try { if(rs.next()){ intent i=new intent(getapplicationcontext(),act2.cla

java - How to convert/cast a jobject into jbyte* -

i deal byte array retrieved java callback function. however, got error 'jnienv' has no member named 'getobjectelements' jmethodid funcgetarray = getstaticmethodid(clazz, "getarray", "()[b"); jobject data_obj = env->callstaticobjectmethod(clazz, funcgetarray); const jboolean is_copy = jni_false; jbyte *byte_array = env->getobjectelements(data_obj, is_copy); can pointer byte array in easy way instead of retrieving each element , copying it. i think function looking getbytearrayelements . can cast data_obj have jbytearray , pass function. also should passing pointer is_copy .

vim - What can follow "d" in normal mode? -

in answer this question , learned empty lines around cursor can deleted using key sequence d i p in normal mode. astonished, looked vim help, vim says d may followed movement, i isn't (it brings insert mode normally). what d i p doing? i , p stand in context? where can find documented? other "magic" characters can follow d ? you use vim you'd think, speak or write normal spoken language. you have verbs d[elete] , y[ank] , p[ut] , c[hange] , v[isually select] , on. you have sorts of objects w[ord] , p[aragraph] , t[ag] , on. you have modifiers i[nner] , a[round] , t[ill] or /foo , many others , ability use {count} quantifier. dip means "delete inner paragraph". vat means "[visually ]select current html tag", c2t; means "change here second next semicolon"… like real language, learning full sentences won't far. basic vocabulary not large idea forget dip , learn d , i , p instead. learning dip

javascript - How do I stop a span going to next line in bootstrap? -

Image
i getting behaviour on bootstrap website it looks fine @ full width when make window narrower or view on ipad, span10 (content area) goes new line. can solve making span10 span 9 leaves gap right of it. this how i'd on ipad , narrow computer windows:

linux - permutation with two sets in itertools using python -

i having trouble in rewriting length python code in more pythonic way. here have tried, contains example how want final code like #!/usr/bin/env python import time import itertools import os freq = [2400000,2000000,1600000,1200000,800000] freq_set = [ [ in itertools.combinations(freq,1)], [ in itertools.combinations(freq,2)], [ in itertools.combinations(freq,3)], [ in itertools.combinations(freq,4)] ] cores = [[0,4],[1,5],[2,6],[3,7]] sets = [[0,4],[0,4,1,5],[0,4,1,5,2,6],[0,4,1,5,2,6,3,7]] # 5 10 10 5 ; 1 3 5 7 freq_set_val in range(0, len(freq_set)): if freq_set_val == 0: change = "echo "+ freq_set[freq_set_val][0] +"> /sys/devices/system/cpu/cpu"+ sets[freq_set_val][0] + "/cpufreq/scaling_setspeed" change = "echo "+ freq_set[freq_set_val][0] +"> /sys/devices/system/cpu/cpu"+ sets[freq_set_val][1] + "/cpufreq/scaling_setspeed"

android - How to set `ImageView`'s height to match it's width while `layout_weight` is set? -

here deal: have gridview android:numcolumns="2" . items in gridview imageviews android:layout_weight="1" , half screen width. problem height property, should equal width. tried play scaleype , far without success. how can set width of gridview elements fill half screen , set height equal width? you have imageviews width programmatically , set height. but if use img.getwidth() ; eg. in oncreate() , return 0 because hasn't been drawn yet. so have in oncreate() : imageview img = (imageview) findviewbyid(r.id.img); viewtreeobserver vto = img.getviewtreeobserver(); vto.addonpredrawlistener(new viewtreeobserver.onpredrawlistener() { public boolean onpredraw() { int x; img.getviewtreeobserver().removeonpredrawlistener(this); x = img.getmeasuredwidth(); img.setlayoutparams(new linearlayout.layoutparams(x,x)); return true; }

java - org.hibernate.QueryException: Not all named parameters have been set:[] -

i'm getting extremely strange behavior out of jpa 2.0 i'm trying build query looks likes, employeid , empdepartment long values passing through java arguments query query=em.createquery("select e employee e e.empid = :empid , e.empdepartment = :empdepartment"); query.setparameter("empid" ,employeid); query.setparameter("empdepartment",empdepartment); but above query doesnt work first time, generating above error when second time trigged same method again every thing went smoothly, happens each , every time, reason it? you try this: query query=em.createquery("select e employee e e.empid = ? , e.empdepartment = ?"); query.setparameter(1, employeid); query.setparameter(2, empdepartment); if not working either, there can problem query content well, not replacement of parameters. maybe the types not correct. parameter type inferred context.

r - Factor as date to numeric -

i'm sorry bothering can't find solution this. i have data.frame column name date: str(df$date) factor w/ 360 levels "1982-11-30","1982-12-31",..: 1 4 7 10 13 16 19 22 25 28 ... class(a) [1] "factor" i convert numeric values: from: "1982-11-30" 19821130 or else. edit: initially have had in numeric format , converted factor following: date <- as.date(as.character(df$date_num),format="%y%m%d") so how reverse this? something this? dd <- structure(1:2, .label = c("2013-01-01", "2013-02-01"), class = "factor") # [1] 2013-01-01 2013-02-01 # levels: 2013-01-01 2013-02-01 as.numeric(gsub("-", "", as.character(dd), fixed=true)) # [1] 20130101 20130201

Problems creating Sankey diagrams using d3.js (2) -

Image
this continuation of previous question "problems creating sankey diagrams using d3.js (1)" here i'm trying follow example posted timelyprtfolio @ http://timelyportfolio.github.io/rcharts_d3_sankey/example_build_network_sankey.html uses packages igraph , rcharts create sankey diagram template the output running r script ./rcharts_d3_sankey-gh-pages/libraries/widgets/d3_sankey/layouts/chart.html and resultant html is <!--attribution: mike bostock https://github.com/d3/d3-plugins/tree/master/sankey mike bostock http://bost.ocks.org/mike/sankey/ --> <script> (function(){ var params = {{{ chartparams }}}; params.units ? units = " " + params.units : units = ""; //hard code these make available var formatnumber = d3.format("0,.0f"), // 0 decimal places format = function(d) { return formatnumber(d) + units; }, color = d3.scale.category20(); if(params.labelformat){ formatnumber = d3.format(".2%")

Best Practice for State Management in a Distributed ASP.NET MVC 4 Application -

i building enterprise application asp.net mvc 4, following n-tier architecture (including web farm load balancing , possibly application farm). best practice manage state such distributed architecture? i know can go sql state management, choice keeping performance in mind (especially considering many inter-server calls)? other options have if not want use session variables @ (due performance issues or don't want handle session timeouts)? how using @html.serialize() ? apologies if similar question has been asked before, search did not result in definitive answer. edit: here of key metrics: volume of users - 1.2 millions concurrency - during peak time, transactions high 800 per minute geographic diversity - , europe caching - there plan use distributed caching (appfabric) availability - 99.99%. internet site 1 of largest retailers in world , expect high growth rate.

asp.net mvc - Providing synchronous behaviour in CQRS when needed? -

i using asp.net mvc nservicebus , vast majority of commands can executed eventual consistency in mind, there small minority of tasks immediate consistency appear simplify things. i have done plenty of research on various methods used accomplish few come kind of justification why particular method preferable. don't have experience nsb in production environment, nice know if methods limit scalability in way. the following broadly methods have come across: - no synchronisation, fake information client. reservations 1 firstly, have deal case have faked data , command has failed (unlikely scenario) , more importantly, if initialisation of data within command complex, ability fake data not feasible anyway. reply (or publish event recieved client) when task completed. reservation 1 means distributed architecture becomes more complex , not sure if load balanced clients cause issues 1 of client machines should recieving reply. poll read store until data present. reservat

javax.el.PropertyNotFoundException : Target Unreachable, identifier 'login' resolved to null Spring + JSF -

this question has answer here: identifying , solving javax.el.propertynotfoundexception: target unreachable 8 answers i can't resolve problem getting null @autowired service. here's code. my configuration file applicationcontext.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context

java - How to change menu item dynamically/instantly? -

i have refresh button on action bar 3 activities. these 3 activities extended baseactivity . provides me write oncreateoptionsmenu(menu menu) { //... } method once. when user clicks it, want change icon refreshing icon. i can handle click , refresh operations , changing icon cannot handle change icon when operation completes. what best way know when method (which located in activity extends baseactivity ) has finished job? have use interface handle on baseactivity 's onoptionsitemselected() method? when want change icon, call invalidateoptionsmenu() (this trigger oncreateoptionsmenu(menu menu) called) , add logic change icon within oncreateoptionsmenu(menu menu) e.g. @override public boolean oncreateoptionsmenu(menu menu) { menuinflater menuinflater = getmenuinflater(); menuinflater.inflate(r.id.menu, menu); if(isrefreshing()){ menu.finditem(r.id.refresh).seticon(r.drawable.refreshing); }else{ menu.finditem(r.id.refresh).set