Posts

Showing posts from April, 2013

I want to create a program that checks if the input is syntactically valid in C -

how create c program takes in command in c input, , prints if there errors? for example, input: for(i=0; i<5; i++); no errors. input: for((i=0); i>2,(i<5) ; i++); no errors. input: for(i=0, i<5; i++); error. input: for((i=0; i<5; i++)); error. i think shortest way compile input string, , check if errors occur. don't know how compile piece of code passed during runtime. also, there problem of undeclared variables. c particuraly complicated parse. if remove pre-processor side of it, there still tricky parts. if learning yourself, can c grammar (there in lex/yacc format ansi c) can at. from example guess want able recognize subset of c, not entire language, correct? if case, should define subset , write parser it. rather trying write parser hand, should learn grammars , parser generators if haven't worked them already. if it's subset of c you're interested in, use peg parse generator packcc pars

javascript - Firefox Extension port to emit from main.js -

i building firefox extension , trying communicate between main.js , contentscriptfile. want in when tab closed call function in contentscriptfile injected in other open tabs. code using port doesn't seems work main.js var tabs = require("sdk/tabs"); tabs.on('close', function(tab){ if(tab.url.indexof('example.com/url2') > -1) { (let tab of tabs) { tab.attach({}).port.emit("docorn", 'eg1'); } } else if(tab.url.indexof('example.com/url1') > -1) { (let tab of tabs) { tab.attach({}).port.emit("docorn", 'eg2'); } } }); contentscriptfile self.port.on("docorn", function(msg) { console.log(msg) }); but doesn't seem work. so, have idea?

Skip githooks on git push -

intro: installed software fires on git pre-push hook. unfortunately there mistake in software, , crashes on large commits. is possible run git push without triggering githooks? that way don't have uninstall githook? after reading through of githook documentation found pre-commit hook omitted flag --no-verify . although not mentioned, --no-verify works on git push :)

Java output the number of scores above or equal to the average -

