Posts

Showing posts from June, 2010

Curve the lengths of a rectangle with CSS? -

Image
is possible make shape css? can't done border radius, there way 'bend' rectangles sides? as other answers, best way make shape perfect using svg. css3 , of pseudolements after , before may have close shapes. this 1 far i've made fiddle fast example time may better results: div { position: relative; width: 200px; height: 150px; margin: 20px 0; background: green; border-radius: 50% / 10%; color: white; text-align: center; text-indent: .1em; } div:before { content: ''; position: absolute; top: 10%; bottom: 10%; right: -5%; left: -5%; background: inherit; border-radius: 5% / 50%; } div:after { content: ''; position: absolute; bottom: 0px; right: -11px; width: 130px; height: 120px; background: green; border-radius: 20% / 150%; }

Fastest way to convert between two bases in arbitary precision floating point arithmetic for over a billion digits -

which fastest way convert between base 2 ^ 64 other base? "any other base", mean any base less 2 ^ 64 itself. think it's using divide-and-conquer based methods bernstein scaled remainder trees? more details: want convert on 1 billion digits of famous constants in different bases future version of isitnormal . there 2 approaches can use: 1. calculate billion digits of constant in every base wish. 2. digits somewhere (e.g. y-cruncher) , convert every base wish. plan use approach #2 seems faster. as far know can done in o(n*log(n)) operation using fft big-integer multiplication , fast sqrt algorithm. basic idea follow. step 1. large integer x of k digits in base b1, found 2 integers y & z, such y & z both have no more k/2 digits, , x=y*y+z. (notice z can negative). can done doing sqrt(x) operation, let y nearest integer of sqrt(x) , z remainder. step 2. convert y & z base b1 base b2, recursively using step 1. step 3. compute x in base b2 u...

Creating Android LIbrary Project Jar Using gradle with dependencies -

i'm trying build .jar file out of android library project (non-executable) using gradle dependencies, i'm getting noclassdeffounderror because accessing 1 of files dependency modules. so far i've tried fatjar method includes in jar file except dependant libraries. what should do? update my gradle.build file apply plugin: 'android' android { compilesdkversion 22 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.myapplication" minsdkversion 9 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } sourcesets { main { java { srcdir 'src/main/java...

hadoop - Hive Query performance tuning -

i'm newbie hadoop & hive. can please suggest if there performance tuning steps apache hive running on cloudera 5.2.1 . what tuning parameters in order improve hive queries performance hive version :- hive 0.13.1-cdh5.2.1 hive query :- select distinct a1.chain_number chain_number, a1.chain_description chain_description staff.organization_hierarchy a1; hive table created external option "stored text format" , table properties below :- after changing below hive setting have seen 10 sec improvement set hive.exec.parallel=true; can please suggest other setting apart above improve hive query performance type of query using. you can use group by replace distinct ,because there 1 reduce job distinct job. try this select chain_number, chain_description staff.organization_hierarchy group chain_number, chain_description if reduce job number still small.you can specific using mapred.reduct.tasks configure ...

mysql - displaying revenue for each year -

i'm using northwind sql database. not familiar, has of following tables: orders, orderdetails, products, categories (orders.orderid = orderdetails.orderid) (products.productid = orderdetails.productid) (categories.categoryid = products.categoryid) orders has column named "orderdate" (formatted dd/mm/yy) orderdetails has column named "price" i need display total "revenue" each year. is, sum of "prices". idea how so? try this, don't have complete table structure. way of group mysql select sum (od.price) revenue orderdetails od inner join orders o on orders.orderid = orderdetails.orderid group year(o.orderdate);

android - How to use RealmBaseAdapter without memory exceptions? -

i trying figure out right way use realmbaseadapter. background : i have app single activity , many fragments. the main screen fragment contains viewpager child fragments (with tabs in action bar). each child fragment contains list view displays realm results using subclass of realmbaseadapter. when user taps on item in 1 of list views inner fragment displayed (it replaces main fragment child fragments). for realmbaseadapter work realm object created realmresults has open (after getinstance , before close), have base fragment creates instance of realm in onstart , closes in ondestroy. now problem : there re many memory related crashes in app , think understand reason. problem there @ least 1 open realm, avoids cleaned. meaning realm grows in memory time , never gets chance cleaned. according few memory related issues in realm's github repo understand realm should opened , closed short operation possible, comes in contrast fact realmbaseadapter requires originat...

