Posts

Showing posts from July, 2012

php - CodeIgniter some issues with subomain and subdirectory -

i have problems codeigniter 3.0.1 installation. have installed codeigniter subdirectory on subdomain, example subdomain.domain.com/codeigniter. i have created .htaccess file remove index.php url when try access default controller got 404 error. my htaccess file. rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php/$0 [pt,l] my config file $config['base_url'] = ''; $config['index_page'] = ''; $config['uri_protocol'] = 'request_uri'; and default controller in routes.php $route['default_controller'] = "auth"; why $0 - segment 0? htaccess: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l] and try switch request uri parameter, auto should work in cases.

C++ create linked list and print -

i created linked list , wanted print items. struct node{ int item; node *next; }; typedef node* nodeptr; void insertat(nodeptr headnode, size_t index, int item); int main(int argc, const char * argv[]) { nodeptr head; head = new node; nodeptr constructor = new node; head->item = 0; head->next = constructor; for(int n = 0; n<8; n++){ constructor->item = n+1; constructor->next = new node; constructor = constructor->next; } constructor->item = 9; constructor->next = new node; constructor->next = nullptr; for(nodeptr begin = head; begin != nullptr; begin = begin->next){ cout << begin->item << endl; } return 0; } if write code this, works fine (print 0123456789). after making slight change after loop: constructor->item = 9; constructor->next = new node; constructor = constructor->next; constructor = nullptr; i assumed work same way...

Liquibase: runOnChange + rollback -

according liquibase docs stored procs/triggers etc should stored separately in single copy , added changeset runonchange update them each change. recommended way rollback previous change? idea have copy them separate folder each release , add apply operation of version rollback (for example, have sql\procs\current last version added changelog apply , sql\procs\1.0.0 copy of sql\procs\current when started new 1.0.0 release). there best practices it? thanks! we keep single copy of replaceable objects (procs/triggers/views etc) , use version control system (vcs) - git in our case. when want rollback previous version, revert relevant commit in vcs , run liquibase update. tutorial using oracle - working tutorial 2 years.

awk to count lines in column of file -

i have large file want use awk count lines in specific column $5 , before the : , count -uniq entries, seem having trouble getting syntax correct. thank :). sample input chr1 955542 955763 + agrn:exon.1 1 0 chr1 955542 955763 + agrn:exon.1 2 0 chr1 955542 955763 + agrn:exon.1 3 0 chr1 955542 955763 + agrn:exon.1 4 1 chr1 955542 955763 + agrn:exon.1 5 1 awk -f: ' nr > 1 { count += $5 } -uniq' input desired output 1 $ awk -f'[ \t:]+' '{a[$5]=1;} end{for (k in a)n++; print n;}' input 1 -f'[ \t:]+' this tells awk use spaces, tabs, or colons field separator. a[$5]=1 as loop through each line, adds entry associative array a each value of $5 encountered. end{for (k in a)n++; print n;} after have finished reading file, counts number of keys in associative array a , prints total.

Push notifications do not show for iOS devices -

Image
on bluemix dashboard, need see analytics information of push service both ios , android devices. can see in following screen shot, analytics information android devices displays expected: however, shown in screen shot, analytics information ios devices missing: what need analytics information ios devices display? push analytics not enabled correctly application. service connection needs made. otherwise, full push analytics data not received , see no version information available message in bluemix dashboard. push documentation explains how initialize push , enable notifications.

php - Killing session after certain time and update database -

i write following php code destroy session after 10 sec if user not on web page, not functioning properly. kills session after 10 sec not updating database. update database had refresh index.php page on browser updates database. want session destroyed automatically after 10 sec of start if close browser or inactive, , update database whether i'm on browser or not. don't want refreshing thing update database. $inactive = 10; // check see if $_session["timeout"] set if (isset($_session["timeout"])) { // calculate session's "time live" $sessionttl = time() - $_session["timeout"]; if ($sessionttl > $inactive) { $new_status= 0; $checkbox = "update online set status=($new_status) id=1 "; $stmt = $conn->prepare($checkbox); // execute query passing array toe execute(); $results = $stmt->execute(array($new_status)); // extract values $result ...

