Posts

Showing posts from July, 2012

What does {{{…}}} mean in Swift? -

i wrote following code in playground. struct product { var randomnumber: int? init?(number: int){ if number <3 {return nil} randomnumber=number } } var mug = product(number: 5) // {{{…}}} in output on right {{{…}}} indicated comment. symbols mean? it's shorthand notation indicates different levels of wrapping. xcode telling what's in variable mug outermost curly-brackets wrapping around optional. second level of brackets wraps around struct properties , third level of wrapping optional wrapped around randomnumber property. can visualize doing this. var mug = product(number: 5) // {{{...}}} var amug = mug! // {{some 5}} var bmug = mug!.randomnumber // {some 5} var cmug = mug!.randomnumber! // 5

Running Google Script without updating spreadsheet? -

i have multiple scripts want run on data in spreadsheet. of data populated random number function.. change every time spreadsheet updated/edited. it seems scripts update spreadsheet if doesn't explicitly edit cells. causes of data change mid-script , mess things up. is there way stop spreadsheet updating while script running? no, don't think so. you'll need come way of structuring retrieval , updating of data, , timing of flow of events. check conditions, , halt script if need be. set key cell values script, rather function in cell.

c# - How to use enums with dynamic and word -

in function load template using word , replace words other words. that's not important. how change function use dynamic ? in particular, how use enums (such wdreplace.wdreplaceone) without having reference microsoft.office.interop.word? public static void createsheetbyreplacement(string student, list<string> words) { application wordapp = new application(); wordapp.documents.add(environment.currentdirectory + "\\spellingsreplace.dot"); wordapp.selection.find.execute(findtext: "studentname", replace: wdreplace.wdreplaceone, wrap: wdfindwrap.wdfindcontinue, replacewith: student); (int = 0; < 80; i++) { string word = (i < words.count ? words[i] : ""); wordapp.selection.find.execute(findtext: "[word" + (i + 1) + "]", replace: wdreplace.wdreplaceone, wrap: wdfindwrap.wdfindcontinue, replacewith: word); } wordapp.visible = true; wordapp = null; } i need 1 example of how u...

github - hg-git repository not found -

i configure mercurial project able push github repository. while using command: hg push git+ssh://git@github.com/myusername/myproject.git i receive msg: abort: repository git+ssh://git@github.com/myusername/myproject.git not found! i check , establish ssh connection, , looks ok: hi myusername! you've authenticated, github not provide shell access. my respository url copied github (it's fork other open-source project): https://github.com/myusername/myproject.git what else should check? why have information doesn't exist while, in fact, does? can problem? are sure have enabled , setup hg-git extension correctly. error appears if extension not correctly setup. can try local git repository phase-out github possible error.

How do I specify an index using a Kibana query? -

how 1 create kibana query uses specific index? i've tried using _type:stats , index:prod _type:stats , _index:prod _type:stats , _index_:prod all no luck. i have main dashboard index set _all , if terms panel, see prod index know it's visible.

Any way to inject styling into an AngularJS template in a contributed directive -

i using contributed directive contains template. i'd modify template use function set styles on specific elements in directive template via ng-style (i.e. conditionally set background color based upon value within said directive). now, can modify template contain ng-style directives overriding template in $templatecache. however, given directive has own isolate scope, don't know function call can define without modify directive definition. is there way either a) inject function directive can use in overridden ng-style-containing template or b) write ng-style directives in such way can access containing (or global) $scope?

android - Using fetchUuidsWithSdp() to prevent friendly name caching -

definition: my non-android device (nad) bluetooth device loops name 60 0 , resets in infinite fashion. objective: i'm trying have android device closely possible detect countdown , initiate alarm close of nad counter possible. i'm doing getting native bluetoothadapter of device startdiscovery() manually tying function onscreen buttons , keeping eye on toasts set through broadcastreceiver, updates onscreen textviews enables me monitor device receiving in real-time requirement: system & resource efficiency not concern in context. problem:(keep eye out part 1 , part 2 in code) i'm not sure how using fetchuuidswithsdp() helping me since textview it's updating remains empty , textview getting populated extra_name intent returning action action_name_changed cached, initial discovery name (ie. application not reading name after initial discovery). my code can found below sorry newbie mistakes,i'm trying best :) public class btbroadca...