python - Script encrypts, but still saves the plaintext instead of the ciphertext -

i have issue current program supposed take user input, encrypt allowing choose how want shift by, save file. unknown reasons program seems capable of saving file missing out encryption. appreciated. text = "abcdefghijklmnopqrstuvwxyz 1234567890-=!Ãâ€Å¡Ãƒ‚£%^&*" def main(): #if want save file after encrypting if statement ans = input("would save file of read file, press w or r").lower() if ans == "w": text = input("what text want enter").lower() caeser(text) save_file() elif ans == "r": text = input("what file name want enter").lower() caeser(text) # organise loop & function def caeser(text): shift = int(input("how shift?: ")) shifted_list = [] letter in text: character_lower = letter.lower() ascii = ord(character_lower) shift = shift % 26 shifted_letter = ascii + shift shifted_char = chr(shif...

jira - Auto assign to team lead/developer on bug reopen -

in implementation of jira, have custom field called developer gets populated automatically (username) whenever move jira open fixed state. want similar fixed reopen transition. is, whenever tester changes status reopen, should go developer or project lead (in case field isnt populated custom field can overridden). i tried implement post function, there isn't way can use or criteria. or there way? you can post function on transition using script runner plugin if self-hosted jira instance allow great flexibility in logic fill target field in.

excel - How can I limit the number of loops in a Do While loop? -

so i've written function that uses text-box inputs search corresponding values in sheet. problem if doesn't find match goes infinite loop. can limit loops doesn't crash? if there solution rather limiting loops, i'm ears. here's i'm working with: function most_recent_deployment(label1 string, label2 string, label3 string) long dim all_rows range dim row range dim lastcell range dim lastcellrownumber long set lastcell = sheet7.cells(sheet7.rows.count, "a").end(xldown).end(xlup) lastcellrownumber = lastcell.row + 1 set row = sheet7.range("a:a").find(label1, lookin:=xlvalues, after:=cells(lastcellrownumber, "a"), searchdirection:=xlprevious) while row.row > 1 if (sheet7.cells(row.row, 2).text = label2) , (sheet7.cells(row.row, 3).text = label3) most_recent_deployment = row.row exit function end if lastcellrownumber = row.row set row = sheet...

"Excel has stopped working" when using VBA macro with on change event -

i experiencing consistent "excel has stopped working" error. have user form populates combo box dependent drop-down options based on user selects in 1st combo box. the error consistently created any of on-change event subs when user types 2nd combo box letter corresponds existing value should in 2nd box. if user selects option drop-down list, not occur -- when user types in 1st letter of matching value. example: if 1st combo box "fruit", 2nd combo options might "apple", "orange", etc. if user types in "a" or "o" in 2nd box (because matches corresponding values), crashes excel. why not "fill in" matching value on 1st combo box? error handling in place, never throws error in code, "excel has stopped working", crash. do need use enable/disable worksheet events within macros? if so, please offer suggestion of how implement , explanation of how works. have solved previous on change problems co...

c - MIPS Code Cycle Time -

i need task of determining number of cycles mips code below. my main issue determining if condition not met, if statement still executed (thus adding number of total cycles) assuming single cycle implementation scheme i.e., each instruction requires 1 clock cycle execute. 1. number of cycles required execute code when a. s==0? b. s==1? this have come myself: a. 9 cycles b. 8 cycles (it not instruction contained in if statement, , not jump endif statement - (goes function) final endif. this sample of mips: main: # evaluate expression. # put final result in a0 prepare syscall. addi $sp, $sp, -4 # make space on stack. sw $ra, 0($sp) # save return address. li $t0, 1 # put 0 in register li $a1, 4 # put 4 in register li $a2, 6 # put 6 in register if: bne $t0, $zero, else # (i == 0) ? add $v0, $a1, $a2 # v0 = a1 + a2 j endif else: jal func endif: add $a0, $v0, $zero li $v0, 1 so need determine number of cycles if a. s = 1...

sockets - Break a file into chunks and send it as binary from client to server in C using winsock? -

i created application send text file client server far i'm send string this: fp = fopen(filename, "r"); if (fp != null) { newlen = fread(source, sizeof(char), 5000, fp); if (newlen == 0) { fputs("error reading file", stderr); } else { source[++newlen] = '\0'; /* safe. */ } }else{ printf("the file %s not exist :("); return 1; } fclose(fp); send(s , source , strlen(source) , 0); //send file however professor told me must send file in binary , ready accept file of size i'm trying figure out how send file in binary , break chunks you can copy 1 byte @ time. reading/writing more byte @ time theoretically make read , write more efficiently disk. since binary short, , disk i/o internally buffered doesn't make noticeable difference. perror() convenient function displays text associated error code returned recent unix sy...

What happens when there is a javascript runtime error? -

i understand causes runtime errors. want understand how browser behaves afterwards. will event handlers attached before error still work? if script loaded async finishes after runtime error able execute? basically, how catastrophic run-time error? an uncatched runtime error stops current execution, may be the execution of script the call of event handler suppose have runtime error while handling event, problem might have (apart not handling event) non consistent state of user variables if event handler modifies of them. other event handlers won't impacted besides that. so can considered non catastrophic (i guess don't have remember it's practice fix errors anyways , flooding console errors isn't thing).

