Posts

Showing posts from June, 2014

css - how to create a gradient effect on half of an image -

i trying create gradient effect on half of image, found gives full gradient overlay effect on image .tinted-image { background: /* top, transparent red */ rgba(255, 0, 0, 0.25), /* bottom, image */ url(image.jpg); } but wondering how can apply effect half of image,i searched online didnt see ws looking for, decided post. by half of image mean vertically not horizontally us there has idea of this multiple backgrounds , suitable color stop in gradient. .tinted-image { width: 460px; height: 300px; border: 1px solid grey; background-image: linear-gradient(to bottom, rgba(0, 255, 0, 0.5), rgba(0, 255, 0, 0) 50%, transparent 50%), url(http://www.fillmurray.com/460/300); margin: auto; } <div class="tinted-image"></div>

python - How can i make cloud of words occuring together? -

edit "please focus answer example below, no broad scenarios" ok. have read word cloud. wondering how can represent words occuring in string variable in example below?: var_x wireless problems, migration competitor dissatisfied customers, technicians visits scheduled call waiting, technicians visits bad customer experience, wireless problems so want is: ("wireless problems" , "technicians visits") representation in cloud. how can done? this code produces frequency distribution of adjacent words can used underlying word cloud data: from nltk import bigrams, freqdist nltk.tokenize import regexptokenizer operator import itemgetter sent = 'wireless problems, migration competitor\n\ dissatisfied customers, technicians visits scheduled\n\ call waiting, technicians visits\n\ bad customer experience, wireless problems' tokenizer = regexptokenizer(r'\w+') sent_words = tokenizer.tokenize(sent) freq_dist = freqdist(bigrams(sent_w...

excel - Formula is not working because of '#N/A' -

i writing simple formula =if(g295="#n/a","na","somethingelse") but it's not printing 'na' when give value "#n/a" if use above formula =if(g295="r","na","somethingelse") then it's working. can me how reconize value "#n/a"? need write formular if value (#n/a) presents, have other operation, there way this? the isna function identify #n/a =if(isna(g295),"na","somethingelse") unlike iserror , catches #n/a

Split a CSV field into different rows in SQL -

a colleague of mines encountered problem while working on cobol program , solved @ application level. still curious if possible solve on data access level, sql. somehow related this other question , i'd use ansi sql. i'm looking single sql select query acts on varchar field contains variable length csv rows. purpose of query split every csv field in own result set row. here example schema , data (and here fiddle ): create table table1 (`field` varchar(100)); insert table1 (`field`) values ('hello,world,!') , ('haloa,!') , ('have,a,nice,day,!'); here output i'd have query: hello world ! haloa ! have nice day ! the csv separator used comma, , wouldn't worry escaping. as far can tell, ansi sql: with recursive word_list (field, word, rest, field_id, level) ( select field, substring(field 1 position(',' in field) - 1) word, s...

java - Android Wear Background Image is not drawn -

i copied of code google sample watchface digital watchface, , works fine far. when want add background image, see grey background instead of image store under drawable (bg.png). doing wrong? ***update**** ok apparantly grey apparantly background image, somehow resolution off. background image 320x320 (the dog image google sample). can observe same behaviour preview images ... made screenshot my watchface, instead of proper preview can see background color. public class wearwatchfaceservice extends canvaswatchfaceservice { private static final string tag = "digitalwatchfaceservice"; private static final typeface bold_typeface = typeface.create(typeface.sans_serif, typeface.bold); private static final typeface normal_typeface = typeface.create(typeface.sans_serif, typeface.normal); /** * update rate in milliseconds normal (not ambient , not mute) mode. update twice * second blink colons. */ private static final long normal_update_rate_ms = 500; /**...

Partition key only in Cassandra -

in cassandra, understand default, given primary key(id1, id2), id1 partition key , id2 clustering key. i want know if can define 2 partition keys without clustering key follows: primary key ((id1, id2)); your understanding correct. your primary key ((id1, id2)) correct , specifying one partition key consisting of two columns. in second case, can query data specifying both columns values. eg: select * mytable id1=1 , id2=3; and queries like: select * mytable id1=1; will fail because id2 is part of primary key.

javascript - React-Native: LocalStorage deleted when app reloaded when using domStorageEnabled -

i have @ moment small log in system stores asyncstorage session token , refresh token. after logged in sent page dashboard i'm getting asyncstorage session , refresh token , passing them link in webview. way how webview works me passing domstorageenabled={true} deleting storage when app closed user needs again log in. know way how manage problem? render() { if (this.state.access_token = null) { return ( <splashscreen visible={true}/> ); } else { let source = {uri: `myurl/auth/login?access_token=${this.state.access_token}&refresh_token=${this.state.refresh_token}`}; return ( <webview source={source} domstorageenabled={true} /> ); } }

mdx - How to optimize mondrian hierarchy? -

Image
facts table have date_id column. date table have year, month, day, hour columns. date dimension: when send request this: select {[measures].[pc in sum]} on columns, [renter].children on rows [renter] [date].[2010].[1].[1].[10] : [date].[2015].[5].[2].[20] mondrian generate ~2000 requests this: select `date`.`hour` `c0` `date` `date` (`date`.`day_of_month` = 1 , `date`.`month_calendar` = 4 , `date`.`year_calendar` = 2015) group `date`.`hour` it slow. how fix this? change date slicer in request solved problem { [date].[2008].[8].[10].[10], [date].[2008].[8].[10].[11], [date].[2008].[8].[10].[12], [date].[2008].[8].[10].[13], [date].[2008].[8].[10].[14], [date].[2008].[8].[10].[15], [date].[2008].[8].[10].[16], [date].[2008].[8].[10].[17], [date].[2008].[8].[10].[18], [date].[2008].[8].[10].[19], [date].[2008].[8].[10].[20], [date].[2008].[8].[10].[21], [date].[2008].[8].[10].[22], [date].[2008].[8].[10].[23], [date].[2008].[8].[11], [date].[2008]....

android - Ionic push notification is not working if app is open -

i able send push form apps.ionic.io , postman when app on background or screen locked not able send notification when app open. code in run var io = ionic.io(); var push = new ionic.push({ "onnotification": function(notification) { alert('received push notification!'); }, "pluginconfig": { "android": { "icon": "ic_stat_icon" } }, "debug": true }); push.register(function(token) { console.log("registered"); console.log("device token:",token.token); }); and in controller $ionicpush.register( { canshowconsole.log: true, //can pushes show console.log on screen? canshowalert: true, //can pushes show alert on screen? cansetbadge: true, //can pushes update app icon badges? canplaysound: true, //can noti...

android - How to solve these about SharedPreference? -

i read post sharedpreference use auto-login using retrofit2 , okhttp3. i learned , copied code googling, public class addcookiesinterceptor implements interceptor { @override public response intercept(chain chain) throws ioexception { request.builder builder = chain.request().newbuilder(); // author said it's getting cookies. can't understand, can't use code set<string> preferences = sharedpreferencebase.getsharedpreference(apipreferences.shared_preference_name_cookie, new hashset<string>()); (string cookie : preferences) { builder.addheader("cookie", cookie); } return chain.proceed(builder.build()); } } codes : http://gun0912.tistory.com/50 from these, can't understand , don't know set<string> preferences = sharedpreferencebase.getsharedpreference(apipreferences.shared_preference_name_cookie, new hashset<string>()); part. what sharedprefe...

http - How to Form-encode a dictionary in Python? -

i interacting rest api , need explicitly form-encode request body before sending. the urllib module has urlencode method, see no equivalent form-encode, presumably dictionaries automatically encoded when using urllib post request. is there built in method can use form-encode object? example: params={'f':'json','type':'map'} post_body = formencode(params) producing post_body: f=json type=map in instance i'm using winhttprequest through win32com module can take care of authentication natively don't need handle credentials in script.

sql - Insert empty string as NULL and zero as zero into float column -

i have float column, call money. i trying insert 0 value 0 , empty string value should null insert t1 (money) values ('0.00') insert t1 (money) values ('') select * t1 this result trying achieve money 0 null i tried using instead of insert trigger (i used '123' visualize condition met) iif(cast(money nvarchar) = '', null, iif(money < '0.0001', '123', money)) select * t1 money 123 123 so seems cannot compare float column against empty string. but when trying following looks in fact possible: case when (money = '' '456' else iif(money < '0.0001', '123', money)) select * t1 money 456 456 which makes me unsure of how sql server converts datatypes internally. uhm, you try wierd things if insert string values float-column. insert t1 (money) values (nullif('0.00', '')) but should invest time in data type conversion ground up. expect calli...

perl - Force use of flags Getopt::Long -

is there way force use of -flags when reading in command-line arguments using getopt::long? example in current situation: getoptions('r=s' => \$var1, 'lf=f' => \$var2, 'uf=f' => \$var3, 'trd=i' => \$var4, 'vd=f' => \$var5) or die("$usage"); the script not exit or display $usage if arguments still provided without flags (such -lf). instead runs regardless until inevitably errors later on arguments not read respective variables (and may in wrong order). q: getoptions not return false result when option not supplied a: that's why they're called 'options'. source: getopt::long documentation you add conditionals check value of flags , if not defined call die or call usage .

javascript - HTML DOM innerHTML Property -

change html content of <p> element id="demo" : document.getelementbyid("demo").innerhtml = "paragraph changed!"; is right way change html content? if want change contents use document.getelementbyid("demo").innertext = "paragraph changed!"; or want change html tags use, document.getelementbyid("demo").innerhtml = "<h2>heading changed!</h2>"; another method document.getelementbyid("demo").firstchild.nodevalue = "paragraph changed!";

javascript - Create array containing the single chars of a string. How does these regular expression work? -

i guess start example code: var sentence = 'lorem ipsum dolor sit amet, consectetuer adipiscing elit.'; // makes array single chars of sentence elements. sentence = sentence.split(''); // makes multi-dimensional array. var result = sentence.map(function(ch) { // using /./ leads multi-dimensional array too. // each array contains 2 empty strings elements. // => ["", ""] return ch.split(/. /); }); result.foreach(function(item, i) { console.log(item); // [ ["l"], ["o"], ["r"] ... ] }); the purpose clear me: it's making multi-dimensional array. each element got 1 char of sentence. what don't understand regular expression used. . stands 1 arbitrary character in regular expressions. what's purpose of blank after dot ( . ) ? moreover: if rid of blank , write /./ results arrays too. each array contains 2 empty strings ( "" ) . that behaviour isn't clear me too. ...

angular - Angular2 - Execute code after observable content update -

i need create routine gets data http service, , populates <form> , automatically calls submit() on generated form: <form target="_top" #paymentform action="{{payment?.url}}" method="post"> <input *ngfor="let d of payment?.data | keys" name="{{d}}" value= {{payment.data[d]}}> </form> to populate form request returns payment object, containing url , form data posted: this.globalsservice.placeorder(this.globalsservice.shoppingcart) .subscribe(res => { this.payment = res; this.paymentform.nativeelement.submit() }); even though code executes , data loaded form properly, @ moment submit() action executed form not yet populated, , therefore redirect wrong , values mmissing. i looking elegant solution not involve settimeout, redirecting route or using lifecycle hooks.

html - Phone number validation in angularjs -

i trying validate phone number below condition, if 10 digits of same number,it should display error message. if starts 1, should display error message. please share suggestion if have come across such scenario. without example code, hard see trying - , if have attempted @ solving yourself. but oh well, there multiple ways of doing this, want serverside validation - never want validate on users end. how can limit value input using angularjs? adding listener on model in angularjs 1 (and 'think' want), can update 'something' according being input text area.

Inno Setup Start menu uninstall shortcut is not shown on Windows 10 -

i've got issue seems specific windows 10 start menu uninstall shortcut create in setup. shortcut not shown. however, others shortcuts create shown well... here value defaultgroupname : defaultgroupname={#myapppublisher}\mycompany\mysoftwarename here entries shortcuts in [icons] section: [icons] name: "{group}\{#myappname} {#myappversion}"; filename: "{app}\myexename.exe"; workingdir: "{app}" name: "{commondesktop}\{#myappname} {#myappversion}"; filename: "{app}\myexename.exe"; workingdir: "{app}"; iconfilename: "{app}\myexename.exe" name: "{userappdata}\microsoft\internet explorer\quick launch\{#myappname} {#myappversion}"; filename: "{app}\myexename.exe"; workingdir: "{app}"; tasks: quicklaunchicon name: "{group}\{cm:uninstallprogram, {#myappname} {#myappversion}}"; filename: "{uninstallexe}"; workingdir: "{app}"; iconfilename: "{app}...

botframework - replaceDialog() where the dialog is defind using dialog.matches -

i have integrated luis chatbot, , of dialogs defined using dialog.matches(). problem dialogs need redirected other dialogs, replacedialog or begindialog doesnt seem working dialogs defined using dialog.matches. example: consider following dialog options.dialog.matches('startactivity', [ function(session) { }) how manually invoke other dialog? session.replacedialog('startactivity') throws error. error: dialog[*:startactivity] not found. @ session.replacedialog (d:\insight\ms-bot\src\api\node_modules\botbuilder\ lib\session.js:146:19) @ array.options.dialog.matches.regex (d:\insight\ms-bot\src\api\dialogs\mor tgage\mortgage-check-account-balance.dialog.js:7:26) @ object.waterfallaction [as mortgagecheckbalance] (d:\insight\ms-bot\src\a pi\node_modules\botbuilder\lib\dialogs\dialogaction.js:130:25) @ intentdialog.invokeintent (d:\insight\ms-bot\src\api\node_modules\botbuil der\lib\dialogs\intentdialog.js:264:44) refer this issue on g...

javascript - EmberJS: Unit test class-based helpers -

i have several class-based helpers in app, can include i18n service. works nicely, however, can't figure out way test them. the auto generated test not working, expects function exported , complains, undefined not constructor : module('unit | helper | format number'); // replace real tests. test('it works', function(assert) { let result = formatnumber([42]); assert.ok(result); }); so tried using modulefor worked testing mixins, failed: modulefor('helper:format-number', 'unit | helper | format number', { needs: ['service:i18n'] }); test('it works', function(assert) { let result = formatnumber.compute(42); assert.ok(result); }); i tried different versions of instantiating helper object , calling compute on nothing worked. in end either returned null or failed undefined error. did manage succeed failed? the issue in example you're trying call compute static method on class itself, when need in...

reporting services - How to build SSRS reports (rptproj) with TeamCity and Visual Studio 2015 -

Image
we have build step build solution 70 projects using visual studio (sln) runner type. able build other projects not supported msbuild, such vdproj file , office plug-ins doing this. however, apparently not work ssdt/ssrs projects. have made sure latest version of ssdt installed visual studio, , visual studio 2015 directly on build server. rptproj not supported msbuild , cannot built is there thing else need these build correctly? have read people moving them own solution not after here, , i'm not sure fix problem. this important because require build output targets sql 2008 instead of copying rdl's directly in project tooling version (sql 2016). you have build rptproj calling visual studio executable (devenv.exe): "c:\program files (x86)\microsoft visual studio 14.0\common7\ide\devenv.exe" "[fullpath]\foobarsolution.sln" /rebuild [solutionconfiguration] /project kpi /log "[fullpath]\logs\kpi.build.log.log" /out "[f...

java - Handle absence of JNDI -

i have configured jndi reference in spring <bean id="optionalbean" class="org.springframework.jndi.jndiobjectfactorybean"> <property name="jndiname" value="name"/> </bean> but jndi property not configured. in case tomcat doesn't start. how can tell spring jndi optional? update: after adding lookuponstartup error: nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'optionalbean': cannot resolve reference bean 'optionalbean' while setting bean property 'optionalbean'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'optionalbean': invocation of init method failed; nested exception java.lang.illegalstateexception: cannot deactivate 'lookuponstartup' without specifying 'proxyinterface' or 'expectedtype' this should <bean id="optionalbea...

html - Can I use glyphicons as collapsible bullet points? -

is possible set clickable glyphicons bullet points instead of buttons? right i've managed put buttons, i'm hiding bullet points. code here: http://www.codeply.com/go/wdczrcnhyg i'm trying put glyphicons bullets, when click on them collapse if they're bolded (meaning there's description in sub-bullets) , they're normal or faded when they're not collapsible. something this: http://www.codeply.com/go/zavfmmybdr item3 , item4 bullets bolded , clickable/collapsible. right i'm trying figure out if can use buttons , hide background , outline glyphicon shown. in case need specify item1 , item2 buttons not clickable. any appreciated. i'm new i'm sorry if didn't explain myself enough:) p.s. instructed i'm adding code here instead of providing outside link. .btn { padding: 0px 5px; } /* icon when collapsible content shown */ .btn:after { font-family: "glyphicons halflings"; content: "\e113...

Troubleshoot option not printing plugin for protractor -

i trying find out if plugin being loaded protractor tests. plugin protractor-istanbul-plugin when enter protractor myconf.js --troubleshoot on command line not print out data said accepted answer this question. missing in code maybe? can't find details should doing other am. i think --troubleshoot flag being broken since version 3.2.1 (experimentally determined). i've created issue in protractor issue tracker confirm if bug: is troubleshoot flag still working? this fixed in "trunk" , released in next version (4.0.5).

java - BigInteger valueOf method cannot find symbol -

i created array consisting biginteger objects. when want assign numbers array, cannot find symbol error. can me? that's code: import java.io.*; import java.util.*; import java.math.biginteger; public class solution { public static void main(string[] args) { scanner in = new scanner(system.in); int t1= in.nextint(); int t2= in.nextint(); int n= in.nextint(); biginteger[] arr = new biginteger[n]; arr[0] = new biginteger.valueof(t1); arr[1] = new biginteger.valueof(t2); } } input values 0 1 5. , error: solution.java:15: error: cannot find symbol arr[0] = new biginteger.valueof(t1); ^ symbol: class valueof location: class biginteger solution.java:16: error: cannot find symbol arr[1] = new biginteger.valueof(t2); ^ symbol: class valueof location: class biginteger 2 errors valueof static method arr[0] = big...

r - Count number of occurrences of vector in list -

i have list of vectors of variable length, example: q <- list(c(1,3,5), c(2,4), c(1,3,5), c(2,5), c(7), c(2,5)) i need count number of occurrences each of vectors in list, example (any other suitable datastructure acceptable): list(list(c(1,3,5), 2), list(c(2,4), 1), list(c(2,5), 2), list(c(7), 1)) is there efficient way this? actual list has tens of thousands of items quadratic behaviour not feasible. match , unique accept , handle "list"s ( ?match warns being slow on "list"s). so, with: match(q, unique(q)) #[1] 1 2 1 3 4 3 each element mapped single integer. then: tabulate(match(q, unique(q))) #[1] 2 1 2 1 and find structure present results: as.data.frame(cbind(vec = unique(q), n = tabulate(match(q, unique(q))))) # vec n #1 1, 3, 5 2 #2 2, 4 1 #3 2, 5 2 #4 7 1 alternatively match(x, unique(x)) approach, map each element single value deparse ing: table(sapply(q, deparse)) # # 7 c(1, 3, 5) c(2, 4)...

r - Transform sequence of data into JSON for D3.js visualization -

i have data shows series of actions (column actions ) performed several users (column id ). order of data frame important - order actions performed in. each id, first action performed start . consecutive identical actions possible (for example, sequence start -> d -> d -> d valid ). code generate data: set.seed(10) <- 0 all_id <- null all_vals <- null while (i < 5) { <- + 1 print(i) size <- sample(3:5, size = 1) tmp_id <- rep(i, times = size + 1) tmp_vals <- c("start",sample(letters, size = size) ) all_id <- c(all_id, tmp_id) all_vals <- c(all_vals, tmp_vals) } df <- data.frame(id = all_id, action = all_vals) goal - transform data in json nested on multiple levels used in d3.js visualization (like this ). see counter how many times each child appears respective parent (an maybe percentage out of total appearances of parent) - hope can myself. expected output below - generic, not data gen...

javascript - Use data in view from controller from ng-click angular -

pretty new angular , having little trouble getting data controller , displaying in view using ionic. i have function in controller ('dashctrl') pass through string use within function using ng-click. want take string , display in next view have href on same element have ng-click event. when log string on next page, working , shows up. how use in view? heres code: html *first page <ul contentful-entries> <div ng-repeat="story in $contentfulentries.items"> <li class="story col col-100"> <a href="#/tab/story/{{story.fields.slug}}" ng-click='storydetails("{{story.fields.title}}")'> <p>{{ story.fields.title }}</p> </a> </li> </div> </ul> *redirects on ng-click <ion-view view-title="story"> <ion-nav-buttons side="left"> <button class="button back-button buttons button-clear header-...

c# - Get content of GridView -

i have application c#/wpf listview containing gridview. want content create csv file values. i have made research found solution windows form or wpf datagrid. nothing gridview. my list: <listview grid.row="1" x:name="mylistview" borderbrush="white" horizontalalignment="stretch" itemssource="{binding path=myitem}" selecteditem="{binding path=actualitem}"> <listview.view> <gridview x:name="mygridview"> <gridviewcolumn header="{x:static p:resources.name}" displaymemberbinding="{binding path=name,mode=oneway,updatesourcetrigger=propertychanged}" width="{staticresource doublenan}"/> <gridviewcolumn header="{x:static p:resources.label}" displaymemberbinding="{binding path=label,mode=oneway,updatesour...

Spawn multiprocessing.Process under different python executable with own path -

i have 2 versions of python (these 2 conda environments) /path/to/bin-1/python /path/to/bin-2/python from 1 version of python want launch function runs in other version using multiprocessing.process object. turns out doable using set_executable method: ctx = multiprocess.get_context('spawn') ctx.set_executable('/path/to/bin-2/python') and indeed can see in fact launch using executable: def f(q): import sys q.put(sys.executable) if __name__ == '__main__': import multiprocessing ctx = multiprocessing.get_context('spawn') ctx.set_executable('/path/to/bin-2/python') q = ctx.queue() proc = ctx.process(target=f, args=(q,)) proc.start() print(q.get()) $ python foo.py /path/to/bin-2/python however path wrong however when same thing sys.path rather sys.executable find sys.path hosting python process printed out instead, rather sys.path find running /path/to/bin-2/python -c "import sys; print...

c# - Does RoleEnvironment.GetConfigurationSettingValue read everytime from cfg file? -

the azure role setting, useful since lets change values on-the-fly while iis running. problem is, if have plenty users, , if reads every time config value file, not best practice use without putting in static variable. next problem, if put in static variable , have reset iis every time change it. did research, , found similar question on stackoverflow , tells first time reads conf on file, stores on cache. question answered configurationmanager , mine rolemanager azure . this line gets current setting on azure : roleenvironment.getconfigurationsettingvalue("appname.settingkey"); this 1 saves in cache, know how works, , gets current setting ex.: connectionstring in webconfig : configurationmanager.connectionstrings["settingkey"].connectionstring; https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.serviceruntime.roleenvironment.changed.aspx here link changed. if follow types down can to: https://msdn.microsoft.com/en-us/l...

java - Understanding Maven Version Ranges -

assume have artifact versions 1.0-snapshot, 1.0, 1.1, 1.2-snapshot in maven repository. now, when specify version range [1.0-snapshot,) for artifact (and assume there no other version requirements), maven resolve 1.1 or 1.2-snapshot? i have read version ranges resolve release versions if both boundaries release versions haven't understood exact behaviour if 1 of boundaries snapshot. background: legacy reasons, have release artifacts depend on snapshot artifacts. these snapshot artifacts removed when release version available (which breaks maven builds). logically, aiming behaviour: take snapshot version, replace release version 1 available. i tested, maven resolved 1.2-snapshot so priority seems be: look latest version (1.2) take release if available. else snapshot

C++ Durand-Kerner root finding algorithm crashes with GMP, but not with long double -

i trying root-finding algorithm based on durand-kerner , need polynomials of orders maybe 50, coefficients go beyond long double or long long , trying (for 1st time) gmp . now, made program test, why main() (plus not advanced programmer), , works if don't involve gmp, think it's in implementation makes crash. codeblock's debugger points lines inside gmpxx.h , @ function f() , line sum += . here's code, minus polynomial coefficient generation (here simple loop): #include <iostream> #include <vector> // std::vector #include <complex> #include <cmath> #include <iomanip> // std::setprecision #include <gmpxx.h> typedef std::complex<mpf_class> cplx; // x! mpz_class fact(const unsigned int &x) { mpz_class z {1}; (unsigned int i=1; i<=x; ++i) z *= i; return z; } // 2^n mpz_class pwr2(const unsigned int &n) { mpz_class z {1}; (unsigned int i=0; i<n; ++i) z *= 2; re...

python sqlite3 UPDATE set from variables -

i made next query update row in db. def savedata(title, ll, lr, rl, rr, distanceback): c.execute("update settings set (?,?,?,?,?,?) name=?",(title, ll, lr, rl, rr, distanceback, title)) conn.commit() i next error: sqlite3.operationalerror: near "(": syntax error know isn't correct question marks. can't find out exact solution is. can explain me problem is? you use sql syntax: update table_name set column1 = value1, column2 = value2...., columnn = valuen [condition]; for example, if have table called category , want edit category name can use: c.execute("update category set name=? id=?", (name,category_id)) where: category table contains 2 items: (id, name) id primary key.

android - RecyclerView content is disappearing -

after minimizing or opening other app content loosing , need fill recycler view again p.s. in manifest have android:configchanges="orientation|keyboardhidden|screensize" recyclerview <android.support.v7.widget.recyclerview android:id="@+id/booking_rec" android:scrollbars="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginbottom="10dp" android:background="#eceff1"> </android.support.v7.widget.recyclerview> adapter public class recadapterbooking extends recyclerview.adapter<recadapterbooking.customviewholder> { private list<booking> bookinglist; private context context; public recadapterbooking(list<booking> bookinglist, context context) { this.bookinglist = bookinglist; this.context = context; } @override public recadapterbookin...

python 3.x - Complete Algebraic Equations -

im trying build app graphs equation based on user input. equation in slope intercept form: y = mx + b , m slope , b y intercept . however, isn't working me in python! i tried this: >>> x = 3 >>> 1/2x and returned this: file "<stdin>", line 1 1/2x ^ syntaxerror: invalid syntax >>> how make returns 1.5? import re mxb = re.compile('''(?p<slope>[(\d)/.]*)x\s+(?p<sign>[+-])\s+(?p<intercept>[\d./]*)''') s = '1/2x + 5' match = mxb.match(s) if match : print( match.groupdict() ) test python regex here : pythex.org

python - GAE NDB Expando Model with dynamic Kind -

is possible assign dynamic entity kind expando model? example, want use model many types of dynamic entities: class dynamic(ndb.expando): """ handles "post types", such pages, posts, users, products, etc... """ col = ndb.stringproperty() parent = ndb.integerproperty() name = ndb.stringproperty() slug = ndb.stringproperty() right use "col" stringproperty hold kind (like "pages", "posts", etc) , query "col" every time. after reading docs, stumbled upon @classmethod: class mymodel(ndb.model): @classmethod def _get_kind(cls): return 'anotherkind' does mean can this? class dynamic(ndb.expando): """ handles "post types", such pages, posts, users, products, etc... """ col = ndb.stringproperty() parent = ndb.integerproperty() name = ndb.stringproperty() slug = ndb.stringproperty(...

Java and SAP JCoFunction getting no data -

hi need sap integration java. don't know sap if i'm getting function next template using java jcofunction. input: iv_size_exchg iv_trgid changing: null output: ev_total_zdt1 tables: et_articles et_location_keys et_treagers it_location_keys return exceptions: my client gets data sap filtering table it_location_keys. can see table on output side , not on input. can works on java? by way there way data limit or top in sql. thanks this code jcoparameterlist importparameterlist = function.getimportparameterlist(); jcotable articlestable = importparameterlist.gettable("it_location_keys"); articlestable.appendrow(); articlestable.setvalue(param_customer_number, request.getcustomer().getcustomernumber()); articlestable.setvalue(param_contract_number, request.getcontractnumber()); articlestable.setvalue(param_location, request.getlocation()); and when tried table it_location_keys says there no input table. i tried table using next code. jcot...

java - How to get link from Array<T> level? -

how object reference(link) object array(levelarray)? f.e., levelarray has created object "level1" under index 1, , need change variables in object. how it? public class leveleditorscreen implements screen { final drop game; private batch batch; private array<level> levelarray; private int levelcount; private void createlevel(int lvlcount) { levelcount += 1; lvlcount = levelcount; levelarray.add(new level()); } } if know index can use get(int index) method. levelarray.get(0); //this return object of index 0 if don't know index, know variable set specific value can desired object: in example level has variable string name for(level level : levelarray) { if(level.name.equals("awesome level")) { //we found desired level! } }

r - Duplicate columns in dyadic-year data -

as title indicates have dyadic-year data. problem have (for reason...) duplicated dyadic column names – example, shown below, a , b b observations make no sense. real data on 70.000 observations. what want generate dummy variable indicate same-same dyadic observations. person1 person2 year 1990 1991 1992 b 1990 b 1991 b 1992 c 1990 c 1991 c 1992 b b 1990 b b 1991 b b 1992 ... the function duplicated() doesn't help, other basic r commands since it's dyadic data. here's reproducible example structure(list(person1 = structure(c(1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 2l, 3l, 3l, 3l, 3l, 3l, 3l, 3l, 3l, 3l), .la...

python - Create dataframe from specific column -

i trying create dataframe in pandas ab column in csv file. (ab 27th column). i using line: df = pd.read_csv(filename, error_bad_lines = false, usecols = [27]) ... resulting in error: valueerror: usecols not match names. i'm new pandas, point out i'm doing wrong me? here small demo: csv file (without header, i.e. there no column names): 1,2,3,4,5,6,7,8,9,10 11,12,13,14,15,16,17,18,19,20 we going read 8- th column: in [1]: fn = r'd:\temp\.data\1.csv' in [2]: df = pd.read_csv(fn, header=none, usecols=[7], names=['col8']) in [3]: df out[3]: col8 0 8 1 18 ps pay attention @ header=none, usecols=[7], names=['col8'] if don't use header=none , names parameters, first row used header: in [6]: df = pd.read_csv(fn, usecols=[7]) in [7]: df out[7]: 8 0 18 in [8]: df.columns out[8]: index(['8'], dtype='object') and if want read last 10- th column: in [9]: df = pd.read_csv(fn, usecols=...

sitecore8 - Sitecore's "Links" button doesn't work because of a null-reference exception -

i trying see item's linked items. doing on client's content management server. when click on navigate -> links, nothing happens. error in javascript console: http://sitename.local/sitecore/shell/default.aspx?xmlcontrol=gallery.links& …de-de&vs=1&db=master&sc_content=master&showeditor=1&ribbon.rendertabs=true failed load resource: server responded status of 500 (internal server error) here's see in sitecore logs: 38424 19:09:30 error application error. exception: system.web.httpunhandledexception message: exception of type 'system.web.httpunhandledexception' thrown. source: system.web @ system.web.ui.page.handleerror(exception e) @ system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) @ system.web.ui.page.processrequest(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) @ system.web.ui.page.processrequest() @ system.web....