Android: Adding more than one Bundle to a new activity -

i'm trying pass in 2 separate pieces of information new activity in android application. have this: bundle databundle = new bundle(); bundle extras = getintent().getextras(); // student id databundle.putint("id", 0);// lesson id intent intent = new intent(getapplicationcontext(),com.example.ltss.dyslexia.app.lessonnotes.class); intent.putextras(databundle); intent.putextras(extras); startactivity(intent); i have code accessing information. however, adding second bundle overrides first one. bundle extras = getintent().getextras(); bundle studentid = getintent().getextras(); log.d("lessonid: ", string.valueof(extras)); log.d("studentid: ", string.valueof(studentid)); i need have information passed in separately need check if 1 of them null. can i'm asking done? ideas how this? or way this? (parsing maybe?) thanks you use putextra("bundle1", bundle1) , putextra("bundle2", bundle2) , use getintent().getb...

html - Zocialcss CSS button background changes to white. -

Image
i trying incorporate zocialcss buttons in site color of background changes automatically white when insert them instead of retaining rest of buttons default color. <div classname="form-group"> <div classname="col-sm-offset-2 zocial facebook"> <button class="zocial facebook"> sign in facebook </button> </div> </div> i works in jsfiddle: http://jsfiddle.net/bc6et/ , in computer, class part ignored, plain html button. here picture of looks when write zocial facebook within classname part: everyone saying should use class instead of classname , gets ignored wherever substitute it. know why? additional comments i using react. i have index.html file calls js file, containing render function above html code in it. answer incluiding classname within button worked perfectly: <div classname="form-group"> <div classname="col-sm-offset-...

python - win32api.messagebox gets called on program start -

i have simple python program using familiar win32api message calls. put line in program mywin['button'].onclick = win32api.messagebox(0, 'hello', 'title') the problem message box gets displayed program starts. , not displayed when button clicked. ideas doing wrong? here rest of code: import gui import win32api gui.window(name='mywin', title=u'gui2py minimal app', resizable=true, height='459px', width='400px', image='', ) gui.button(label=u'click me!', name='button', left='8', top='115', default=true, parent='mywin', ) # reference top level window: mywin = gui.get("mywin") mywin['button'].onclick = win32api.messagebox(0, 'hello', 'title') if name == "main": mywin.show() gui.main_loop() you assigning .onclick attribute return value of calling win32api.messagebox . no different doing: value = win32api.m...

javascript - Retrieve value of a Jquery variable name containing a variable in itself -

in top of jquery i've got many variables (associated values) called : files_1, files_2, etc. they created in script, in bottom of page : <script> $(function () { <?php foreach ($folders $f) { ?> var files_<?=$f['request_id']?> = 0; <?php } ?> … }); </script> in html i've got link : <a href="#" class="delete" data-request-id="2" title="delete">delete</a> data-request-id parameter gives me number, ones you've got in variables names on top. in example, it's data-request-id=" 2 " : files_ 2 . next, i've got jquery function catch data values links : $('.request-files').on('click', 'a.delete', function (e) { e.preventdefault(); var $link = $(this); var $id = $link.data('request-id'); console.log(files_$id); // <-- doesn't work }); what need retrieve value of variables files_x . in exa...

java - Error: Constructor A in class A cannot be applied to given types -

