Posts

recursion - Recursing Binary Decision Diagrams in SML -

Image
in 1 of classes @ university, learning functional programming through sml/nj. i have been given assignment requires perform number of operations on binary decision diagrams. (conjunction, disjunction, not, etc.) based on truth table i have following function defined fun ifthenelse(p,q,r) = if p q else r; then, have bdd (robdd) datatype declared such datatype robdd = true | false | ifthenelse of string * robdd * robdd; so far straightforward. i'm getting lost on operating on bdd's, instance, creating robdd represents conjunction of 2 robdd's. my function declaration far looks this infix bddand; fun op bddand(first:robdd,second:robdd) = ... it called 2 robdd's, this val conjunction = ifthenelse("p", true, false) bddand ifthenelse("q", true, false); from here, i'm not sure start. professor has given hint: of course, true bddand anyrobdd anyrobdd . ordering: if you’re asked comp...

android - Why getView not getting called? -

i have adapter extends simplecursoradapter. reason can't seem see, getview not being called. have breakpoint inside getview , never gets there , list shows empty. can take thru , see i've done wrong? package com.example.ok1; import java.text.simpledateformat; import java.util.date; import android.app.activity; import android.content.contentvalues; import android.content.intent; import android.content.sharedpreferences; import android.content.sharedpreferences.editor; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.os.bundle; import android.util.log; import android.util.sparsebooleanarray; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.listview; import android.widget.textview; import android.app.listactivity; public class mainactivity extends a...

string - reading unicode input from user in java -

i have simple console program in java, try input user input in hebrew "שלום" when tried read ???? , wish "שלום" , how best way? my code: public static void main(string[] args) { string s; scanner in = new scanner(system.in); system.out.println("enter string"); s = in.nextline(); system.out.println(s); } } output: run: enter string שלום ???? build successful (total time: 5 seconds) i know should use utf-8 dont know how... help?

Videos converted using FFMPEG do not have video duration information -

i using ffmpeg convert uploaded videos .flv, after conversion flv video doesn't have information it's duration. user cannot rewind/forward, replay or see specific part of it. code follows: "ffmpeg -i $srcfile_path -s 320x240 -ar 44100 -b 2048k -r 12 $desfilepath"; please help. in advance. i ran following command , worked. "ffmpeg -i $srcfile_path -f flv - | flvtool2 -u stdin $desfilepath" this requires flvtool installed on system. using ffmpeg , flvtool2 enabled server, worked.

Extjs Store DataModel Subfield Null Error -

when try load remotely data grid error subfields: cannot read property 'id' of null my datamodel: ext.define('ruledatamodel', { extend: 'ext.data.model', fields: [ { name: 'id'}, { name: 'createtime', type:'date', dateformat: 'timestamp', convert:function(v,j){ return (v != null?new date(v):null);}}, { name: 'discountpercent'}, { name: 'discountamount'}, { name: 'discountoversalepriceflag', type: 'boolean'}, { name: 'minsalepricetotal'}, { name: 'maxcount'}, { name: 'execorder'}, { name: 'clearanceincludedflag', type: 'boolean'}, { name: 'relatedproductmincount'}, { name: 'promocoderuletypename', mapping: 'promocoderuletype.friendlytype'}, { name: 'groupname'}, ...

if statement - Multiple nested if blocks in google spreadsheets formulas -

im trying write nested if statement pseudo code : =if(h4=1, "correct", if(h4=2, "correct"), if(h4=3, "correct"), if(h4=4, "correct")) but im getting following error, if write out code , add if statement each time. ie. start first if block , add more testing each time, breaks when add third statement. wrong number of arguments if. expected between 2 , 3 arguments, received 4 arguments. is there better way nest if blocks in google spreadsheets ? ive made google spreadsheet of issue here : https://docs.google.com/spreadsheets/d/1mbomatni5c_spsvudcqpeanhtofr36kglg9bxueazxu/edit#gid=0 (the above code example of nesting if blocks, not actual issue im trying solve) the error simple syntax issue - placement of parentheses - here correct: =if(h4=1, "correct", if(h4=2, "correct", if(h4=3, "correct"))) i fixed on spreadsheet. every if statement must have 3 parts essentially, if(this, this, ...

java - How to ensure a class can only be instantiated by Spring? -

i re-factoring legacy java application use spring. this involves declaring application classes spring beans , replacing occurrences of new context.getbean or di . i'm re-writing application logic in way classes become singletons. since being instantiated using new in other locations, multiple copies exist mess business logic. i'd ensure application explicitly fails whenever tries instantiate object itself, instead of running , misbehaving in unpredictable ways. (i'm not sure re-factoring has covered 100% of application there still might new lurked in corner) what best way of ensuring class can instantiated spring container? (i'm hoping avoid writing factory each class) as question in particular scenario 1 copy of object should exist fetched context, multiple copies mess business logic. you can create classic singleton , use getinstance() method factory method in bean definition in spring's xml file: <bean id="mybean" clas...