c# - Why can the resource cannot be found? -

i have asp.net application following view directories. -account -shared -layout -home -index -about -upload -uploadindex -uploadview -uploaddelete in layout have fellowing actionlink: <li class="navbar-links"> @html.actionlink("view uploads", "uploadindex", "upload", new { @class = "navbar-links" }) </li> if in de home/index page go home/uploadindex. when type in de url http://localhost:12345/upload/uploadindex , actionlink upload works. how make actionlinks works other directory other controller. a link in mvc (i think you're using mvc) routed controller invokes view. link /upload/uploadindex default handled method uploadindex on uploadcontroller . however, @html.actionlink("view uploads", "uploadindex", "upload", new { @class = "navbar-links" }) doesn't think it's doing. resolves https://msdn.microsoft.com/en-us/library/dd49212...

sql - Aggregate function not giving sum -

Image
i have query: select o.idorder, sum(case when cast(isnull(ama.freeshiping, 0) int) = 0 - 1000 else cast(isnull(ama.freeshiping, 0) int) end) freeshiping orderdetail od, amazonsku ama, orders o, tempprintrecords tmp o.idorder = od.idorder , o.idcustomer = ama.idcustomer , od.sku = ama.sku --and od.idorder=350184 , od.idorder = tmp.idorder , ama.freeshiping != 0 group o.idorder result: here have 0 , null in ama.freeshiping basically column bit , contains 0 , 1. if 0 found make -1000 identify idorder having 0 or null freeshipping but it's not giving proper sum, should give result in -ve each column. this expression in where clause: and ama.freeshiping != 0 only chooses values "1". remove if want see other values. you should learn use proper join syntax. if used join keyword, of conditions in on clauses, , where condition might have been easier spot...

php - Getting a decimal qty from subtracting two times -

how subtract 2 time variables each other answer decimal number? time variables this: 07:32:00 i looking this: $total = $start_time - $end_time echo "$time hours"; output this: 5.3 hours you cant subtract on strings. variable "07:32:00" string. you have convert time unix timestamp php function strtotime . and aslo have subtract largest time. here solution: echo (strtotime("15:00:00") - strtotime("11:30:00"))/(60*60);

Yii2 MaskedInput with alias 'url' limits input to 60 characters -

i using following code in yii2: <?php $form = activeform::begin(); ?> <?= $form->field($model, 'link')->widget(maskedinput::classname(), [ 'clientoptions' => [ 'alias' => 'url', ], ]) ?> <?php activeform::end(); ?> it seems, input field limited 60 characters. how remove limitations? see url example on: http://demos.krajee.com/masked-input the limitation in jquery.inputmask . see https://github.com/robinherbots/jquery.inputmask/issues/863 . limitation disappear if issue solved , new jquery.inputmask.js included in yii2 bower package.

How to match two curves in time in matlab? -

i new in matlab , face problem. have 2 datasets, let's (t,y1) , (t,y2). measurements of same experiment 2 different methods. there time delay between two. y1 , y2 values should correspond in time. have idea how can this? thank much. as long time points equal both y1 , y2 , xcorr should tell when alignment maximal. [r,lags] = xcorr(y1,y2); [~,idx] = max(r); y2_shift = lags(idx); %// amount of shift needed correct y2

javascript - Downloading file from ajax result using blob -