so have class assignment have let users type values array, average , output number of scores above or equal average, , number of scores below average. however, figured out average part. here have far: public static void main(string[] args) { scanner sc = new scanner(system.in); system.out.println("enter size of array: "); int n = sc.nextint(); int a[] = new int[n]; system.out.println("enter test scores"); for(int = 0; < a.length; i++) { a[i] = sc.nextint(); } int sum = 0; for(int b=0; b < a.length; b++) { sum = sum + a[b]; } double average = ((double)sum) / a.length; system.out.println("the average is"+" " + average); } i on part output number of scores above or equal average , number of scores below average. public static void main(string[] args) { scanner sc = new scanner(system.in); system.out.println("enter size of array: "); int n

listview - make list view show what I want JavaFX -

i have created class , added observable list, have list view set item observable list. problem when add object class observable list, list view shows address on memory package.testclass@574f5892 , how can make list view show text stored in each object , image instead of memory address? thanks a quick hack define tostring method in testclass returning text want display. isn't robust solution, because in general might want tostring() method return different text want displayed in gui environment. the "proper" way set cellfactory on list view. along lines of listview.setcellfactory(lv -> new listcell<testclass>() { @override public void updateitem(testclass item, boolean empty) { super.updateitem(item, empty); if (empty) { settext(null); } else { string text = ... ; // text item settext(text); } } }); to include image, can do listview.setcellfactory(lv ->

java - How to output variables from nested for loops using BigIntegers -

i getting mad errors when try implement program wrote solve leonhard euler's conjecture. error seems in println . know i'm doing wrong? (there no errors before run program, error messages appear after) i'm implementing simple i'm not quite sure why not cooperating. p.s. read on website assign out message string object , print string object, adds error message list. public static void main(string[] args) { biginteger max = new biginteger("integer.max_value"); // for(int a=0; a<max; a++) for(biginteger a=biginteger.zero; a.compareto(max)<=0; a=a.add(biginteger.one)){ for(biginteger b=biginteger.zero; b.compareto(max)<=0; b=b.add(biginteger.one)){ for(biginteger c=biginteger.zero; c.compareto(max)<=0; c=c.add(biginteger.one)){ for(biginteger d=biginteger.zero; d.compareto(max)<=0; d=d.add(biginteger.one)){ // a^4 a=a.pow(4);

powershell - Referenceing Piped Element's Parent -

i'm trying write powershell go through folder , preform different operations depending on file name. issue i'm having when use switch case $_ contains base name (see below). there way access it's parent element? need full path of file. saw somewhere $_.parent.fullpath, seems not correct. get-childitem -path "c:\folder\" -filter "*.xls" | foreach-object { switch -wildcard ($_.basename){ "*test1*" { write-host "test1" write-host $_.parent.fullname } "*test2*" { write-host "test2" write-host $_.parent.fullname } "*tets3*" { write-host "test3" write-host $_.parent.fullname } } } i know if changed swtich case if statements have access fullname. when you're in switch statement, you're within new pipeline, lose reference parent object. unless stored ob

c - Writing bits of a byte to bin file -

so attempting write stucture binary file. works until come writing part of byte. data_offset, reserved, , ctl_bit, want write last 4, 6, 6 bits binary file. i'm not sure going wrong. struct tcp_head { unsigned short source_port; //16 bits unsigned short dest_port; //16 bits unsigned int seq_num; //32 bits unsigned int ack_num; //32 bits unsigned char data_offset; //4 bits unsigned short reserved; //6 bits unsigned short ctl_bit; //6 bits unsigned short window; //16 bits unsigned short checksum; //16 bits unsigned short urgent_point; //16 bits }; when write file have attempted use bit-wise operators mixed use. file *fileptr = fopen(filename, "wb"); int i; if (!fileptr) { printf("\nerror while writing file\n"); exit(1); } (*temp).data_offset = (*temp).data_offset << 4; (*temp).reserved = (*temp).

How to enable "persistent mode" in Windows failover cluster manager 2012? -

in windows server 2008 r2 there checkbox named "enable persistent mode" on general tab in properties of cluster resource. in windows server 2012 seems have disappeared. my cluster resource "generic script" resource (not makes difference). how enable "persistent mode" cluster resource in windows server 2012? thanks after further investigation seems me 2012 either defaults or hard-coded "persistent mode" , they've disabled changing value gui.

javascript - Knockout.js Observable Not Getting Set -

i have code not doing suppose do. knockout.js project , object; self.eventitem = ko.observable({ recordid: ko.observable(0), selectedeventtype: ko.observable() } this object initialized in function. there lot of code in here debugging while shows "self.originaleventitem().eventtypeid" return value of "6" , number. value set selectedeventtype; self.loadinitialdata = function () { self.pageloaded(false); var step1 = common.geteventdetailsforedit(self.eventitem().recordid()); //step1 var step2 = step1.then( function (data) { if (data.iserror) { toastr.error(data.errormessage, "error"); return new $.deferred().reject(); } else { self.originaleventitem(data.data); return common.geteventtypes(); } }); //step2 var step3 = step2.then( function (data) {

sockets - Android app that connects to server port 8080 -

so have been developing , android application fun in spare time. application opens connection home server running java program, calculations , sends response. issue not want use port 80. if cell phone on wifi can connect using port like, 8080. works wifi connection outside of home network. switch 4g , connection fails. server:8080 phone on wifi(any) - works phone on 4g - fails server:80 phone on wifi(any) - works phone on 4g - works i switched server on listen on port 80 , app connect using same , connection works on both 4g , wifi. is there missing make work on uncommon port? or limitation of 4g connections. thanks i can assure it's not issue 4g ip connectivity. ports part of udp/tcp , "data" ip network. however, possible cellular provider has firewall prevents traffic ports. portquiz public website listens on ports. using browser on phone, try connecting various ports , see successful , not. http://portquiz.

asp.net mvc - Convert Server Side Include to Razor -

i'm in process of upgrading/modifying asp.net webforms application mvc5 - ideally, razor engine (to allow automatic mobile layout page switching, , take advantage of mvc features). we have hundreds of server-side includes, named *.inc. absolute gobs of them. application large have convert pages piecemeal - there no way @ once. (for idea of how big project , how long it's been around, entire source control history in vss upon our migration tfs 10gb. includes lots of media files, still. it's big, , it's not going away.) is there way can convert these #!include calls renderpartial() or renderaction() call without renaming every single file .cshtml? duplicating include file poor recommendation, because breaks dry. ideally, i'd one partial view handles - guess take filename argument, , that's one-liner, can train convert these trivially. i want sort of file-level caching. loading output disk & dumping output stream nice small sites...but isn't

php - Change "Click to sort by this column" default text using jHtml::_('grid.sort' -

i'm writing backend component, columns generated this: <th><?php echo jhtml::_('grid.sort', 'column title', 'table_column', $listdirn, $listorder) ?></th> in backend, when hold mouse on column header, message: "click sort column." we want use tool tips , title tag give deeper explanations on each column instead of default message. came across page: https://docs.joomla.org/api17:jhtmljgrid::action public static function action ( $i $task $prefix='' $text='' $active_title='' $inactive_title='' $tip=false $active_class='' $inactive_class='' $enabled=true $translate=true $checkbox='cb' ) but have been unsuccessful in getting tooltip fire. ideas on overriding default message? ok investigated little bit , seems jhtml::_('grid.sort', 'column title', 'table_column', $listdirn, $listorder

eclipse - Error message failure and crash when using pydev embedded jython interpreter -

i have strange problem when using pydev on work machine (others @ work have same issue). not occur when @ home, makes me think it's environment @ work. running windows 7. i using pydev 3.9.2 same thing happens earlier versions. occurs versions of eclipse after 3.7. problem this. when create jython console (the 1 running in eclipse vm), error output doesn't work. if type invalid python command, there no output on console. appears command worked. if type command such "print 100", output prints expect. the second problem if hit red square supposed remove console window, eclipse crashes. there no errors or indication of going wrong. i have tried different versons of eclipse, different versions of pydev, different machines , doesnt make difference. has seen this? i've tried can think of debug issue appreciated. thanks, brian unfortunately quirks expected... the internal console in eclipse developers sdk experimenting eclipse , not me

java - UTF 8 Special Characters when converting JString to String in JNI -

i'm trying convert string jstring in jni, when string contains utf 8 special characters, doesn't seems saving in right way. for example: “avda. espaᡬ 1” when should “avda. españa 1”. this code: jstr= env->newstringutf(str.c_str()); is there way convert jstring specifying utf 8 charset? i copied these somewhere, added exception handling. work in production. // jstring std::wstring std::wstring jstr2wsz(jnienv *env, jstring string) { std::wstring wstr; if (string == null) { return wstr; // empty string } try { const jchar *raw = env->getstringchars(string, null); if (raw != null) { jsize len = env->getstringlength(string); wstr.assign(raw, raw + len); env->releasestringchars(string, raw); } } catch (const std::exception ex) { std::cout << "exception in jstr2wsz translating string input " << string <&l

html/hta mutiple file in audio player -

ok started coding .hta application , pretty html page .hta extension , adde mp3 player , did work <object data="test.mp3" type="audio/mp3" width="200" height="40"> <param name="src" value="test.mp3"> <param name="autostart" value="0"> </object> but it's 1 song playing again , again , plz there way add multiple files playlist believe it's should added "src" parameters not sure, i'm starting did add "," in between , , tried ";" none of them working i'm waiting answers :d i wanna know if can show me how become familiar tag see it's helpful , powerful activex, audio,video,pdf .... files i'm waiting impatiently [i don't know object, plz plz more clear] get inspired example hta_audio_player.hta <html> <head> <title>hackoo audio player playlist hackoo 2014</title> <hta:app

sql server - SSRS: Dataset2 not showing data inserted in Dataset1 -

i have 2 datasets namely dataset1 , dataset2. dataset1 query type of "stored procedure". sp "testprocpk" selected , parameter "value" mapped it. testprocpk query: create procedure testprocpk @value varchar(20) insert testproc select @value dataset2 uses above table below (dataset2 fields used in report display): select value testproc value = @value expected note: table "testproc" empty. while running report select parameter value "abc". report should display value "abc". why dataset2 not reflecting value "abc" in same time? other workaround achieve this. thanks i believe problem due ssrs running transaction in parallel. table isn't created dataset 1 when dataset 2 run. in datasource properties , on general tab there setting use single transaction when processing queries . forces queries run 1 @ time in single transaction (great using temp tables). check box , should work expe

c# - How can I hook into all property setters of derived classes from a base class? -

i have .net web application intents , purposes of question crud many different domain objects. a common theme across theses objects need know value properties have been modified child domain model properties. have 2 different systems in place this. the value properties 1 trying sort out question. right models inherit persistablemodel base has these fields , methods of note: private readonly list<string> _modifiedproperties = new list<string>(); public virtual modelstate state { get; set; } public ienumerable<string> modifiedproperties { { return _modifiedproperties; } } protected bool hasmodifiedproperties { { return 0 < _modifiedproperties.count; } } public bool wasmodified(string propertyname) { return _modifiedproperties.contains(propertyname); } public void wasmodified(string propertyname, bool modified) { if (modified) { if (!wasmodified(propertyname)) _modifiedproperties.add(propertyname); } else {

Dividing components of a vector into several data points in R -

i trying turn vector of length n (say, 14), , turn vector of length n (say, 90). example, vector x<-c(5,3,7,11,12,19,40,2,22,6,10,12,12,4) and want turn vector of length 90, creating 90 equally "spaced" points on vector- think of x function. there way in r? something this? > x<-c(5,3,7,11,12,19,40,2,22,6,10,12,12,4) > seq(min(x),max(x),length=90) [1] 2.000000 2.426966 2.853933 3.280899 3.707865 4.134831 4.561798 [8] 4.988764 5.415730 5.842697 6.269663 6.696629 7.123596 7.550562 [15] 7.977528 8.404494 8.831461 9.258427 9.685393 10.112360 10.539326 [22] 10.966292 11.393258 11.820225 12.247191 12.674157 13.101124 13.528090 [29] 13.955056 14.382022 14.808989 15.235955 15.662921 16.089888 16.516854 [36] 16.943820 17.370787 17.797753 18.224719 18.651685 19.078652 19.505618 [43] 19.932584 20.359551 20.786517 21.213483 21.640449 22.067416 22.494382 [50] 22.921348 23.348315 23.775281 24.202247 24.629213 25.056180 25.483146 [57] 25

javascript - Full Calendar Get current date -

Image
i've been learning ruby on last year , i'm new js i'll try explain best can. i using adam shaw's full calendar plugin . want current month viewing (and use limit how far in future or past user can navigate, that's not problem). i can current date, sort of. but, because of lack of js knowledge i'm not sure how access date. here relevant section of config file, viewrender: function(view){ var maxdate = "<%= finish.strftime('%y/%m/%d') %>"; var currentdate = $('#calendar').fullcalendar('getdate'); console.log(currentdate); if (view.start > maxdate){ header.disablebutton('prev'); } } when inspect console log see being output click through months. so can see displaying current date in view. question how access _d bit of moment variable can use it? my understanding moment class instance , stuff in dropdown attributes, correct interpretation? fullcalendar's getdate ret

c - why XLC compiler on bluegene/q doesn't support '-qtm'? -

i have problem xlc compiler on bluegene/q. version of xlc compiler 12.1: ibm xl c/c++ blue gene, v12.1 version: 12.01.0000.0000 according document 1 , should support compiler option "-qtm", used enable transactional memory. however, got following error message: option -qtm not valid. enter xlc_r list of valid options. how can figure out? appreciated. are invoking compiler bgxlc ?

MySQL: how to select the Nth value of each group with GROUP BY -

i want select 2nd response column value of each new_threads group, 0 value if group of 1 row. new_treads|response ------------------ 1 | 0 1 | 1 2 | 0 2 | 0 2 | 1 ... | ... 9 | 0 9 | 1 9 | 0 10 | 0 the output being: new_treads|response ------------------ 1 | 1 2 | 0 ... | ... 9 | 1 10 | 0 so far, understand how first min, need 2nd select thread, min(response) messages group thread; i use group because i'm using group other selects well thanks! since rows not "numbered", need create number each group , select it. i'd user variables: select thread, response ( select @n := (case when m.thread = @prev_thread @n else 0 end) + 1 n -- if current thread same -- previous row, increase counter,

multithreading - Java CountDownLatch with Threads -

i looking learn using java countdownlatch control execution of thread. i have 2 classes. 1 called poller , other referendum . threads created in referendum class , run() methods contained in poller class. in poller , referendum classes have imported java countdown latch via import java.util.concurrent.countdownlatch . i looking understand why , the *.countdown(); , *.await(); statements need applied , understand if have correctly initialised countdownlatch within poller constructor. the complete code 2 classes are: import java.util.concurrent.countdownlatch; public class poller extends thread { private string id; // pollster id private int pollsize; // number of samples private int numberofpolls; // number of times perform poll private referendum referendum; // referendum (implies voting population) private int sampledvotes[]; // counts of votes or against static countdownlatch pollsarecomplete; //the countdow

math - In C, why is the ratio 10.0/100 different from 0.1? -

this question has answer here: why floating point numbers cant compared? [duplicate] 7 answers this simple question , searched forums, couldn't find answer (i found 1 log don't think there rounding error here). i wrote program determine value of fine range of expired products, when ratio exact, program return next fine category, ignoring = sign in conditional. the program must return following fines: 0 if no product expired. 100 if 10% of products expired. 10000 if more 10% of products , 30% expired. 100000 if more 30% of products expired. this code wrote: #include <stdio.h> int calculate_fine(int ncheckedproducts, int nexpiredproducts) { int fine; float ratio; ratio=(float)nexpiredproducts/ncheckedproducts; if(nexpiredproducts==0) fine=0; else if(ratio<=0.1) fine=100; else

amazon s3 - Cloud Storage Appending and Logging -

what cloud service combination allow storage of logs n parts such cheap , easy to: append new entries log request parts i -> j log, or @ least parts i -> n have requests above consistent (i.e. reading log after user appends entry n + 1 results in entry n + 1 being available) log entries potentially quite large (10's 100's of mb) imagine user uploads picture service log entry i'm storing [log , user data | picture content] . while can happily store log , user data separately picture content , when retrieve log need efficiently able both sections. some research , thoughts have: s3/google cloud storage not seem allow modifying object data, although google allows compose function might useful. google cloud storage , windows azure storage consistent, s3 not although might able use db deal consistency issues here. microsoft azure might best bet, since blobs seem allow manipulating individual pages/blocks. however, i'm not sure whether using blobs

javascript - Is there a way to have console.log() log messages in IE with the console closed? -

i have been reading console.log in ie works when console exists (is open). i working through timing issue in ie , whatever reason can replicate issue when console closed. therefore, using console.log not me since cannot replicate issue when console open. is there anyway have console.log work in ie console closed? there approach use write debug data browser? if problem happens when console closed, may possible console.log failing. i'll put @ top of master page or layout page, guarantee runs before else: if (!window.console) { window.console = { log: function() { } }; } so if console doesn't exist, in old ie, won't cause issues if call console.log . of course, if potentially use of other console functions, define well. you can assign real log instead of dummy call - maybe log can execute ajax request simple handler logs message on server.

javascript - Animating a line drawn between 2 elements without canvas, linking by ID's -

Image
i using library called pattern lock sudhanshu yadav. mimic of android pattern lock screen. trying draw animation, showing unlock steps (to use captcha). not want way has done in 1 of other projects - has picture arrows on line, showing directions, run animation on exact unlock screen user can complete that. have tried using svg's, did not work out not understand them , tutorials have found relevant quite technical. have tried using @keyframes in css well. project here not work if container canvas, needs div or section. my end goal go through animation starting @ this: moving next part of animation - drawing line: with end result of: i need see animation happening know start , end points are. need able adjust timing on animation if possible. have tried jsplumb did not needed, , documentation confusing. but here code: <html> <head> <link href="css/patternlock.css" rel="stylesheet" type="text/css" /> <

android - Gradle: 'buildTypes' cannot be applied to groovy.lang.Closure -

this question has answer here: buildtypes cannot applied groovy.lang.closure 19 answers after changing targetsdkversion , compilesdkversion 22, , changing buildtoolsversion 22.0.1, keep getting following error: 'buildtypes' cannot applied '(groovy.lang.closure< com.android.build.gradle.internal.dsl.buildtype>)' i looked @ build.gradle file , tried error: apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "********" minsdkversion 14 targetsdkversion 22 versioncode 17 versionname "1.5-beta" } buildtypes { release { minifyenabled true proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro&

java - Record and replay interactions with a webpage -

i implementing integration test complex website. i write tests hand simulate various events on pages, check value of various elements , check fine storing screenshots. server requests mocked. this works quite well, process of writing tests takes lot of time. instead want record interactions page able replay them. i want record: the events generated the network requests , responses, can mock them later the value of , positions of fields displayed on page (could hand-picked) is there such tool? writing firefox plugin don't want reinvent wheel. this plugin use: http://www.seleniumhq.org/projects/ide/ it has record function, can export , run test. when right click element on page can assert on in various ways. hope looking for,

c - Variable in NASM -

i trying convert lines: struct node * head; struct node * tail; into nasm (x86-64). code partially in c , partially in assembly. should write in section .bss this: head resb 8 tail resb 8 also making global in section .text : global head:data 8 global tail:data 8 ? doesn't want work :/ know pointer in fact address, unsigned long . ===== here the struct: struct node { unsigned long length; char * buf; struct node * previous; struct node * next; }; you might want define global variables in data section can initialize values. pointers can defined quad words using dq : section .data global head head dq 0 global tail tail dq 0

sql - Storing XML into Postgres -

i have xml document needs stored in sql db (postgres). i've seen how that's done, have question: create single table xml field , place whole document there? document movies , (movies, actors...) has information later retrieved. i've never worked xml in databases, i'm little confused. here's example of xml: <?xml version="1.0" encoding="utf-8"?> <cinema xmlns="movies" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="movies file:/c:/users/fabio/git/lapd/movies.xsd"> <persons> <person id="p1"> <name>samuel l. jackson</name> <birth>1948-12-21</birth> </person> <person id="p2"> <name>leonardo di caprio</name> <birth>1974-11-11</birth> </person> <person id="p3"> <name>quentin tarantino</name>

php - Laravel - moving file causing error -

i trying copy file 1 directory follows: $files = file::allfiles($temp); foreach ($files $f) { $f->move($destination, file::name($f)); } i getting error: call undefined method symfony\component\finder\splfileinfo::move() in following line: $f->move($destination, file::name($f)); it seems not detect $f being of type file because every time try , use of functions getclientoriginalname() i error. i keep getting error. seems not registering $f being file.. also thing keep in mind don't know name of file why of files in directory (only ever 1 @ time) try this: file::get($f) let me know happens.

angularjs - angular js content not wrapped inside the return resource object -

i have service class in angular calls backend , gets userinfo object. angular service class has following. var userresource = $resource(coreurl+'getfullprofile', {}, { getuserinfo: { method: 'post' } userservice.getuserinfo = function (userobj) { var res = userresource.getuserinfo(); var promises = res.$promise; return promises; } my controller class has following. promise = userservice.getuserinfo(); promise.then(function (response) { $scope.user = response; }); my backends service returns object. my problem user info object backend not wrapped inside object.the object mix angular variables. dont have response.data .the response object has information. $promise: objectcatch: function (callback) {finally: function (callback) {then: function (callback, errback, progressback) {__proto__: object $resolved: true about: &qu

javascript - Array.length seemingly not working; console.log shows otherwise -

i want write contactlist page though console.log showing contactlist receiving contacts being pushed localstorage, length remains @ 1! , when try iterate on contactlist write page, doesn't work expected , see undefined values should be. var contactlist = []; window.onload = init; function init(){ var data = window.localstorage.getitem("contacts"); if(data){ mydata = json.parse(data); console.log("this local storage:\n"); console.log(mydata); console.log("this contact list before push local storage:\n"); console.log(contactlist); contactlist.push(mydata); console.log("this contact list after push local storage:\n"); console.log(contactlist); var j = contactlist.length; console.log("this length of contact list:\n"); console.log(contactlist.length); } } here's example of console window: this local storage: form

node.js - XMLHttpRequest detect new data from server before res.end() -

is possible detect new data server sent? example, express.js: res.write('processing 14% or something'); and display on page progress bar. edit: my original question bit confusing let me explain situation. have created page users can upload song files. these files converted (using ffmpeg) .ogg , .mp3 files web. conversion takes long time. possible send real time data conversion client using same xmlhttprequest sent files? if understand correctly trying implement event based actions. yes node.js has got excellent web socket libraries such socket.io , sack.js you need understand nodejs event driven pattern. websocket protocol helps maintain full duplex connection between server , client. can notify clients when action happens in server , similar can notify server when action happens in client. libraries provide flexibility broadcast event connected client or selected ones. so emit , on using often. go through documentation, not take time learn. let m

recursion - Generating Power Set of a String Recursively in Java -

i'm trying recursive implementation of power set generator working off of pseudocode given, when given string "abc", rather having sets {}, {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, , {a,b,c}, i {}, {0}, {1}, {2}, {0,1}, etc. public static arraylist generatesubsets(string setstring) { arraylist = new arraylist<string>(); arraylist temp = new arraylist<string>(); if(setstring.length() > 0) { temp = generatesubsets(setstring.substring(0,setstring.length() - 1)); for(int = 0; < temp.size(); i++) { system.out.println("temp i: "+temp.get(i)); a.add(temp.get(i)); a.add(temp.get(i) + " " + (setstring.length() - 1)); } return a; } else a.add(""); return a; } this based directly on pseudocode, why isn't working correctly? edit: test public static void main(string[] args) { arraylist 1 = generatesu

Building Android app with Jenkins & Gradle -

i'm devops engineer, , company building first android app. of our other projects, we've used jenkins handle builds. i've read quite few tutorials on getting android building on jenkins , seem rely on gradle. i'd out in front of devs bit , start job. possible app build doesn't support gradle? scenarios those, can influence decisions? maybe gradle isn't latest thing, if not, is? is possible app build doesn't support gradle? it possible not building app gradle, highly unlikely app not built gradle. what scenarios those, can influence decisions? the scenario not building gradle, use eclipse ide develop app. eclipse projects have historically been built more ant or maven. eclipse project can built gradle. said, configuring android project built gradle not requirement build project jenkins. ant, maven, , other build tools play nice jenkins also. so, if dev team using build tool other gradle, shouldn't blocker you. should

Does Erlang have methods? -

e.g. there this: o = widget:new(), o:whirl() i seem recall seeing code (maybe imagining it), haven't seen in tutorials i've read. i've seen, closest thing this: o = widget:new(), widget:whirl(o) that's not bad, not having repeat widget: in second expression nice. this syntax parametrized modules removed erlang in r16 (2012) .

love2d - Lua Error "Attempt to call method '' (a nil Value) -

i wanted make 2d-platformer (with love2d-framework) , have main.lua-file select random maps states folder. start that, said main-main.lua should open main.lua-file in /states/map1/. every time try run it, error-message: error states/map1/main.lua:169: attempt call method 'update' (a nil value) traceback states/map1/main.lua:169: in function 'update' [c]: in function 'xpcall' the main-main.lua-code: function clearlovecallbacks() love.draw = nil love.joystickpressed = nil love.joystickreleased = nil love.keypressed = nil love.keyreleased = nil --love.load = nil love.mousepressed = nil love.mousereleased = nil love.update = nil end state = {} function loadstate(name) state = {} clearlovecallbacks() local path = "states/" .. name require(path .. "/main") load() local player end function load() end function love.load() loadstate("map1") end the main.lua