Racket - How to count the number of elements in a list? -

i wondering how count number of elements example, counting number of elements in (list 'a 'b 'c' 'd). thank you! based on racket documentation : http://docs.racket-lang.org/reference/pairs.html#%28def. %28%28quote. ~23~25kernel%29._length%29%29 (length lst) returns number of elements in lst.

osx - How can I decide which python I will open in mac terminal? -

i have several 2 python on mac, 1 original, , downloaded on website, when open python in terminal, how can decide i'm opening? help. specify full path binary. $ some/path/to/python ... >>> alternatively, create alias so. $ alias pythonx="some/path/to/python" $ pythonx ... >>>

c++ - Safely release a resource on a different thread -

i have class similiar to: class a{ private: boost::shared_ptr< foo > m_pfoo; } instances of destroyed on gui thread may hold last reference foo. destructor foo potentially long running, causing undesirable pause on gui thread. foo destroyed on separate thread in case, foo's self contained , not critical released immediately. currently, use pattern this: a::~a(){ auto pmtx = boost::make_shared<boost::mutex>(); boost::unique_lock<boost::mutex> destroyergate(*pmtx); auto pfoo = m_pfoo; auto destroyer = [pmtx,pfoo](){ boost::unique_lock<boost::mutex> gate(*pmtx); }; m_pfoo.reset(); pfoo.reset(); s_cleanupthread->post(destroyer); } essentially, capture in lambda , lock until released object. there better way accomplish this? seems more complicated needs be. a should not responsible destruction of target of m_pfoo . destruction of resource shared_ptr points responsibility of shared_pt...

junit - java.lang.IllegalStateException: no last call on a mock available with PowerMock and EasyMock -

i have test case using powermock test on static method math, as @runwith(powermockrunner.class) @preparefortest( { math.class }) public class test{ @test public void test2(){ powermockito.mockstatic(math.class); easymock.expect(math.abs(-123)).andreturn(1); easymock.replay(math.class); long returns = math.abs(-123); easymock.verify(math.class); org.junit.assert.assertequals(1,returns); } } my pom.xml looks as <dependency> <groupid>org.mockito</groupid> <artifactid>mockito-all</artifactid> <version>${mockito.version}</version> <scope>test</scope> </dependency> <dependency> <groupid>org.easymock</groupid> <artifactid>easymock</artifactid> <version>3.3.1</version> </dependency...

VXML <say-as> within <filled> -

i able <say-as> working correctly beginning prompt read of test number. however, experiencing issue <say-as> not seem process inside <filled> tag. <form> <field name="accountnumber" type="digits?minlength=9;maxlength=9"> <prompt> test account number <say-as interpret-as="number_digit">111111111</say-as> 9 digit account number </prompt> <filled> <prompt> <say-as interpret-as="number_digit"> 222222222 </say-as> </prompt> </filled> </field> </form> you can see have same <say-as> statement in both first prompt, , second prompt. expect first tts readoff works planned, reads each digit 1 one. second 1 not. reads off value whole number. my guess following - i need field tag or i need break forms somehow. any advice appreciated. @robert second 1 read same way first one, , seco...

html - Why won't my table column respect a max-width of 50%? -

i trying table column expand fill contents, until it's taking 50% (or arbitrary %) of width of whole table. i've set every cell in column, including header, have max-width: 50%; in css style.i've verified rule isn't being overridden max-width. fixed pixel amounts max-width work fine. percents seem failing take effect. i've tried simplifying reproducable example see if other obscure layout or css quirk causing problem, , i'm still able reproduce it. jsfiddle: http://jsfiddle.net/8lmtvzur/1/ html: <table class="data"> <thead> <tr> <th>entry header 1</th> <th>entry header 2</th> <th>entry header 3</th> <th class="asdf">entry header 4</th> </tr> </thead> <tbody> <tr> <td>entry first line 1</td> <td>duis sollicitudin ip...

javascript - Tablesorter - One column table, remove sorting but keep search for that column -

so here link table . can't disable sorting feature without disabling search column well. im using filter widget external search incase helps. here js coding $(function() { var $table = $('table').tablesorter({ theme: 'blue', widgets: ["zebra", "filter"], widgetoptions : { // filter_anymatch replaced! instead use filter_external option // set use jquery selector (or jquery object) pointing // external filter (column specific or match) filter_external : '.search', // add default type search first name column filter_defaultfilter: { 1 : '~{query}' }, // include column filters filter_columnfilters: false, filter_placeholder: { search : 'search...' }, filter_savefilters : true, filter_reset: '.reset' } }); // make demo search buttons work $('button[data-column]').on('click', function(){ ...

python - Program with flask-socketio and multiprocessing thorws 'LoopExit: This operation would block forever' -

first: absolute beginner in python, used write php before, if getting complitly wrong please let me know. i writing app. should serve information via websockets. choosed flask-socketio this. in background want process data. because have app small decided against solution celery. i have shortened code to: # -*- coding: utf8 -*- flask import flask, jsonify, abort, make_response, url_for, request, render_template flask.ext.socketio import socketio, emit multiprocessing import pool multiprocessing.managers import basemanager import time import os def background_stuff(args): while true: try: print args time.sleep(1) except exception e: return e thread = none _pool = none app = flask(__name__) app.debug = true socketio = socketio(app) @app.route('/', methods=['get']) def get_timers(): return 'timer' if __name__=='__main__': _pool = pool(1) if os.environ.get('werkzeug_run_ma...

sql - How do I get a string right before a certain character in SSIS 2008? -

i've been seeing lot of answers online none of them give me need. example: 12345_helloworld_328923_haha.txt i need grab before second "_" output: helloworld how do expression in ssis? i figured out. substring(@[user::filename],findstring(@[user::filename],"_",1) + 1,findstring(@[user::filename],"_",2) - findstring(@[user::filename],"_",1) - 1)

c# - user and password authentication asp.net -

the user , password correct returning incorrect. can be? importantly, password , encrypted in md5. public static bool logarusuario(string user, string pw) { try { const string checkuser = "select count(*) tbusuario username = '@user'"; sqlconnection con = banco.con(); con.open(); sqlcommand cmd = new sqlcommand(checkuser, con); int temp = convert.toint32(cmd.executenonquery().tostring()); cmd.parameters.addwithvalue("@user", user); con.close(); if (temp == 1) { con.open(); string checkpw = "select pw tbusuario username = '@user'"; sqlcommand passconn = new sqlcommand(checkpw, con); cmd.parameters.addwithvalue("@user", user); string password = passconn.executescalar().tostring(); registrar crip...

mysql - SQL Query to insert into a particular column from output of select query -

i have query shown below: select department departmentname,count(distinct(uid)) userscnt outlier_report department not null group department ; i want insert outlier_output table populated , has 20 fields including departmentname , user_count (this field empty). want put userscnt field output of select outlier_output table department=outlier_report.departmentment_name i assuming this: insert outlier_output(user_count select department, count(distinct(uid) userscnt outlier_report department=outlier_report.departmentment_name) how exact query be? in advance standard insert-select format is: insert `tablea` ([field_list]) select [results corresponding items in field list in same order field list] [etc...] http://dev.mysql.com/doc/refman/5.6/en/insert.html

excel vba - Find cell address in another workbook with its value: "Run time error '9' Subscript out of range" -

i'm working user form contains listbox , i'm trying list items in workbook cell addresses if found. my code follow: with me.listbox i=0 listbox.listcount -1 colnum = worksheetfunction.match(listbox.list(i), workbooks("c:\sourcefile").worksheets(1).range("1:1"), 0) msgbox "column :" & colnum next end an error message pops telling me "run time error '9' subscript out of range". i can see following problems might facing: 1) use application.match instead of worksheetfunction, latter not member of userform object 2) doubt name of listbox member not listbox, listbox1 or so 3) workbooks("c:\sourcefile") .. reference open workbook? if so, should using name (with extension) without path. with me.listbox1 i=0 .listcount -1 colnum = application.match(.list(i), workbooks("sourcefile.xlsx").worksheets(1).range("1:1"), 0) msgbox "col...

html - How to center nav in div -

i trying center navigation bar in middle of div body. want navigation bar go 1 side of div other have list in ul center in middle of div if makes sense. can't seem figure out after trying online examples. thanks body { margin: 0px; padding: 0px; background-color: #505050 ; } #body { width: 75%; margin: 0 auto; position: center; background-color: #c0c0c0; height: 100%; } .nav { } .nav ul { background-color: #cccccc; width: 100%; padding: 0; text-align: center; } .nav li { list-style: none; font-family: arial black; padding: 0px; height:40px; width: 120px; line-height: 40px; border: none; float: left; font-size: 1.3em; background-color: #cccccc; display:inline; } .nav { display: block; color: black; text-decoration: none; width: 60px; } <div id="body"> <h2>hello world!</h2> ...

go - How to run multiple goroutines and collect results in the same order it runs -

i have following code has double-go routine structure: package main import( "fmt" "math/rand" "time" "strconv" ) func main(){ outchan := make(chan string) i:=0;i<10;i++{ go testfun(i, outchan) } i:=0;i<10;i++{ := <-outchan fmt.println(a) } } func testfun(i int, outchan chan<- string){ outchan2 := make(chan int) time.sleep(time.millisecond*time.duration(int64(rand.intn(10)))) j:=0;j<10;j++ { go testfun2(j, outchan2) } tempstr := strconv.formatint(int64(i),10)+" - " j:=0;j<10;j++ { tempstr = tempstr + strconv.formatint(int64(<-outchan2),10) } outchan <- tempstr } func testfun2(j int, outchan2 chan<- int){ time.sleep(time.millisecond*time.duration(int64(rand.intn(10)))) outchan2 <- j } the output expecting 0 - 0123456789 1 - 0123456789 2 - 0123456789 3 - 0123456789 4 - 0123456789 5 ...

Optimized for loop python -

okay so, while solving problem going through else's code , implemented kind of statement not familiar in python. sorry new python , google searches did not me this. distance, food = min([(util.manhattandistance(state, food), food) food in foodlist]) i kind of understand loops minimum value of food or distance or something, not sure. the 1 line of list comprehension translates loop, , assignment food in foodlist: food_list.append(util.manhattandistance(state, food), food) <--> value of min_value = min(food_list)

symfony - JMSSerializerBundle AccessorOrder custom ignored -

i'm trying order serialized output data using jmsserializerbundle annotation. got this: use jms\serializer\annotation\accessororder; /** * @orm\entity(repositoryclass="appbundle\entity\customerrepository") * @exclusionpolicy("all") * @accessororder("custom", custom = {"custom_id", "company_name", "first_name", "last_name", "email", "phone_number", * "line1", "line2", "line3", "city", "state", "postal_code", "country_code", "created_at"}) */ /** * @orm\entity(repositoryclass="appbundle\entity\customerrepository") * @exclusionpolicy("all") * @accessororder("custom", custom = {"custom_id", "company_name", "first_name", "last_name", "email", "phone_number", * ...

javascript - Using Node Web Kit GUI, how do you close a Screen? -

i'm trying use node web kits screen broadcasting capture image of video applying canvas. i'm using angularjs switch between video , canvas. i'm opening , initializing video : gui.screen.init(); gui.screen.choosedesktopmedia( ["window", "screen"], function(streamid) { var vid_constraint = { mandatory: { chromemediasource: 'desktop', chromemediasourceid: streamid, maxwidth: 900, maxheight: 600, minframerate: 1, maxframerate: 5 }, optional: [] }; navigator.webkitgetusermedia({ audio: false, video: vid_constraint }, function(stream) { console.log(stream, typeof url.createobjecturl(stream)); video.src = url.createobjecturl(stream); }, function(error) { co...

mysql - Uploading images to database in codeigniter? -

i tried searching no success want upload max 5 images database along user form data.i have table user data of form posted saved along images uploaded[image upload attached user form] picture fields in database named pic1,pic2,pic3.. pic5 + email,password etc successfull in uploading image data database not images. //controller if ($this->form_validation->run()!=true) { $data['countrydrop'] = $this->country_states_cities->getcountries(); $this->load->view('header'); $this->load->view('register',$data); //display page $this->load->view('footer'); }else{ $form=array(); $form['first_name']=$this->input->post("first_name",true); $form['last_name']=$this->input->post("last_name",true); $form['dob']=date('y-m-d',strtotime($this->input->post("d...

How to remove last 3 characters from a list of String in java? -

i have list contains string in format 23:45:50 ,12:32:70 etc. want cut last 2 digits after : . i using substring() not working properly,i posting code: public class splitstring { public static void main(string[] args) { list<string> alist = new arraylist<string>(); alist.add("4:78:34"); alist.add("5:8:34"); alist.add("8:18:90"); alist.add("2:8:40"); for(int i=0;i<alist.size();i++){ string str = alist.get(i).substring(0, alist.get(i).length()-3); alist.add(str); } system.out.println(alist); } } but giving result exception in thread "main" java.lang.stringindexoutofboundsexception: string index out of range: -2 @ java.lang.string.substring(unknown source) @ com.test.splitstring.main(splitstring.java:19) i want output 23:45,12:32 i think should create new list storage sub string. know when for-cycle break? debugged , break when alist.size()=0. e...

javamail - OWASP HTML Sanitizer allow colon in HTML -

how can allow : sign in sanitized html? using sanitize html code in generating java mail. code has inline image content id <img src=\"cid:image\" height=\"70\" width=\"70\" /> . upon sanitizing, src attribute not included in sanitized html. policyfactory images = new htmlpolicybuilder().allowurlprotocols("http", "https") .allowelements("img") .allowattributes("src").matching(pattern.compile("^cid[:][\\w]+$")) .onelements("img") .allowattributes("border", "height", "width").onelements("img") .tofactory(); string html = "<img src=\"cid:image\" height=\"70\" width=\"70\" />"; final string sanitized = images.sanitize(html); system.out.println(sanitized); the output of above code is: <img height="70" width=...

R: read the first column and then the rest -

i have file codes , descriptions. code short (3-6 characters) string of letters, separated following description space. description several words (also spaces). here example: liiss license issued limod license modified lipass license assigned (partial assignment) lipnd license assigned (partition/disaggregation) lippnd license issued partial/p&d assignment lipur license purged lirein license reinstated liren license renewed i'd read 2-column data frame code in first column , description in second one. how can r? you use stri_split_fixed() stringi library(stringi) as.data.frame(stri_split_fixed(readlines("x.txt"), " ", n = 2, simplify = true)) # v1 v2 # 1 liiss license issued # 2 limod license modified # 3 lipass license assigned (partial assignment) # 4 lipnd license assigned (partition/disaggregation) # 5 lippnd license i...

ios - Why reducing an image size will rotate the image? -

i not sure if doing wrong in reducing image size or happening saving in cloud. i take image camera or camera roll , save parse cloud. when retrieve image , display it, rotated 90 degree left. i checked image on cloud , saving rotated. when take picture camera , before reducing size show on uiimageview , not rotated. here code: nsdata *imagedata = uiimagepngrepresentation(userimage.image); if (imagedata.length > 10485760) { uiimage *compressedpngimage = [uiimage imagewithdata:imagedata]; nslog(@"image on sized"); uigraphicsbeginimagecontext(cgsizemake(480,320)); //cgcontextref context = uigraphicsgetcurrentcontext(); [compressedpngimage drawinrect: cgrectmake(0, 0, 480, 320)]; uiimage *smallimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); imagedata = uiimagepngrepresentation(smallimage); pffile *file = [pffile filewithname:@"pic.png" data:imagedata]; pfquery *query = [pfuser ...

dashboard - Where test data will be stored in stripe account? -

i have used stripe payment in system. have tried test keys process payment , returning successful after submission w.r.t test api keys, in stripe dashboard can't find test data processed. if click on account settings there pop-up in if click on data tab shows option delete test data, can't find view processed test data. is there option view test data submitted ? if it's available. where find submitted test data in stripe dashboard? thanks in advance. in upper left corner of stripe dashboard, there toggle can use switch between live , test views. note toggle changes view -- can use both test mode , live mode, no matter toggle set to. done specifying set of api keys you're using make charge.

vba - Cumulative Sum in a column -

Image
i trying write vba code run cumulative sum matrix of variable size output sheet further analysis. these cells need offset 1 row , 1 column new top row assigned "0" value. such shown below (done manual calc) i struggling develop code have shown below. 'private sub lgmethod_click() 'declare variables dim integer dim j integer 'clear worksheet worksheets("lg").cells.clear 'loop count , and analyse = 1 worksheets("data").cells(rows.count, "a").end(xlup).row j = 1 worksheets("data").cells(1, columns.count).end(xltoleft).column worksheets("lg").cells(i + 1, j + 1) = application.worksheetfunction.sum(worksheets("data").range.cells(1, i)) next next end sub' as see example, want shift down 1 row , calculate @ each cell cumulative sum on column. dim integer, j integer, nrows integer, ncols integer worksheets("data") nr...

javascript - Node.js: Cannot set a value '0xff' by 'buf.writeIntBE()' -

i can write -1 buffer writeintbe , code is: var b = new buffer(1); b.writeintbe(-1, 0, 1); console.log(b); //<buffer ff> however, following code not functional var b = new buffer(1); b.writeintbe(0xff, 0, 1); console.log(b); the error code : buffer.js:794 throw new typeerror('value out of bounds'); ^ typeerror: value out of bounds @ checkint (buffer.js:794:11) @ buffer.writeintbe (buffer.js:919:5) @ object.<anonymous> (/home/liuzeya/http/examples/buffer.js:2:3) @ module._compile (module.js:434:26) @ object.module._extensions..js (module.js:452:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ function.module.runmain (module.js:475:10) @ startup (node.js:117:18) @ node.js:951:3 help me understanding difference, please. this can solved examining source at: https://github.com/nodejs/node/blob/0a329d2d1f6bce2410d65ecd47175b5a4e1c1c91/lib/buffer.js we can see ca...

XMPPFramework Swift fetch objects always null -

hi have problem xmppframework using swift, 0 element when fetch objects func fetchedresultscontroller() -> nsfetchedresultscontroller? { if fetchedresultscontrollervar == nil { let moc = managedobjectcontext_roster() nsmanagedobjectcontext? let entity = nsentitydescription.entityforname("xmppusercoredatastorageobject", inmanagedobjectcontext: moc!) let sd1 = nssortdescriptor(key: "sectionnum", ascending: true) let sd2 = nssortdescriptor(key: "displayname", ascending: true) let sortdescriptors = [sd1, sd2] let fetchrequest = nsfetchrequest() fetchrequest.entity = entity fetchrequest.sortdescriptors = sortdescriptors fetchrequest.fetchbatchsize = 10 fetchedresultscontrollervar = nsfetchedresultscontroller(fetchrequest: fetchrequest, managedobjectcontext: moc!, sectionnamekeypath: "sectionnum", cachename: nil) fetchedresultscontrollervar?.delega...

checkbox - Display an image in place of a check mark with codeigniter -

i found code on here. know if work codeigniter. want ability click on image , perform same function check box. after click image display new image overlay check mark on top of image. code found. input[type=checkbox] { display: block; width: 30px; height: 30px; background-repeat: no-repeat; background-position: center center; background-size: contain; -webkit-appearance: none; outline: 0; } input[type=checkbox]:checked { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewbox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"><path id="checkbox-3-icon" fill="#000" d="m81,81v350h350v81h81z m227.383,345.013l-81.476-81.498l34.69-34.697l46.783,46.794l108.007-108.005 l34.706,34.684l227.383,345.013z...

machine learning - algorithm for building multi-class (versus binary) classifiers -

i student , doing research text classification. have read several paper that. found many people using naive bayesian classifier. i have 4 class classify. , read svm can classify thing 2 class,..yes/no 1/0 is there algorithm besides nbc algorithm building classifiers separate data more than 2 classes? most ml techniques capable of building multi-class classifiers, instance: decision tree (eg c4.5) neural network via softmax (aka multi-layer perceptron, or mlp) lda (linear discriminant analysis) naive bayes support vector machines routinely used multi-class classification (see example excellent scikit-learn library ), using instance, "one-against-many" inductive approach. in other words, data trained on first svm separate data class versus else. "everything else" data passed second svm separates data class ii versus else, , on.

When I run the code in matlab, it should run a GUI in the output but I get the output as driverhandle. How to solve this error? -

i have 2 files driver.m , driver.fig , when run driver.m should run gui in output output >> driver driver = driverhandle: [] try change function name else i.e. my_driver.m , my_driver.fig . should solve problem.

css - Multiple gradients and radial gradient with center outside of the element -

Image
is possible similar result css gradients? can use 2 gradients on 1 div , can radial 1 have center outside div? it possible add more 1 gradient element (even combination of linear , radial gradients) providing them in comma separated format in below snippet. gradient specified first (from right side) forms bottom layer while specified last comes on top. key thing note gradient (on top) must have colors alpha less 1 able show colors in lower layers. coming second part of question, radial gradients can created such center point outside div . can done specifying negative values position . the gradient in below snippet not tally 100% image provided in question can idea. div{ height: 200px; width: 150px; border: 1px solid; border-radius: 12px; background: linear-gradient(to bottom, rgba(0,0,0,0.4), rgba(0,0,0,0.7)), radial-gradient(ellipse @ -40% -50%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0.7) 50%); background-size: 180% 200%; } <script src="h...

sql server - How to get a fixed number of rows in sql -

if have 4 rows in database these. |____a____|____b_____| | a1 | b1 | | a2 | b2 | | a3 | b3 | | a4 | b4 | but need display 10 rows added no column serial number each row these __no__|____a____|____b_____| 1 | a1 | b1 | 2 | a2 | b2 | 3 | a3 | b3 | 4 | a4 | b4 | 5 | | | 6 | | | 7 | | | 8 | | | 9 | | | 10 | | | how query sql server? fiddle here : http://sqlfiddle.com/#!3/9a9dd/1 with cte1 ( select 1 [no] union select [no]+1 cte1 [no]<10 ), cte2 ( select row_number() on (order (select null)) rn, a,b yourtable ) select c1.[no],a,b cte1 c1 left join cte2 c2 on c1.[no] = c2.rn

java - Shortcut to remove the first parameter of a function everywhere it is called -

we evaluating intellij idea 14.1.4 our project based on java. have remove first parameter of few functions, because of no use. problem each of these functions called more 50 times in entire project. have manually remove first parameter everywhere function called? there shortcuts? you can "change signature" feature (ctrl+f6).

string - How to center a drawString in Java? -

how can center text of drawstring in java? want it can centered along screen dynamically, whether change height , width of box or not. found this code but don't know how use it. can explain? horizontally... string text = "..."; graphics2d g2d = (graphics2d)g.create(); fontmetrics fm = g2d.getfontmetrics(); int x = (getwidth() - fm.stringwidth(text)) / 2; vertically... string text = "..."; graphics2d g2d = (graphics2d)g.create(); fontmetrics fm = g2d.getfontmetrics(); int y = ((getheight() - fm.getheight()) / 2) + fm.getascent(); also demonstrated here also have @ 2d graphics , working text apis

Access element of MATLAB multi-dimensional array specified by another vector -

this question has answer here: use vector index matrix 3 answers i have matlab function returns 4-element vector, e.g. [1 2 3 4] . use function output access corresponding element in existing 4-dimensional vector, i.e. vec(1, 2, 3, 4) . there way without storing result , explicitly accessing elements, in following? result = f(blah); myelement = vec(result(1), result(2), result(3), result(4)); in (python-influenced) head, answer looks this: result = f(blah); myelement = vec(*result); % or vec(tosubscripts(result)); or similar the * operator in python expands list comma-separated arguments. there analogous operator or function in matlab solve problem? there *result in matlab, it's called comma separated list. unfortunately can not create comma separated list array, conversion cell first required: result=(num2cell(f(blah))); myelement=v(result{...

jquery - Bootstrap datepicker refresh/update after first selection -

i using bootstrap-datepicker inline mode on form this. code form <div id="frmdate" data-date=""></div> and , updating data-date value jquery ajax returned date server. on datepicker date selection write value hidden input.. <input type="hidden" name="ttsasssd" id="ttsasssd"> datpicker code.. the strtdatedump variable date received ajax. write "data-date" value on each form submission. set new date datepicker. $("#frmdate").attr("data-date", strtdatedump); $("#frmdate").datepicker({format: "yyyy/mm/dd"}); $("#frmdate").on('changedate', function(){ $("#ttsasssd").val( $("#frmdate").datepicker('getformatteddate') ); }); i tried use datepickers update() method update datepickers not showing current set dates. $("#frmdate").datepicker('update'); how update datepicker after each f...

Mouse event not firing on custom control C# wpf -

i seem have problem events. want able to, 1 way or another, register mouse over/down/up-events, whatever do, doesn't seem trick. resiring works , triggers fine. can tell me what's wrong? using system.diagnostics; using system.windows; using system.windows.controls; using system.windows.input; using system.windows.media; using system.windows.shapes; namespace rangeselector.controls { public class rangeselector : grid { private static readonly solidcolorbrush defaultbackground = new solidcolorbrush(color.fromargb(255, 200, 200, 200)); private static readonly solidcolorbrush defaultforeground = new solidcolorbrush(color.fromargb(255, 090, 090, 090)); public rangeselector() { background = defaultbackground; //create selector var polygon = new polygon { points = new pointcollection() { new point(0,0), new point(0,10), new point(10,10), new point(10,0) }, s...

c++ - How to calculate checksum of UDP packet embedded inside IP packet -

i have udp packet embedded inside ip packet , not able calculate checksum of udp can correctly find checksum of ip. can how udp checksum found. [45 00 00 53 00 80 00 00 40 11 66 16 0a 00 00 03 0a 00 00 02] ca b1 ca b1 00 3f df a5 the bits enclosed in bracket ip packet , checksum given in bold. **udp packet** ca b1 source port ca b1 destination port 00 3f length df a5 checksum here how checksum "df a5" came. did 16 bit addition , took 1s complement still not getting value. whether need consider ip header calculate checksum of udp

php - Getting empty query -

this question has answer here: mysql pdo how bind like 6 answers i'm trying pdo query running, i'm doing: $src = $this->conn->prepare("select name, model, software product model '%:search_string%' or name '%:search_string%' or software '%:search_string%'"); $src->bindparam(':search_string', $search_string); $src->execute(); return $src->fetchall(); but when var_dump this, empty array ( [] ). however, if change " select name, model, software product ", of products, expected, how using like clause wrong? or doing wrong? bound parameters cannot used in way. have input like :search_string in prepared query, add percent signs in bound value (i.e. $src->bindparam(':search_string', ...

ruby on rails - ArgumentError in StaticPages#manager -

i have problem item creation. have next error: argumenterror in staticpages#manager showing /home/verevkinra/apps/yurta24/app/views/items/_new.html.erb line #2 raised: first argument in form cannot contain nil or empty extracted source (around line #2): <h1>items manage</h1> <%= form_for @item |f| %> <%= f.text_field :variable1 %> <%= f.text_field :variable2 %> <%= f.text_field :variable3 %> <%= f.text_field :variable4 %> trace of template inclusion: app/views/static_pages/manager.html.erb rails.root: /home/verevkinra/apps/yurta24 first argument in form cannot contain nil or empty on second line of code (app/view/items/new.html.erb): <h1>items manage</h1> <%= form_for @item |f| %> <%= f.text_field :variable1 %> <%= f.text_field :variable2 %> <%= f.text_field :variable3 %> <%= f.text_field :variable4 %> <%= f.text_field :value1 %> <%= f.text_field :va...

html - Drying Up JQuery Button Code -

just wondering if codepen, i've tried drying code using jquery .each method no joy, it's lines 1 7. here code: html: <section class="top-bar cf"> <div class="container"> <div class="left"> left </div><!-- .left --> <div class="right"> <span href="#" class="button darkblue toggle-tester"> tester </span><!-- .button .toggle-tester --> <div class="tester"> <div class="triangle"></div><!-- .triangle --> <div class="test-box"> hello, i'm box, yo! </div><!-- .test-box --> </div><!-- .tester --> <span href="#" class="button blue toggle-login"> login </span><!-- .button .toggle-login --> <div class="login...