public class a{ public a(string x){ system.out.println("a constructor called "+x); } public static void main(string []args){ system.out.println("hello world"); a= new b("b"); } } class b extends a{ public b(string x){ system.out.println("b constructor called "+x); } } what problem in simple program, unable locate it. getting following error on compile: a.java:13: error: constructor in class cannot applied given types; public b(string x){ ^ required: stri...

Openshift: application is not responding -

Image
i have webapp quite not respond request. there no errors in logs. not think application errors. cause of this? note, happens before application controller action. service info: “oo-cgroup-read cpu.cfs_period_us” 100000 “oo-cgroup-read cpu.cfs_quota_us” 100000 “oo-cgroup-read cpu.rt_period_us” 1000000 “oo-cgroup-read cpu.rt_runtime_us” 0 “oo-cgroup-read cpu.shares” 128 “oo-cgroup-read cpu.stat” nr_periods 4422171 nr_throttled 2640 throttled_time 123367550142 “oo-cgroup-read cpuacct.stat” user 240149 system 115230 “oo-cgroup-read cpuacct.usage” 5286207717468 “oo-cgroup-read cpuacct.usage_percpu” 2765304828137 2521009189993 “oo-cgroup-read freezer.state” thawed “oo-cgroup-read memory.failcnt” 0 “oo-cgroup-read memory.limit_in_bytes” 536870912 “oo-cgroup-read memory.max_usage_in_bytes” 360595456 “oo-cgroup-read memory.memsw.failcnt” 0 “oo-cgroup-read memory.memsw.limit_in_bytes” 641728512 “oo-cgroup-read memory.memsw.max_usage_in_bytes” 441470976 “oo-cgroup-read memory.memsw.usage_in...

How to detect Disk drive letter using batch code -

i need guys. want create batch file detect running dvd in disk drive , after that, want batch file write it's letter text file. can me wiritng batch code so? hope can me. thank you. this list drive letters in drives.txt : @echo off %%a in (a b c d e f g h j k l m n o p q r s t u v w x y z) (if exist "%%~a:" echo %%~a: >> drives.txt) which produced me: c: p: r: s:

java ee - How to know how many connections can handle my server -

Image
i have javaee(jsf/ejb/jpa) + mysql server , know how many connections can handle @ same time. use ubuntu. maximum users connections 4,294,967,295 this provided mysql docs

csv - CsvBulkLoader import/update only existing objects -

i'm using simple csvbulkloader bulk update dataobjects. class orderimporter extends csvbulkloader { public $delimiter = ';'; public $enclosure = '"'; public $hasheaderrow = true; public $columnmap = array( 'id' => 'id', 'bezahlt' => 'payed', 'geandert' => 'needreview' ); } my problem is, don't want create new objects, if in import file. want update existing ones. is there way achieve this? sadly can't find in docs. i think you'd have @ csvbulkloader::processrecord() . each line processed. try in orderimporter class (untested): protected function processrecord($record, $columnmap, &$results, $preview = false) { // find existing object $existingobj = $this->findexistingobject($record, $columnmap); return ($existingobject) ? parent::processrecord($record, $columnmap, $results, $preview) ...

mingw-w64 on ubuntu 14.04 -

i searching ubuntu package. is there way x86_64-mingw-w64-gcc compiler in version 4.9 on ubuntu 14.04? in official repositorys find mingw-w64 in version 3.1 comes mingw-w64-gcc in version 4.8 i'm searching 2 days now, can find neither package nor sources build myself. there packages arch linux , on debian/testing, think don't work ubuntu. it gonna cross compiler windows 7 64 bit.

function - Parameter Passing in C - Pointers, Addresses, Aliases -

could please explain difference between parameter passing in c please? according professor notes there 4 different ways pass parameters call-by-value call-by-address (pointer) call-by-alias global variable / static variable if please give example, appreciate that, , work commended. call-by-value passing value function parameter. if function modifies variable, actual variable won't changed. void fun1(int myparam) { myparam = 4; } void main() { int myvalue = 2; fun1(myvalue); printf("myvalue = %d",myvalue); } myvalue 2. call-by-address (pointer) void fun1(int *myparam) { *myparam = 4; } void main() { int myvalue = 2; fun1(&myvalue); printf("myvalue = %d",myvalue); } here passing address of myvalue fun1 . value of myvalue 4 @ end of main() . call-by-alias there no alias in c per understanding. should c++ reference mechanism. global variable / static variable global , static variables ...

C: How to use strtok to output grades from input file & find average, minimum and maximum? -

i'm trying output grades of assignments input file, output average, minimum , maximum grades each assignment. as example, input file class 4 students , 3 assignments may like: 8.5, 10.5, 90.5 49.5, 99, 97 88, 88, 100 88.5, 99, 0 and output should be student grades input file: 8.5, 10.5, 90.5 49.5, 99.0, 97.0 88.0, 88.0, 100.0 88.5, 99.0, 0.0 assignment # 1 stats avg = 58.6 min = 8.5 max = 88.5 assignment # 2 stats avg = 74.1 min = 10.5 max = 99.0 assignment # 3 stats avg = 71.9 min = 0.0 max = 100.0 so far, i'm stuck on first part have output contents of file. have far, on or functions appreciated. int main(int argc, char *argv[]) { file *input_file; int line_number = 0; char *next_field; char line[max_students+1]; input_file = fopen(argv[1], "r"); //output grades input file while (1) { fgets(line, max_students, input_file); if (feof(input_file)) break; next_field = strtok(line, ...

java - Smooth velocity based movement with predictable duration -

Image
anyone has algorithm how smooth predictable movement point a -> b in 2d in language? i need have 1 function setting velocity each frame: function getvel(current_pos : vector2, dest_pos : vector2, current_vel : vector2) { var new_vel : vector2d; ....... return new_vel; } and corresponding: function getdesttime(current_pos : vector2, dest_pos : vector2, current_vel : vector2 ) { var duration : float; ....... return duration; } simply using acceleration leads lots of sliding smoothdamp algorithm can predicted exact dest time need. any ideas? let's assume v(0) = 0 , v(t) = 0 and, v(t) quadratic function maximum value @ t = t/2. accordingly, can assume form, since point moves l within t seconds, integrating v(t) 0 t must give l. so, can equation, solving these equations gives, using these , b, can compute current velocity. it rather long, made java toy realize this. please check it! import java.awt.*; import javax.swing.*; public c...

Steroids Connect: What is the URL for the preview QR code? -

running steroids connect ordinarily opens browser big qr code testing on real device. i'm running on vps doesn't open browser. what url opens? what mr. jones said! also, can run steroids connect --debug see url trying open in console log.

Moving Top Disc Tower Of Hanoi Using Recursion Java -

i have weird issue whenever program attempts solve tower of hanoi puzzle. whenever tries solve it, move first 2 discs on end pole (the pole way right), move remainder of discs starting pole. example, if have tower of hanoi 10 discs, move first several discs start pole, top 2 make end pole. rest of discs end on first pole. when this, gives me index out of bounds error. not sure going wrong it, , appreciated. in advance. public class towerofhanoi { private int[] towerone; private int[] towertwo; private int[] towerthree; private int discone; private int disctwo; private int discthree; /* construct towers of hanoi (3 towers) anumdisc * on first tower. each tower can identified * integer number (0 first tower, 1 second * tower, , 2 third tower). each disc can identified * integer number starting 0 (for smallest disc) * , (anumdisc - 1) largest disc. */ public towerofhanoi(int anumdiscs) { towerone = new int[anumdiscs]; for(int = 0; < anumdiscs; i++...

sql server - SSIS Package Store vs. MSDB -

Image
when setting sql agent job, there options choosing, among others, "sql server" or "ssis package store". if choose "ssis package store" , browse msdb instead of file system, can choose ssis packages stored in sysssispackages. however, documentation /dts switch, ssms automatically chooses when selecting ssis package store, appears packages stored on file system. i've noticed if user executing job doesn't have file system rights, job fail when choosing ssis package store --> msdb --> package "access denied" error or "~object doesn't exist". since package doesn't exist on file system though, why execution work when choosing sql server , fail when using ssis package store? dtexec looking dtsx file on file system when msdb chosen? have, false, understanding sql server , ssis package store --> msdb same thing when referencing server on agent running. i've done research , can't find clear distinction o...

Eclipse Error: java.lang.NoClassDefFoundError -

hi using eclipse kepler update old project. original programmer has following ejb unrelated table. changenotification.java import java.io.serializable; import java.util.date; public interface changenotification extends serializable{ public string getid(); public void setid(string id); public void setproduct(string product); public void setchangetype(string changetype); } this compiles , see .class in ejb jar under deployments directory. but when try compile project following error. include of in-case there hint further down: 21:01:28,478 error [org.jboss.msc.service.fail] (serverservice thread pool -- 18) msc000001: failed start service jboss.persistenceunit."adtf_ear.ear#grid-persistence": org.jboss.msc.service.startexception in service jboss.persistenceunit."adtf_ear.ear#grid-persistence": java.lang.noclassdeffounderror: changenotification @ org.jboss.as.jpa.service.persistenceunitserviceimpl$1$1.run(persistenceunitserviceimpl.j...

html - How would I make this CSS / jQuery dropdown menu multilevel? -

i'm having trouble figuring out how make dropdown menu multilevel. here codepen of it: http://codepen.io/owlsky/pen/ddukj i'm trying learn how menu open additional menu when user hovers on 1 of options. i'm not comfortable jquery, solution easy understand. html: <select name="" id="" class="dropdown"> <option class="label">label</option> <option value="1">option 1</option> <option value="1">option 2</option> <option value="1">option 3</option> <option value="1">option 4</option> <option value="1">option 5</option> <option value="1">option 6</option> <option value="1">option 7</option> <option value="1">option 8</option> <option value="1">option 9</option> </select> css: /* reset */ u...

yii - Can you run console jobs from yii2-basic? -

i aware yii2-advanced has ability run console jobs (php yii controllername) wondering if basic app has same ability? notice console.php file in config folder, cannot seem jobs run. if possible, can give example - controller go (since put in controllers, message 'error: unknown command test' when trying php yii test) any appreciated. yes, same functionality exists in basic template too. however, it's organized bit differently. by default console controllers located in commands folder (you can change editing setting: 'controllernamespace' => 'app\commands' ). configuration managed through config/console.php mentioned. as example can take @ hellocontroller comes template default. you can find more info in according official docs section . as error, accurately check controller name , action names, problem there. update: make sure have @ least 1 action in controller, otherwise same error ("unknown command") appear. ...

c++ - Confused with pointer and double pointer in the heap -

i'm getting confused pointers , double pointers. suppose have these int* ptr = new int[2]; here, ptr has address of array of size 2 in heap keeps int data right? int** ptr = new int* [2]; here, ptr has address 2 pointers in heap , these 2 pointers can point int data. is thinking here correct? this correct: in first case assign pointer memory block in heap sufficient storing 2 int s, can considered int array of size two. the second ptr assigned pointer memory block in heap sufficient storing 2 pointers int . however, these pointers not point in particular until assign them value * , in same way assign other pointers. example, can make second ptr make array of 2 int arrays, this: int** ptr = new int* [2]; ptr[0] = new int[2]; ptr[1] = new int[2]; * same true int s first code snippet: value indeterminate until assign them.

html - Will replacing H1 tag with H2 have any effect on my website's SEO? -

currently website has 2 kinds of pages, , have google page ranking. one type of page exercise pages , uses h1 , h2 tags. , other article pages , uses h2 , h3 tags. i want show exercise pages important pages of website , should shown before article pages. so if use h2 , h3 tags exercise pages, have effect on seo? or exercise pages have same importance article pages? (which don't want. want exercise pages have more impact) it doesn't make sense how have now, or changes want make. firstly - how write sites, google rank higher for: every page should have h1 , represents main title of page. use h2 h6 form sub headings rest of content, each 1 used given block of content required. playing headings not allow "choose" want ranking go. it's wrong approach anyway, should using headings correctly , designed. not attempt google place rank. you should understand google little cleverer dumbly ranking site headings. the way rank ...

Oracle: What is the data type of ORA_ROWSCN? -

what data type of ora_rowscn? seems number cannot find specified in documentation. declare myscn ???; begin select ora_rowscn myscn t ...; end; it number . can see creating simple view , describing (or selecting *_tab_columns ). here's simple sqlfiddle demonstration create table foo ( col1 number ); create view vw_foo select col1, ora_rowscn scn foo; select * user_tab_cols table_name = 'vw_foo'; if want more detail you'd ever care on format of scn (system change number), here one decent article

Access by roles at controller level -

is possible mvc allow whole controller accessed 1 role except 1 or few methods accessed role? where methods belong staff except method3 can access both clients , staff. below: [authorize(roles = "staff")] public class staffcontroller : controller { public staffcontroller() { } public actionresult method1() { } public actionresult method2() { } [authorize(roles = "staff, customer")] public actionresult method3() { } } or scenario belong staff except method3 exclusively accessible clients, below: [authorize(roles = "staff")] public class staffcontroller : controller { public staffcontroller() { } public actionresult method1() { } public actionresult method2() { } [authorize(roles = "customer")] public actionresult metho...

javascript - Prototype inheritance is not working as expected -

since javascript childhood have read , followed should override constructor in case of prototypical inheritance. surprised see following example outputs same @ console if overriding constructor statement commented. please enlighten. function a() { console.info("a constructor"); } function b() { console.info("b constructor"); } b.prototype = a.prototype; b.prototype.constructor = b; // need statement? console.info("cp 1"); var b = new b(); console.info("cp 2"); before getting constructor part, there problem in code. making both b.prototype , a.prototype same, doing b.prototype = a.prototype; this means that, cannot identify parent of objects constructed these functions. try this console.log(new b() instanceof a, new b() instanceof b); // true true this expected, since b created b , b created a 's prototype. but console.log(new a() instanceof a, new a() instanceof b); // true true whaaat? how come obje...

Can Spring help to prevent caching of html pages on the browser? -

i have java/spring 3.x webapp uses extjs , use sencha architect create front end results in automatically generated app.html file loads in js , css resources looks this: <!doctype html> <!-- auto generated sencha architect --> <!-- modifications file overwritten. --> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>ui</title> <script src="ext/ext-all.js"></script> <script src="ext/ext-theme-neptune.js"></script> <link rel="stylesheet" href="ext/resources/ext-theme-neptune/ext-theme-neptune-all.css"> <link rel="stylesheet" href="css/custom.css"> <script type="text/javascript" src="app.js"></script> </head> <body></body> </html> i want protect html file spring security , seems work except cach...

c# - cannot upload file to server getting error "device not ready" -

when i'm trying upload .htm file server selecting file dropdown list getting exception. details of exception given below system.io.ioexception unhandled user code message=the device not ready. source=mscorlib stacktrace: @ system.io.__error.winioerror(int32 errorcode, string maybefullpath) @ system.io.filestream.init(string path, filemode mode, fileaccess access, int32 rights, boolean userights, fileshare share, int32 buffersize, fileoptions options, security_attributes secattrs, string msgpath, boolean bfromproxy, boolean uselongpath) @ system.io.filestream..ctor(string path, filemode mode, fileaccess access, fileshare share, int32 buffersize, fileoptions options) @ system.io.streamreader..ctor(string path, encoding encoding, boolean detectencodingfrombyteordermarks, int32 buffersize) @ system.io.streamreader..ctor(string path, encoding encoding) @ system.io.file.internalreadalltext(string path, encoding encoding) @ s...

ios - Xcode: Segue Show Transition Repeats Twice -

Image
i have 2 views, spring element , spring insert variables . user click on add button, change view spring element spring insert variables adaptive segue - show(eg.push). user input variables , submit , change view spring insert variables spring element adaptive segue - show(eg.push). the problem transition spring insert variables spring element repeats twice. video illustration here how correct it? code add function @ibaction func add(sender: anyobject) { self.performseguewithidentifier("addspring", sender: sender) } code submit function @ibaction func submit(sender: anyobject) { self.performseguewithidentifier("springsubmit", sender: sender) } remove segue spring insert variable spring element. in submit action, add command: [self.navigationcontroller popviewcontrolleranimated:yes];

javascript - Removing class from li -

i have searched answer cant seem quite find needs done here. i have 3 li tags each drop down ul. want change background color on active li, remove if click on annother li or active li. far have managed add class active li removed clicking on annother li. need class removed if active li clicked again , closed well. thanks. <style> .add_color {background:#f3a54e;color:#fff !important;} </style> <body> <ul class="submenu"> <li>shop category <ul> <li>some text</li> <li>some text</li> </ul> </li> <li>shop brand <ul> <li>some text</li> <li>some text</li> </ul> </li> <li>diet specifics <ul> <li>some text</li> <li>some text...

Adding extra step to ASP.NET MVC authentication -

i have mvc 5 website running using standard forms authentication. however need add step user's login process. once user has been authenticated whether or not have access multiple offices. if need show them list of offices , must choose one. this mandatory step , cannot considered logged on until it. do need create our own authentication or should add check basecontroller? you can extend implementation of built-in authentication: public class officeselectionauthorizeattribute : authorizeattribute { protected override bool authorizecore(httpcontextbase httpcontext) { var result = base.authorizecore(httpcontext); if (result) { if (isofficeselected()) { return true; } httpcontext.response.redirecttoroute("officeselection route"); httpcontext.response.flush(); } return false; } private bool isofficeselected() { ...

Augmenting Latin Hypercube Points in MATLAB -

i know commands create lhs design , augment more points later on if model not enough? example, first create 50 points lhs design, add more points (perhaps in batches of 20) incrementally until model accurate enough. example: set1=lhsdesign(5,5); %5x5 matrix %use of set 1, determine more points needed set2=%some command adds 20 points set1 make 25x5 matrix the difficulty in running lhsdesign again 20 new points not take account of original points. there work done using original points , generating new set of points scratch wastes work new points not included in new set. i able make function solves problem. not sure final matrix true latin hypercube, adds required number of points given points , moves them closest available open 'channel' (sub range no point exists) if need be. usage follows: x1=lhsdesign(200,17); xf=lhsaugment(x1,200); which adds 200 points x1 set of points, resulting in xf being 400x17 matrix. function follows: function xf = lhsaugmen...

android - How to detect when phone is answered or rejected -

i managed prepare activity when phone ringing. need know how cancel activity when anwser phone or reject call.do call extra_state_idle?extra_state_offhook? any ideas? <receiver android:name=".incomingbroadcastreceiver"> <intent-filter> <action android:name="android.intent.action.phone_state"/> </intent-filter> </receiver> public class incomingbroadcastreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { string state = intent.getstringextra(telephonymanager.extra_state); // if incoming call arrives if (state.equals(telephonymanager.extra_state_ringing)) { //did work } in onreceive: phonestatechangelistener pscl = new phonestatechangelistener; telephonymanager tm = (telephonymanager)this.getsystemservice(context.telephony_service); tm.listen(psc...

mysql - Leaderboard : return 5 records, then the one I want, then 4 more records -

i'm constructing leaderboard, , want specific user in middle of returned records. in other words, want 5 higher scored users, user want in middle, next 4 lower: **users:** user, score rita, 9 sue, 8 bob, 7 bill, 6 sam, 5 **me, 4** <-- user want in middle. sally, 3 simon, 2 john, 1 jim, 0 i in php, wanted try , more elegant sql statement. i have literally no idea how approach it! thanks something think about: select id,name my_table; +----+---------+ | id | name | +----+---------+ | 1 | adam | | 2 | ben | | 3 | charlie | | 4 | adam | | 5 | ben | | 6 | dan | +----+---------+ select * (select id,name my_table order id limit 2) x union (select id,name my_table order id desc limit 2); +----+------+ | id | name | +----+------+ | 1 | adam | | 2 | ben | | 6 | dan | | 5 | ben | +----+------+

arrays - C# assigning variables -

i found bothers me, great if 1 of explain me. maybe question asked before, i'm out of ideas how name it. here's problem: array1 = {1,2,3,4,5}; array2 = array1; array1[0] = 10 console.writeline(array2[0]); // - "10" besides of "1" and when use normal variables instead of arrys, like, ie: int = 5; int b = a; = 10; console.writeline(b); // - 1 have value "5" instead of 10. i know how copy arrys values, i'm curious why works that. the variable array1 not have value 1 or 'c', instead holds address points place in memory data stored. so array2 = array1 giving array2 same address array1... both point same place. if want allocate new chunk of memory, you'd have declare new array: int[] array2 = new int[5]; reserves 5*32 bits in memory new array , gives array2 address of first bit.

java - Rectangles Performance -

Image
i'm creating simple 2d platformer game using libgdx , i'm using rectangle class. of these options better? create 1 huge rectangle create lot of small rectangles from memory standpoint, 1 rectangle should more compact several, i'd start one. 1 rectangle avoid trap-on-border problem multiple rectangles pose.

MySQL : search string by first alphabetic letter -

here mysql table : id | title 1 | albert 2 | ali 3 | " alienor " 4 | à rebour 5 | bernard 6 | cassy i pick title "starting" "a", including lower/uppercase, accents , ignoring non letter caracters before first letter. i want result : 1,2,3,4 i got regex first letter : ^[^[:alpha:]]*([[:alpha:]]).*$ but not figure out how use in mysql query. thanks help is there problem using regex or rlike ? select * table t t.title rlike '^[^[:alpha:]]*[aa].*$' ;