Posts

Showing posts from May, 2013

android - scroll bar doesn't scroll to the last view -

i have problem scroll view i have tow toolbar 1 on top , 1 on bottom, , these tool bars should on top of other views when scroll down last view behind bottom bar , not shown this pic show mean : https://drive.google.com/file/d/0b4lj_q-ecia7n19meujuothwanm/view?usp=sharing in red circle there view behind bar want view shown in same time bottom bar still on top of other views this layout code : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/mainroot" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.wujhaat.wujhaatod.mainactivity"> <include android:id="@+id/app_bar" layout="@layout/app_bar" /> <include android:id="@+id/end_bar" layout="@layout/end_bar" android:layout_width="wrap_content" an

php - Symfony2 Object of class could not be converted to string error on the simplest code -

i have simplest code ever, , cant understand why hell error. want create form create new email message... looks simple, yet doesnt work.... here error: contexterrorexception: catchable fatal error: object of class mediaparklt\userbundle\entity\email not converted string in c:\wamp\www\digidis\front\app\cache\dev\twig\e4\61\15c5455e50341edc1387cde083d07297f9c2cb3fe9cf4782bd2ed3ead531.php line 172 i tried clearing cache. this entity: <?php /** * created phpstorm. * user: domas * date: 6/10/2015 * time: 2:18 pm */ namespace mediaparklt\userbundle\entity; use doctrine\common\collections\collection; use doctrine\orm\mapping orm; use mp\cmsbundle\entity\cmselement; use mp\cmsbundle\entity\cmsimage; use mp\cmsbundle\entity\cmsimagegallery; use mediaparklt\lotterybundle\entity\product; use mediaparklt\skinbundle\entity\urlskin; use symfony\component\httpfoundation\file\uploadedfile; use symfony\component\validator\constraints assert; /** * mediaparklt\userbundle\entit

android - Recall, onCreateOptionsMenu method (more times) -

i have problem: in class.java have private method (i call in onremotecalllistenercomplete ) elaborate data want appear in menu. method not fast , application call oncreateoptionsmenu method before onremotecalllistenercomplete finished. i have read use void invalidateoptionsmenu() method - invalidate , re-call oncreateoptionsmenu - , append before onremotecalllistenercomplete ended. however, onoptionsitemselected method not re-called. nb: i'm sorry (terrible) english the following put code oncreateoptionsmenu method @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.dati_carriera, menu); sharedpreferences prefs = getpreferences(mode_private); menuitem item = menu.finditem(r.id.expandablelistview1_checkable); if(sizevaluecollection>0){ item.setvisible(false); }else{ boolean value = prefs.getboolean(preference_expandible_list_view

java ee - EJB Lookup Issue with WebSphere Application Server 6.1 -

at first want tell similar type of questions has been asked here still can't find solution of problem. i have ejb 3 project (name = helloworldejbproject). there have created stateless remote ejb (name = helloworldejb). have created remote interface there (name= helloworldejbinterfaceremote). after creating jar & ear of project after compiling using ant. deployed ear in websphere application server 6.1. next have created stand alone java project (name = helloworldclient), put jar of helloworldejbproject project build path. while doing getting errors. helloworldejb.java: package com.staples.ejb; import com.staples.ejb.interfaces.helloworldejbinterfaceremote; import javax.ejb.stateless; @stateless public class helloworldejb implements helloworldejbinterfaceremote { public helloworldejb() { } public string helloworld() { return "hello world"; } } client.java (inside helloworldclient project): package com.staples.client.proce

python - Realigning labels and levels in multi-level columns in Pandas DataFrame -

based on example dataframe multi-level columns found on question: arrays = [[1, 2]*3, ['a', 'b', 'c']*2] columns = pd.multiindex.from_arrays(arrays, names=['foo', 'bar']) ​ df = pd.dataframe(np.random.randn(2,6), columns=columns, index= pd.date_range('20000103',periods=2)) print(df) foo 1 2 1 2 1 2 bar b c b c 2000-01-03 2.040867 -1.727071 0.126223 2.101799 1.811349 -0.003293 2000-01-04 -2.644979 0.156852 -1.034756 0.609625 -0.213968 -0.293759 i need re-order column labels instead follow pattern, re-aligning data necessary: bar b b c c foo 1 2 1 2 1 2 2000-01-03 2.040867 2.101799 1.811349 -1.727071 0.126223 -0.003293 2000-01-04 -2.644979 0.609625 -0.213968 0.156852

ios - How to send SwftyJSON with Alamofire? -

Image
i have long data want send api server alamofire created json object swiftyjson , if pass json alamofire gives error please explain missing ? json : { "skill" : { "name" : "ios", "desc" : "objective-c, swift" }, "langinfo" : [ "hindi", "english", "french", "russian" ], "eduinfo" : { "degree" : "mca", "school" : "university of kota", "year" : "2013" }, "geninfo" : { "firstname" : "varun", "email" : "varun@gmail.com", "state" : "rajasthan", "address" : "plot no. 00, bhagwan nagar 31,", "zip" : "21354", "phone" : "123456789", "lastname" : "sharma" } } code :- var jsonobj = json(skillda

scripting - mIRC: Check if INI-file has a key -

i'm trying see if there entry in ini-file user's nick key or not. if not; make entry. if exists; post error message. var %previous = $readini(numbers.ini,number,$nick) if(%previous != $null) { msg $chan $nick , have written %previous . } else { writeini numbers.ini number $nick $2 msg $chan $nick has written $2. } what's happening script above is never $null , , can't find anywhere returned $readini if key not found. $ini(numbers.ini, numbers, $nick) return number n (indicating item nth item in section) if exists. if not exist, return $null . in case, you'll want along lines of if ($ini(numbers.ini, numbers, $nick) != $null) { msg $chan $nick , have written $readini(numbers.ini, numbers, $nick) } else { writeini numbers.ini numbers $nick $2 msg $chan $nick has written $2. }

Is there a way to override default CSS of HTML5 form validation messages -

i want change background of bubble message - red , text in language , not english. i've set "required" input fields , css valid , invalid , it's working. , how make bubble message appear when hover input field.i tried with: ::-webkit-validation-bubble-message { border: 1px solid #e6c700; background: #ff0000; } but doesn't change. how change background of bubble messages? css valid , invalid is: input:focus:invalid, select:focus:invalid { background: #fff url("images/required.png") no-repeat 98% center; box-shadow: 0 0 5px #d45252; border-color: #b03535 } input:required:valid, select:required:valid { background: #fff url("images/valid.png") no-repeat 98% center; box-shadow: 0 0 5px #5cd053; border-color: #28921f; } ::-webkit-validation-bubble-message will partially work on chrome , safari. ultimately can not style these @ moment browser/os specif

In R:How do I itearate through character strings in a loop? -

i'm trying access character strings vector in for-loop. i have corpus one: library(tm) corpus = corpus(vectorsource(c("cfilm,cgame,ccd","cd,film,cfilm"))) my goal rid off unnecessary "c" characters. note, means don't want remove c cd, ccd, cgame , forth. i use function, takes in corpus , removes term second one. tostring = content_transformer(function(x,from,to)gsub(from, to, x)) so, example, replace cgame game, use corpus = tm_map(corpus,tostring,"cgame","game") now, instead of repeating line terms, i'd use loop iterates possible replacements using vector relevant terms. replace = c("game","film","cd") i tried 2 approaches, none of them work: for(i in replace){tm_map(corpus,tostring,paste("c",get(i),sep=""),get(i))} and for(i in 1:length(replace)){tm_map(corpus,tostring,paste("c",replace[i],sep=""),replace[i])} in first cas

Rails 4 how to make enrolment to a course for users (controller, view, model) -

i trying build simple learning app rails , facing problems. when user signs course try make viewed_course record them can display viewed_course on profile page. i can't figure out how set different controllers creates viewed_record when on course controller /index. how can modify course/index view creates new viewed record current signed in user. i using devise. class course has_many :lessons end class lesson #fields: course_id belongs_to :course end class user has_many :viewed_lessons has_many :viewed_courses end class viewedlesson #fields: user_id, lesson_id, completed(boolean) belongs_to :user belongs_to :lesson end class viewedcourse #fields: user_id, course_id, completed(boolean) belongs_to :user belongs_to :course end thank in advance helping me out! something should it, in courses controller show action (index action should list of courses, show action should viewing individual course): class coursescontroller < appl

android - Date Picker Dialog using Xamarin -

i'm developing android application using xamarin , want set date on edittext field using datepicker. when click on edittext datepicker opens when date set date not shown on edittext. wrong in provided code. thanks in advance. public class pagefragment : android.support.v4.app.fragment { int _num; database baseobj = new database(); edittext datepickertext; datepickerdialog date; view v; public pagefragment() { } public pagefragment(int num) { // supply num input argument. var args = new bundle(); args.putint("num", num); arguments = args; } public override void oncreate(bundle savedinstancestate) { base.oncreate(savedinstancestate); _num = arguments != null ? arguments.getint("num") : 1; } public override view oncreateview(layoutinflater inflater, viewgroup con

Dygraphs - black areas / artefacts appearing for some users -

some users experiencing black rectangles appearing in dygraphs, seem triggered hover events. using firefox 38.0.5 on windows 64 bit machine. i have latest version of dygraphs - v1.2 has else experienced , know of cure? only become apparent, , users have been using graphs since 2011, guess may linked windows update. thanks.

c++ - Changing texture parameters at runtime -

i opengl beginner , have built small engine universitary course. 1 constraint/feature need implement change texture quality (interpolation) @ runtime. so instead of e.g.: gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear); it should changed mipmaps gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear_mipmap_linear) now have texture class abstracts , loads image , creates id texture etc. what do: i'd bind textures in game 1 one , set parameters again. or there more advanced or faster way this, if want effect textures? in opengl 3.2 , higher, there texture sampler objects, can override sampling parameters in textures themselves. use them here. it particularly convenient if want of textures use same sampling parameters. create single sampler: gluint samplerid = 0; glgensamplers(1, &samplerid); glsamplerparameteri(samplerid, gl_texture_min_filter, gl_linear); you can bind single sampler object, in addition regular texture b

Django ANDing queryset filters using variable assignment -

let's have queryset of products has tons of prefetch objects in it. among prefetch objects "categories", , categories can have "filters". not every product has categories , filters defined. example categories "price" , "color", , filters "lt $5" , "blue". i can products have "price" , "color" defined enough, using exclude. but how this, example: all products have "price"=* defined, , products have "color"="blue" defined. any ideas? edit: i'm gonna go ahead , show solution came with. bear in mind example above simplified. there dozens of categories, each dozens of filters. imagine the user chose category 'shoes' not filters 'shoes': 'women' or 'shoes': 'football'. and chose category 'price' , filter 'price': 'lt $5' from django.db.models import q import operator argument_list = [] #

Why is the standard C# event invocation pattern thread-safe without a memory barrier or cache invalidation? What about similar code? -

in c#, standard code invoking event in thread-safe way: var handler = somethinghappened; if(handler != null) handler(this, e); where, potentially on thread, compiler-generated add method uses delegate.combine create new multicast delegate instance, sets on compiler-generated field (using interlocked compare-exchange). (note: purposes of question, don't care code runs in event subscribers. assume it's thread-safe , robust in face of removal.) in own code, want similar, along these lines: var localfoo = this.memberfoo; if(localfoo != null) localfoo.bar(localfoo.baz); where this.memberfoo set thread. (it's 1 thread, don't think needs interlocked - maybe there's side-effect here?) (and, obviously, assume foo "immutable enough" we're not actively modifying while in use on thread.) now i understand obvious reason thread-safe : reads reference fields atomic. copying local ensures don't 2 different values. ( apparently

uitableview - Static TableViewControllers cells UI don't show up when connected to a controller -

i running strange problem regarding uitableview cells in xcode 6 ios8. when create tableviewcontroller storyboard , choose static cells, view shows suppose to. however, when connect same view tableviewcontroller source, cells disappear. connected necessary things (reusable cell_id, etc). experience this? used work me previously. in advance! make sure don't implement of uitableviewdatasourcedelegate methods in tableviewcontroller such these methods below. - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { }

php - Count how many times a string appears in a mysql table -

i have big database stores data form. answers of form yes or no, in database there 62 names of questions stored answers (yes or no) , uid. need count how many times yes , no appears , store in variable. how can this? example of stored data this: tl1a->yes , tl2a->no , ..., uid->1234 just example ... select *, round ( ( length(`yourfield`) - length( replace ( `yourfield`, "yes", "") ) ) / length("yes") ) count `yourtable` in same manner "no" hope work...

c++ - Error: cannot convert 'int (*)[3]' to 'int (*)[100]' for argument '1' to 'void repl(int (*)[100], int, int)' -

hello im trying write program replace each negative number -1 , positive 1 error : [error] cannot convert 'int ( )[3]' 'int ( )[100]' argument '1' 'void replace(int (*)[100], int, int)' what mean ?? #include<iostream> using namespace std; void replace(int arr[][100],int rsize, int csize) { for(int r=0;r<rsize;r++) { (int c=0;c<csize;c++) { if (arr[r][c]>0) arr[r][c]=1; else if (arr[r][c]<0) arr[r][c]=-1; else arr[r][c]=0; } } } int main() { int a[4][3]={ {2,0,-5}, {-8,-9,0}, {0,5,-6}, {1,2,3}}; replace(a,4,3); for(int i=0;i<4;i++) (int j=0;j<3;j++) cout<<a[i][j]<<" ";}cout<<endl; system ("pause"); return 0; } you declared function void replace(int arr[][100],int rsize, int csize) - expects 2d array, 'inner' dimension being 100. pass int a[4][3] has 'inner' dimens

php - How to parse user search string for Postgresql query? -

i created search engine on site using full text search in postegresql. added searchbox in php page in users can write strings these: word1 +word2 word1+word2 word1 -word2 word1-word2 word1 word2 word1 word2 how convert them following strings? word1&word2 word1&word2 word1&!word2 word1&!word2 word1|word2 word1|word2 i tried several solutions none works cases. last 1 tried following: $user_query_string = trim($_get['search']); $final_query_string = str_replace(array('+', ' ', '-'), array('&','|', '&!'), $user_query_string); try this: $a=array('word1 +word2','word1+word2','word1 -word2',' word1-word2','word1 word2','word1 word2'); foreach ($a &$v) { $v=preg_replace('/ +/','|', // last: change blanks | preg_replace('/ *(?=[!&])/','', // delete blanks before ! or &

php - MySQL LOAD DATA INFILE "not found (Errcode: 13 - Permission denied)" -

last week working, , today isn't. have not changed php file. have done in interim run apt-get update on ubuntu 15.04 server. the mysql statement have is: load data infile "/var/www/html/uploads/titlelist.csv" table tbllsititlelist fields terminated "," optionally enclosed "\"" ignore 5 lines; this gives following error: file '/var/www/html/uploads/titlelist.csv' not found (errcode: 13 - permission denied) i have tried following solution (which how solved exact problem last week: load data infile error code : 13 i have checked apparmor , uploads folder still there. i have tried chmodding various permissions, including 777, nothing helps. any clever suggestions? from docs: for security reasons, when reading text files located on server, files must either reside in database directory or readable i recommend copying .csv file database directory, like cp titlelist.csv /var/lib/mysql/yourdbname/titlelist.

magento - Remove where filter from Zend DB Select -

how remove condition on zend_db_select? i've magento collection added condition using addattributetofilter method varien_data_collection_db. need remove condition. possible? more info i've magento widget loads collection based on attribute. widget this: $collection->addattributetofilter($attributecode, array('notnull'->true)); the widget adds following filter, limit results products have name starting letter: collection->addattributetofilter('name', array('like'-> $letter.'%')); however, client's custom toolbar needs index of products first letter, [a][b][c][d]...[z], when click on link, product collection filtered products starting first letter. problem catalog/product_list_toolbar toolbar block uses same product collection parent catalog/product_list block. toolbar's product collection filtered letter. workaround here's hacky solution. added following code widget using php's reflection: $letterc

oracle - SQL - missing keyword in case when syntax -

i getting error message missing keyword any suggestions? case when substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=0 , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 4000 'asset' else case when substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=4000 , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 8000 'liability' else case when substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=8000 , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 9000 'off balance sheet asset' else case when substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4)>=9000 , substr(m1.m_gl_line_no,length(m1.m_gl_line_no - 4),4) < 10000 'off balance sheet liability' end asset_type, i think using more "case" word in case statement. remove "else case" after each &qu

java - JAX-WS WebService via CXF provides inaccurate wsdl -

i've deployed simple jax-ws service, built contract-first. in jax-ws endpoint configuration, specify location of original wsdl. however, not wsdl returned cxf. original wsdl contains policy statements important part of contract, , should visible in wsdl service consumers. i know wsdl location i'm setting on endpoint correct. when it's not correct, deployment of war fails. i've logged value double-check. when deployed locally, service available @ http://localhost:8080/store-web-0.1.0/services/store . problem : wsdl available @ http://localhost:8080/store-web-0.1.0/services/store?wsdl not contain policy statements can seen in original wsdl. leaving out important part of contract not acceptable. question : why wsdl available @ http://localhost:8080/store-web-0.1.0/services/store?wsdl missing policy statements , not original wsdl configured on jax-ws endpoint? additional details below. please let me know if there's other information you'd see. than

javascript - Draw triangle by the intersect of 3 circles -

Image
i want draw triangle base on intersection points of 3 circles. there function or method javascript solve this? or need perform math calculation exact position of intersection point , draw triangle myself. function drawmap(){ var ctx = $('#map')[0].getcontext("2d"); // draw map of room 400cm * 300cm ctx.fillstyle = "#ecf0f1" ctx.beginpath(); ctx.rect(0, 0, 300, 400); ctx.closepath(); ctx.fill(); //draw first circle (blue one) ctx.fillstyle = "rgba(52, 152, 219,0.5)"; ctx.beginpath(); ctx.arc(0, 0, 200, 0, math.pi*2, true); ctx.closepath(); ctx.fill(); //draw second circle(green one) ctx.fillstyle = "rgba(46, 204, 113,0.5)"; ctx.beginpath(); ctx.arc(0, 400, 250, 0, math.pi*2, true); ctx.closepath(); ctx.fill(); // draw third circle (yellow one) ctx.fillstyle = "rgba(241, 196, 15,0.5)"; ctx.beginpath(); ctx.arc(300, 200, 280, 0,

encryption - What is encrypted in Android operating system? -

when android os encryption activated, read /data (user data) encrypted , not storage. correct? can encrypt storage if it's case? pictures in \dcim , can have many folders in \ edit if take android folders structure: ┌─────────────┬───────────────────────────┐ | partition | explanation | ├─────────────┼───────────────────────────┤ | /boot | kernel & co. | | /cache | app cache | | /data | user data partition¹ | | /data/data | app data¹ | | /dev | devices² | | /mnt/asec | encrypted apps (app2sd) | | /mnt/emmc | internal sdcard³ | | /mnt/sdcard | external sdcard³ | | /proc | process information² | | /recovery | used in recovery mode | | /system | system rom (read-only) | └─────────────┴───────────────────────────┘ what encrypted when android encryption activated ?

jquery - Embedded qtip2 Modal in Fullcalendar + Google Calendar -

i using fullcalendar 2.3.1, qtip2.2.1 , multiple google calendar feeds. so got qtips work in fullcalendar (yay!), i'd see getting modal qtip appear when event clicked on ( eventclick ). currently have eventclick set to: // opens events in popup window eventclick: function(event) { window.open(event.url, 'gcalevent', 'width=600,height=400,top=200,left=200'); return false; }, i'd modal appear instead, event.url portion embedded within in. qtip2 has modal functionality, , got included when downloaded qtip2, can't seem figure out how modal part functioning page embedded in it. , other resources online seem bootstrap, not qtip2. or other plugin. i know part of using qtip's show: modal: on: true , using iframe. it's proper sequence can't seem get. this coding have general qtips, wasn't sure if there way modify function on eventclick instead, , again, embedded page eve

c# - LINQ: Compare List A and B, if in B, select item in A -

i have list of tags (list a), , list of tags matched topics (list b). want parse items in list b , if it's there, have select item in list a. i've tried 2 line , 1 line statement this, run same problem no matter try. here's 1 line attempt of code: var tags = db.tags.where(x=>x.tagid == db.taglink.where(y => y.topicid == incomingtopicid)).tolist(); list , b have common column of tag id. any suggestions? update the structure of db.taglink these columns: taglinkid(key), topicid, tagid. the structure of db.tags these columns: tagid, tagname, istagscored. there several ways go it. here's 1 approach: var tags = db.tags .where(x=>db.taglink .any(y => y.tagid == x.tagid && y.topicid == incomingtopicid)) .tolist();

iOS widget not working on few iPhone5S -

we facing weird issue. have implemented ios8 widget , working fine iphone5, iphone5c, iphone6 it's not working iphone5s. sometime working ios 8.2 , stop working. not able figure out exact cause. widget showing app icon & app name , doesn't show widget content. we set architecture arm64 doesn't help. please let know if have idea resolve issue or faced same issue. if extension takes time load @ start won't show , show crash in device logs. check device logs. also recheck if setting widget height properly.

javascript - Can browsersync inject updated content in the browser without a refresh? -

i using browsersync + gulp cool browser plugins, perfectpixel name one. problem every time save work, forces browser reload, clearing browser , shutting off browser extension. causes me have reactivate plugin , continue inefficient workflow. have ideas? update 7/7/2015 below matthew, provided links solution incorporates websockets, can't work gulp set-up. var gulp = require('gulp'), open = require('gulp-open'), browsersync = require('browser-sync').create(); var websocketserver, socket, wss; websocketserver = require('ws').server; wss = new websocketserver({ port: 9191 }); var reload = browsersync.reload; var paths = { css: 'app/repsuite/web/static/css/*.css', js: 'app/repsuite/web/static/js/*.js', html: 'app/*.html' }; gulp.task('reload', function() { var client, i, len, ref, results; ref = wss.clients; results = []; (i = 0, len = ref.length; < len; i++) {

python - How to use a variable in filename -

i trying use current date & time file name spreadsheet file keep on getting error "no such file or directory exists." below code tried use: wb = workbook() dest_filename = time.strftime("%d/%m/%y_%h:%m.xlsx") wb.save(filename = dest_filename) look @ file name: time.strftime("%d/%m/%y_%h:%m.xlsx") when statement executed returns result this: '10/06/2015_11:44.xlsx' do have directory structure looks this: /pathtoscript /10 /06 2015_11:44.xlsx those / s in file name indicating directories. if wish have d-m-y pattern, suggest using other / separator: time.strftime("%d-%m-%y_%h:%m.xlsx")

javascript - Using gulp-load-tasks in a gulpfile -

i have project using grunt. moving use gulp. grunt implementation this: gruntfile.js /e2e page.e2e.js /tasks e2e.js /configuration clean.js concat.js i have approach working in grunt. however, want mimic approach in gulp. @ time, have following in gulpfile.js gulpfile.js 'use strict'; var gulp = require('gulp'); var tasks = require('gulp-load-tasks')('tasks'); then, in e2e.js, have following: e2e.js var gulp = require('gulp'); var rimraf = require('gulp-rimraf'); gulp.task('clean, function(cb) { console.log('here'); }); when run gulp command-line, error says: "error: task e2e can't support dependencies not array of strings." i'm not sure how fix this. haven't gotten part i'm putting definition of clean task in /tasks/configuration/clean.js. thank insights can provide! you have error in code: gulp.task('clean, function(cb) { console.log('her

Python calculate many different sum in for loop -

i trying calculate letter value (a = 1, b = 2...z = 26) of input. other characters considered 0 code listed below: alpha = list('abcdefjhijklmnopqrstuvwxyz') = [] sum1= 0 while true: b = input() if b == '': break else: a.append(b.lower()) lst_len = len(a) in range(lst_len): elem_len = len(a[i]) j in range(elem_len): if (a[i][j]) in alpha: num = alpha.index(a[i][j]) + 1 sum1 += num else: pass print sum1 my question how print sum value of each in loop instead of keep adding previous sums thank you! move sum1 = 0 after for in range(lst_len): , gets reset after every time inner loop finishes.

php - Patch update Authenticated User in Laravel -

Image
i'm trying edit/update profile information users table. my idea authenticated user able edit own profile in users table. during registration, required fill out couple specific items (username, name, lastname, email, password) i've added couple columns user table (city, country, phone, twitter, facebook). i have profile user page (route= '/profile') information shown. of course columns aren't required during registration not filled in: i have edit page columns need info added editable: here code editprofile.blade.php (where try send out patch method): ... {!! form::model($user, ['route' => 'user/' . $user , 'method' => 'patch']) !!} <div class="form-group form-horizontal"> <div class="form-group"> {!! form::label('username', 'username:', ['class' => 'col-md-4 control-label']) !!} <div class="col-

php - Return the array position of the containig array -

assuming give following array: $array = array ( array ( 'key' => 'value' ), array ( 'key' => 'another value' ), array ( 'key' => 'yet value' ), array ( 'key' => 'final value' ) ); what want array position of array value supplied. if searching $array value of "yet value" result should be: 2 because matching array @ position 2. i know following: foreach ($array $a) { foreach ($a $k => $v) { if ($v === "yet value") { return $array[$a]; // do, want // int position of $a in $array. // so: $a == 2, give me 2. } } } update: the key same you can this, if keys same: $v = "yet value"; $a = array_search(array("key"=>$v),$array); echo $a;//2 http://sandbox.onlinephpfunctions.com/code/1c37819f

javascript - Material Angular md-cotent don't get 100% of height -

Image
i have problem @ height of md-content. app has ng-view , 100% of page, md-content don't 100% of parent. result: <ng-view flex class="md-padding"> <md-content flex> foo </md-content> </ng-view> i try put style="height: 100%" not work. i've tried issues found solved problem. you need add layout ng-view, , make sure parents fill 100% height: <ng-view flex layout="column" class="md-padding"> <md-content flex> foo </md-content> </ng-view>

How to change placeholder content of an input with jQuery.on in Bootstrap framework? -

i have input bootstrap placeholder , select. need when option selected, text of placeholder of input changes. i think bootstrap.js binds it's objects when page loaded , after document.ready, changes in objects not affect. my attempt: $('select').on('change', function () { $('input').attr('placeholder',$(this).val()) }); that not work $(document).on('change', 'select', function () { $('input').attr('placeholder', $(this).val()); }); you should assign ids or other selector target select , target input . code above execute on every input time select changed.

android - Cordova debug.apk works fine, but signed version crashes -

i tested debug.apk on several devices, , worked. released using cordova build android --release afterwards, signed with jarsigner -verbose -sigalg sha1withrsa -digestalg sha1 -keystore example.keystore example.apk example jarsigner -verify -verbose -certs example.apk zipalign -v 4 example.apk example_01.apk the signed version can installed, open app, crashes. else having same problem? if need more specific information, please let me know greetings

c# - Mkbundle Mono Assembly binding redirection -

Image
i have sample .net application runs fine on windows, , ubuntu environment using mono. i trying use mkbundle create single native assembly can docker containerize using busybox , keep size small instead of huge bloated containers. the problem running json.net, think due assembly binding redirection app.config file, else ran this? <?xml version="1.0" encoding="utf-8"?> <configuration> <startup><supportedruntime version="v4.0" sku=".netframework,version=v4.5.1" /></startup> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversion="6.0.0.0" /> </dependentassembly> </as

sql server - How to use field value of joined table for join rather than foreign key -

i have new database schema need query , having trouble getting data need without using primary key in join. didn't design schema have work it. tried creating sqlfiddle kept giving me gateway error when tried. basically have contacts table contains contacts stored in database. contacts table contains 2 fields reference tables contact linked (vendor , client). contact table contains field named "contacttype". links table defines type of contact (owner or employee). [client] clientid | name ============================== 1 | uptown dining 2 | downtown eatery 3 | midtown steakhouse [vendor] vendorid | name ============================== 1 | abc produce 2 | def seafood 3 | ghi meats [contacttype] contacttypeid | name ============================== 1 | owner 2 | employee [contact] contactid | tablename | tableid | contacttypeid | firstname | lastname ====================================================