Posts

verilog - how can I reduce mux size -

module memory_module (input clk,input[0:6] address,input [0:7]data_input, input read_write,output [0:7] data_output,input enable,output ready); reg ready; reg [0:7] data_output; reg [0:7] memory [127:0]; initial begin ready=0; end @(posedge clk) begin if(enable) begin ready=0; if(read_write) begin data_output[0:3]= memory[address][0:3]; data_output[4:7]= memory[address][4:7]; end else begin memory[address][4:7]=data_input[4:7]; memory[address][0:3]=data_input[0:3]; end ready=1; end else ready=0; end endmodule here simple verilog code memory module design (i want make code more efficient) also when write data_output[0:7]= memory[address][0:7]; creates 8x1 mux by writing ...

jquery - What's the best way to sort function inputs based on type in Javascript? -

i've got function several inputs, optional in calling function. each input of different type, such string, array, or number. code this: function dostuff(str, arr, num){ if typeof(str) != 'undefined' { $('#stringdiv').text(str)} if typeof(arr) != 'undefined' { for(var i=0; < arr.length; i++){ $('<li>').text(arr[i]).appendto('#arrayul') } } if typeof(num) != 'undefined' { $('#numberdiv').text(num)} } jquery(document).ready(function() { dostuff("i'm string", [1,2,3,4,5], 7) }) i can account fact arguments might optional, not fact that, if missing arr , numeric argument ( num ) come second, not third. to around this, can dump inputs array, , sort through array , of each type, in this fiddle. seems sloppy, and, based on number of libraries i've seen in functions, seems there's better way. there better way this? or looping through arguments ...

android - how to put data in two different table using two different activity -

here in application in first activity using following code storing data mysql. java code: public class mainactivity extends activity { edittext et; button b; inputstream is; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); et = (edittext) findviewbyid(r.id.edittext1); b = (button) findviewbyid(r.id.button1); b.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { // todo auto-generated method stub string name = et.gettext().tostring(); arraylist<namevaluepair> params = new arraylist<namevaluepair>(); params.add(new basicnamevaluepair("name", name)); try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://10.0.2.2/insert1.php"); httppost...

suppress one of the options from help when using optparse in python -

consider following: parser.add_option("-f", "--file", "--secret", action = "append", type = "string", dest = "filename", default = [], = "specify files") i hide --secret option user when invoked. can in following way? parser.add_option("-f", "--file", action = "append", type = "string", dest = "filename", default = [], = "specify files") parser.add_option("--secret", action = "append", type = "string", dest = "filename", default = [], = "specify files") am missing hidden issue doing so?if so, can suggest alternative way achieve this. try help=suppress_help trick (see docs ): from optparse import optionparser, suppress_help parser.add_option("-f", "--file", action = "append", type = "string", dest = "filename", default = [], = "spe...

emacs - Gnus: How to archive emails according to the account they were written from? [gcc-self not working as expected] -

i have 2 mail accounts, foo.bar@uni.edu , foo.bar@gmail.com . archive messages send either 1 in corresponding "sent mail" folder ( nnimap+foo.bar@uni.edu:sent items , foo.bar@gmail.com:[google mail]/sent mail ). i tried set (setq gnus-message-archive-group '(("uni" "nnimap+foo.bar@uni.edu:sent items") ("gmail" "nnimap+foo.bar@gmail.com:[google mail]/sent mail") )) but not set gcc (new messages don't have gcc; solution here?). went (setq gnus-message-archive-group "nnimap+foo.bar@uni.edu:sent items") sets gcc correctly (for main account foo.bar@uni.edu ) if open new message in *group* via m . i tried use gcc-self via gnus-parameters archive sent mails correctly: (setq gnus-parameters `((,(rx "nnimap+foo.bar@uni.edu") (gcc-self . "nnimap+foo.bar@uni.edu:sent items")) (,(rx "nnimap+foo.bar@gmail.com") (gcc-self . "foo.bar@gma...

c# - DevExpress XtraGrid is not visible even after I set Visible = true -

i'm using devexpress' tools on current winforms project. page i'm working on has grid sub-agencies visible or not depending on flag called isparentagency . if agency parent agency, grid should visible of agency's sub-agencies. if not, grid should invisible. no matter do, though, can't seem grid visible. after i've given data source, forced initialize, , populated columns. i've tried going right ahead , setting subagenciesgridcontrol.visible = true . no matter has visible set false (even when debugging line after subagenciesgridcontrol.visible = true ). here's code i'm using set grid , toggle visibility (i'm using mvp pattern on top of winforms): subagenciesgridcontrol.datasource = model.subagencies; subagenciesgridcontrol.forceinitialize(); subagenciesgridview.populatecolumns(); subagenciesgridcontrol.visible = model.isparentagency; how can grid visible? adding controls, shown in comments. if you're using layoutcontrol t...

generics - How to interpret "public <T> T readObjectData(... Class<T> type)" in Java? -

i have java code. public <t> t readobjectdata(bytebuffer buffer, class<t> type) { ... t retval = (t) summaries; return retval; how interpret code? why need public <t> t instead of public t ? how give parameter 2nd argument ( class<t> type )? this declares readobjectdata method generic, 1 type parameter, t . public <t> ... then return type t . ... t readobjectdata(... without initial <t> , generic type declaration, symbol t undefined. in parameter list, class<t> type 1 of parameters. because return type , parameter both reference t , ensures if pass in class<string> , return string . if pass in class<double> , return double . to pass in parameter, pass in class object, e.g. string.class .