i use code download excel file server. $.ajax({ headers: client.authorize(), url: '/server/url', type: 'post', contenttype: "application/json; charset=utf-8", data: json.stringify(jsondata), success: function (data) { alert('data size: ' + data.length); var blob = new blob([data], { type: "application/vnd.ms-excel" }); alert('blob size: ' + data.length); var url = window.url || window.webkiturl; var downloadurl = url.createobjecturl(blob); document.location = downloadurl; }, }); the problem experience though data , blob sizes identical, moment document.location gets assigned i'm prompted download almoste 2 times larger excel file. , when try open it, excel complains wrong file format , opened file contains lot of garbage, though required text still there. any ideas causing , how avoid it? so solved problem using ajax 2. natively supports...

android - Using intents for methods -

edit: updated code: the notificationsetter method: public void notificationsetter(){ intent myintent = new intent(this, myreceiver.class); alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service); pendingintent pendingintent = pendingintent.getbroadcast(this, 0, myintent, 0); log.v("log","notificationsetter"); calendar calendar = calendar.getinstance(); calendar.set(calendar.hour_of_day, 21); calendar.set(calendar.minute, 55); calendar.set(calendar.second, 00); alarmmanager.setrepeating(alarmmanager.rtc_wakeup, calendar.gettimeinmillis(), 24*60*60*1000 , pendingintent); } the myreceiver class: public class myreceiver extends broadcastreceiver { private static final string tag = "myactivity"; @override public void onreceive(context context, intent intent) { string = "log recieved"; log.v(tag, "index=" + i)...

java - How can I install new fonts to jasper reports? -

i'm getting "could not load following font" error. installed font in jasper reports. missing i'm taking error ? try on ide terminal: mvn install:install-file -dfile=./font/fonts.jar -dgroupid=ttf -dartifactid=fonts -dversion=1.0 -dpackaging=jar

html - How to validate text box in Angular js -

i have text box , search button in ui. want validate numbers should entered on button click. i didn't use in form(i got know lot of ways validate form control). i've designed it(independent) in div. so can pls guide me validate control in angular. <div id="srchbox"> <p id="ptext">please enter movie id</p> <input type="text" class="form-control" placeholder="search" id="srchtxt" ng-model="_id"> <button type="submit" class="btn btn-default" id="btnsrch" ng-click="search(_id)"><span class="glyphicon glyphicon-search"></span></button> </div> use ngpattern directive. from documentation sets pattern validation error key if ngmodel value not match regexp found evaluating angular expression given in attribute value. if expression ev...

Visual Studio 2013 Pro installation 0x80070643 error -

Image
when install visual studio professional update 4, "package failed" error. the log file show 4 errors , 1 warning. the 4 errors are: 0x80070643: failed execute msu package 0x80070643: failed configure pre-machine msu package mux: set result: return code = -2147023293 (0x80070643) error message =, vital = false, package action = install, package id = windowsidentityfoundation_x64 applied non-vital package: windowsidentityfoundation_x64, encountered error: 0x80070643. there 1 warning message: mux: warning : missing display name: windowsidentityfoundation_x64 googling led me here . don't know .net etc , hoping can fix without opening whole new can of worms because worried if tried reinstalling .net may entangled in host of other issues. please help. thanks. have tried apply method 1. fix suggested microsoft: https://support.microsoft.com/en-us/kb/976982/en-us this seems have fixed issue others have come across around web

nim - Difference between a const inside a proc vs outside -

this dumb question, other visibility there real difference between const inside proc vs outside? const foo = "foo" proc test() = const bar = "bar" echo foo & bar test() like when inside, stack grow , shrink const every time proc invoked, or because it's const held in static memory location duration of application? i'm asking nim reflections on differences/similarities in other languages welcome too. if @ generated c code, see line: string_literal(tmp139, "foobar", 6); what tells foo & bar evaluated @ compile time. nimbase.h has this: #define string_literal(name, str, length) \ static const struct { \ tgenericseq sup; \ nim_char data[(length) + 1]; \ } name = {{length, length}, str} const in nim more static memory location. seem in case string "foobar" in static memory location. however, if replace these strings numbers, example,...

DomPDF Zend not executing PHP? -

this controller function not generate right pdf problem. this generate static html pdf requirement create pdf on dynamic created html. $archive_msgs = $this->getrequest()->getpost('ids'); $archive_ids = explode(",",$archive_msgs); $ul = '<ul>'; if(!empty($archive_ids)){ foreach($archive_ids $archive){ if(trim($archive)!=''){ $msgdata = $this->getquerydatawithprimary('message', 'msgid', $archive); $dec_data = base64_decode($msgdata[0]['message']['s']); $arr_data_com = explode(",,", $dec_data); $arr_temp = implode("",$arr_data_com); $arr_data_dash = explode("--", $arr_temp); for($j=1; $j<sizeof($arr_data_dash); $j+=3) { $ul .="<li>".$arr_data_dash[$j].":".$arr_data_dash[$j+1]....

sql - Remote mysql not executing query: how to make it simpler? -

the query listed below running fine on localhost it's somehow hanging when executed remotely targeting service provider database (both php script , sql query in phpmyadmin console hang), although every chunk returning expected table when run individually. what's wrong? suggestions on how make shorter or simpler , remote mysql? select * `table1` `tag1` in ( select distinct `tag1` `table2` `tag1` not in ( select `tag1` `table2` `tag2` = '$keyword' ) )

linux - Unable to get right git branch name in bash -

i'm working on post-receive of git server automatically uploads latest version of website in folder named after branch commit in, somehow doing code doesn't work intended. somehow value branch gets values of branches instead of branch i'm trying get. hash right hash code. have tested outside of program, branch when type right hash. did use wrong syntax in program? #!/bin/sh hash=$(git log -n 1 --pretty=format:"%h") branch=$(git branch --contains $(git log -n 1 --pretty=format:"%h")) if [ branch ] git_work_tree="/data/site/'$branch'" echo "/data/site/'$branch'" git checkout -f $branch fi alright, got work wanted! after hearing post-receive got refname stdin, found out had trim down refname branch name , came bit of code. guys. :) #!/bin/sh while read oldrev newrev refname branch=${refname##*/} if [ branch ] path="/data/site/$branch" mkdir $path ...

angularjs - ui-router with ControllerAs binding -

ui-router state: $stateprovider .state('dashboard', { url: '/dashboard', templateurl: 'app/dashboard/dashboard.html', controller: 'dashboardcontroller vm' }); in dashboardcontroller have: var vm = this; vm.title = 'dashboard'; and in dashboard.html template: {{vm.title}} why result showing "{{vm.title}}" instead of bind it's value in controller? there's controlleras setting when configure state. $stateprovider .state('dashboard', { url: '/dashboard', templateurl: 'app/dashboard/dashboard.html', controller: 'dashboardcontroller', controlleras: 'vm' }); https://github.com/angular-ui/ui-router/wiki

postgresql - `pg:pull` is not a heroku command, but `db:pull` is -

i've been trying pull database heroku. reason when try heroku pg:pull heroku_postgresql_rainbow_url newlocaldb --app myapp it returns ! pg:pull not heroku command. ! perhaps meant db:pull , pg:kill or pg:psql . ! see heroku help list of available commands. on other hand, command heroku db:pull heroku_postgresql_rainbow_url newlocaldb --app myapp is recognized, despite db:pull replaced pg:pull according e.g. this . when try heroku help , shows entry db:pull not pg:pull . so, nice use command pg:pull . doesn't work me now. (i believe did recently.) problem?

How to rebuild solr index using core reload -

i need update solr schema testing search relevancy in application. this article says: one can delete documents, change schema.xml file, , reload core w/o shutting down solr. when added copyfield , followed same approach, changes not reflect. missing anything? you missing important step document. re-index data. not changes schema files reloadable dynamically. for ex. adding copyfield requires reindexing of data. those changes considered backward compatible indexed data reloadable without need re-indexing.

date - javascript getDate getMonth returns wrong month -

this question has answer here: unexpected javascript date behavior 3 answers i know there have been other posts can't see figure out doing wrong here. below code: var d = new date(); var month = d.getmonth(); system.log(d); system.log(month); my output looks this: [2015-04-01 09:24:53.012] [i] wed apr 01 2015 09:24:53 gmt-0400 (edt) [2015-04-01 09:24:53.012] [i] 3 shouldn't bottom output 4? thanks in advance it array. month starts 0, should plus 1 yourself. you can take @ :) http://www.w3schools.com/jsref/jsref_getmonth.asp

javascript - Changing .innerHTML after a button is clicked -

i using jquery mobile , have collapsible set. when using function change innerhtml works fine. displaying content inside collapsibles. <div id="doro" data-role="collapsibleset" data-iconpos="right" dir="rtl" align="right"> </div> works when using: document.getelementbyid("doro").innerhtml ='<div data-role="collapsible"> <h3>click me - im collapsible!</h3> <p>i'm expanded content.</p> </div>' but when try: <input type="button" data-theme="b" name="submit" id="submit" value="submit" onclick="refreshpage();"> while: function refreshpage(){ var text = "<div data-role='collapsible'><h1>click me - i'm collapsible!</h1><p>i'm expanded content.</p></div>"; document.getelementbyid("doro...

redirect - PHP/cURL Redirection -

here problem i want post data page using curl, redirected destination page without using header function. the call must post request. i don't want retrieve data on call page. any solution ? please thank you there multiple way handle it. 1 simple solution save $data session , retrieve session data other file. another method create form values , post form using javascript.

MYSQL Select with joins and where -

i got 2 tables: device deviceid devicename categoryid category categoryid categoryname it seems stupid solve problem; need select query brings me result: resulttable deviceid categoryid categoryname i tried this, no success: select deviceid , categoryid , categoryname category left join device on (category.categoryid = device.categoryid) deviceid = '1'; in short, need table shows me categorie's id , name, of category certain device in. hope me, since english not good. your query should this: select d.deviceid, c.categoryid, c.categoryname device d inner join category c on c.categoryid = d.categoryid d.deviceid = 1

ios - Array of arrays in Swift -

i want make , array contains arrays, of double's, of int's. this not work: var arrayzero = [1,2,3] var arrayone = [4.0,5.0,6.0] var arrayofarrayzeroandone: [[anyobject]] = arrayzero.append(arrayone) how can append arrays array can 5.0 if write arrayofarrayzeroandone[1][1] ? i take advantage of swift's type safety. going route introduce bugs if you're not careful adding , retrieving array. var numbers = array<array<nsnumber>>() // bit clearer imo var numbers = [[nsnumber]]() // way declare numbers.append(arrayzero) numbers.append(arrayone) then when like let 5 = numbers[1][1] // 5.0 you know of type nsnumber. further swift won't let put else array unless it's nsnumber without appends solution var numbers = array<array<nsnumber>>() [ [1,2,3,4], [1.0,2.0,3.0,4.0] ]

HTML5 multi video screen -

i have multiple video tags in single screen absolute position , want longer video multiple , when longer video ends want execute code. <div style="width:1320px;height:1080px;position:absolute;left:0px;top:0px;z-index:0;"> <video preload="auto" autoplay> <source src="1.mp4" type="video/mp4"> <source src="1.ogv" type="video/ogg"> </video> </div> <div style="width:600px;height:1080px;position:absolute;left:1321px;top:0px;z-index:0;"> <video preload="auto" autoplay> <source src="2.mp4" type="video/mp4"> <source src="2.ogv" type="video/ogg"> </video> </div> <div style="width:1000px;height:600px;position:absolute;left:200px;top:200px;z-index:5;"> <video preload="auto" autoplay> <sourc...

Call MYSQL stored procedure through c# -

i trying call mysql stored procedure through c# keeps giving me error saying "you have error in sql syntax; check manual corresponds mysql server version right syntax use near ''55\'', 'useremail','username@company-it.pk\''' @ line 1 " sp takes 3 input parameters user_id, preferences_key , preferences_value. have checked sp executing through mysql works want excute through c#. below code. mysqlcontext = new mysql_otrsentities(); var userid=mysqlcontext.users.where(x=>x.login==agent.login).select(x=>x.id).firstordefault(); mysqlparameter param1 = new mysqlparameter("@user_id", agent.id); param1.mysqldbtype = mysqldbtype.int32; mysqlparameter param2 = new mysqlparameter("@preferences_key", "useremail"); param2.mysqldbtype = mysqldbtype.varchar; mysqlparameter param3 = new mysqlparameter("@preferences_value", agent.login); param3.mysqldbtype = mysqldbtype.longblob; mysqlcon...

c++ - Using Cramers rule with the Eigen library -

i using eigen linear algebra library , solve 3x3 matrix. in past have used cramer's rule. know if can use cramer's rule in eigen or need program myself? i using c++ 11 , linux. cannot use other external libraries, boost etc.. yes. can use eigen . take @ documentation here http://eigen.tuxfamily.org/dox/group__tutoriallinearalgebra.html the example given quite short , simple: #include <iostream> #include <eigen/dense> using namespace std; using namespace eigen; int main() { matrix3f a; vector3f b; << 1,2,3, 4,5,6, 7,8,10; b << 3, 3, 4; cout << "here matrix a:\n" << << endl; cout << "here vector b:\n" << b << endl; vector3f x = a.colpivhouseholderqr().solve(b); cout << "the solution is:\n" << x << endl; } output: here matrix a: 1 2 3 4 5 6 7 8 10 here vector b: 3 3 4 solution is: -2 1 1 it guaranteed work...

android - change fragment by swiping or pushing button differences -

Image
i have activity has 3 fragments. when i'm switching fragments swiping ok. on fragment 2 have button must set current fragment fragment 1 . pushing button changes fragment problems expressed in pics when normal on . similar normal 1 . works correct on devices higher performance. how solve problem , problem connected? button listener onclicklistener btnlistener = new onclicklistener() { @override public void onclick(view v) { ((mainactivity)getactivity()).changefragment(2); } }; also here info mainactivity mainactivity extends fragmentactivity implements clfragment.onfragmentinteractionlistener, fmfragment.onfragmentinteractionlistener and private class screenslidepageradapter extends fragmentstatepageradapter { public screenslidepageradapter(fragmentmanager fm) { super(fm); } @override public fragment getitem(int position) { if (position == 0) { ret...

java - Couldn't parse the HTML tags from live site in android -

we working on power shut down app in android domain particular region.so need live update details url.so need html tags live site.we got nothing. for example in app title live url , put in text view code comes here.we using jsoup values. package com.example.poweralert.app; import java.io.file; import java.io.ioexception; import java.io.inputstream; import java.lang.annotation.documented; import java.util.arraylist; import java.util.arrays; import java.util.hashmap; import java.util.list; import android.app.progressdialog; import android.provider.documentscontract; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.util.log; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.listadapter; import android.widget.radiobutton; import android.widget.radiogroup; import android.widget.simpleadapter; import android.widget.tex...

python - Print the current footprint of arbitrary objects -

i looking way print out current state of object. i want include variables declared using self (note: not want see methods, or other information on object). using this: def __str__(self): return str(', '.join("%s: %s" % (str(s), str(self.__dict__.get(s))) s in self.__dict__)) in words: i loop on object's __dict__ for each value, create tuple consists of str(key) , str(value) the resulting tuple joined in string of following format: "key:value, key:value, ..." my question is, there more convenient way? obviously, uses __str__ method , may want change behavior serve purpose.

How to limit the depth of the @Fetch annotation in Spring data neo4j -

i know @fetch annotation can used load nodes on other sides of relationships . normally, appears id of foreign node loaded, , not properties. is there way limit depth of @fetch first neighbor loaded, , no further? in heavily connected graph, don't want load entire graph of course, minimize number of calls server, it's useful first level of connected nodes included in response. currently there no way of limiting depth, @fetch goes along next object , if 1 has again @fetch annotations continue load. might not have been wisest decision so, that's way in sdn3. in sdn4 have option specify depth parameter load , store methods. i'm not big fan of navigation / loading of nested structures via domain objects. that's why i'd rather recommend nested loading write use-case specific cypher query load data need , project dto annotated @queryresult part of repository method. interface movierespository extends graphrepository<movie> { @quer...

parsing a text file in python, c++, given specific format -

i have file in following format; parse in pyhton , c++ , extract number after impvarno: there lots of line in format. sample.txt start: abc pqr (ff_ggggg_confirm_tr):tc:20222,seqnum:86,impvarno:1000000008234436,id:12,oneid:66454,a/c:1,impvalue:905,impvar:25,actualvalue:905,actualvar:25,abc pqr xyz impquantity:0,pgb ncr yepp start: abc pqr (ff_ggggg_confirm_tr):tc:20222,seqnum:86,impvarno:1000000008234436,id:12,oneid:66454,a/c:1,impvalue:905,impvar:25,actualvalue:905,actualvar:25,abc pqr xyz impquantity:0,pgb ncr yepp start: abc pqr (ff_ggggg_confirm_tr):tc:20222,seqnum:86,impvarno:1000000008234436,id:12,oneid:66454,a/c:1,impvalue:905,impvar:25,actualvalue:905,actualvar:25,abc pqr xyz impquantity:0,pgb ncr yepp start: abc pqr (ff_ggggg_confirm_tr):tc:20222,seqnum:86,impvarno:1000000008234436,id:12,oneid:66454,a/c:1,impvalue:905,impvar:25,actualvalue:905,actualvar:25,abc pqr xyz impquantity:0,pgb ncr yepp so wrote following code: #!/usr/bin/env python import sys import re h...

multithreading - Code in button click c# happens after the function finishes -

i have simple c# code triggered on button press. button press first clears listboxes, changes text of label, , calls function. private void button1_click(object sender, eventargs e) { listbox1.items.clear(); listbox2.items.clear(); listbox3.items.clear(); listbox4.items.clear(); label5.text = "getting links..."; process(url); label5.text = "finished"; } but lists cleared , label changed after process() finished executing. ruins purpose i'm changing label user aware action taking place. how can make initial label change before function process() finishes? if process method long-running, can cause ui freezing , prevent ui redrawing - that's why don't see label text immediate update. simpliest way achieve goal - call label5.refresh() right after label5.text = "getting links..."; , cause invalidation , redrawing of label. or can call this.refresh() if more 1 control should updated - update whole...

c# - Dependency injection for a static method -

i have class in api, have static method, intended validate , log details. guidance how inject ilogger interface please. public class validatedatainapi { public static bool isvalid(string data) { //do if(error) { _logger.error("log error implemented caller"); } } } if understand correctly, want inject instance of ilogger static method. figured out cannot make use of dependency injection "normal way" when dependent method static. what might looking here service locator pattern . using structuremap ioc container (but can use container), configuration wiring might this: for<ilogger>().use<someloggerimplementation>(); when implemented, calling code might this: public class validatedatainapi { private static ilogger logger { // dependencyresolver di container here. { return dependencyresolver.resolve<ilogger>(); } } public static bool isvali...

c# - WPF SplashControl - > Login Page - > Main Window -

i try build logic start application. splash control need load data, user can login, while data loaded. private void splashcontrol_onloaded(object sender, routedeventargs e) { stauslabel.content = "loading data..."; showlogincontinueloading(); } private void showlogincontinueloading() { var loginwindow = new loginwindow(); var task = new task(() => { managers.loadusers(); }); task.continuewith(async innertask => { dispatcher.invoke(loginwindow.show); try { managers.loaddata(); } catch (exception exception) { throw exception; } dispatcher.invoke(() => stauslabel.content = "loading complite"); }); task.start(); how slashcontrol can know login successful or not?

c# - MVVM with dynamic commands -

Image
i need create class able create dynamic commands can bind to. have highly dynamic application plugins, developer creates plugin in backend , controls things backend. frontend created in different "remote" application has backend datacontext. here's example (not full example), show want do: <window x:class="wpfapplication7.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" height="350" width="525"> <grid> <button command="{binding pressme}">pressme</button> </grid> </window> namespace wpfapplication7 { /// <summary> /// interaction logic mainwindow.xaml /// </summary> public partial class mainwindow : window { taskviewmodel model = new taskviewmodel(); public mainwindow() ...

python - how to match 477xx with regular expression -

the input string must in format "477xx" , x may 0 - 9 or whitespace, , length muse 5. want find following targets regular expression. ["477 ", "4770 ", "4771 ", "4781 "] how can it? rough idea: "477[0,1,8,9]?" you can use following regex: ^477[0-9\s]{2}$ mind "4781 " not matched not start "477". here demo . and example code on tutorialspoint : p = re.compile(ur'^477[0-9\s]{2}$', re.multiline) test_str = u"477 \n4770 \n4771 \n4781 " arr = re.findall(p, test_str) print arr

java - Why I got errors in a brand new webapp-javaee7 project -

Image
i created project in eclipse keppler java ee developers selecting file->new->maven project-> webapp-javaee7 archetype. before writing single line of code got errors: resource '/test/src/main/webapp/web-inf/web.xml' not exist. and: plugin execution not covered lifecycle configuration: org.apache.maven.plugins:maven-dependency-plugin:2.6:copy (execution: default, phase: validate) pom.xml /test line 53 maven project build lifecycle mapping problem why web.xml not created? why plugin execution not covered lifecycle configuration? i have clean installation of eclipse , latest m2eclipse plugin. according oracle docs web.xml deployment descriptor , web.xml no longer requirement, can use java ee annotations instead: from web.xml deployment descriptor elements : with java ee annotations, standard web.xml deployment descriptor optional. according servlet 2.5 specification, annotations can defined on web components, such servlets, ...